{"slug":"write-tests-3","title":"write-tests","summary":"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.","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-10-19T20:29:04.570023Z","repo":{"url":"https://github.com/polyai/adk","stars":83,"forks":20,"license":"Apache-2.0","updatedAt":"2026-10-19T14:31:01Z"},"bodyHtml":"<hr>\n<h2>name: write-tests\ndescription: 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.\nmetadata:\ninternal: true</h2>\n<h1>Write tests for an ADK change</h1>\n<h2>1. Measure first</h2>\n<p>Run <code>uv run pytest src/poly/tests/ --cov=poly --cov-report=term-missing</code> and note the coverage\nof each module the change touches.</p>\n<h2>2. Write the tests</h2>\n<ul>\n<li><p><strong>Placement:</strong> add to the existing file and class for the area:</p>\n<ul>\n<li><code>resources_test.py</code> for resources</li>\n<li><code>project_test.py</code> for project logic</li>\n<li><code>cli_test.py</code> for argument parsing and command output</li>\n<li><code>tests/api/</code> for handlers</li>\n<li><code>tests/call/</code> for voice calls</li>\n<li>The <code>*_test.py</code> file named after the feature (<code>metrics_test.py</code>, <code>rtc_test.py</code>, …)</li>\n</ul>\n<p>Only create a new file or class when nothing fits.</p>\n</li>\n<li><p><strong>Fixtures:</strong> use real objects and the fixture projects in <code>src/poly/tests/test_projects/</code>.\nWhen a resource gains a field or a new resource type is added, add an example to\n<code>test_projects/test_project/</code> as well.</p>\n</li>\n<li><p><strong>Mocks:</strong> mock only at the API or filesystem boundary, one <code>@patch</code> per test where possible.\nDon't assert that a mock was called when you could assert on the result.</p>\n</li>\n<li><p><strong>Style:</strong> <code>unittest.TestCase</code> classes. Names read as <code>test_&lt;scenario&gt;_&lt;expected_outcome&gt;</code>,\nwith one behaviour per test and a short docstring.</p>\n</li>\n<li><p><strong>Cover:</strong> the happy path, edge cases (empty, <code>None</code>, missing fields), errors (<code>ValueError</code> for\nbad input), and a YAML round-trip (<code>to_yaml_dict</code> → <code>from_yaml_dict</code>) for resources.</p>\n</li>\n<li><p>Never test generated code under <code>handlers/protobuf/</code> or <code>types/</code>.</p>\n</li>\n</ul>\n<h2>3. Measure again</h2>\n<p>Re-run the coverage command and the full suite. Then run <code>uv run ruff check . --fix</code> and\n<code>uv run ruff format .</code>.</p>\n<h2>Report</h2>\n<p>The tests you added (file and class), and the before → after coverage for each touched module.\nIf coverage dropped, say which lines are uncovered and why.</p>\n","files":[{"path":"SKILL.md","sizeBytes":1987,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-10-19T20:29:24.230818Z","sha256":"6402BE183F133216B1A2215BAD669916346C3BF18B456BD5FEDC33EF84A29A5C","sizeBytes":1137},"review":null,"source":{"repositoryUrl":"https://github.com/polyai/adk","path":".claude/skills/write-tests","license":"Apache-2.0","commit":"f615d0fa167805d1e5ecc04560cd6fdf73924aad","subtreeSha":"1F6746DED56352DB50CB42FA4DA372C498D52A890C8723115744D2997E5B0F70","lastSyncedAt":"2026-10-19T20:29:00.12477Z"},"reviewedAt":"2026-10-19T20:29:58.619447Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/polyai/adk/tree/main/.claude/skills/write-tests"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install polyai-adk@llmmart"},{"target":"git","command":"git clone https://github.com/polyai/adk.git"}]}