hivemind: Skill for Claude Code

.claude/skills/fastapi-backend/SKILL.md

fastapi-backend is a skill for Claude Code from cohen-liel/hivemind. It costs 41 tokens per session (652 once invoked), scanned A, original, Apache-2.0.

A set of patterns for building Python web backends with FastAPI, a framework for creating web APIs. It covers project structure, asynchronous endpoints, validation models, shared dependencies, middleware, and database handling.

In plain words
What is it for?
Use it when creating REST APIs, Pydantic request and response models, dependency injection, middleware, async routes, or a FastAPI server.
Why use it?
It provides a consistent way to organise API code and manage common concerns such as validation, authentication, startup, shutdown, commits, and rollbacks.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is cohen-liel/hivemind's own configuration. It tells Claude Code how to work on hivemind itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything hivemind configures →

Reuse

Borrowing it

Nothing to install: this file belongs to cohen-liel/hivemind. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/cohen-liel/hivemind/main/.claude/skills/fastapi-backend/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/cohen-liel/hivemind

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fastapi-backend

README.md
[![agentmods](https://agentmods.dev/badge/skills/cohen-liel/hivemind/fastapi-backend.svg)](https://agentmods.dev/skills/cohen-liel/hivemind/fastapi-backend)
Your own site
<a href="https://agentmods.dev/skills/cohen-liel/hivemind/fastapi-backend"><img src="https://agentmods.dev/badge/skills/cohen-liel/hivemind/fastapi-backend.svg" alt="Measured on agentmods" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 652 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00041 $0.00652
Opus 5 $0.00020 $0.00326
Sonnet 5 $0.00008 $0.00130
Haiku 4.5 $0.00004 $0.00065

Measured 6d ago against content hash 3bf03a59c10b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

fastapi-backend scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/fastapi-backend/SKILL.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FastAPI Backend Patterns

Project Structure

app/
  main.py          # FastAPI app, lifespan, middleware
  config.py        # Pydantic Settings, env vars
  models/          # SQLAlchemy ORM models
  schemas/         # Pydantic request/response schemas
  routers/         # APIRouter per domain (auth, users, posts)
  services/        # Business logic (no DB or HTTP here)
  deps.py          # Shared dependencies (get_db, get_current_user)
  database.py      # Engine, SessionLocal, Base

Core Patterns

App setup with lifespan

from contextlib import asynccontextmanager
from fastapi import FastAPI

@asynccontextmanager
async def lifespan(app: FastAPI):
    # startup
    await database.connect()
    yield
    # shutdown
    await database.disconnect()

app = FastAPI(lifespan=lifespan)

Dependency injection

# deps.py
async def get_db() -> AsyncGenerator[AsyncSession, None]:
    async with AsyncSessionLocal() as session:
        try:
            yield session
            await session.commit()
        except Exception:
            await session.rollback()
            raise

async def get_current_user(
    token: str = Depends(oauth2_scheme),
    db: AsyncSession = Depends(get_db)
) -> User:
    ...

Router pattern

router = APIRouter(prefix="/users", tags=["users"])

@router.get("/{user_id}", response_model=UserResponse)
async def get_user(user_id: int, db: AsyncSession = Depends(get_db)):
    user = await db.get(User, user_id)
    if not user:
        raise HTTPException(status_code=404, detail="User not found")
    return user

Error handling

from fastapi import Request
from fastapi.responses import JSONResponse

@app.exception_handler(ValueError)
async def value_error_handler(request: Request, exc: ValueError):
    return JSONResponse(status_code=400, content={"detail": str(exc)})

Pydantic schemas

class UserCreate(BaseModel):
    email: EmailStr
    password: str = Field(min_length=8)
    name: str = Field(max_length=100)

class UserResponse(BaseModel):
    id: int
    email: str
    name: str
    model_config = ConfigDict(from_attributes=True)

Read the full file on GitHub · 102 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 102 lines · 41 tokens per session scan A 3bf03a59c10b

Subscribe to this mod's changes

fastapi-backend is a skill published in the GitHub repository cohen-liel/hivemind (108 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 41 tokens to every session and 652 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

dotnet-backend-expert

This skill should be used when the user is writing, reviewing, debugging, or architecting pure .NET backend code for Kestrel-hosted services. It provides expert critique for REST endpoints, SignalR hubs, TypeScript/React client integration shape, pragmatic Rust interop, application services, AppHost-aware project…

mathisk2095/jko-claude-plugins · 181 tokens

python-backend-expert

This skill should be used when the user is writing, reviewing, debugging, or architecting Python backend code using Litestar or FastAPI with SQLAlchemy or Advanced Alchemy. Provides expert critique covering SOLID principles, hexagonal architecture, repository/service patterns, dependency injection, async correctness…

mathisk2095/jko-claude-plugins · 183 tokens

sdd-apply

Skill "sdd-apply" from Gentleman-Programming/gentle-ai, covering execution role, language domain contract, purpose, what you receive and execution and persistence contract.

Gentleman-Programming/gentle-ai · 0 tokens

kotlin-ktor-patterns

Ktor server patterns including routing DSL, plugins, authentication, Koin DI, kotlinx.serialization, WebSockets, and testApplication testing.

hashgraph-online/awesome-codex-plugins · 34 tokens

laravel-patterns

Laravel architecture patterns, routing/controllers, Eloquent ORM, service layers, queues, events, caching, and API resources for production apps.

hashgraph-online/awesome-codex-plugins · 32 tokens

goframe-v2

GoFrame development skill. TRIGGER when writing/modifying Go files, implementing services, creating APIs, or database operations. DO NOT TRIGGER for frontend/shell scripts.

hashgraph-online/awesome-codex-plugins · 40 tokens