dhpk-fastapi-pro

dhpk-fastapi-pro is a skill for Claude Code from hmj1026/dhpk. It costs 75 tokens per session (1,079 once invoked), scanned A, original, MIT.

A set of patterns and review rules for building FastAPI web APIs with SQLAlchemy, an object-relational database library, and asynchronous Python code.

In plain words
What is it for?
Use it when writing or reviewing FastAPI routes, database repositories, dependency injection, authentication, error handling, or Alembic database migrations.
Why use it?
It helps prevent tangled route handlers, unsafe database transactions, inconsistent responses, and common authentication or migration mistakes.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dhpk plugin — 65 skills, 31 commands, 37 agents, 3 hooks shipped together

Good fit Use it when writing or reviewing FastAPI routes, database repositories, dependency injection, authentication, error handling, or Alembic database migrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hmj1026/dhpk/dhpk-fastapi-pro
View source ↗ hmj1026/dhpk
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hmj1026/dhpk --skill dhpk-fastapi-pro
Clone the repo
git clone --depth 1 https://github.com/hmj1026/dhpk

Made for: Claude Code.

Or install dhpk, the plugin that ships this one along with the rest of its 65 skills, 31 commands, 37 agents, 3 hooks.

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 dhpk-fastapi-pro

README.md
[![agentmods](https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-fastapi-pro/github.svg)](https://agentmods.dev/skills/hmj1026/dhpk/dhpk-fastapi-pro)
Your own site
<a href="https://agentmods.dev/skills/hmj1026/dhpk/dhpk-fastapi-pro"><img src="https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-fastapi-pro/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dhpk-fastapi-pro

Your own site · 80×15
<a href="https://agentmods.dev/skills/hmj1026/dhpk/dhpk-fastapi-pro"><img src="https://agentmods.dev/badge/skills/hmj1026/dhpk/dhpk-fastapi-pro.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,079 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00075 $0.01079
Opus 5 $0.00037 $0.00540
Sonnet 5 $0.00015 $0.00216
Haiku 4.5 $0.00007 $0.00108

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

Security

Grade A, and why

dhpk-fastapi-pro 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 7d 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.

generated/claude-profiles/compat-v1/package/skills/dhpk-fastapi-pro/SKILL.md · 90 lines

How it starts

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

FastAPI + SQLAlchemy (async) Pro

Web-API layer guidance. Builds on the python module (typing, async discipline, ruff/pyright). Layering: Router → Service → Repository; routers stay thin (validate, delegate, shape response), business logic lives in services, data-access in repositories.

Routers & dependency injection

  • Inject collaborators via Depends(...) — DB session, current user, settings. Don't instantiate sessions/clients inside the handler.
  • Declare an explicit response_model= and status_code= on every route. Never return raw ORM objects — return a Pydantic response schema (prevents lazy-load serialization surprises and leaking columns).
  • Keep one session per request, yielded by a dependency; commit/rollback at the edge of the unit of work, not scattered through services.
  • Version/prefix routers (APIRouter(prefix=...)); group by domain. Paginate list endpoints with a consistent envelope (ccas standardized /pipeline/runs pagination) and bound max page size.

Pydantic schemas

  • Separate request (...Create / ...Update) and response (...Out) models from ORM models. Use model_config = ConfigDict(from_attributes=True) for ORM→schema conversion.
  • Validate at the boundary: constrained types, field validators. Reject bad input with 422 rather than letting it reach the DB.
  • Don't put secrets/internal fields in response schemas.

SQLAlchemy 2.0 async

  • async with AsyncSession(...) as session: — every query is await session.execute(select(...)); use .scalars() / .scalar_one_or_none().
  • One transaction per unit of work. Wrap multi-statement writes in async with session.begin():. Don't hold a session across an await to an external service it doesn't need.
  • Avoid N+1: eager-load with selectinload / joinedload for relationships you render. ccas batch-aggregates monthly budget totals to kill a 1+N frontend load.
  • Set busy_timeout / pool sensibly (SQLite WAL in ccas uses a 30s busy timeout for write atomicity). Always parameterize — never f-string SQL.
  • Repositories return domain objects or None; they don't leak Session upward.

Read the full file on GitHub · 90 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. 7d ago First seen · 90 lines · 75 tokens per session scan A 6fcf0365bd40

Subscribe to this mod's changes

dhpk-fastapi-pro is a skill published in the GitHub repository hmj1026/dhpk (2 stars, last pushed yesterday), licensed MIT. It adds 75 tokens to every session and 1,079 once invoked, about $0.0004 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-09-05.

Related

Other skills, from other repositories

fastapi

FastAPI best practices and conventions. Use when working with FastAPI APIs and Pydantic models for them. Keeps FastAPI code clean and up to date with the latest features and patterns, updated with new versions. Write new code or refactor and update old code.

ReflexioAI/claude-smart · 57 tokens

cloudflare-workers-multi-lang

Multi-language Workers development with Rust, Python, and WebAssembly. Use when building Workers in languages other than JavaScript/TypeScript, or when integrating WASM modules for performance-critical code.

secondsky/claude-skills · 45 tokens

python-services

Python patterns for CLI tools, async parallelism, and backend services. Use when building CLI apps, async/parallel Python, FastAPI services, background jobs, or configuring Python project tooling (uv, ruff, ty).

iliaal/whetstone · 48 tokens

functions-development

Build serverless Go or Python functions for Falcon Foundry apps. TRIGGER when user asks to "create a function", "write a serverless function", "build backend logic", runs foundry functions create, or needs help with FDK handler patterns, function testing, or collection integration from functions. Also TRIGGER when…

CrowdStrike/foundry-skills · 195 tokens

litestar-granian

Auto-activate for litestargranian, GranianPlugin, litestar run Granian options, runtime threads, HTTP/2, TLS, access logs, metrics, static mounts, or worker lifecycle. Not for non-Granian servers.

litestar-org/litestar-skills · 54 tokens

litestar-autowire

Auto-activate for litestarautowire, AutowirePlugin, AutowireConfig, domainpackages, AutowireIntegration, AutowireLoader, or clearautowirecache. Not for manual Router composition — use explicit routes.

litestar-org/litestar-skills · 56 tokens