e6bfe7c946
- Add Chrome browser access to 6 visual agents (18 tools each) - Add Playwright access to 2 testing agents (22 tools each) - Add 4 MCP servers: Postgres Pro, Redis, Lighthouse, Docker (.mcp.json) - Add 3 new rules: testing.md, security.md, remotion-service.md - Add Context7 library references to all domain agents - Add CLI tool instructions per agent (curl, ffprobe, k6, semgrep, etc.) - Update team protocol with new capabilities column - Add orchestrator dispatch guidance for new agent capabilities - Init git repo tracking docs + Claude config only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.8 KiB
1.8 KiB
paths
| paths | |
|---|---|
|
Backend Module Rules
Module Structure (strict — do not deviate)
Every module contains exactly these files — no more, no subdirectories:
modules/<module>/
├── __init__.py
├── models.py # SQLAlchemy models
├── schemas.py # Pydantic DTOs (*Create, *Update, *Read)
├── repository.py # Database CRUD
├── service.py # Business logic + Dramatiq actors
└── router.py # FastAPI endpoints
When in doubt, put logic in service.py. Cross-cutting concerns go in infrastructure/, not in module subdirectories.
Repository Pattern
- One repository per model, accepts
AsyncSessionin constructor. - Filter soft-deleted records (
is_deleted) by default. - Methods should be atomic and focused.
Schemas
- Inherit from
cpv3.common.schemas.Schema(Pydantic withfrom_attributes=True). - Suffix names:
*Create,*Update,*Read. - Use
Literaltypes for enums with string values.
Models
- Inherit from
Base+BaseModelMixin(cpv3.db.base). - Use explicit column types, add indexes for frequently queried fields.
- Soft deletes via
is_deletedflag.
Endpoints
- Use dependency injection for DB session (
get_db), auth (get_current_user), and services. - Return typed response models. Use appropriate HTTP status codes.
Settings
- All config via
get_settings()fromcpv3.infrastructure.settings.py(cached with@lru_cache). - Never hardcode configuration values.
Style
- Python 3.11+,
from __future__ import annotationsfor forward references. - Line length: 100 characters (Ruff). Type hints on all function signatures.
- Async-first for I/O. Use
anyio.to_thread.run_syncfor CPU-bound work in async context. - Store error messages as module-level constants with
ERROR_prefix.