diff --git a/.agents/skills/traust-core-patterns/SKILL.md b/.agents/skills/traust-core-patterns/SKILL.md index 913fa25c..dcd753ba 100644 --- a/.agents/skills/traust-core-patterns/SKILL.md +++ b/.agents/skills/traust-core-patterns/SKILL.md @@ -41,6 +41,21 @@ outside the process? → provider SQL rule several readers share? → a view in traust-contracts ``` +## Two defaults + +- **Convention over configuration.** Copy the worked example's shape (names, verbs, layout); don't add a setting or flag to choose between behaviours. Config is for what truly differs per deployment, read once in `Context`. +- **Fallbacks are a decision, not a default.** No silent `except: return default` or "if missing, use X". Missing or malformed input raises a typed `traust_core.v1.errors` error, logged once where handled. A fallback is fine only when the domain defines it as behaviour (a degraded outcome with a reason), and then it's explicit and tested. + +## Quality checklist (every PR) + +1. Comments only for a non-obvious *why*; nothing that restates the code. +2. Docstrings: one or two lines on public API where name and types don't say it; none on private helpers or tests. +3. Don't reinvent: search `src/` for an existing function first and extend it. +4. Generic logic used in more than one place is one helper where its kind lives (`models/values.py`, a provider, the owning repository). +5. Tests cover edges: empty, not found, re-runs, invalid values, boundaries, each typed error, rollback. +6. Integration tests run the real path on SQLite and Postgres with sanitized copies of real data under `tests/fixtures//` (people, hosts, org/repo names, tokens replaced). Never live systems. +7. Minimal code: shrink the diff (inline one-use helpers, merge near-duplicates, drop dead code and unused parameters). + ## No duplicated responsibility - One query, one place: the owning table's repository. Filtering rows in Python that SQL could filter → a named query. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b5434a2e..7381eb4b 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -12,4 +12,8 @@ - [ ] Duplicated responsibility touched by this change moved to its owner, copy deleted - [ ] Tests: behaviour on SQLite (+ Postgres for new queries) via `uow` / `seed` - [ ] Legacy code deleted only with a parity diff attached +- [ ] Comments only for non-obvious whys; docstrings one or two lines, none on private helpers +- [ ] No reinvented functions (searched `src/`); shared logic is one helper +- [ ] Tests cover edge cases; integration tests use sanitized copies of real data +- [ ] Diff is as small as it can be - [ ] `make lint-fix && make test` green