From digital-innovation-agents
Creates unit and integration tests by analyzing the codebase, auto-detecting the test framework, and generating tests that follow project conventions. Use when writing new tests or updating tests after implementation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/digital-innovation-agents:testingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Creates tests that fit into the existing codebase. Detects the
Creates tests that fit into the existing codebase. Detects the framework, patterns, and conventions automatically from the project.
Writing style and frontmatter rules:
See skills/project-conventions/SKILL.md#canonical-specs (Writing style,
Frontmatter spec).
Tests bind to a specific backlog item. Run the team-workflow check (full
rules: skills/project-conventions/references/team-workflow.md):
feature/<item-id-lower>-<slug>. On a
wrong branch, AskUserQuestion to switch.python3 tools/github-integration/flow.py create-issue --item <ID>
python3 tools/github-integration/flow.py open-draft-pr --item <ID>
python3 tools/github-integration/flow.py tag-phase --item <ID> --phase test..git/dia-active-skill so subsequent invocations stay silent.New tests bind to an existing FEATURE, IMP, or FIX id. Exception: read-only analysis (coverage report, gap identification, reading existing tests) does not need triage.
If the binding cannot be derived from the prompt, ask once before the first new test (user's working language):
"Does this test run belong to a FEATURE, an IMP, or a FIX? Please name the ID."
Triage details:
skills/project-conventions/references/graph-invariants.md, section
"Artifact triage at entry point".
/testing shares the verify gate with /coding. No completion claim
without fresh verification evidence in the current message.
Hard threshold for "all green": 0 test failures, 0 lint errors (if lint
runs in the suite), coverage not regressed (line/branch/function each at
or above the project target from _devprocess/rules/technical.md or
Coverage section).
Forbidden without fresh verification: "should pass", "tests should be green now", "looks good", "probably fine". The skill executes the test command IN THIS MESSAGE before any completion claim. Cached output and stale logs are not evidence.
Before writing tests, scan the project for:
This is internal analysis; do not write back into FEATURE/BACKLOG. Adopt the patterns the project already uses. Do not introduce new frameworks unless the project has none.
Unit > integration > e2e, scope-aware. Focus of this skill: integration tests (primary) and unit tests (TDD fallback or gap-filling). E2E is a separate topic.
When /coding runs in TDD mode (see coding/SKILL.md Phase 3b), unit
tests already exist. /testing then focuses on, in priority:
If /coding ran without TDD, /testing also creates the unit tests
following AAA and FIRST.
When. Public functions with logic, utilities, data transformations, error handling. Skip trivial getters/setters and pure pass-throughs.
Every test follows the AAA shape:
Match the project's existing assertion verbosity; do not add // Arrange
comments unless they already exist.
Fast (<1s/test), Independent, Repeatable, Self-validating, Timely.
Full version: references/test-checklist.md. Short version: happy path,
edge cases (empty/null/undefined/boundary), error cases (invalid inputs,
missing dependencies), boundary conditions (min/max, empty, large).
Mock external dependencies (APIs, FS, DB) only. Never mock the unit under test. Prefer dependency injection over global mocks. Reuse the project's existing mock patterns.
When. Multi-module interactions, API request -> response, DB access (test DB or in-memory), event/message flows.
Rules. Real dependencies where possible; mock only external services.
Each test independent (own state and teardown). Realistic test data, not
foo/bar/test. Set timeouts for async. Use beforeAll/afterAll only
for shared resources.
Follow the existing project pattern. If none exists: {module}.test.ts
or {module}.spec.ts for unit, {module}.integration.test.ts for
integration. Same directory as source, or under tests/.
| Trigger | Steps |
|---|---|
| Existing feature without tests | Analyze file -> identify testables -> recognize patterns -> create tests (AAA/FIRST) -> run -> coverage |
New feature after /coding | Read FEATURE spec Success Criteria -> identify changed files -> integration tests -> fill unit gaps -> verify SC |
| Metric | Target | Minimum |
|---|---|---|
| Line Coverage | 85% | 70% |
| Branch Coverage | 80% | 65% |
| Function Coverage | 90% | 75% |
Guidelines only. Project-specific targets in CLAUDE.md, feature specs,
or _devprocess/rules/technical.md take precedence.
Full version: references/test-anti-patterns.md. Short version: no
testing of implementation details (test behavior); no excessive mocking
(5+ mocks signals a design problem); no trivial tests; no fragile tests
that break on refactor; no testing of timers (test the result).
When tests fail, a fix-loop starts. The user decides how to proceed.
Emit the canonical Test Result block (referenced as TEST-RESULT-BLOCK
elsewhere in this skill):
=== Test Result ===
Passed: {N} tests
Failed: {N} tests
Coverage: {line}% / {branch}% / {function}%
Failed tests:
- {test name}: {short error description}
Cause: code bug / wrong test expectation / missing implementation
Fix effort: S/M/L
File: {src/path/file.ts} or {tests/path/test.ts}
Coverage gaps:
- {src/path/file.ts}: {function} not tested
How should I proceed?
A) Fix all findings automatically
-> I fix everything, retest, repeat until all tests are green
B) Approve fixes one by one
-> I show each fix before implementation
C) Only adjust tests (the code is correct, the tests are wrong)
D) Abort -- I want to look at findings manually first
For each fix:
After all fixes: run the full test suite again and emit the
TEST-RESULT-BLOCK from Step 1. If failures remain, return to Step 1.
The loop repeats until all tests are green or the user aborts.
After a successful test run:
In Progress -> In Review or In Progress -> Done.src/ARCHITECTURE.map and write the JSDoc header./coding rules) if code fixes
were needed during the test run./consistency-check mode A at phase end. Catches orphan tests,
missing coverage entries, dashboard mismatches, dead links. The
Handoff Ritual reports the result./testing always runs this ritual at the end, regardless of how it was
started (directly or via /dia-guide).
Reference the final TEST-RESULT-BLOCK from the fix-loop (Step 1) for
pass/fail and coverage numbers. Add the produced or updated artifacts:
Produced / updated:
- tests/{paths}
- Fix-loop status: {N iterations, N fixes applied}
- _devprocess/requirements/features/FEATURE-*.md: {test-status updates}
- _devprocess/context/BACKLOG.md: {coverage items added, dashboard refreshed}
Append a new entry to _devprocess/context/HANDOFFS.md with:
Run the phase-end commit per
skills/project-conventions/references/team-workflow.md section
"Phase-end commit (binding)". It stages every artefact produced (tests,
coverage config, FEATURE updates, BACKLOG updates), commits, tags the
phase, and opens a draft PR if missing.
Canonical commit message for TESTING:
test: <ITEM-ID> testing complete
<one-line summary: N tests added, coverage L%/B%/F%>
Refs: <ITEM-ID>
After the commit lands:
python3 tools/github-integration/flow.py tag-phase --item <ID> --phase test
python3 tools/github-integration/flow.py sync-status --item <ID>
sync-status mirrors BACKLOG Status to the GitHub issue/project (and
Assignee back to Claim). No-op outside mode = "github-sync". Skip
the commit silently if the working tree has no changes.
Ask the user:
"Tests are complete and all green. Coverage: {line}% / {branch}% / {function}%. Recommended next:
/security-audit.Shall I start
/security-auditnow, or would you like to review first?"
On agreement ("yes" / "go" / "next") or when running inside
/dia-guide:
-> Start /security-audit and pass the handoff context
On rejection ("no" / "stop" / "I want to check first"): -> Pause and wait for user instruction
Tests, unit tests, integration tests, test coverage, testing, TDD, coverage gaps, test pyramid, fix-loop, re-test, regression, handoff
npx claudepluginhub pssah4/digital-innovation-agents --plugin digital-innovation-agentsGenerates test suites with unit, integration, and e2e tests, proper mocking strategies, and edge case coverage. Works with any language/framework.
Executes testing tasks: writes colocated test files, runs tests, and summarizes coverage. Includes TDD variant with rationalization counters and red flags.