CLAUDE.md@by-framework/fastapiA
CLAUDE.md@by-framework/fastapi from overseastelegramaliterateperson865/awesome-claude-md is a CLAUDE.md file: the standing instructions Claude Code reads in that repo.
mdr add overseastelegramaliterateperson865/awesome-claude-md/by-framework/fastapi/CLAUDE.md@git:20260320.9b01acaPins git:20260320.9b01aca in mdr.lock. Pin the fingerprint instead.
- Audit grade
- A, 14 of 14 checks passed
- Kind
- CLAUDE.md file
- Repository
- overseastelegramaliterateperson865/awesome-claude-md
- Path
by-framework/fastapi/CLAUDE.md- Versions recorded
- 2
- Latest version
- git:20260320.9b01aca, committed Mar 20, 2026
- First version recorded
- Mar 20, 2026
- Size
- 3,481 bytes
- Repository stars
- 3
- License
- MIT
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# CLAUDE.md - FastAPI 项目规范
## 构建与运行
- 依赖管理:`uv` 或 `poetry`,锁文件必须提交到仓库
- 启动开发服务器:`uvicorn app.main:app --reload --port 8000`
- 运行测试:`pytest -xvs`,Lint 检查:`ruff check . && ruff format --check .`
- Python 版本:3.11+,充分利用类型标注
## 项目结构
- `app/main.py` - 入口,注册 router 和 middleware
- `app/routers/` - 按业务域拆分路由(如 `users.py`、`orders.py`)
- `app/models/` - SQLAlchemy ORM 模型,`app/schemas/` - Pydantic v2 模型
- `app/services/` - 业务逻辑层,`app/dependencies.py` - 公共依赖注入
- `alembic/` - 数据库迁移脚本
## 异步模式
- 路由函数默认 `async def`,仅调用同步阻塞库时用 `def`
- CPU 密集型任务用 `run_in_executor` 推到线程池,不要阻塞事件循环
- 数据库用 `sqlalchemy[asyncio]` + `asyncpg`,禁止 async 中调同步阻塞 I/O
- HTTP 客户端用 `httpx.AsyncClient`,在 lifespan 中创建共享实例:
```python
async def lifespan(app: FastAPI):
app.state.http = httpx.AsyncClient()
yield
await app.state.http.aclose()
```
- 后台任务用 `BackgroundTasks` 或 Celery/ARQ,禁止在请求中做耗时操作
## Pydantic v2 规范
- 请求体和响应体必须定义 Pydantic model,禁止裸 `dict` 返回
- 请求/响应模型分开定义:`UserCreate`(入参)、`UserResponse`(出参)、`UserInDB`(内部)
- 使用 `ConfigDict(from_attributes=True)` 替代旧版 `orm_mode`,入参 model 启用 `ConfigDict(strict=True)`
- 敏感字段(password)只出现在入参 model,响应 model 用 `model_fields` 显式列出
…Read the whole file at its exact version.
How to install
mdr add overseastelegramaliterateperson865/awesome-claude-md/by-framework/fastapi/CLAUDE.md@sha256:e256728fda4827e1The line at the top of this page pins the label git:20260320.9b01aca, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
[](https://markdownregistry.com/a/art_z5v5xypzokxl3ijh)
2 badge image fetches in 30 days. What the badge shows.
Versions
The registry has recorded 2 versions of this file, all committed on Mar 20, 2026.
| version | committed | commit | size | audit | |
|---|---|---|---|---|---|
| git:20260320.9b01aca latest | 2026-03-20 | 9b01aca | 3,481 B | A | view · diff |
| git:20260320.fcf2609 | 2026-03-20 | fcf2609 | 2,094 B | A | view |
Audit of the latest version
- pass: Size between 200 bytes and 200 KB (3481 bytes)
- pass: No zero-width or bidi control characters
- pass: No instruction hidden inside an HTML comment
- pass: No link to an exfiltration or paste host
- pass: No credential-shaped string
- pass: No instruction to send local credentials anywhere
- pass: No text hidden with inline styles
- pass: No prompt-injection phrasing
- pass: No curl or wget piped into a shell
- pass: No recursive delete of root, home or parent
- pass: No instruction to read or print local credentials
- pass: No base64 blob over 200 characters
- pass: No link to a raw IP address
- pass: No script tag
Source
overseastelegramaliterateperson865/awesome-claude-md · 3 stars · license MIT · pushed 2026-10-14 · branch main
API
GET https://markdownregistry.com/api/v1/artifacts/art_z5v5xypzokxl3ijh GET https://markdownregistry.com/api/v1/resolve?ref=overseastelegramaliterateperson865/awesome-claude-md/by-framework/fastapi/CLAUDE.md GET https://markdownregistry.com/api/v1/blob/e256728fda4827e12524eaed2677fc0f93a6f29840f0c9a7f9987991f1b817bf
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
Guides: what a CLAUDE.md file is · keeping AGENTS.md and CLAUDE.md in sync · which agent file does what.
More from overseastelegramaliterateperson865/awesome-claude-md
Every file in overseastelegramaliterateperson865/awesome-claude-md