- Run
make lintandmake testafter adding a feature or fixing a bug. - Use
uv runfor tests and CLI commands (e.g.,uv run pytest,uv run chap). - Be concise. Only add code related to the task; skip nice-to-have extras.
- If the prompt is unclear, ask follow-up questions until you are confident you can solve the problem.
- Use Conventional Commits for commit messages and PR titles.
- Name branches after the commit prefix:
feat/,fix/,docs/,refactor/, etc. - No attribution lines in commits or PRs (no
Co-Authored-By, noGenerated by). - No emojis in commit messages, PR descriptions or code comments.
- A PR that only adds a design document does not use
docs:in its title. - Open pull requests as drafts (
gh pr create --draft) unless told otherwise. Mark a PR ready for review only when asked to. - PR descriptions follow
.github/PULL_REQUEST_TEMPLATE.mdand must include aReview needed:line withquick-merge,check: <what>orfull. CI fails PRs without it. Ask the user which one applies if it is not clear. - PR reviews follow
docs/contributor/pr_review.md. When asked to review a PR, use thepr-reviewskill. - When creating Jira issues, always set at least one component and at least one
ch-obj-*objective label (see thejiracommand in.claude/commands/jira.md).
- Add a test for every new feature or fix. When changing code that has no relevant tests, consider adding a simple one.
- Never access private fields or methods (starting with an underscore), in tests or elsewhere.
- Use existing fixtures from
conftest.pyfiles instead of creating test data inline. Only add a new fixture toconftest.pyfor edge cases the existing ones do not cover.
- When adding or removing a
@backtest_plot(...)registration underchap_core/assessment/backtest_plots/, runmake regen-plot-helpand commit the regeneratedchap_core/cli_endpoints/generated_plot_ids.py. Thetests/test_generated_plot_ids.pylock-in test fails otherwise. chap_core/__init__.pyexposesdata,fetch,ModelTemplateInterfaceandis_debug_modelazily via PEP 562__getattr__to keep CLI startup fast. Register a new public re-export at the package root in the lazy table (_LAZY_SUBMODULESor_LAZY_FROM) rather than as an eager top-level import, and also import it underif TYPE_CHECKING:so static type checkers still see it.- Built-in models under
chap_core/models/builtin/are versioned throughBuiltinModelSpec.version. Any change to a built-in model's output or spec needs a new version, because stored template versions are write-once and backtests reference them. - User stories (who uses Chap and what they need to be able to do) live as YAML in dhis2-chap/user-stories, not in this repo. The
docs-reviewplugin in dhis2-chap/claude-plugins follows them through the docs. When a change moves or renames a doc page a story starts at, or changes a flow a story describes, update the story there in a separate PR. - The team's terminology has one source:
terminology.yamlin dhis2-chap/user-stories.chap_core/terminology/terminology.yamlis a synced copy that/v1/terminologyserves. Never edit it by hand: thesync-terminologyworkflow updates it withscripts/sync_terminology.py. Change a term with a pull request to dhis2-chap/user-stories.
Read the relevant guide under docs/contributor/ before working in that area:
code_overview.md: architecture and where code livestesting.md: how tests are organised, run and filtered in CIdatabase_migrations.md: changing database models and Alembic migrationsadding_cli_commands.md: adding achapsubcommandwriting_building_documentation.md: writing and building the docs (see alsodocs/AGENTS.md)