Declarative .mdcQuy tắc Cursor/Claude/Windsurf & quy trình làm việc n8nQuy tắc IDEĐã kiểm tra rò rỉ bí mật

Python 3.12 + Astral uv + FastAPI Quy tắc dịch vụ đại lý không đồng bộ

Quy tắc Con trỏ khai báo/Claude/Windsurf tiêu chuẩn hóa các môi trường có thể tái tạo uv.lock, Ruff lint, mô hình nghiêm ngặt Pydantic v2 và thời gian chờ httpx bị giới hạn.

Tệp quy tắc IDE & Tác nhân khai báo

---
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
```

Ghi chú Thiết lập Cộng đồng & Đánh giá Sản xuất (0)

Chưa có ghi chú cộng đồng nào. Chia sẻ mẹo cấu hình sản xuất của bạn bên dưới.

Đăng ghi chú thiết lập hoặc mẹo xác minh

Trình kiểm tra lược đồ tài nguyên và công cụ MCP

Mã định danh công cụ/tài nguyênThông số đầu vàoHành vi thực thi
uv_reproducible_lockfilepyproject.toml, uv.lockMandates uv run / uv sync --frozen and forbids unpinned global pip installs.