rune-kit/rune/test
Claude Code and agent skill by rune-kit/rune
- community
Checking that the SKILL.md file is still in the repository.
TDD test writer. Use before implementing any feature or fix (write the failing test first), when the user asks to 'write tests', or when coverage is missing. Writes failing tests FIRST (red), then verifies they pass after implementation (green). Covers unit, integration, and e2e tests.
Install
npx vskill@latest install rune-kit/rune/testSKILL.md
The same SKILL.md was published earlier as rune-kit/rune/test.
test
<HARD-GATE> Tests define the EXPECTED BEHAVIOR. They MUST be written BEFORE implementation code. If tests pass without implementation → the tests are wrong. Rewrite them. The only exception: when retrofitting tests for existing untested code.
THE IRON LAW: Write code before test? DELETE IT. Start over.
- Do NOT keep it as "reference"
- Do NOT "adapt" it while writing tests
- Do NOT look at it to "inform" test design
- Delete means delete.
git checkout -- <file>or remove the changes entirely.
This is not negotiable. This is not optional. "But I already wrote it" is a sunk cost fallacy.
ROLE BOUNDARY: Test writes TEST FILES only. NEVER modify source/implementation files.
- Do NOT "quickly fix" a broken import in source to make tests run
- Do NOT refactor source code to be "more testable"
- Do NOT add missing exports to source files
- If source needs changes → hand off to
rune:fix. Test's job ends at the test file.
This separation ensures test never writes code biased toward passing its own tests.
VERTICAL SLICING (Iron Law extension): one test → GREEN → one test → GREEN. Never bulk.
- bulk_test_count MUST stay <= 1 before the first GREEN in a session
- After each GREEN, bulk_test_count resets to 0; writing 2+ tests before the next GREEN = HORIZONTAL VIOLATION
- Each cycle MUST emit a commit pair:
test(scope): <behavior>+feat(scope): <behavior> - Claim "I did TDD" is verified by
completion-gateagainstgit log --oneline— no paired commits = REJECTED - Horizontal slicing produces tests-of-imagination, not tests-of-behavior. See references/vertical-tdd.md.
- Emit signal
tdd.horizontal.violationwhen triggered; preflight blocks merge until cycles are unwound.
Exceptions (narrow, must be documented in test header): retrofitting characterization tests for legacy untested code; spec-driven scaffolding where the contract is external (OpenAPI, wire protocol). Characterization tests go under tests/char/ and stay frozen after safeguard; holdout tests go under tests/holdout/ and are not authored by the implementer. See references/test-integrity-gate.md. </HARD-GATE>
Instructions
Phase 1: Understand What to Test
- Read the implementation plan or task description carefully
- Use
Globto find existing test files:**/*.test.*,**/*.spec.*,**/test_* - Use
Readon 2-3 existing test files to understand:
- Test framework in use
- File naming convention (e.g.,
foo.test.tsmirrorsfoo.ts) - Test directory structure (co-located vs
__tests__/vstests/) - Assertion style and patterns
- Use
Globto find the source file(s) being tested
Phase 2: Detect Test Framework
Use Glob to find config files and identify the framework:
jest.config.*or"jest"key inpackage.json→ Jestvitest.config.*or"vitest"key inpackage.json→ Vitestpytest.ini,[tool.pytest.ini_options]inpyproject.toml→ pytest- Async check: If pytest detected AND source files contain
async def: - Check if
pytest-asynciois in dependencies (pyproject.toml [project.dependencies]or[project.optional-dependencies]) - Check if
asyncio_modeis set in[tool.pytest.ini_options](values:auto,strict, or absent) - If async code exists but no
asyncio_modeconfigured → WARN: "pytest-asyncio not configured. Async tests may silently pass without executing async code. Recommend addingasyncio_mode = \"auto\"to[tool.pytest.ini_options]in pyproject.toml." Cargo.tomlwith#[cfg(test)]pattern → built-incargo test*_test.gofiles present → built-ingo testcypress.config.*→ Cypress (E2E)playwright.config.*→ Playwright (E2E)
Verification gate: Framework identified before writing any test code.
Phase 3: Write Failing Tests
Use Write to create test files following the detected conventions:
- Mirror source file location: if source is
src/auth/login.ts, test issrc/auth/login.test.ts - Structure tests with clear
describe/itblocks (or language equivalent):
describe('Feature name')it('should [expected behavior] when [condition]')
- Cover all three categories:
- Happy path: valid inputs, expected success output
- Edge cases: empty input, boundary values, large input
- Error cases: invalid input, missing data, network failure simulation
- Use proper assertions. Do NOT use implementation details — test behavior:
- Jest/Vitest:
expect(result).toBe(expected) - pytest:
assert result == expected - Rust:
assert_eq!(result, expected) - Go:
if result != expected { t.Errorf(...) }
- For async code: use
async/awaitor pytest@pytest.mark.asyncio
Python Async Tests (pytest-asyncio)
Full detail moved to `references/python-async.md` (progressive disclosure). Read that file before executing this section.
Phase 3.5: Cycle Discipline (Vertical Slicing Gate)
Before running the new test in Phase 4, count what's about to be added to the working tree:
Gate: bulk_test_count MUST be exactly 1.
| State | Action | |
|---|---|---|
bulk_test_count == 1 | Proceed to Phase 4 (run RED). | |
bulk_test_count >= 2 AND no prior GREEN this session | HORIZONTAL VIOLATION — pause, keep one test, defer the rest. | |
bulk_test_count >= 2 AND last GREEN exists in git log | HORIZONTAL VIOLATION — same. | |
bulk_test_count == 0 | No test to run; this phase is a no-op. |
Cycle audit log — append to TEST.md (or create) one line per cycle:
The audit log is the receipt. completion-gate reads it.
When the violation fires, do NOT delete tests automatically — surface to the calling agent: "horizontal slicing detected (N tests before first GREEN). Recommend keeping test K, deferring N-1 to subsequent cycles."
Phase 4: Run Tests — Verify They FAIL (RED)
Use Bash to run ONLY the newly created test files (not full suite):
- Jest:
npx jest path/to/test.ts --no-coverage - Vitest:
npx vitest run path/to/test.ts - pytest:
pytest path/to/test_file.py -v(if async tests and noasyncio_modein config: add--asyncio-mode=auto) - Rust:
cargo test test_module_name - Go:
go test ./path/to/package/... -run TestFunctionName
Hard gate: ALL new tests MUST fail at this point.
- If ANY test passes before implementation exists → that test is not testing real behavior. Rewrite it to be stricter.
- If tests fail with import/syntax errors (not assertion errors) → fix the test code, re-run
Phase 5: After Implementation — Verify Tests PASS (GREEN)
After rune:fix writes implementation code, run the same test command again:
- ALL tests in the new test files MUST pass
- Run the full test suite with
Bashto check for regressions:
npm test,pytest,cargo test,go test ./...
- If any test fails: report clearly which test, what was expected, what was received
- If an existing test now fails (regression): escalate to
rune:debug
Verification gate: 100% of new tests pass AND 0 regressions in existing tests.
Phase 6: Coverage Check
After GREEN phase, call verification to check coverage threshold (80% minimum):
- If coverage drops below 80%: identify uncovered lines, write additional tests
- Report coverage gaps with file:line references
Phase 6.5: Diff-Aware Mode (optional)
When invoked with mode: "diff-aware" or by cook after implementation:
- Run
git diff main --name-onlyto get changed files - For each changed file, trace its blast radius: what imports it? what routes does it serve? what components render it?
- Map changed files → affected routes/endpoints/pages
- Prioritize tests: files with most downstream dependents get tested first
- Generate targeted test commands that cover ONLY affected paths — skip unchanged modules
This mode is valuable for large codebases where running the full suite is slow. It answers: "what could this diff have broken?"
Test Types — 4-Layer Methodology
Full detail moved to `references/test-types.md` (progressive disclosure). Read that file before executing this section.
TEST.md — Test Plan + Results Document
Full detail moved to `references/test-plan-doc.md` (progressive disclosure). Read that file before executing this section.
Skill Behavior Tests (Eval Scenarios)
Full detail moved to `references/evals.md` (progressive disclosure). Read that file before executing this section.
Error Recovery
- If test framework not found: ask calling skill to specify, or check
package.jsondevDependencies - If
Writeto test file fails: check if directory exists, create it first withBash mkdir -p - If tests error on import (module not found): check that source file path is correct, adjust imports
- If
Bashtest runner hangs beyond 120 seconds: kill and report as TIMEOUT
Called By (inbound)
cook(L1): Phase 3 TEST — write tests firstfix(L2): verify fix passes testsreview(L2): untested edge case found → write test for itdeploy(L2): pre-deployment full test suitepreflight(L2): run targeted regression tests on affected codesurgeon(L2): verify refactored codelaunch(L1): pre-deployment test suitesafeguard(L2): writing characterization tests for legacy codereview-intake(L2): write tests for issues identified during review intakescaffold(L1): generate initial test suite for new projectgraft(L2): write integration tests for grafted codeskill-forge(L2): write tests for new skill functionalitymcp-builder(L2): write tests for MCP server toolsdebug(L2): write regression test capturing the bugplan(L2): reference test requirements in implementation plan
Calls (outbound)
verification(L3): Phase 6 — coverage check (80% minimum threshold)browser-pilot(L3): Phase 4 — e2e and visual testing for UI flowsdebug(L2): Phase 5 — when existing test regresses unexpectedly
Data Flow
Feeds Into →
cook(L1): test results (pass/fail/coverage) → cook's Phase 5 quality gate evidencecompletion-gate(L3): test runner stdout → evidence for "tests pass" claimsfix(L2): failing test output → fix's target (what to make green)
Fed By ←
plan(L2): phase file test tasks → test's RED phase targets (what to test)review(L2): untested edge cases found during review → new test targetsfix(L2): implemented code → test's GREEN phase verification target
Feedback Loops ↻
test↔fix: test writes failing tests (RED) → fix implements to pass → test verifies (GREEN) → if new failures emerge, loop continuestest↔debug: test discovers regression → debug diagnoses root cause → test writes regression test to prevent recurrence
Anti-Rationalization Table
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 0 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/test/SKILL.md
Popularity
- Repository stars
- 77
- Repository forks
- 21
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/rune-kit/rune/test)