Agent skill

Python API Design

by johnku2011 in johnku2011/boilerplates-with-ai-skills

A skill your agent uses when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.

MITAuto-check passedBackend & APIs

Install Python API Design

skills CLI
$ npx skills add johnku2011/boilerplates-with-ai-skills --skill python-api-design -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install johnku2011/boilerplates-with-ai-skills python-api-design --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/johnku2011/boilerplates-with-ai-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/boilerplates/python-service/skills/python-api-design .claude/skills/python-api-design && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
python-api-design
GitHub stars
240
Token cost
~449 tokens
SKILL.md length
166 words
Files
1
Skills in repo
18
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.

  • Works in 5 steps: Register routes on the app from… → Use Pydantic models for request/response… → Return correct status codes; use… → …
  • Changing FastAPI routes
  • SKILL.md covers Overview, Process, Project Layout and Testing, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Python API Design is an agent skill from johnku2011/boilerplates-with-ai-skills. Use when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.

Its SKILL.md is about 450 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: FastAPI + pytest service in this boilerplate

It sits in Backend & APIs, covering API design, Backend development and Unit testing. It works with Python, FastAPI and pytest. The licence is MIT.

When your agent uses it

  • Changing FastAPI routes
  • Tests in this Python service — keep endpoints typed
  • Covered by pytest

Example prompts

  • “/python-api-design”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): FastAPI + pytest service in this boilerplate
  • Pre-approved tools (allowed-tools): Read

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Register routes on the app from create_app() in app/main.py.
  2. Use Pydantic models for request/response bodies when shapes matter.
  3. Return correct status codes; use HTTPException for client errors.
  4. Add a pytest case for each new route or behavior change.
  5. Run pytest before claiming completion.

What it can do on your machine

Read from SKILL.md and the folder at commit 475dc6a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    FastAPI + pytest service in this boilerplate

    From compatibility in the SKILL.md frontmatter.

Context cost

Python API Design loads about 449 tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 166 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~449

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from johnku2011/boilerplates-with-ai-skills at commit 475dc6a, republished under its MIT licence (© johnku2011). 166 words, ~449 tokens.

Download SKILL.mdSave it as .claude/skills/python-api-design/SKILL.md (or your agent's skills folder).
name
python-api-design
description
Use when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.
allowed-tools
Read
compatibility
FastAPI + pytest service in this boilerplate
license
MIT
metadata.stack
python-fastapi

Python API Design (FastAPI)

Overview

Keep the FastAPI app small and testable. Build with create_app() so pytest can use TestClient without starting a real server on a fixed port.

Process

  1. Register routes on the app from create_app() in app/main.py.
  2. Use Pydantic models for request/response bodies when shapes matter.
  3. Return correct status codes; use HTTPException for client errors.
  4. Add a pytest case for each new route or behavior change.
  5. Run pytest before claiming completion.

Project Layout

  • app/main.py — create_app() factory and route definitions
  • tests/ — pytest tests using fastapi.testclient.TestClient
  • requirements.txt — pinned runtime + test dependencies

Testing

python
from fastapi.testclient import TestClient
from app.main import create_app

def test_health():
    client = TestClient(create_app())
    assert client.get("/api/health").json() == {"status": "ok"}

Guidelines

  • Type hints on route functions and shared helpers.
  • Secrets from environment variables (os.environ), never hardcoded.
  • Keep route handlers thin; extract logic to pure functions when non-trivial.
  • Prefer dependency injection for DB sessions and auth when the app grows.

Anti-patterns

  • Business logic embedded directly in route decorators without tests.
  • Returning raw exception strings to clients in production.
  • Skipping tests because "FastAPI validates for us" — test behavior, not just schemas.

© johnku2011, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in boilerplates/python-service/skills/python-api-design of johnku2011/boilerplates-with-ai-skills.

Open the folder on GitHubat commit 475dc6a

Compare with similar skills

Python API Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python API Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python API Design this skilljohnku2011/boilerplates-with-ai-skills240—~449Automated safety check: PassMIT
Python Devdoccker/cc-use-exp1.1k—~790Automated safety check: PassCustom licence
Pythonericrisco/rsc-harness156—~3.8kAutomated safety check: PassMIT
Python Rulessoftspark/ai-toolkit179—~2.9kAutomated safety check: PassApache-2.0
PythonMadAppGang/claude-code283—~2.8kAutomated safety check: NotesMIT
Mastering Python SkillSpillwaveSolutions/agent-brain120—~1.4kAutomated safety check: NotesMIT

Similar skills

  • Python Dev

    doccker/cc-use-exp

    Python 开发规范。当用户操作 .py、pyproject.toml、requirements.txt、setup.py 文件, 或涉及 FastAPI、Django、Flask、pytest、asyncio 开发时触发。

    1.1k GitHub stars~790 tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Python

    ericrisco/rsc-harness

    A skill your agent uses when the task is Python itself, in any framework or none: PEP 695 generics, mypy --strict typing, dataclass/Protocol/TypedDict/Enum choices, asyncio.TaskGroup, stdlib idioms…

    156 GitHub stars~3.8k tokensUpdated today
    Backend & APIsAuto-check passed
  • Python Rules

    softspark/ai-toolkit

    Python coding rules: style, patterns, security, testing. An agent skill from softspark/ai-toolkit.

    179 GitHub stars~2.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Python

    MadAppGang/claude-code

    A skill your agent uses when building FastAPI applications, implementing async endpoints, setting up Pydantic schemas, working with SQLAlchemy, or writing pytest tests for Python backend services.

    283 GitHub stars~2.8k tokensUpdated 6 mo ago
    Backend & APIsAuto-check: notes
  • Mastering Python Skill

    SpillwaveSolutions/agent-brain

    Modern Python coaching covering language foundations through advanced production patterns.

    120 GitHub stars~1.4k tokensUpdated 17 days ago
    DevelopmentAuto-check: notes
  • Flowfile Debugging Playbook

    Edwardvaneechoud/Flowfile

    Symptom-to-cause triage playbook for Flowfile (core/worker/kernel/frontend/AI) — covers "no such table" DB cascades (two distinct causes), import-time Alembic migration corruption, silent…

    370 GitHub stars~6.3k tokensUpdated yesterday
    DevelopmentAuto-check passed

More from johnku2011/boilerplates-with-ai-skills

All 18 skills in this repo
  • Project Security

    johnku2011/boilerplates-with-ai-skills

    A skill your agent uses when reviewing security-sensitive code paths — check auth, secrets, input validation, dependency risk, and data exposure before shipping.

    240 GitHub stars~650 tokensUpdated 1 mo ago
    Auto-check passed
  • Code Review

    johnku2011/boilerplates-with-ai-skills

    A skill your agent uses when reviewing a diff or pull request — check correctness, tests, readability, security, and server/client boundaries before approving.

    240 GitHub stars~708 tokensUpdated 1 mo ago
    Auto-check passed
  • Bwai Advisor

    johnku2011/boilerplates-with-ai-skills

    Use before scaffolding a bwai project — runs the full startup-goal workflow then recommends the right boilerplate and outputs the exact bwai new command to run.

    240 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Deploy Vercel

    johnku2011/boilerplates-with-ai-skills

    A skill your agent uses when deploying or configuring this project on Vercel — env vars, build settings, serverless limits, and production checks for Next.js or Express.

    240 GitHub stars~660 tokensUpdated 1 mo ago
    Auto-check: notes
  • Express API Design

    johnku2011/boilerplates-with-ai-skills

    A skill your agent uses when adding or changing routes, middleware, or error handling in this Express.js API, to keep endpoints consistent, validated, and testable.

    240 GitHub stars~575 tokensUpdated 1 mo ago
    Auto-check passed
  • Nextjs App Router

    johnku2011/boilerplates-with-ai-skills

    A skill your agent uses when adding pages, layouts, route handlers, or data fetching in this Next.js App Router project, to follow server-first conventions correctly.

    240 GitHub stars~587 tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Python API Design

What does Python API Design do?

A skill your agent uses when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest. Python API Design is an agent skill from johnku2011/boilerplates-with-ai-skills. Use when adding or changing FastAPI routes, dependencies, or tests in this Python service — keep endpoints typed, validated, and covered by pytest.

When should I use Python API Design?

Python API Design fits situations like: changing FastAPI routes; tests in this Python service — keep endpoints typed; covered by pytest.

How do I install Python API Design in Claude Code?

Run `npx skills add johnku2011/boilerplates-with-ai-skills --skill python-api-design -a claude-code`. Or copy the skill folder (boilerplates/python-service/skills/python-api-design in johnku2011/boilerplates-with-ai-skills) into .claude/skills/python-api-design in your project. Claude Code loads it when a task matches its description.

How do I install Python API Design in Codex?

Run `npx skills add johnku2011/boilerplates-with-ai-skills --skill python-api-design -a codex`. Or copy the skill folder (boilerplates/python-service/skills/python-api-design in johnku2011/boilerplates-with-ai-skills) into .agents/skills/python-api-design in your project. Codex loads it when a task matches its description.

Can I use Python API Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add johnku2011/boilerplates-with-ai-skills --skill python-api-design -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/python-api-design, .gemini/skills/python-api-design, .github/skills/python-api-design and .opencode/skills/python-api-design in your project.

What does Python API Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Python API Design is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read. Compatibility (from SKILL.md): FastAPI + pytest service in this boilerplate.

Does Python API Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Python API Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Python API Design use?

Python API Design is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python API Design use?

About 449 tokens (SKILL.md is roughly 1.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Python API Design?

Skills that share tags, products or a category with Python API Design: Python Dev (doccker/cc-use-exp, 1.1k stars), Python (ericrisco/rsc-harness, 156 stars), Python Rules (softspark/ai-toolkit, 179 stars) and Python (MadAppGang/claude-code, 283 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python API Design?

johnku2011 (a GitHub user) maintains it in johnku2011/boilerplates-with-ai-skills, which has 240 GitHub stars. The repository holds 18 skills in this directory. The repository was last updated on August 24, 2026.

Source: johnku2011/boilerplates-with-ai-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.