Skip to content
Skillpedia
APIs & servers (backend)48k · #2985

fastapi-router-py

Helps create API routes in Python following best practices. Ensures routes have security, response models, and correct status codes.

What it does

This code helps create parts of a website or web application that handle information, ensuring it's organized and secure. It defines how data is received and sent, and who can access it.

When to use it

  • ✓When building new sections for a website.
  • ✓When adding login or permission features.
  • ✓When organizing how data is displayed to the user.

Example of what to ask your AI

“Create a new section to manage users in my app, with secure login and a user list display.”

Want more? Open the sections below.

How to use

The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.

Skill link

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fastapi-router-py/SKILL.md

Ready-to-paste message

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fastapi-router-py/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
How it works

It uses a template to define data structures and rules to ensure only authorized users can access certain information. It also sets status codes to indicate if an operation was successful.

Installation

Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.

In the terminal (Claude Code, Codex, Cursor), in your project folder:

npx skills add sickn33/agentic-awesome-skills --skill fastapi-router-py

Or download just the file:

curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/fastapi-router-py/SKILL.md -o SKILL.md
Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Bundled upstream support

Supporting files are included at skill-relative paths. See UPSTREAM-NOTICE.md for their pinned sources, licenses, hashes, and import changes.

FastAPI Router

Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.

Quick Start

Copy the template from assets/template.py and replace placeholders:

  • {{ResourceName}} → PascalCase name (e.g., Project)
  • {{resource_name}} → snake_case name (e.g., project)
  • {{resource_plural}} → plural form (e.g., projects)

Authentication Patterns

# Optional auth - returns None if not authenticated
current_user: Optional[User] = Depends(get_current_user)

# Required auth - raises 401 if not authenticated
current_user: User = Depends(get_current_user_required)

Response Models

@router.get("/items/{item_id}", response_model=Item)
async def get_item(item_id: str) -> Item:
    ...

@router.get("/items", response_model=list[Item])
async def list_items() -> list[Item]:
    ...

HTTP Status Codes

@router.post("/items", status_code=status.HTTP_201_CREATED)
@router.delete("/items/{id}", status_code=status.HTTP_204_NO_CONTENT)

Integration Steps

  1. Create router in src/backend/app/routers/
  2. Mount in src/backend/app/main.py
  3. Create corresponding Pydantic models
  4. Create service layer if needed
  5. Add frontend API functions

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
FAQ

What are 'routers'?

They are like divisions in a building, where each floor or room has a specific function. In code, they organize the different parts of a web application.

What is 'authentication'?

It's the process of verifying if a user is who they claim to be, like logging in with a username and password.

What are 'response models'?

They are like forms that define the appearance and data that will be sent back to the user, ensuring consistency.

Details

Original description by the author

Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.

repo: sickn33/agentic-awesome-skills

Popularity

GitHub stars
48k
Ranking position
#2985
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills