Lab: Your First Quality Feature
Why This Matters
This lab puts module 3 together in one realistic flow. You take a feature from brief to merged pull request with tests, review and quality gates, and every check is green from the first commit.
The brief
As a tester I want to see the pass rate of each test over its last 20 runs, so I can tell a flaky test from a broken one. Acceptance: pass rate with one decimal in a new column; “n/a” when a test has fewer than 3 runs; sortable column.
Use this brief on TestRun Board, or write an equivalent one for your own project.
The result in the example project, sorted by pass rate (solution branch solution/lesson-16-pass-rate-column):
The flow
1. Plan (plan mode). Ask for a plan that includes the tests and names the files. Answer open questions. Check the order: logic and tests before UI.
2. Tests first. Let the agent write unit tests for the pass-rate calculation, including the “fewer than 3 runs” case and a rounding case. Confirm they fail for the right reason.
3. Implement. Minimal code to green, no test changes. The PostToolUse lint hook from lesson 15, Rules versus Hooks runs on every edit.
4. UI and end-to-end. Add the column and let the agent verify it in the browser with Playwright MCP, then codify one e2e test.
5. Independent review. Ask the test-reviewer subagent to review the test changes. If you installed Superpowers, use its review skill as well.
6. Gates. npm run check locally, then push the branch and open a pull request. CI runs the same gates.
Self-assessment
Before you merge, answer honestly:
- Did every test fail before the implementation existed?
- Did any test change between red and green? If yes, is the reason written in the PR?
- Does
git diff --statcontain only files that belong to this feature? - Would a test fail if pass rate were rounded wrongly? (Break it and check.)
- Can a reviewer understand the PR in under 15 minutes?
Common problems in this lab
- The agent adds the column before the tests. Stop it and go back to step 2; the order is the lesson.
- Flaky e2e test. Usually a missing wait on data loading; ask the agent to wait for the table row instead of adding a timeout.
- Hook too slow. Lint only the changed file instead of the whole project.
Walkthrough in TestRun Board
Do the lab on docs/specs/pass-rate-column.md, starting from your lesson 13, Test-First with an Agent (TDD) branch (or solution/lesson-13-pass-rate-tdd):
- Plan mode with the spec; answer the open question about the history endpoint.
- Contract first: the agent should use the add-api-endpoint skill. Check
npm run generate:apiupdatedsrc/generated/api-types.tsand thatscripts/agent-policy.sh mainreports generated types match docs/api.yaml. - Tests first for sorting: lowest first, highest first, n/a always last, input not mutated.
- Column and sorting in the UI; verify with Playwright MCP; codify in
tests/e2e/. - Gates:
npm run check,npm run mutation:changed -- main(the worked solution scores about 93% on the changed files) andbash scripts/agent-policy.sh main. - Open a pull request and watch all four CI jobs run.
Then compare with solution/lesson-16-pass-rate-column and its notes in docs/solutions/lesson-16-pass-rate-column.md, including the decision to show “n/a” when the history call fails.
Key Takeaways
- Plan, test first, implement, verify in the browser, review independently, gate.
- Each step has a check you can see; nothing depends on trust alone.
- A small, focused PR with green gates is the goal, not the most code per hour.

