Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 3.94 KB

AGENTS.md

File metadata and controls

42 lines (32 loc) · 3.94 KB

Workflow

  1. Run make lint and make test after adding a feature or fixing a bug.
  2. Use uv run for tests and CLI commands (e.g., uv run pytest, uv run chap).
  3. Be concise. Only add code related to the task; skip nice-to-have extras.
  4. If the prompt is unclear, ask follow-up questions until you are confident you can solve the problem.

Git and pull requests

  1. Use Conventional Commits for commit messages and PR titles.
  2. Name branches after the commit prefix: feat/, fix/, docs/, refactor/, etc.
  3. No attribution lines in commits or PRs (no Co-Authored-By, no Generated by).
  4. No emojis in commit messages, PR descriptions or code comments.
  5. A PR that only adds a design document does not use docs: in its title.
  6. Open pull requests as drafts (gh pr create --draft) unless told otherwise. Mark a PR ready for review only when asked to.
  7. PR descriptions follow .github/PULL_REQUEST_TEMPLATE.md and must include a Review needed: line with quick-merge, check: <what> or full. CI fails PRs without it. Ask the user which one applies if it is not clear.
  8. PR reviews follow docs/contributor/pr_review.md. When asked to review a PR, use the pr-review skill.
  9. When creating Jira issues, always set at least one component and at least one ch-obj-* objective label (see the jira command in .claude/commands/jira.md).

Tests

  1. Add a test for every new feature or fix. When changing code that has no relevant tests, consider adding a simple one.
  2. Never access private fields or methods (starting with an underscore), in tests or elsewhere.
  3. Use existing fixtures from conftest.py files instead of creating test data inline. Only add a new fixture to conftest.py for edge cases the existing ones do not cover.

Codebase rules

  1. When adding or removing a @backtest_plot(...) registration under chap_core/assessment/backtest_plots/, run make regen-plot-help and commit the regenerated chap_core/cli_endpoints/generated_plot_ids.py. The tests/test_generated_plot_ids.py lock-in test fails otherwise.
  2. chap_core/__init__.py exposes data, fetch, ModelTemplateInterface and is_debug_mode lazily via PEP 562 __getattr__ to keep CLI startup fast. Register a new public re-export at the package root in the lazy table (_LAZY_SUBMODULES or _LAZY_FROM) rather than as an eager top-level import, and also import it under if TYPE_CHECKING: so static type checkers still see it.
  3. Built-in models under chap_core/models/builtin/ are versioned through BuiltinModelSpec.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.
  4. 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-review plugin 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.
  5. The team's terminology has one source: terminology.yaml in dhis2-chap/user-stories. chap_core/terminology/terminology.yaml is a synced copy that /v1/terminology serves. Never edit it by hand: the sync-terminology workflow updates it with scripts/sync_terminology.py. Change a term with a pull request to dhis2-chap/user-stories.

Contributor docs

Read the relevant guide under docs/contributor/ before working in that area:

  • code_overview.md: architecture and where code lives
  • testing.md: how tests are organised, run and filtered in CI
  • database_migrations.md: changing database models and Alembic migrations
  • adding_cli_commands.md: adding a chap subcommand
  • writing_building_documentation.md: writing and building the docs (see also docs/AGENTS.md)