johnku2011/boilerplates-with-ai-skills/fastify-api-design
Claude Code and agent skill by johnku2011/boilerplates-with-ai-skills
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Use when adding or changing routes, schemas, or plugins in this Fastify API — keep endpoints validated, typed, and testable.
Install
npx vskill@latest install johnku2011/boilerplates-with-ai-skills/fastify-api-designSKILL.md
The same SKILL.md was published earlier as johnku2011/boilerplates-with-ai-skills/fastify-api-design.
Fastify API Design
Overview
Keep the Fastify app small, testable, and schema-first. Build on the exported createApp() factory so tests can inject the server without binding a fixed port.
Process
- Register routes on the app returned by
createApp()insrc/app.js. - Define JSON schemas for request/response when the payload shape matters.
- Return correct status codes (200/201 success, 400 client error, 404 not found).
- Use Fastify's built-in error handler; do not leak stack traces in production.
- Add a
test/case that starts the app on port0and asserts responses.
Plugin Order
- Core plugins (cors, sensible) if needed
- Route registration
- Global error handler
Testing
- Integration tests:
app.listen({ port: 0 }),fetchagainst127.0.0.1. - Extract pure helpers for unit tests when logic grows beyond route handlers.
- Run
npm testbefore every commit.
Guidelines
- Prefer route-level schemas over ad-hoc validation in handlers.
- Keep handlers thin; move business logic to testable functions.
- Read secrets from environment variables at startup, not from requests.
- Prefer explicit routes over catch-all handlers.
Anti-patterns
- Bypassing Fastify validation with unvalidated
request.bodyaccess. - Starting the server inside
createApp()— keep listen inserver.jsonly. - Global mutable state shared across requests.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingboilerplates/fastify-api/skills/fastify-api-design/SKILL.md
Popularity
- Repository stars
- 240
- Repository forks
- 24
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/johnku2011/boilerplates-with-ai-skills/fastify-api-design)