production-fast-api-template
БесплатноБез исполняемых скриптовНе проверенStructure and execution rules for a unified, production-ready backend combining domain-oriented FastAPI, Retrieval-Augmented Generation (RAG) and Agentic AI…
от davepoon★ 3 815 звёзд на GitHubОб этом скилле
Production FastAPI Template: Rules
These rules define where code lives and how it executes in a unified FastAPI + RAG + Agentic AI backend. Apply them whenever you generate or modify code in a project built from this template.
Companion references. Read the relevant file before writing code:
| File | Read before writing… | Summarized in |
|---|---|---|
| ASYNC_EXECUTION.md | Any route, service, client, agent tool, worker or background job | Section 5 |
| PYDANTIC_STANDARDS.md | Any schema, settings class, serialization, LLM call with structured output, citation check, agent plan or tool argument model | Section 6 |
| API_CONVENTIONS.md | Any dependency, route signature, auth/permission check, OpenAPI metadata, DB model or query, migration, API test or lint setup | Section 7 |
| GUARDRAILS.md | Any user-facing LLM call, RAG answer, ingestion of untrusted documents, agent tool execution, gateway target or content-safety check | Section 8 |
| AI_EVALUATION.md | Any evaluation contract, metric, dataset, judge, runner, report or threshold; any new RAG stage, agent, tool or conversation feature that needs quality coverage | Section 9 |
| API_SECURITY.md | Any authentication, token, permission, tenant or ownership check; input/upload/outbound-URL handling; response headers, CORS, errors; rate limits; audit events; ECS/IAM/secrets; CI security; security tests | Section 10 |
| AGENT_SECURITY.md | Any agent, tool, tool registry entry, approval flow, memory write, MCP connector or LLM-output sink | Section 10 |
Status labels:
- 🟢 Convention. A proposed rule. Follow it by default.
- 🟡 Needs approval. An open team decision. Surface the options to the user and never pick one silently.
These rules don't choose agent frameworks, LLM providers, models, vector stores or a queue implementation. If a rule doesn't fit a real need, raise it with the user instead of silently working around it.
1. Core structure rules 🟢
- One application. FastAPI, RAG and Agentic AI are not separate apps. There is exactly one
src/package, one FastAPI entry point (src/main.py) and one shared infrastructure layer. - Never create a second entry point. Don't add a second
src/, a separate app folder (rag_app/,agents_service/,worker_app/) or an extraFastAPI()instance. - Background workers and Lambda functions are extra entry points into the same codebase. They are not separate applications, and they call the same service functions the API calls.
- One central API router. All routers mount through
src/api/v1/router.py. Domain, RAG and agent routers never mount themselves on the app. - Domain-oriented modules. Business code lives inside its domain package.
src/'s root holds only application-wide concerns. - No duplicated shared layers. Model clients go in
src/llm/, content-safety checks insrc/guardrails/and external-service clients insrc/providers/, each exactly once. RAG and agents consume them and never define their own copies (norag/llm_client.py, noagents/vector_db.py). - Provider-neutral naming. Name files by responsibility, not vendor (
llm/embeddings.py, notopenai_embeddings.py). Vendor specifics stay behindsrc/providers/orsrc/llm/. common/is for genuinely reusable, domain-agnostic code only. Never put business logic there.- Keep agents, reasoning and execution apart. Agent definitions go in
agents/, thinking incognition/and doing, scheduling and offloading inexecution/. - Tests mirror
src/. Quality evaluation (datasets, DeepEval/Ragas suites, deterministic metrics, runners, reports) lives in the top-levelevaluation/directory, separate fromtests/.src/evaluation/holds only framework-neutral contracts, the metric registry and adapters, with lazy framework imports (AI_EVALUATION.md §1). - Every Python directory under
src/has an__init__.py. Non-Python directories that must survive in Git (prompt folders, data, empty test folders) get a.gitkeep. - Explicit module imports across packages, e.g.
from src.auth import constants as auth_constants. - Reuse existing files before adding new ones. Extend
execution/background_worker.pyrather than creatingexecution/worker2.pyorrag/worker.py.
2. Canonical structure
<project-name>/
├── src/
│ ├── __init__.py
│ ├── main.py # the single FastAPI entry point (lifespan creates shared clients/limiters)
│ ├── config.py # application-wide configuration
│ ├── constants.py
│ ├── exceptions.py # base domain exception + handlers rendering ErrorResponse
│ ├── middleware.py
│ ├── database.py # shared metadata (naming convention), engine/session factory, get_db_session
│ ├── models.py
Установить production-fast-api-template в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл production-fast-api-template?
Structure and execution rules for a unified, production-ready backend combining domain-oriented FastAPI, Retrieval-Augmented Generation (RAG) and Agentic AI in one codebase on AWS ECS Fargate. Use when scaffolding a new backend; adding a module, API domain, RAG component, agent, tool, workflow, LLM/provider integration or test; deciding where a file belongs; writing async/sync routes, services or clients; offloading blocking or CPU-heavy work (thread pools, process pools, AWS Lambda); designing background jobs, queues (SQS, Celery), workers and scaling; or writing Pydantic schemas, settings (pydantic-settings), serialization, structured LLM outputs, citation validation, agent plans or tool-call arguments; or writing FastAPI dependencies (request validation, auth, access scopes, chaining), REST paths, response models, OpenAPI docs, error responses, database naming and SQL queries, migrations, API tests (async client, dependency overrides) or lint/format setup (ruff); or adding content-safety guardrails (input/output checks, PII, prompt injection, toxicity, Bedrock Guardrails, AgentCore Policy/Gateway Cedar policies, Guardrails AI validators), fail-closed handling and guardrail evaluation; or evaluating RAG, retrieval stages, structured outputs, citations, agents, multi-agent workflows or conversations (DeepEval, Ragas, LLM-as-judge, G-Eval, golden datasets, regression tiers, thresholds, judge calibration); or securing the API (authentication, JWT/JWKS, OAuth 2.0/OIDC, RBAC/ABAC, BOLA/BFLA, tenant isolation, input/upload/SSRF validation, security headers, CORS, CSRF, rate limiting, audit logging, ECS/IAM/secrets hardening, CI security scanning, security tests) or LLM/agent security (OWASP LLM Top 10, OWASP Agentic Top 10, prompt injection, tool authorization, human approval, excessive agency).
Как установить скилл production-fast-api-template?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл production-fast-api-template запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic