Cursor rule
.cursor/rules/10-hermes-api.mdcCursor rules
Quality
100/100
Scores the file, not the repository.Length
457 words
16 headings · 2 code blocksRepository
45
— · pushed 2 days agoLast changed
3 days ago
First indexed 3 days ago.123456# Hermes API - Python/FastAPI Rules78## Python Version9- Target Python 3.11+10- Use modern Python features (match/case, type hints, etc.)1112## Code Style1314### Formatting (Black)15- Line length: 88 characters (configured in `pyproject.toml`)16- Let Black handle formatting automatically17- Run: `black .` before committing1819### Import Ordering (isort)20- Profile: black (configured in `pyproject.toml`)21- Order: standard library, third-party, local imports22- Run: `isort .` before committing2324### Type Hints (mypy)25- All functions must have type hints for parameters and return values26- Use `typing` module for complex types27- Comply with mypy strict mode settings in `pyproject.toml`28- Run: `mypy app` to check types2930## FastAPI Patterns3132### Async/Await33- Use `async def` for all endpoint handlers34- Use `await` for database operations and external API calls35- Import `AsyncSession` for database operations3637### Dependencies38- Use FastAPI's dependency injection system39- Define dependencies in `app/api/dependencies.py`40- Common dependencies:41 - `get_database_session()` - Database session42 - `get_current_user_from_token()` - Authenticated user43 - `get_current_user_optional()` - Optional authentication4445### Error Handling46- Use `HTTPException` for API errors47- Include appropriate status codes from `fastapi.status`48- Provide clear error messages in `detail` field49- Log errors using structured logging5051### Request/Response Models52- Define Pydantic models in `app/models/pydantic/`53- Use type validation and serialization54- Include field descriptions for API documentation55- Separate request models from response models5657## Project Structure5859```60app/61├── api/ # API routes and endpoints62│ ├── dependencies.py63│ └── v1/64│ ├── endpoints/ # Individual endpoint files65│ └── router.py # Route registration66├── core/ # Core configuration67│ ├── config.py # Settings and configuration68│ ├── logging.py # Logging setup69│ └── security.py # Auth/security utilities70├── db/ # Database layer71│ ├── base.py # Base model72│ ├── models.py # SQLAlchemy models73│ ├── repositories.py # Repository pattern74│ └── session.py # DB session management75├── models/ # Data models76│ └── pydantic/ # Pydantic models77├── services/ # Business logic78├── tasks/ # Celery tasks79└── utils/ # Utility functions80```8182## Logging8384Use structured logging via `structlog`:85```python86from app.core.logging import get_logger8788logger = get_logger(__name__)89logger.info("Operation completed", user_id=user_id, action="download")90logger.error("Operation failed", error=str(e), error_type=type(e).__name__)91```9293## Configuration9495- Use `pydantic-settings` for configuration management96- Access settings via `app.core.config.settings`97- Environment variables override default values98- Never hardcode configuration values99100## Testing101102- Write tests in `tests/` directory103- Use pytest with async support (`pytest-asyncio`)104- Follow naming: `test_*.py` for files, `test_*` for functions105- Use markers: `@pytest.mark.unit`, `@pytest.mark.integration`, `@pytest.mark.slow`106- Run: `pytest` or `python -m pytest`107108## Dependencies109110Manage dependencies with UV (following `pyproject.toml`):111- Production dependencies in `[project.dependencies]`112- Development dependencies in `[dependency-groups.dev]`113- Pin versions for stability114- Run: `uv pip compile` to update `uv.lock`115
Also in TechSquidTV/Hermes
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/00-project.mdc · 45 | Cursor rules | setuplint-formatstylearch+4 | 89/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-app.mdc · 45 | Cursor rules | lint-formatstylearchtypes+5 | 88/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-api.mdc · 45 | Cursor rules | stylearchdependenciesapi+2 | 77/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-db.mdc · 45 | Cursor rules | teststylearchtesting-strategy+3 | 73/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-app-components.mdc · 45 | Cursor rules | archtypesuiperformance+1 | 65/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-app-hooks.mdc · 45 | Cursor rules | lint-formatstylearchtypes+3 | 73/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-app-routes.mdc · 45 | Cursor rules | archapiuido-not | 65/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/30-docker.mdc · 45 | Cursor rules | setupbuildstylesecurity+4 | 84/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/30-docs.mdc · 45 | Cursor rules | setuplint-formatstylearch+3 | 81/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/30-tests.mdc · 45 | Cursor rules | buildteststylearch+4 | 85/100 | 3 days ago |
Diff against .cursor/rules/00-project.mdc Diff against .cursor/rules/10-hermes-app.mdc Diff against .cursor/rules/20-hermes-api-api.mdc Diff against .cursor/rules/20-hermes-api-db.mdc Diff against .cursor/rules/20-hermes-api-tests.mdc Diff against .cursor/rules/20-hermes-app-components.mdc Diff against .cursor/rules/20-hermes-app-hooks.mdc Diff against .cursor/rules/20-hermes-app-routes.mdc Diff against .cursor/rules/30-docker.mdc Diff against .cursor/rules/30-docs.mdc Diff against .cursor/rules/30-tests.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4k | Cursor rules | teststylearchtypes+2 | 96/100 | 3 days ago |
