# Quality rules Codex MUST write clean, minimal, maintainable code. ## General rules Codex MUST: - prefer simple solutions; - avoid over-engineering; - avoid unnecessary abstractions; - avoid introducing dependencies unless justified; - keep functions and modules focused; - use clear names; - write comments in English only when they add value; - preserve existing style unless it conflicts with explicit project rules; - keep changes scoped to the requested task; - avoid broad rewrites unless explicitly requested. ## Pragmatic TDD Codex MUST use pragmatic TDD: - bugfix: write or update a test that reproduces the bug before fixing it, when practical; - feature: write tests for expected behavior before implementation, when practical; - refactor: rely on existing tests and add missing coverage where needed; - documentation-only changes: tests may be unnecessary, but Codex must say so explicitly; - infrastructure changes: use syntax checks, dry runs, validation commands, or containerized smoke tests when applicable. ## Completion quality gate Before completing a task, Codex MUST verify: - tests were run inside Docker; - lint/format checks were run if configured; - no unrelated changes were introduced; - no secrets were introduced; - docs and ADRs were updated if needed; - the final commit uses Conventional Commits.