fastapi-code-review
Reviews FastAPI code for routing patterns, dependency injection, validation, and async handlers. Use when reviewing FastAPI apps, checking APIRouter setup, Depends() usage, or response models.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/anderskev/fastapi-code-reviewWhat This Skill Does
The fastapi-code-review skill acts as a specialized linting and architectural assistant for Python developers working with the FastAPI framework. It provides automated, context-aware analysis of your codebase to ensure adherence to best practices in asynchronous programming, dependency injection, and data validation. By leveraging a comprehensive checklist and a predefined set of valid idiomatic patterns, the agent helps developers identify potential bottlenecks, security oversights, and structural inconsistencies before they reach production.
Installation
To integrate this skill into your environment, use the OpenClaw CLI:
clawhub install openclaw/skills/skills/anderskev/fastapi-code-review
Once installed, the agent gains access to the skill's local references, enabling it to cross-reference your code against standard patterns for APIRouters, dependency lifecycles, and Pydantic validation schemas.
Use Cases
- Pre-PR Audits: Run a scan before submitting code to ensure all handlers are async, use appropriate status codes, and implement proper response models.
- Dependency Refactoring: Ensure your
Depends()patterns are centralized, reusable, and correctly handle resource cleanup viayieldstatements. - Debugging 422 Errors: Diagnose validation failures by checking your Pydantic models against incoming request shapes.
- Performance Tuning: Identify accidental blocking I/O calls (like synchronous database drivers or file system operations) inside
async defroute handlers that may be stalling your event loop.
Example Prompts
- "Review this route handler: I'm concerned that my database lookup might be blocking the event loop. Can you check if I'm using the dependency injection pattern correctly?"
- "I have an APIRouter setup but my response models aren't being applied correctly in the generated OpenAPI documentation. Could you scan my code for missing
response_modeldefinitions?" - "Is this exception handling pattern sufficient for a production FastAPI app, or should I replace these bare except blocks with custom HTTPExceptions?"
Tips & Limitations
- Understand Context: The agent is programmed to ignore idiomatic FastAPI patterns (like returning a dictionary or non-awaiting simple functions), preventing "false positive" flags.
- Avoid Manual Validation: Trust Pydantic for validation; if the agent flags a missing check, verify whether a Pydantic model is already covering that logic.
- Blocking vs Non-Blocking: Always distinguish between CPU-bound tasks and network-bound tasks. The agent will flag blocking I/O, but it relies on your input to understand the nature of external library calls.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-anderskev-fastapi-code-review": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read
Related Skills
tutorial-docs
Tutorial patterns for documentation - learning-oriented guides that teach through guided doing
fetch-pr-feedback
Fetch review comments from a PR and evaluate with receive-feedback skill
swift-testing-code-review
Reviews Swift Testing code for proper use of
rust-testing-code-review
Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Covers Rust 2024 edition changes including async fn in traits for mocks,
explanation-docs
Explanation documentation patterns for understanding-oriented content - conceptual guides that explain why things work the way they do