what-to-test
Use when writing tests, improving coverage, or deciding what to test in this CLI
When & Why to Use This Skill
This Claude skill provides a strategic framework for testing CLI applications, focusing on user-facing behavior and real-world workflows. It guides developers in identifying critical test cases, improving meaningful code coverage, and implementing best practices for mocking and test isolation to ensure robust software quality and catch regressions before they reach the user.
Use Cases
- Identifying critical user-facing CLI commands that require comprehensive test coverage to prevent regressions.
- Determining which implementation details or integration boundaries (like Git calls or filesystem operations) should be ignored to maintain a clean and focused test suite.
- Improving test suite quality by shifting focus from arbitrary coverage numbers to validating real-world user workflows and dependencies.
- Implementing testable patterns in CLI development, such as exporting core functions and mocking external service dependencies like PromptService.
| name | what-to-test |
|---|---|
| description | Use when writing tests, improving coverage, or deciding what to test in this CLI |
| version | 1.0.0 |
What to Test
Philosophy
Test user-facing behavior. If a user would notice it's broken, it needs a test.
All CLI commands must be tested - including commands marked "internal". Internal commands are still user-facing (Matt uses them daily).
What Makes a Good Test
- Tests behavior users depend on
- Validates real workflows, not implementation details
- Catches regressions before users do
Do NOT write tests just to increase coverage numbers. Use coverage as a guide to find untested user-facing behavior.
What NOT to Test
Use /* v8 ignore start */ for:
- Integration boundaries (actual git calls, shell execution, filesystem)
- Service layers that get mocked in tests
- Entry points and DI wiring
- Boilerplate, unreachable error branches
Testing Pattern
- Export a
runX()function from command files for testability - Mock external services (GitService, PromptService)
- Test error paths users will actually hit
- Use v8 ignore for CLI formatting/presentation code