agentleFS
bbvch-aibbvch-ai/aihub-core/.claude/skills/generate-sdk/SKILL.md

generate-sdk

Skill16 starsChanged 3 days agoApache-2.0View on GitHub

Regenerate the frontend TypeScript API client from the OpenAPI spec using openapi-ts. Verifies API server is running, runs the code generator against openapi-ts.config.ts, and lints the output into sdk/client/. Use when user says 'regenerate SDK', 'update API client', 'sync frontend types', 'generate TypeScript client', 'API changed, update frontend', or 'openapi-ts'. Do NOT use for scaffolding frontend pages or composables (use scaffold-frontend-page, scaffold-composable), backend API endpoint creation (use scaffold-api-endpoint), or manual SDK file edits (sdk/client/ is fully generated).

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Any other code or connection refused: Stop and display this message:

    line 18
  2. Distinctive:

    Check for TypeScript compilation errors in the generated output:

    line 65
  3. Very specific:

    API not running: Start it with make run-dev in packages/api/

    line 85
  4. Very specific:

    pnpm not found: Run corepack enable or install pnpm globally

    line 86
  5. Distinctive:

    Run this skill after any of these changes:

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend API SDK Generation

Regenerate the TypeScript API client from the live OpenAPI specification.

Step 1: Verify API Server Is Running

curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/api/v1/openapi.json
  • 200: Proceed to Step 2
  • Any other code or connection refused: Stop and display this message:

    API server not running at http://localhost:8000. Start it with:

    • make run-dev in packages/api/ (the API is not part of infra/docker-compose.dev.yml)

Stop every agent runner first

The API registers an endpoint pair per discovered agent class, so the spec depends on which runners happen to be attached. Regenerating with a local agent running bakes that agent into the shared client — a RAG agent alone adds four …ToRAGAgent… endpoints plus the ChatMessage_Input/Output and *Block_Input/Output schemas they pull in, roughly 2,900 lines of diff that belong to nobody's change. The committed SDK carries no agent-specific endpoints, which is the baseline to reproduce.

pkill -f "app/.*_agent/main.py"
curl -s -H "Authorization: Bearer $SUPERUSER_TOKEN" http://localhost:8000/api/v1/openapi.json | grep -c "RagAgent"

Expect 0 before generating. Restart the runners afterwards.

Step 2: Generate the SDK

Run from packages/web/:

cd packages/web && pnpm generate-sdk

This uses the config at packages/web/openapi-ts.config.ts to fetch the OpenAPI spec from http://localhost:8000/api/v1/openapi.json and regenerate TypeScript files into packages/web/sdk/client/ (types.gen.ts, sdk.gen.ts, schemas.gen.ts, client.gen.ts, transformers.gen.ts). The admin plane (packages/sysadmin-web, backend packages/sysadmin-api on :8001) has its own client; a packages/core change affects both. To reproduce CI without a running stack use /verify-sdk-sync.

Step 3: Do Not Lint the Output

eslint.config.js globally ignores sdk/** and the generator already runs prettier (postProcess), so pnpm lint over the output is a no-op. Commit the files exactly as generated.

Step 4: Verify and Report

  1. Confirm generated files exist and are non-empty:
ls -la packages/web/sdk/client/types.gen.ts packages/web/sdk/client/sdk.gen.ts
  1. Check for TypeScript compilation errors in the generated output:
cd packages/web && pnpm nuxi typecheck 2>&1 | head -30
  1. Report what changed:
git diff --stat -- packages/web/sdk/client/

Summarize: new endpoints added, modified request/response types, removed endpoints, number of files changed.

Examples

  • /generate-sdk — Full regeneration workflow (verify, generate, lint, report)

Troubleshooting

  • API not running: Start it with make run-dev in packages/api/
  • pnpm not found: Run corepack enable or install pnpm globally
  • Generation produces no changes: The API spec may not have changed. Verify your API changes are deployed to the running server.

When to Run

Run this skill after any of these changes:

  • Adding new API endpoints (new routes in FastAPI)
  • Modifying DTOs or Pydantic response/request models
  • Changing route paths or HTTP methods
  • Updating query parameters or path parameters

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.