Python REST API Formatter skill for Claude and Codex
Generates one FastAPI endpoint with Pydantic request and response models from a field list: typed path parameters, validated body, declared status codes…
Install it once and Claude or Codex runs it for you. When your request matches, your AI loads the skill, asks for anything it is missing, and works through the template itself. Prefer to fill it in by hand? See the full prompt template.
Download the skill (.zip) · View SKILL.md
When it is used
Use when one FastAPI endpoint needs Pydantic request and response models, typed path parameters, declared status codes, and an optional auth dependency. Do not use for a whole API project, Flask endpoints, or validation middleware in another framework. Related topics: coding, python.
What it will ask you for
- Endpoint name (free text, e.g. "get_user")
- HTTP method (choose one: GET, POST, PUT, DELETE, PATCH)
- URL path (free text, e.g. "/users/{id}")
- Request fields (one per line) (longer free text)
- Response fields (one per line) (longer free text)
- Authentication required (choose one: Yes, No)
- Status codes (choose any: 200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 404 Not Found, 500 Internal Server Error)
How it works
- Build the Request and Response Pydantic models from the field lists with matching type hints, treating GET and DELETE request fields as query parameters.
- Extract path parameters from the URL and declare them typed in the signature.
- Declare the route with response_model, the primary success status_code, and a responses dictionary for every other selected code.
- Add the bearer-token Depends stub raising 401 when auth is required and a 404 raise where a lookup can miss.
- Append the example request comment and output a single python code block with nothing outside it.
What you get
Exactly one markdown code block tagged python: imports, the Pydantic Request and Response models, the auth dependency when required, the decorated route function, and a closing example-request comment.
What it watches out for
- Declaring a body model on a GET endpoint, which FastAPI accepts but every HTTP client and proxy mishandles.
- Setting status_code to 200 on a POST that creates a resource when 201 was selected.
- Leaving a path parameter untyped so a non-numeric id reaches the handler instead of failing validation with 422.
How to install
Claude.ai and the Claude desktop app
- Download the skill .zip.
- Open Settings, then Capabilities, and find Skills.
- Choose Upload skill and select the .zip.
- Ask Claude for help with the task. It loads the skill when your request matches.
Claude Code
- Download the skill .zip.
- Unzip it into ~/.claude/skills/ (or .claude/skills/ inside a project).
- Start a new session. Claude Code loads the skill when your request matches.
Codex
- Download the skill .zip.
- Unzip it into ~/.agents/skills/ (or .agents/skills/ inside a project).
- Codex picks it up on its own. Type $ and the skill name to use it, or just ask for the task.
Cursor
- Download the Cursor rule (.mdc).
- Save it in .cursor/rules/ inside your project.
- Cursor's agent applies the rule when your request matches its description.
AGENTS.md (Codex, Cursor, and other coding agents)
- Copy the AGENTS.md section.
- Paste it into AGENTS.md at the root of your repository, creating the file if needed.
- Coding agents that read AGENTS.md follow it when your request fits.