# Build Consistent FastAPI Routers

FastAPI endpoints become inconsistent when authentication, models, and status codes vary. This skill provides concise router patterns and integration steps for reliable API development.

## Install

```bash
npx skillstore add sickn33/fastapi-router-py
```

## Metadata

- Status: approved
- Slug: sickn33-fastapi-router-py
- Skillstore revision: r1
- Version status: missing
- Tree hash: c9aafaf29e999a5dda2c444d5911c1a561f8197862feec9d4fe34fa547ff69d0
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/fastapi-router-py
- Ref: 88a8e9a07f4c54ab105c1c41b6267c287146b07b
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/sickn33-fastapi-router-py
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-fastapi-router-py/manifest

## Capabilities

- Explains optional and required FastAPI authentication dependency patterns.
- Demonstrates response models for detail and collection endpoints.
- Shows appropriate creation and deletion HTTP status codes.
- Defines naming placeholders for resource-based router generation.
- Lists steps for router registration, models, services, and frontend integration.

## Use Cases

- Create a First Resource Router: Build a clear FastAPI router with typed responses and suitable status codes.
- Standardize Existing API Routes: Align authentication dependencies, response models, and status codes across related endpoints.
- Define Team Router Conventions: Establish a repeatable structure for routers, models, services, and application registration.

## Prompt Templates

### Create a Basic Router

```
Create a FastAPI router for {{resource}} with list and detail endpoints. Use Pydantic response models and explain each status code.
```

### Add Authentication

```
Add required authentication to write routes for {{resource}}. Keep read routes public and use the project authentication dependencies.
```

### Integrate a Router

```
Integrate a {{resource}} router into {{project_path}}. Follow existing imports, service boundaries, response models, and router registration patterns.
```

### Review Router Consistency

```
Review {{router_file}} for authentication gaps, incorrect response models, status code errors, and inconsistent project conventions. Propose focused corrections and tests.
```

## Limitations

- The referenced assets/template.py file is not included in the package.
- The skill does not provide complete CRUD handler implementations.
- It does not cover validation, error responses, pagination, or detailed authorization.
- Generated routers still require project-specific review and testing.

## Best Practices

- Reuse the project's established authentication dependencies and import patterns.
- Declare response models and status codes explicitly for every route.
- Test authorization, validation, success responses, and error responses before integration.

## Anti Patterns

- Do not create new authentication helpers when approved project dependencies already exist.
- Do not return untyped data when a stable response model is available.
- Do not register a router before reviewing paths, prefixes, tags, and dependency behavior.

## Security Audit

- Audited at: 2026-07-24T00:14:13.355\+00:00
- Summary: All ten static findings are false positives caused by Markdown inline-code delimiters and fenced Python examples in SKILL.md. The file contains no shell commands, execution instructions, network behavior, credential access, or prompt injection. Publication security risk is not supported by the reviewed content.

## Stats

- Views: 152
- Downloads: 12
- Favorites: 0
- Popularity score: 0
