agentleFS
mvilrokxmvilrokx/claude-skills/fastapi-code-review/SKILL.md

fastapi-code-review

Skill2 starsChanged 11 months agoMITView on GitHub

Comprehensive code review skill for FastAPI projects. Analyzes codebase against industry best practices covering async patterns, project structure, Pydantic usage, dependency injection, database patterns, testing, and performance. Generates detailed refactor plans with prioritized recommendations. Use when reviewing FastAPI projects, auditing code quality, planning refactors, or ensuring adherence to FastAPI/async best practices.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before reviewing, collect information about the project:

    line 14
  2. Distinctive:

    No custom base Pydantic model

    line 93

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

FastAPI Code Review

Perform comprehensive code reviews of FastAPI projects against industry best practices, identifying violations and generating actionable refactor plans.

Review Process

1. Gather Project Context

Before reviewing, collect information about the project:

- Project structure (list_dir on root and key directories)
- Main application entry point (typically main.py or app.py)
- Router definitions and API endpoints
- Pydantic models/schemas
- Database models and connections
- Dependencies and middleware
- Configuration management
- Test files

2. Execute Review Checklist

Evaluate each category against the best practices in references/best-practices.md.

Review Categories:

  1. Project Structure
  2. Async/Sync Patterns
  3. Pydantic Usage
  4. Dependency Injection
  5. API Design (REST)
  6. Database Patterns
  7. Testing Patterns
  8. Configuration Management
  9. Performance Optimizations
  10. Documentation

3. Generate Refactor Plan

For each violation found, document:

## Refactor Plan

### Critical Issues (Fix Immediately)
| Issue | Location | Best Practice Violated | Refactor Action |
|-------|----------|------------------------|-----------------|
| ... | ... | ... | ... |

### High Priority (Fix Soon)
| Issue | Location | Best Practice Violated | Refactor Action |
|-------|----------|------------------------|-----------------|
| ... | ... | ... | ... |

### Medium Priority (Plan for Refactor)
| Issue | Location | Best Practice Violated | Refactor Action |
|-------|----------|------------------------|-----------------|
| ... | ... | ... | ... |

### Low Priority (Nice to Have)
| Issue | Location | Best Practice Violated | Refactor Action |
|-------|----------|------------------------|-----------------|
| ... | ... | ... | ... |

Quick Reference: Common Violations

Critical (Blocking Event Loop)

  • time.sleep() in async routes → Use asyncio.sleep() or make route sync
  • Sync database calls in async routes → Use async database drivers
  • Sync HTTP calls in async routes → Use httpx.AsyncClient

High Priority (Performance/Security)

  • Missing indexes on frequently queried columns
  • N+1 query patterns
  • Hardcoded secrets → Use environment variables
  • Missing rate limiting on public endpoints
  • SELECT * queries → Select only needed columns

Medium Priority (Maintainability)

  • God routers with too many endpoints → Split by domain
  • Missing dependency injection for validation
  • Sync dependencies in async context
  • No custom base Pydantic model
  • Missing type hints

Low Priority (Polish)

  • Missing OpenAPI documentation
  • Inconsistent naming conventions
  • Missing pre-commit hooks with ruff

Output Format

Generate a comprehensive review report:

# FastAPI Code Review Report

## Executive Summary
- **Project**: [name]
- **Review Date**: [date]
- **Overall Health**: [Critical/Needs Work/Good/Excellent]
- **Total Issues Found**: [count]

## Metrics
| Category | Status | Issues |
|----------|--------|--------|
| Project Structure | ✅/⚠️/❌ | X |
| Async Patterns | ✅/⚠️/❌ | X |
| Pydantic Usage | ✅/⚠️/❌ | X |
| Dependencies | ✅/⚠️/❌ | X |
| API Design | ✅/⚠️/❌ | X |
| Database | ✅/⚠️/❌ | X |
| Testing | ✅/⚠️/❌ | X |
| Configuration | ✅/⚠️/❌ | X |
| Performance | ✅/⚠️/❌ | X |
| Documentation | ✅/⚠️/❌ | X |

## Detailed Findings
[Per-category breakdown with code examples]

## Refactor Plan
[Prioritized action items]

## Recommendations
[Strategic improvements beyond immediate fixes]

Reference

For detailed best practices and code examples, see references/best-practices.md.

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.