unit-testing

Design and implement high-signal unit tests for isolated application logic.

1|1|Updated Jun 24, 2026
One-click install
npx skills add https://github.com/growmax/growmax-skills --skill unit-testing-growmax
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: unit-testing
Source: https://github.com/growmax/growmax-skills/tree/main/gsecure/skills/unit-testing
Command: npx skills add https://github.com/growmax/growmax-skills --skill unit-testing-growmax

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing unit tests often devolves into chasing coverage percentages, mirroring implementation details, or generating shallow happy-path checks that fail to catch real regressions. This Skill provides a reasoning framework that helps you identify the behaviors that actually matter and protect them with meaningful, deterministic tests. ## Core Features & Use Cases - Behavior-driven test design: A structured reasoning framework covering contracts, inputs, outputs, state transitions, dependencies, side effects, failure modes, boundaries, and domain-specific risks. - Three workflow references: Dedicated flows for adding tests to existing code, test-first development of new features, and refactoring with characterization-test protection. - Quality review and mutation thinking: Checklists and challenge questions that verify tests would actually fail when realistic regressions are introduced. - Use Case: When retrofitting tests onto an existing ViewModel or repository, use the existing-code flow to reconstruct the behavioral contract, document a test cause, and implement only high-value scenarios without locking in accidental behavior. ## Quick Start Ask the agent to design and implement unit tests for a specific class or module using the unit-testing skill, for example a login use case or a reducer.

Frequently Asked Questions about unit-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests that catch real regressions?▼

Focus on the unit's behavioral contract rather than coverage. Identify what the unit promises, explore failure modes and boundaries, then write tests with strong assertions that would fail if a realistic regression such as a removed validation or wrong error mapping were introduced.

How to add unit tests to existing legacy code?▼

Use the existing-code flow: inspect the implementation, callers, and documentation to reconstruct the behavioral contract, distinguish intended from accidental behavior, document a test cause, then implement only high-value scenarios. Treat current behavior as evidence, not automatically as specification.

When should I use mocks versus fakes in unit tests?▼

Use a stub for controlled return values, a mock when verifying an interaction is itself part of the contract, a fake when a lightweight working implementation gives better realism, and a spy to observe without replacing behavior. Prefer the simplest double that preserves meaningful behavior.

Does this testing approach work with any test framework?▼

Yes, the framework is stack-agnostic and adapts to the project's existing test runner, mocking conventions, fixtures, and naming. It explicitly forbids introducing new testing libraries solely because they are preferred in the abstract.

Why is high code coverage not enough for test quality?▼

A suite can have high coverage while missing failure paths, incorrect state transitions, boundary conditions, and negative behavior. Coverage is a signal, not proof; tests should be evaluated by whether realistic regressions would cause them to fail.

How do I refactor code safely without changing behavior?▼

Define a preservation contract, create characterization tests for behavior you intend to keep, establish a green baseline, refactor in small steps, and classify every test failure before changing anything. Never weaken an expectation just to make a failing test pass.