Declarative .mdcCursor/Claude/Windsurf 规则和 n8n 工作流程IDE规则零秘密泄漏审计

Python 3.12 + Astral uv + FastAPI 异步代理服务规则

声明性 Cursor/Claude/Windsurf 规则标准化 uv.lock 可重现环境、Ruff lints、Pydantic v2 严格模型和有界 httpx 超时。

声明性代理和 IDE 规则文件

---
description: Astral uv dependency locking, Pydantic v2 validation, and non-blocking FastAPI async handlers
globs: **/*.py,pyproject.toml
alwaysApply: false
---

# Python 3.12 + uv + FastAPI Production Standards

- Manage dependencies exclusively via `pyproject.toml` and `uv.lock` (`uv add`, `uv run`); never invoke global `pip install` without version pins.
- Define all FastAPI request/response and MCP tool payloads with Pydantic v2 `BaseModel` (`model_config = ConfigDict(extra='forbid')`).
- Never call blocking `requests.*`, `time.sleep()`, or synchronous subprocesses inside `async def` endpoints; use `httpx.AsyncClient(timeout=10.0)`.
- Reuse a shared `httpx.AsyncClient` and database pool inside FastAPI `lifespan` context managers to prevent socket exhaustion.
- Format and lint all Python modules cleanly with `ruff check --fix` and `ruff format` before committing.

## Verification Check
```bash
uv run ruff check . && uv run pytest -q
```

社区设置说明和制作评论 (0)

还没有社区笔记。下面分享您的生产配置技巧。

发布设置注释或验证提示

公开的 MCP 工具和资源架构检查器

工具/资源标识符输入参数执行行为
uv_reproducible_lockfilepyproject.toml, uv.lockMandates uv run / uv sync --frozen and forbids unpinned global pip installs.