Stack aware unit testing skill
Stack-aware unit and component test planning, authoring, and review. Use to inspect a codebase, detect the test framework, decide whether to reuse or introduce a stack, design coverage, write isolated tests without changing production, or report unit-test gaps and risks.From its SKILL.md
npx -y skills add jovd83/stack-aware-unit-testing-skillAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
10.6 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it
Stack-Aware Unit Testing Skill
Author: jovd83 | Version: 1.1.1
Use this skill as the default entrypoint for unit and component testing work when no more specific test skill has already been selected.
Responsibilities
- Inspect the repository before proposing a test approach.
- Reuse existing test frameworks, directory layout, naming, and helper patterns when they already exist.
- Choose a minimal, idiomatic default only when the repository is greenfield for tests and no specialized skill is available.
- Author isolated, behavior-focused tests with clear setup, action, and assertions.
- Surface defects, testability risks, and coverage gaps without silently rewriting production code.
Boundaries
- Do not replace an established test framework just because another one is newer or preferred.
- Do not silently refactor production code to make tests easier unless the user explicitly asks for code changes beyond tests.
- Do not broaden unit-test work into integration, browser, or end-to-end automation unless the user asks for that scope.
- Do not add new dependencies casually. If a new test dependency is required, keep it minimal and state the reason.
- Do not claim coverage quality from line coverage alone. Prefer behavior, branches, edge cases, and failure modes.
Dispatcher Integration
Use skill-dispatcher as the primary integration layer when this skill needs to hand off to a stack-specific testing skill.
- Inspect the repository first, then dispatch by intent and detected stack instead of hardcoding sibling skill names.
- Prefer the repository's existing unit-test framework over introducing a new one.
- Treat named framework skills as examples and compatibility fallbacks, not as the primary routing contract.
- Keep shared memory limited to stable cross-project policy supplied externally, never task-local test notes.
Fast Start
- Run
scripts/detect-test-context.ps1 -Root . -Format json. - Read the target code, nearby tests, and the repository's existing conventions.
- Decide which path applies:
- Existing framework and conventions found: follow them.
- No framework found, but a specialized skill exists for the stack: route to that skill.
- No framework skill available: continue with this skill using the fallback references.
- Make the execution plan explicit before writing tests when the task is substantial.
- Deliver both the test changes and a concise report of findings, commands, and residual risks.
Routing Rules
1. Reuse before introducing
If the repository already has unit or component tests, you must stay within that test stack unless the user explicitly asks for migration.
2. Prefer specialized skills when they fit exactly
If the detected stack maps cleanly to a dedicated skill that is available in the environment, use skill-dispatcher to pivot to it after inspection.
Examples:
- Java plus JUnit 5: prefer
junit5-skill - Playwright, Cypress, or REST/API suites: route to their dedicated skills instead of stretching this one
3. Keep the fallback path disciplined
If no dedicated skill is available, use this skill's references for framework selection, authoring, and reporting:
- references/analysis-workflow.md
- references/framework-selection.md
- references/test-authoring-playbook.md
- references/reporting-contract.md
Required Output Contract
For substantive testing tasks, structure the response around these sections in this order:
Context- ecosystem, framework decision, and why
- whether existing tests or conventions were reused
Test Plan- target behavior
- key happy paths, edge cases, and failure modes
- important seams or mocks
Implementation- files changed
- noteworthy test design choices
Verification- commands run
- whether tests passed, failed, or were not run
Findings- defects, testability issues, or meaningful residual risks
For smaller tasks, compress the same information into a shorter prose response, but do not skip the framework decision or verification status.
Guardrails For Common Situations
Existing tests are present
- Match naming, folder structure, fixtures, assertion style, and helper usage.
- Avoid introducing a second assertion library or test runner unless the user asks for migration.
No tests are present
- Use references/framework-selection.md.
- Favor the ecosystem default with the fewest new moving parts.
- State the assumption when introducing a new framework or dependency.
The code is hard to test
- Try seams that preserve production behavior first: constructor injection already present, local stubs, test doubles, or deterministic clocks and IDs.
- If the architecture is still too coupled, document the limitation precisely instead of hiding it.
- Prefer a failing test or explicit report over speculative refactors.
A defect is discovered while writing tests
- Expose it with a focused failing test when practical.
- Leave production code untouched unless the user explicitly expands the scope.
- Report the impact and exact location using references/reporting-contract.md.
Gotchas
- Environment & Shell: The provided scripts (e.g.,
detect-test-context.ps1) are PowerShell. You must usepwshon Linux or macOS environments. - Implicit Production Changes: Changing a method from
privatetopublicor adding a newexportjust to enable testing is a production code change. Always call this out as a "testability tradeoff" rather than doing it silently. devDependenciesvsdependencies: When a task requires adding a new framework, ensure it is strictly added as a development dependency (e.g.,npm install --save-devorpip install --dev) to avoid bloating the production artifact.- Leaky Mocks: Mocking global objects (like
console,Date, orprocess.env) can cause test flakiness if the mocks aren't reset. Always prefer framework-native mocking utilities that handle cleanup automatically. - CI/Local Divergence: Tests may pass locally but fail in CI due to missing environment variables or filesystem permissions. Before declaring "Verification" successful, check for any
setup.sh,.env.example, or CI YAML files that define the test environment. - Detection Ambiguity: In monorepos with mixed languages (e.g., a Python backend and Node frontend),
detect-test-context.ps1might return multiple frameworks. Always verify you are looking at the manifest (package.json,pyproject.toml) closest to the target file. - The Reality Trap (Rubber-Stamping): When generating tests for existing code, do not assume the current output is correct. Always cross-reference the logic with the problem description or requirements. A test that "passes" against a bug is itself a defect.
- Hallucinated Infrastructure: AI might invent test helpers, assertions (e.g.,
expect(f).toExist()), or runner flags that don't exist in your specific version of Jest/Pytest/Mocha. Always verify the API against the actual installed version or official documentation. - Integration Drift: Without strict mocking of I/O, unit tests can accidentally become slow integration tests. If a test hits a database, network, or filesystem, it violates the isolation principle and should be flagged as a "testability risk" or moved to a separate suite.
Memory Model
This skill does not maintain its own persistent memory layer.
- Treat repository inspection notes and test plans as runtime memory for the current task.
- Store durable, project-specific conventions in repository files, not hidden memory.
- If cross-agent memory is needed for broader reuse, integrate an external shared-memory skill instead of embedding that responsibility here.
Resource Map
scripts/detect-test-context.ps1: structured repository inspection for ecosystems, frameworks, and test footprintsscripts/detect-framework.ps1: compatibility wrapper for older referencesscripts/import-testing-policy.ps1: import a repository- or organization-specific testing policy into this skill's local reference layerscripts/validate-skill.ps1: run smoke validation for required files, eval assets, and fixture detectionreferences/analysis-workflow.md: inspection checklist, routing logic, and escalation pointsreferences/framework-selection.md: greenfield defaults and specialized skill handoff guidancereferences/org-policy-integration.md: optional organization-specific policy layering guidancereferences/test-authoring-playbook.md: authoring heuristics, coverage expectations, and anti-patternsreferences/reporting-contract.md: reporting templates for implementation summaries and defect calloutsreferences/evaluation.md: forward-testing strategy and quality gates for maintaining the skill
When To Read Extra References
- Read
references/analysis-workflow.mdwhen the repository layout or stack is unclear. - Read
references/framework-selection.mdbefore adding a new test framework or dependency. - Read
references/org-policy-integration.mdwhen an organization-specific testing policy, checklist, or standard should override the default heuristics. - Read
references/test-authoring-playbook.mdwhen manually authoring tests without a specialized skill. - Read
references/reporting-contract.mdwhen the task includes a review, defect report, or testability critique. - Read
references/evaluation.mdwhen extending or validating this skill itself.
What ships with it: 47 files
57.8 KB alongside SKILL.md, 10 of them executable
agents/
- openai.yaml469 B
assets/
evals/
- evals.json8.3 KB
- fixtures/dotnet-mstest/Calculator.sln165 B
- fixtures/dotnet-mstest/tests/Calculator.Tests/CalculatorTests.cs227 B
- fixtures/dotnet-mstest/tests/Calculator.Tests/Calculator.Tests.csproj367 B
- fixtures/dotnet-nunit/Calculator.sln165 B
- fixtures/dotnet-nunit/tests/Calculator.Tests/CalculatorTests.cs188 B
- fixtures/dotnet-nunit/tests/Calculator.Tests/Calculator.Tests.csproj351 B
- fixtures/dotnet-xunit/Calculator.sln165 B
- fixtures/dotnet-xunit/src/Calculator/Calculator.cs111 B
- fixtures/dotnet-xunit/tests/Calculator.Tests/CalculatorTests.cs182 B
- fixtures/dotnet-xunit/tests/Calculator.Tests/Calculator.Tests.csproj359 B
- fixtures/go-greenfield/go.mod52 B
- fixtures/go-greenfield/internal/mathutil/add.go63 B
- fixtures/java-junit/pom.xml594 B
- fixtures/java-junit/src/main/java/com/example/PriceCalculator.java128 B
- fixtures/java-junit/src/test/java/com/example/PriceCalculatorTest.java263 B
- fixtures/node-jest/package.json157 B
- fixtures/node-jest/src/sum.test.tsruns128 B
- fixtures/node-jest/src/sum.tsruns70 B
- fixtures/policy-override/app/service.pyruns72 B
- fixtures/policy-override/pyproject.toml130 B
- fixtures/policy-override/testing-policy.md266 B
- fixtures/python-greenfield/app/service.pyruns72 B
- fixtures/python-greenfield/pyproject.toml118 B
- fixtures/ruby-rspec/Gemfile43 B
- fixtures/ruby-rspec/lib/calculator.rbruns53 B
- fixtures/ruby-rspec/spec/calculator_spec.rbruns155 B
- fixtures/rust-cargo/Cargo.toml111 B
- fixtures/rust-cargo/src/lib.rs177 B
references/
- analysis-workflow.md2.8 KB
- evaluation.md1.9 KB
- framework-selection.md1.9 KB
- org-policy-integration.md1.4 KB
- reporting-contract.md1.1 KB
- CHANGELOG.md2.1 KB
- .gitignore236 B
- LICENSE1.0 KB
- README.md6.4 KB
7 more files not listed here. See all 47 in the repository.