Agent Upstart

Cool things people are building with agents. Five links a day, one line each.

Playbooks · Coding agents

Add tests to an untested module with an agent

A solo builder adds the first tests to a module that has none, starting with the behaviour that already exists — not the behaviour they wish it had.

Audience: Solo builder · Stack: A Python module with no tests, in a project with a test runner already set up · Tool: GitHub Copilot Chat in VS Code, slash command /tests

Before you start

Steps

  1. Pick one module, and within it one function that matters most — the one whose breakage would hurt first. Do not ask for tests for the whole module at once.
  2. Select that function in the editor and run /tests in Copilot Chat. The author docs describe this command as creating a unit test for the current code selection. If your project uses a particular test framework, say so in the same prompt, using the framework's name as your project already uses it.
  3. Read every generated test before running it. For each test, ask: does this assert something the code actually does, or something that sounds plausible? Delete or correct any test you cannot trace to the code.
  4. Run the new tests. Every test should pass on the unchanged module. A test that fails on unchanged code is either wrong or has found a real bug — find out which before continuing, and do not quietly edit the module to make a wrong test pass.
  5. Add one edge case yourself, by hand: an empty input, a zero, a missing value — whichever edge the module actually faces. Generated tests tend to cover the middle of the road; edges are where untested modules break.
  6. Repeat for the next function, one at a time, running the growing suite after each addition. Commit after each function, so a bad batch of tests is one commit to revert, not a pile to untangle.
  7. When the module has a suite that passes, change one line of the module deliberately, run the suite, and confirm a test fails. Then revert. This is the check that the suite actually guards anything.

Worked example

A solo builder has a Python module that formats invoice totals, with no tests. They select the function that computes a line total, run /tests, and get five tests. Reading them, they find one test asserting that a negative quantity raises an error — but the code happily multiplies it. That test is deleted, not “fixed” by changing the module, because the session's rule is current behaviour first. They add one hand-written edge case for quantity zero, run the suite, commit, and then deliberately change the rounding line to confirm a test fails before reverting. The suite now guards the module, and the negative-quantity question is recorded as a separate decision, not smuggled in as a test.

What can go wrong

Limits

Time and cost: NOT_MEASURED. This page gives no time or cost figure because the tool docs fetched for it state none that applies to this task.

Verification

Tier: AUTHOR_DOCS_VERIFIED · verified 2026-10-23. The workflow on this page was not run end to end in a sandbox for this page; every command, flag, and capability claim below was checked against an author doc or author repo fetched on 2026-10-23.

Cut from this page, with reason:

If a step here does not match what your installed tool shows, trust the tool's own docs for your version and stop before approving a change you cannot read.

Back to: Coding playbooks hub (../../guides/coding/) · Skills index (../../skills/)