johnku2011/boilerplates-with-ai-skills/python-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 FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.
Install
npx vskill@latest install johnku2011/boilerplates-with-ai-skills/python-api-designSKILL.md
The same SKILL.md was published earlier as johnku2011/boilerplates-with-ai-skills/python-api-design.
Python API Design (FastAPI)
Overview
Keep the FastAPI app small and testable. Build with create_app() so pytest can use TestClient without starting a real server on a fixed port.
Process
- Register routes on the app from
create_app()inapp/main.py. - Use Pydantic models for request/response bodies when shapes matter.
- Return correct status codes; use
HTTPExceptionfor client errors. - Add a pytest case for each new route or behavior change.
- Run
pytestbefore claiming completion.
Project Layout
app/main.py—create_app()factory and route definitionstests/— pytest tests usingfastapi.testclient.TestClientrequirements.txt— pinned runtime + test dependencies
Testing
Guidelines
- Type hints on route functions and shared helpers.
- Secrets from environment variables (
os.environ), never hardcoded. - Keep route handlers thin; extract logic to pure functions when non-trivial.
- Prefer dependency injection for DB sessions and auth when the app grows.
Anti-patterns
- Business logic embedded directly in route decorators without tests.
- Returning raw exception strings to clients in production.
- Skipping tests because "FastAPI validates for us" — test behavior, not just schemas.
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/python-service/skills/python-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/python-api-design)