fastapi-code-review skill
✓ VerifiedReviews FastAPI code for routing patterns, dependency injection, Pydantic validation, and asynchronous handler efficiency.
- GitHub stars
- 87
- Files
- 5
- Last commit
- Sep 15, 2026
- License
- Apache-2.0
- Allowed tools
- —
What does the fastapi-code-review skill do?
fastapi-code-review reviews FastAPI code for routing patterns, dependency injection, Pydantic validation, and asynchronous handler efficiency.
Summary generated from the skill's SKILL.md.
About the fastapi-code-review skill
Analyzing FastAPI applications for architectural consistency and performance is what this skill enables. Developers use it to audit web services for proper routing patterns, dependency injection usage, and Pydantic validation. An agent should load this tool when performing code reviews on FastAPI repositories to ensure that route handlers are asynchronous and free from blocking I/O operations like requests or time.sleep.
The skill evaluates specific framework implementations such as APIRouter setup, response_model definitions, and the correct application of Depends(). It relies on specialized reference files including routes.md, dependencies.md, validation.md, and async.md to guide its analysis. By following strict verification gates, the tool identifies missing status codes, improper error handling via HTTPException, or incorrect manual validation where Pydantic should be used. It distinguishes between actual bugs and idiomatic FastAPI patterns, such as automatic request body validation or dependency injection for database sessions, to prevent false positives during the review process.
What an agent can do with it
- 1Audit route definitionsCheck if all API endpoints include the necessary response models and status codes.
- 2Verify dependency injectionEnsure that database sessions and other shared resources are managed through the Depends mechanism.
- 3Detect blocking I/OIdentify synchronous calls within asynchronous route handlers that could degrade performance.
- 4Validate Pydantic usageConfirm that request and response models are correctly utilizing Pydantic for type safety.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the fastapi-code-review skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the fastapi-code-review skill in Plugin
/plugin marketplace add existential-birds/beagle /plugin install beagle-python@existential-birds
Install the fastapi-code-review skill in Claude Code
~/.claude/skills/fastapi-code-review/SKILL.md
$ npx degit existential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review ~/.claude/skills/fastapi-code-reviewInstall the fastapi-code-review skill in Claude Code (project)
.claude/skills/fastapi-code-review/SKILL.md
$ npx degit existential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review .claude/skills/fastapi-code-reviewInstall the fastapi-code-review skill in Codex
~/.agents/skills/fastapi-code-review/SKILL.md
$ npx degit existential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review ~/.agents/skills/fastapi-code-reviewInstall the fastapi-code-review skill in Gemini CLI
~/.gemini/skills/fastapi-code-review/SKILL.md
$ npx degit existential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review ~/.gemini/skills/fastapi-code-reviewInstall the fastapi-code-review skill in Claude.ai
npx degit existential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review fastapi-code-review && zip -r fastapi-code-review.zip fastapi-code-review # claude.ai → Customize → Skills → + → Create skill → Upload a skill → fastapi-code-review.zip
Automated checks
Ran Nov 15, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work
- Source repository linked and reachableexistential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review is public and reachablegithub.com/existential-birds/beagle/tree/HEAD/plugins/beagle ↗Pass
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit 2026-09-15github.com/existential-birds/beagle/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/existential-birds/beagle/blob/HEAD/plugins/beagle ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/existential-birds/beagle/blob/HEAD/plugins/beagle ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 107 linesgithub.com/existential-birds/beagle/blob/HEAD/plugins/beagle ↗Pass
SKILL.md
View on GitHubFastAPI Code Review
Quick Reference
| Issue Type | Reference |
|---|---|
| APIRouter setup, response_model, status codes | references/routes.md |
| Depends(), yield deps, cleanup, shared deps | references/dependencies.md |
| Pydantic models, HTTPException, 422 handling | references/validation.md |
| Async handlers, blocking I/O, background tasks | references/async.md |
Review Checklist
- APIRouter with proper prefix and tags
- All routes specify
response_modelfor type safety - Correct HTTP methods (GET, POST, PUT, DELETE, PATCH)
- Proper status codes (200, 201, 204, 404, etc.)
- Dependencies use
Depends()not manual calls - Yield dependencies have proper cleanup
- Request/Response models use Pydantic
- HTTPException with status code and detail
- All route handlers are
async def - No blocking I/O (
requests,time.sleep,open()) - Background tasks for non-blocking operations
- No bare
exceptin route handlers
Valid Patterns (Do NOT Flag)
These are idiomatic FastAPI patterns that may appear problematic but are correct:
- Pydantic validates request body automatically - No manual validation needed when using typed Pydantic models as parameters
- Dependency injection for database sessions - Sessions come from
Depends(), not passed as function arguments - HTTPException for all HTTP errors - FastAPI handles conversion to proper HTTP responses
- Async def endpoint without await - May be using sync dependencies or simple operations; FastAPI handles this
- Type annotation on Depends() - This is documentation/IDE support, not a type assertion
- Query/Path/Body defaults - FastAPI processes these at runtime, not traditional Python defaults
- Returning dict from endpoint - Pydantic converts automatically if
response_modelis set
Context-Sensitive Rules
Only flag issues when the context warrants it:
- Flag missing validation ONLY IF the field isn't already in a Pydantic model with validators
- Flag missing auth ONLY IF the endpoint isn't using
Depends()with an auth dependency - Flag missing error handling ONLY IF HTTPException isn't raised appropriately for error cases
- Flag sync in async ONLY IF the operation is actually blocking (file I/O, network calls, CPU-bound), not just non-async
Gates (FastAPI-specific)
Run once per FastAPI-related finding, after you can anchor file:line for the handler (see review-verification-protocol) and before the finding text ships. If a step’s pass condition is not met, do not assert the finding as written—gather evidence, withdraw, downgrade severity, or rephrase as a question.
Gate 1 — Route decorator and response surface
| Step | Action | Pass condition |
|---|---|---|
| 1a | Open the handler’s route decorator in the repo (not from memory). | file:line for @router.* / @app.* (or the site that registers this handler). |
| 1b | Record HTTP method, response_model=, and status_code= on that decorator (or note they are absent). |
Snippet from that line or explicit absent with the same file:line. |
Gate 2 — Blocking or “should be async”
| Step | Action | Pass condition |
|---|---|---|
| 2a | Read the full handler body. | file:line range covering the body. |
| 2b | If claiming blocking I/O: name each blocking call (e.g. requests., open(, time.sleep, sync DB/ORM). |
Each call has file:line, or withdraw the finding if none after the read. |
Gate 3 — Depends, validation, auth
| Step | Action | Pass condition |
|---|---|---|
| 3a | List parameters: Depends / Annotated[..., Depends], Pydantic models, Body/Query/Path, Request/Response. |
Names + mechanism tied to file:line on the signature. |
| 3b | If claiming missing auth: search the handler file (and its APIRouter module if separate) for Depends, Security, HTTPBearer, or project auth dependencies. |
Citation to an existing hook, or search result: paths searched + N matches (zero is allowed). |
| 3c | If claiming missing validation: confirm the argument is not already a Pydantic model or constrained Query/Path/Body. |
Type/source with file:line, or withdraw if validation already applies. |
FastAPI Framework Behaviors
FastAPI + Pydantic handle many concerns automatically:
- Request validation via Pydantic models
- Response serialization via response_model
- Dependency injection for cross-cutting concerns
- Exception handling via exception handlers
Before flagging "missing" functionality, verify FastAPI isn't handling it.
When to Load References
- Reviewing route definitions → routes.md
- Reviewing dependency injection → dependencies.md
- Reviewing Pydantic models/validation → validation.md
- Reviewing async route handlers → async.md
Review Questions
- Do all routes have explicit response models and status codes?
- Are dependencies injected via Depends() with proper cleanup?
- Do all Pydantic models validate inputs correctly?
- Are all route handlers async and non-blocking?
Before Submitting Findings
- For each FastAPI-related finding, complete Gates (FastAPI-specific) above.
- Load and follow review-verification-protocol (Pre-Report checklist and Verification by Issue Type) before reporting any issue.
Files in this skill
5fastapi-code-review skill questions
How do I install the fastapi-code-review skill in Claude Code?
Run npx degit existential-birds/beagle/plugins/beagle-python/skills/fastapi-code-review ~/.claude/skills/fastapi-code-review. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the fastapi-code-review skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
What specific FastAPI patterns should not be flagged as errors?
Idiomatic patterns like using Pydantic for automatic request body validation, using Depends() for database sessions, and returning dictionaries from endpoints when a response_model is set should not be flagged.
When is it appropriate to flag missing validation?
You should only flag missing validation if the field is not already part of a Pydantic model that includes validators.