Repository navigation
feat: add templates for working with AI agents #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
28a73ad
docs: add AGENTS.md
gemmadanks ae1a4e4
feat: add templates for working with AI agents
gemmadanks c74eedc
Merge branch 'main' into docs-add-agents-file
gemmadanks 2906a87
docs: include workflows in package rename checklist
Copilot 56780f9
fix: update smoke test
gemmadanks e4b7e3e
fix: update smoke test
gemmadanks eca6f76
fix: edit imports in smoke test
gemmadanks 4d88343
fix: fix smoke test
gemmadanks 0862d43
fix: fix smoke test
gemmadanks 566403c
fix: fix smoke test
gemmadanks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| # AGENTS.md | ||
|
|
||
| This file applies to the entire repository. It is guidance for coding agents | ||
| working on this Python project template. | ||
|
|
||
| ## Repository overview | ||
|
|
||
| - The distributable package uses a `src` layout and lives in | ||
| `src/package_name/`. | ||
| - Unit tests live in `tests/unit/`; shared fixtures belong in | ||
| `tests/conftest.py`. | ||
| - Documentation is built with MkDocs Material from `docs/`. | ||
| - Example notebooks live in `notebooks/`. | ||
| - Dependencies and environments are managed with `uv`; common tasks are | ||
| exposed through the root `justfile`. | ||
| - Python 3.11 and newer are supported. `.python-version` selects Python 3.14 | ||
| for the default development environment. | ||
|
|
||
| This is a reusable template. Keep examples and configuration generic unless a | ||
| task explicitly asks to customize the template for a specific project. | ||
|
|
||
| ## Working principles | ||
|
|
||
| - Make the smallest coherent change that satisfies the task. | ||
| - Preserve unrelated work in the working tree. Inspect `git diff` before and | ||
| after editing, and do not revert changes you did not make. | ||
| - Follow the existing structure and naming conventions instead of introducing | ||
| a second tool or parallel configuration. | ||
| - Add or update tests when behavior changes. Update user-facing documentation | ||
| when public APIs, setup steps, or workflows change. | ||
| - Use the lightest planning level in `PLAN.md`: routine work needs no plan file, | ||
| while durable task plans are copied into `plans/`. | ||
| - Use one writing agent by default. Delegate only independent, bounded work; | ||
| prefer parallel agents for read-heavy exploration, testing, or review. Give | ||
| parallel writers separate worktrees and non-overlapping ownership. | ||
| - Review meaningful changes against `CODE_REVIEW.md` before handoff. | ||
| - Record architecturally significant decisions with an ADR based on | ||
| `docs/architecture/adr/template.md`. | ||
|
|
||
| ## Setup and commands | ||
|
|
||
| Install the complete development environment with: | ||
|
|
||
| ```bash | ||
| uv sync --all-groups | ||
| ``` | ||
|
|
||
| Prefer the `just` recipes because they document the intended local workflow: | ||
|
|
||
| ```bash | ||
| just test # quick tests, excluding tests marked slow | ||
| just test-vv # verbose quick tests | ||
| just coverage # full pytest run with terminal coverage | ||
| just test-notebooks # execute notebooks through nbmake | ||
| just lint # Ruff checks | ||
| just format # Ruff formatting | ||
| just format-check # verify formatting without changing files | ||
| just type-check # Pyright | ||
| just check # fast, non-mutating handoff checks | ||
| just docs-build # strict MkDocs build | ||
| just build # build wheel and source distribution | ||
| just package-smoke-test # install and import the built wheel in isolation | ||
| just ci # comprehensive local CI equivalent | ||
| just pre-commit # all push-stage hooks | ||
| ``` | ||
|
gemmadanks marked this conversation as resolved.
Resolved
|
||
|
|
||
| For a focused test while iterating, run pytest through `uv`, for example: | ||
|
|
||
| ```bash | ||
| uv run pytest -q tests/unit/test_greet.py | ||
| uv run pytest -q tests/unit/test_greet.py::test_say_hello | ||
| ``` | ||
|
|
||
| Do not invoke tools from an unrelated global Python environment. If `just` is | ||
| not installed, run the corresponding `uv run ...` command from the `justfile`. | ||
|
|
||
| ## Python code conventions | ||
|
|
||
| - Put production code under `src/package_name/`, not at the repository root. | ||
| - Use absolute imports from `package_name` in tests and consumer examples. | ||
| - Use four spaces, UTF-8, LF line endings, and a final newline, as configured in | ||
| `.editorconfig`. | ||
| - Let Ruff determine formatting. Do not hand-format code against Ruff's output. | ||
| - Add type annotations to new or changed functions. Keep code compatible with | ||
| every supported Python version (3.11 through 3.14), not only the version in | ||
| `.python-version`. | ||
| - Follow the existing Google-style docstrings for public modules and functions. | ||
| Examples in Python docstrings must be valid doctests because the quick test | ||
| recipes collect doctests from `*.py` files. | ||
| - Keep the package importable after changes. Export names from | ||
| `src/package_name/__init__.py` only when they are intentionally part of the | ||
| top-level public API. | ||
|
|
||
| ## Tests | ||
|
|
||
| - Place unit tests in `tests/unit/` and name files `test_*.py`. | ||
| - Use pytest idioms, including parametrization for compact input/output cases | ||
| and fixtures in `tests/conftest.py` when they are shared. | ||
| - Test observable behavior rather than implementation details. | ||
| - Cover normal behavior and relevant edge or failure cases introduced by a | ||
| change. Keep tests deterministic and independent of execution order. | ||
| - Run the narrowest relevant test during development, then run `just test` for | ||
| code changes. Use `just coverage` when the change has broader impact. | ||
| - CI runs the full test suite on Linux, macOS, and Windows with Python | ||
| 3.11-3.14. Avoid platform-specific paths, shell assumptions, and timing-based | ||
| assertions in Python code and tests. | ||
|
|
||
| ## Dependencies and lockfiles | ||
|
|
||
| - Declare runtime and development dependencies in `pyproject.toml`; do not add | ||
| `requirements.txt`, Poetry, or another environment manager. | ||
| - Use `uv add <package>` for runtime dependencies, `uv add --dev <package>` for | ||
| development dependencies, and `uv add --group docs <package>` for docs-only | ||
| dependencies. | ||
| - Commit the resulting `pyproject.toml` and `uv.lock` changes together. | ||
| - Use `uv lock` after a manual metadata change and `uv lock --upgrade` only when | ||
| an upgrade is intended. Do not casually regenerate or broadly upgrade the | ||
| lockfile for an unrelated task. | ||
|
|
||
| ## Documentation and notebooks | ||
|
|
||
| - Keep documentation within the existing Diataxis sections: `tutorials/`, | ||
| `how-to/`, `reference/`, and `explanation/`. | ||
| - Add new pages to `mkdocs.yml` when they should appear in navigation. | ||
| - Build docs with `just docs-build`; the build is strict and warnings fail CI. | ||
| - Keep API reference paths aligned with importable modules under | ||
| `src/package_name/`. | ||
| - Notebook outputs are stripped by pre-commit. After changing a notebook, run | ||
| `just test-notebooks` and do not commit execution output or local kernel | ||
| metadata. | ||
| - `site/`, `dist/`, and `build/` are generated artifacts and must not be | ||
| committed. | ||
|
|
||
| ## Releases and commits | ||
|
|
||
| - Use Conventional Commit subjects such as `feat:`, `fix:`, `docs:`, `test:`, | ||
| `refactor:`, `build:`, and `ci:` when asked to create commits. | ||
| - Release Please manages version bumps, release notes, and release metadata. | ||
| Do not manually edit `CHANGELOG.md`, `.release-please-manifest.json`, or | ||
| release version fields in `pyproject.toml`, `CITATION.cff`, and `uv.lock` | ||
| unless the task is specifically about a release. | ||
| - Never commit secrets, local virtual environments, caches, coverage output, or | ||
| generated documentation. | ||
|
|
||
| ## Validation before handoff | ||
|
|
||
| Choose checks proportional to the change. For a typical Python change, run the | ||
| non-mutating handoff suite: | ||
|
|
||
| ```bash | ||
| just check | ||
| ``` | ||
|
|
||
| Also run `just docs-build` for documentation or public API changes, | ||
| `just test-notebooks` for notebook changes, and `just package-smoke-test` for | ||
| packaging changes. Use `just ci` before handing off a broad or high-risk change. | ||
| Review the final diff using `CODE_REVIEW.md`, report which checks ran, and | ||
| clearly identify any check that could not be run. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Code Review Guide | ||
|
|
||
| Use this guide for human or agent review of uncommitted changes, commits, and | ||
| pull requests. Establish the intended outcome from the request, issue, or work | ||
| plan before judging the implementation. | ||
|
|
||
| ## Review priorities | ||
|
|
||
| Review in this order: | ||
|
|
||
| 1. Correctness and regressions | ||
| 2. Security, privacy, and unsafe data handling | ||
| 3. Public API and supported-version compatibility | ||
| 4. Missing or misleading tests | ||
| 5. Packaging, documentation, and operational impact | ||
| 6. Maintainability that materially affects future changes | ||
|
|
||
| Do not spend review attention on formatting that Ruff or another configured | ||
| tool handles automatically. | ||
|
|
||
| ## Review method | ||
|
|
||
| 1. Read the complete diff and inspect relevant surrounding code, not only the | ||
| changed lines. | ||
| 2. Trace important inputs, outputs, error paths, and platform-dependent paths. | ||
| 3. Compare behavior with tests, documentation, and public API promises. | ||
| 4. Run the narrowest command that can confirm or refute a suspected problem. | ||
| 5. Check that generated files, lockfiles, and release-managed files changed only | ||
| when the task requires them. | ||
| 6. Finish with `just check` when proportional to the change, plus the additional | ||
| commands required by `AGENTS.md`. | ||
|
|
||
| ## Finding quality | ||
|
|
||
| Report only actionable findings caused by the change. Each finding should | ||
| include: | ||
|
|
||
| - **Priority:** `P0` critical, `P1` high, `P2` normal, or `P3` low | ||
| - **Location:** the smallest useful file and line range | ||
| - **Impact:** the concrete failure or risk and who or what it affects | ||
| - **Evidence:** the execution path, reproduction, test, or repository fact that | ||
| supports the finding | ||
| - **Remediation:** a concise direction when the fix is not obvious | ||
|
|
||
| Avoid vague warnings, speculative failures without a reachable path, and style | ||
| preferences not enforced by the repository. Group findings that share one root | ||
| cause. | ||
|
|
||
| ## Review output | ||
|
|
||
| Present findings first, ordered by priority. Then state: | ||
|
|
||
| - assumptions or questions that limit confidence; | ||
| - checks run and their results; | ||
| - residual risks or coverage gaps. | ||
|
|
||
| If there are no findings, say so explicitly and still report checks and | ||
| remaining test or review gaps. A clean review means no actionable issue was | ||
| found; it does not claim the change is risk-free. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.