skills/test-planning/SKILL.md
Plans and creates test issues alongside implementation work using bd issue tracker. Activates at two points: (1) when creating an issue board from a spec/plan — classifies each issue by code layer and attaches the right testing strategy as a companion issue or AC gate, and (2) when closing an implementation issue — checks whether adequate test coverage was planned, improves existing test issues if needed. Use this skill PROACTIVELY whenever you see implementation issues being created without test coverage, when an epic is being broken into tasks, when closing/reviewing implementation work, or when the user asks about testing strategy for a set of issues. Also activate when you see bd create, bd children, bd close in a planning context.
npx skillsauth add jaggerxtrm/jaggers-agent-tools test-planningInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill ensures every implementation issue has appropriate test coverage planned — not as an afterthought, but wired into the issue board from the start. It does NOT write test code; it classifies what needs testing, picks the right strategy, and creates bd issues that another agent (or human) will implement.
When breaking a spec or plan into bd issues — typically during epic decomposition or bd create --parent sequences — scan each implementation issue and create companion test issues.
When an implementation issue is being closed (bd close), check whether:
If a test issue exists, review and improve it. If none exists, create one before or alongside closure.
Read the issue title, description, and any code paths mentioned to classify which architectural layer the work touches. This determines the testing strategy.
Code that transforms data, computes values, manages state, with no I/O. Examples:
Signals: "implement", "compute", "format", "parse", "validate", functions that take data and return data, no HTTP/DB/filesystem in the description.
Code that crosses a system boundary: HTTP clients, API routes, database queries, file I/O, message queues. Examples:
Signals: "endpoint", "API", "client", "route", "fetch", "query", URLs, ports, service names, request/response shapes mentioned.
Code that glues core + boundary together into user-facing features. Examples:
Signals: "command", "CLI", "subcommand", "mercury <verb>", user-facing behavior described, combines multiple components.
| Layer | Primary strategy | What to assert | Mock policy | |---|---|---|---| | Core | Unit + property tests | Input/output correctness, edge cases, invariants | No mocking needed — pure functions | | Boundary | Contract tests (live preferred) | Response schemas, field presence/types, status codes, param behavior | Live > contract > mock (see preference order below) | | Shell | Integration tests | Exit codes, output format validity, end-to-end wiring, error messages | Test the real thing via subprocess or function call |
| Situation | Strategy | When to pick it | |---|---|---| | Interface unclear/evolving | TDD | Spec is vague, requirements shifting — tests define the contract | | Contract known up front | Spec-first | API routes documented, response shapes defined — write schema assertions | | Parsers/transforms/invariants | Property-based | The function should hold for any valid input, not just examples | | Service/API boundaries | Contract testing | Testing the seam between systems — assert schemas, not implementations | | Legacy code being wrapped | Characterization tests | Capture current behavior before changing it | | Simple CRUD paths | Example-based | Straightforward input→output, a few examples suffice |
When services are accessible, prefer this order:
@pytest.mark.live.The rationale: mocks encode your assumptions about the system. If your assumptions were correct, you wouldn't need tests. Live tests validate reality.
Test issues are children of the same parent epic as the implementation issue. Name pattern:
Test: <what's being tested> — <strategy>
Examples:
When creating a test issue with bd create:
bd create "Test: <description>" \
-t task -p <same or +1 from impl issue> \
--parent <same parent epic> \
-l testing,<layer>,<phase> \
--deps "blocks:<next-phase-issue-id>" \
-d "<structured description>"
The description should contain:
Don't create one test issue per implementation issue — that's overhead. Batch by layer and phase:
Example: if a phase ships 4 CLI commands + 1 client change + 1 config change:
Test issues should gate the next phase of work. Use bd dependencies or document in the issue description:
This issue gates: .17 (analyze runner), .18 (spread), .19 (charts)
Do not start Phase 3 until these tests pass.
When an implementation issue is closed, check:
Does a test issue exist? Run bd children <parent> and look for test issues that reference this impl issue.
Is the test issue still accurate? Implementation often diverges from plan. Compare what was built (read the commit, check the code) against what the test issue specifies. Common drift:
Update if needed. Use bd update <test-issue-id> or bd comments add <test-issue-id> to add new assertions, remove obsolete ones, or note discovered quirks.
If no test issue exists, create one. Classify the layer, pick the strategy, write the assertions. This is the safety net for work that was done without planning tests upfront.
Given an epic with these children:
.10 Scaffold CLI project structure
.11 Implement logging system
.12 Implement config system
.13 Implement output formatting
.14 Implement async HTTP client
Create:
bd create "Test: P1 core — unit tests for config, log, session, output" \
-t task -p 1 --parent <epic> -l testing,core,phase-1 \
-d "Unit + property tests for pure domain logic...
Covers: .11, .12, .13
Strategy: unit tests (core layer, pure logic, no I/O)
..."
bd create "Test: P1 boundary — live contract tests for async client" \
-t task -p 1 --parent <epic> -l testing,boundary,phase-1 \
-d "Contract tests against live services...
Covers: .14
Strategy: contract tests, live-first (boundary layer, HTTP I/O)
..."
Agent closes .15 (data commands: rates, candles, stir, curve). Finds existing test issue .26. Reads .26 description, compares against what .15 actually built:
.15 added rates iorb subcommand not in original test plan → update .26 to include IORB assertion.15 discovered STIR implied rates are client-side computation → add property test: implied_rate == 100 - price for any valid price.26 with bd update or add a commentAgent closes a feature issue that was done ad-hoc. No test issue found. Agent:
Run this checklist at both trigger points (planning and closure review). Flag any anti-patterns in the test issue description before closing.
Detect: Test body calls functions/methods but has no assert, expect, or equivalent statement.
Fix: Add at least one meaningful assertion. If the goal is "doesn't throw", assert that explicitly — with pytest.raises(...) or expect(() => fn()).not.toThrow().
Detect: The assertion can only fail if the test framework itself is broken. E.g. assert result == result, expect(true).toBe(true), asserting a value against the same expression used to produce it.
Fix: Assert against a concrete expected value derived independently from the production code. If you can't state what the expected value is without running the code, the test has no falsifiable claim.
Detect: Tests share module-level variables, database rows, file state, or global config without reset between runs. Symptoms: tests pass individually but fail in suite order.
Fix: Use fixtures with setup/teardown (beforeEach/afterEach, pytest fixtures with function scope). Every test starts from a clean slate.
Detect: Mocks are patching classes or functions that live in the same module under test — not external services. The test validates that internal wiring was called, not that the observable outcome is correct. Fix: Only mock at system boundaries (HTTP clients, file I/O, external services). Test internal collaborators by letting them run. If they're hard to instantiate, extract the pure logic and test that directly.
Detect: Remove the core logic being tested and re-read the test — would it still pass? If yes, the test provides no protection. Common form: only testing the happy path of a function whose bug would only appear in error paths. Fix: Add at least one negative-path or edge-case assertion that would catch the most likely regression. Consult the implementation for obvious failure modes.
Test issues inherit priority from their implementation issues with bounded adjustment. The table below gives the deterministic mapping.
| Implementation risk | Test issue priority | Examples | |---|---|---| | Security / auth / protocol compat | P0 (equal) | Auth token validation, schema migration safety, API contract | | Regression-critical boundary path | P0–P1 (equal) | Client URL routing, CLI exit codes used by external tooling | | High-business-impact core logic | P1 (equal or +0) | Pricing computations, session state transitions | | Standard domain logic | P2 (+0 or +1) | Config merge, output formatters, parsers | | Low-risk internals / non-critical adapters | P3 (+1) | Helper utilities, optional UI formatting | | Polish / test debt cleanup | P4 | Improving existing test coverage, test naming |
Inheritance rule: start from the implementation issue's priority. Apply +1 if the test is covering a well-understood path with low regression risk. Never go lower than P2 for boundary or shell layer tests — integration tests are load-bearing.
Equal priority examples:
+1 priority examples:
Use these templates verbatim in test issue descriptions. Replace <...> placeholders.
Layer: core
Strategy: <unit | property-based | example-based>
Covers: <impl issue IDs>
Assertions required:
- [ ] Positive path: <expected output for valid input>
- [ ] Negative path: <expected error/output for invalid input>
- [ ] Edge cases explicitly enumerated: <list: empty input, zero, max boundary, ...>
- [ ] Invariants/properties included: <e.g. "result is always sorted", "output length == input length">
Fixture policy:
- [ ] No shared mutable state between tests
- [ ] Deterministic fixtures (no random, no time.now() without injection)
- [ ] Each test constructs its own input independently
Done when: all assertions above are implemented and passing in CI.
Layer: boundary
Strategy: <live-contract | recorded-fixture | mock (last resort)>
Covers: <impl issue IDs>
Assertions required:
- [ ] Schema/contract assertions: <field presence, types, required vs optional>
- [ ] Error codes and retry/fallback: <e.g. 404→empty list, 500→raises ServiceError>
- [ ] Drift-safe: assertions check field presence and types, not brittle internal structure
- [ ] Live-first policy documented: <live | recorded-fixture | mock — reason for choice>
Done when: contract assertions pass against live service (or recorded fixture if live unavailable).
Fallback documented in issue if live is not accessible.
Layer: shell
Strategy: integration (subprocess or function-level wiring test)
Covers: <impl issue IDs>
Assertions required:
- [ ] End-to-end observable outcomes: <what the user sees — output format, exit code>
- [ ] Failure-mode UX: <error messages, non-zero exit codes, stderr vs stdout>
- [ ] Cross-component wiring: <core + boundary are called and integrated correctly>
- [ ] At least one real-data scenario (not mocked) if service is accessible
Done when: integration tests run against real components (not mocked internals) and cover
both success and at least one failure path.
Do not frame test issues around coverage percentages. Frame them around critical paths and risk rationale.
Every test issue description must include a critical path map:
Critical paths covered:
- <path 1 and risk rationale>
- <path 2 and risk rationale>
Known deferred paths (with follow-up refs):
- <path not covered yet> → follow-up: <bd issue ID or "to be created">
Why: a 90% line-coverage number says nothing about whether the one path that processes payments is tested. A critical path map forces explicit reasoning about what matters and what was skipped.
What counts as a critical path:
What to do with deferred paths:
This skill is advisory. It recommends test strategy, creates test issues, and flags anti-patterns. It does not block code execution or enforce pass/fail decisions — that is the job of hooks and quality gates.
| Concern | Who owns it | How enforced | |---|---|---| | Test strategy selection (TDD vs contract vs unit) | This skill | Recommendation only | | Anti-pattern detection in test issues | This skill | Checklist in issue description | | Priority assignment | This skill | Heuristics table above | | DoD template in issue description | This skill | Template pasted into bd issue | | CI test pass/fail | quality-gates hook | PostToolUse hook blocks on test failures | | Test file lint/type correctness | quality-gates hook | ESLint + mypy on every edit | | Branch not mergeable without tests | Not enforced | Human review — no automated gate today | | Claiming work without test issue existing | Not enforced | Human judgment — skill creates test issue at closure if missing |
Example — advisory boundary in practice:
You are planning tests for .14 (async HTTP client). This skill:
It does NOT:
.14 from closing if the test issue isn't doneThe test issue is a tracked commitment, not a gate. Gating is opt-in via bd dep dependencies you set up during planning.
Epic: "Implement gitnexus MCP sync in xtrm install"
Children: .1 (MCP config writer), .2 (sync-on-install integration), .3 (CLI xtrm mcp command)
Classification:
.1 → boundary (writes to .mcp.json, file I/O).2 → shell (orchestrates install flow).3 → shell (CLI command)Test issues created:
bd create "Test: MCP config writer — contract tests for .mcp.json output" \
-t task -p 2 --parent <epic> \
-d "Layer: boundary
Strategy: example-based (file I/O, no external service)
Covers: .1
Assertions required:
- [ ] Positive path: valid servers config produces correct .mcp.json structure
- [ ] Negative path: invalid server entry raises validation error
- [ ] Edge cases: empty servers list, duplicate server names, existing .mcp.json is merged not overwritten
- [ ] Drift-safe: assert on field presence (name, command, args), not internal object identity
Critical paths covered:
- gitnexus server entry written with correct stdio transport — risk: wrong transport breaks MCP
- existing user entries preserved during merge — risk: data loss
Known deferred paths:
- test with malformed existing .mcp.json → follow-up: to be created (P3)
Done when: all assertions pass, no shared state between tests."
bd create "Test: xtrm install MCP sync + xtrm mcp CLI — integration tests" \
-t task -p 2 --parent <epic> \
-d "Layer: shell
Strategy: integration (subprocess)
Covers: .2, .3
Assertions required:
- [ ] End-to-end: xtrm install writes correct .mcp.json in temp project dir
- [ ] CLI: xtrm mcp list outputs expected server names
- [ ] Failure-mode: xtrm mcp add with duplicate name exits non-zero with clear error
- [ ] Cross-component: install flow calls MCP writer with correct config
Critical paths covered:
- full install → .mcp.json present and readable by Claude Code — risk: MCP servers not available
- CLI add + list roundtrip — risk: user cannot inspect installed servers
Known deferred paths:
- test with no write permission on project dir → follow-up: to be created (P4)
Done when: integration tests run against real file system in temp dir, no mocked internals."
Closing .22 (config merge logic). Existing test issue .31 was written before implementation.
What .22 actually built:
.xtrm.yaml (only .xtrm/config.json now)Updated test issue .31:
bd update xtrm-31 --notes "Scope updated after .22 completed:
+ Add test: env var takes precedence over file config (new precedence chain)
+ Add test: 'true'/'false' env vars coerced to bool correctly
+ Add test: 'TRUE', '1', '0' edge cases for bool coercion
+ Remove test: .xtrm.yaml loading (format removed in .22)
Anti-pattern check:
- [ ] tautological: none detected
- [ ] over-mocking: env injection via monkeypatch only, no internal mocking
- [ ] shared state: each test resets env via fixture
Critical paths covered:
- env > file > defaults chain — risk: wrong precedence silently overrides user config
- bool coercion — risk: 'false' string treated as truthy in Python
Known deferred paths:
- test with missing HOME dir (pathlib resolution edge case) → follow-up: xtrm-4x (P4)"
development
Operational service-knowledge system for a project's services. One skill that creates, discovers, activates, updates, and scopes per-service expert skill packages (SKILL.md + diagnostic scripts + references), kept in sync with the code via a GitNexus-aware drift engine. Use when onboarding to a service, routing a task to the right expert, scaffolding a missing skill, or syncing a skill after the implementation drifted. Triggers: /service-skills, /creating-service-skills, /using-service-skills, /updating-service-skills, /scope, or any task that touches a registered service territory.
development
Bootstrap a complete security pipeline (Dependabot + OSV + Semgrep + gitleaks + pre-commit hooks + Codex review) on any GitHub repo. Designed for free user-private repos where GitHub Advanced Security is unavailable. Reusable across Python/TypeScript/Go/Rust stacks.
testing
Merges queued PRs from xt worktree sessions in the correct order (FIFO), maintaining linear history by rebasing remaining PRs after each merge. Use this skill whenever the user has multiple open PRs from xt worktrees, asks to "merge my PRs", "process the PR queue", "drain the queue", "merge worktree branches", or says "what PRs do I have open". Also activate after any xt-end completion when other PRs are already open, or when the user asks "can I merge yet" or "is CI green". Handles the full sequence: list → sort → CI check → merge oldest → rebase cascade → repeat until queue is empty.
testing
Autonomous session close flow for xt worktree sessions. Use this skill whenever the user says "done", "finished", "wrap up", "close session", "ship it", "I'm done", "ready to merge", or similar. Also activate when all beads issues in the session are closed, or when the user explicitly runs /xt-end. This skill is designed for headless/specialist use: it must make deterministic decisions, auto-remediate common anomalies, and avoid clarification questions unless execution is truly blocked.