Skip to content

Writing tests with AI agents

pnpm run client:generate writes, next to the client, an eberly/api/ folder for agents:

  • INDEX.md: one line per endpoint, grouped by tag. The one generated for the Nest example:

    <!-- AUTO-GENERATED by eberly. Do not edit. Regenerate: pnpm run client:generate -->
    # API index
    Open `<group>.<method>.md` for details. Call as `user.<group>.<method>(…)`.
    ## auth
    - auth.register — POST /auth/register — Register a new user
    - auth.login — POST /auth/login — Log in
    - auth.me — GET /auth/me — Current user
    - auth.whoami — GET /auth/whoami — Current user (deprecated)
    ## posts
    - posts.list — GET /posts — List published posts
    - posts.create — POST /posts — Create a post
    - posts.get — GET /posts/{postId} — Get a post by id
    - posts.remove — DELETE /posts/{postId} — Delete a post
    - posts.publish — POST /posts/{postId}/publish — Publish a post
    ## comments
    - comments.list — GET /posts/{postId}/comments — Comment tree of a post
    - comments.create — POST /posts/{postId}/comments — Comment on a post
    ## users
    - users.uploadAvatar — POST /users/me/avatar — Upload an avatar
    ## test
    - test.reset — POST /test/reset — Reset all data
  • <group>.<method>.md, e.g. posts.create.md: description, a ready-to-paste call, input, responses by status and the types they use, with field descriptions from the spec.

An agent reads the index, then opens only the endpoints of its scenario: a few dozen lines each, instead of the whole generated.ts (700+ lines for a small backend) or the backend source. Less context spent, fewer made-up fields.

Two Claude Code skills use this folder:

  • /eberly-setup: asks where the spec is, how auth works and how to reset data, then writes the config, stores, hooks and smoke tests until they are green.
  • /eberly-write-tests <scenario>: writes and runs a test for a scenario in plain words.

npx eberly create installs both; npx eberly skills installs them into an existing project.

Privacy-friendly analytics, no cookies.