write-tests
Write readable tests for new or changed ADK code and show that coverage of the touched modules didn't drop. Use after implementing a feature or fix in the polyai-adk repo, or when asked to add test coverage.
Install
npx skills add https://github.com/polyai/adk/tree/main/.claude/skills/write-tests
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install polyai-adk@llmmart
git clone https://github.com/polyai/adk.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole polyai/adk collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Write tests for an ADK change
1. Measure first
Run uv run pytest src/poly/tests/ --cov=poly --cov-report=term-missing and note the coverage
of each module the change touches.
2. Write the tests
Placement: add to the existing file and class for the area:
resources_test.pyfor resourcesproject_test.pyfor project logiccli_test.pyfor argument parsing and command outputtests/api/for handlerstests/call/for voice calls- The
*_test.pyfile named after the feature (metrics_test.py,rtc_test.py, …)
Only create a new file or class when nothing fits.
Fixtures: use real objects and the fixture projects in
src/poly/tests/test_projects/. When a resource gains a field or a new resource type is added, add an example totest_projects/test_project/as well.Mocks: mock only at the API or filesystem boundary, one
@patchper test where possible. Don't assert that a mock was called when you could assert on the result.Style:
unittest.TestCaseclasses. Names read astest_<scenario>_<expected_outcome>, with one behaviour per test and a short docstring.Cover: the happy path, edge cases (empty,
None, missing fields), errors (ValueErrorfor bad input), and a YAML round-trip (to_yaml_dict→from_yaml_dict) for resources.Never test generated code under
handlers/protobuf/ortypes/.
3. Measure again
Re-run the coverage command and the full suite. Then run uv run ruff check . --fix and
uv run ruff format ..
Report
The tests you added (file and class), and the before → after coverage for each touched module. If coverage dropped, say which lines are uncovered and why.
Files (adk)
-
SKILL.md 1.9 KB
--- name: write-tests description: Write readable tests for new or changed ADK code and show that coverage of the touched modules didn't drop. Use after implementing a feature or fix in the polyai-adk repo, or when asked to add test coverage. metadata: internal: true --- # Write tests for an ADK change ## 1. Measure first Run `uv run pytest src/poly/tests/ --cov=poly --cov-report=term-missing` and note the coverage of each module the change touches. ## 2. Write the tests - **Placement:** add to the existing file and class for the area: - `resources_test.py` for resources - `project_test.py` for project logic - `cli_test.py` for argument parsing and command output - `tests/api/` for handlers - `tests/call/` for voice calls - The `*_test.py` file named after the feature (`metrics_test.py`, `rtc_test.py`, …) Only create a new file or class when nothing fits. - **Fixtures:** use real objects and the fixture projects in `src/poly/tests/test_projects/`. When a resource gains a field or a new resource type is added, add an example to `test_projects/test_project/` as well. - **Mocks:** mock only at the API or filesystem boundary, one `@patch` per test where possible. Don't assert that a mock was called when you could assert on the result. - **Style:** `unittest.TestCase` classes. Names read as `test_<scenario>_<expected_outcome>`, with one behaviour per test and a short docstring. - **Cover:** the happy path, edge cases (empty, `None`, missing fields), errors (`ValueError` for bad input), and a YAML round-trip (`to_yaml_dict` → `from_yaml_dict`) for resources. - Never test generated code under `handlers/protobuf/` or `types/`. ## 3. Measure again Re-run the coverage command and the full suite. Then run `uv run ruff check . --fix` and `uv run ruff format .`. ## Report The tests you added (file and class), and the before → after coverage for each touched module. If coverage dropped, say which lines are uncovered and why.
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.