Code Style¶
Python¶
- Target: Python 3.12+
- Linter/formatter: ruff
- Line length: 100 characters
Early returns¶
Always use early returns. No nested conditionals, no single-line else:
# Good
async def process(self, signal: Signal) -> Response | None:
if not self.is_running:
return None
if signal.priority < self.threshold:
return None
return await self.handle(signal)
Modern syntax¶
X | NonenotOptional[X]matchstatements where appropriate- f-strings over
.format()
No magic numbers¶
All timing values, thresholds, and counts come from config with sensible defaults. No hardcoded numbers in business logic.
Architecture rules¶
- Domain services import from
ports/only, never fromadapters/ - No ORM — raw SQL with asyncpg
- Dynamic adapter pattern for new adapters (class path in YAML config)
- No custom auth/token layers — delegate to OIDC
Formatting¶
TypeScript (Web UI)¶
- Linter: ESLint
- Formatter: Prettier
- Styles: CSS Modules only (no inline styles, no Tailwind, no CSS-in-JS)
- Design tokens: CSS custom properties from
styles/tokens.css