- Home
- Skills
- Maxritter
- Pilot Shell
- Standards Testing
standards-testing_skill
- TypeScript
419
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill maxritter/pilot-shell --skill standards-testing- SKILL.md10.8 KB
Overview
This skill helps prevent common testing anti-patterns that weaken test confidence and pollute production code. It enforces testing real behavior over asserting mock presence, avoids adding test-only methods to application code, and promotes thoughtful, minimal mocking strategies. Use it to keep tests meaningful, maintainable, and aligned with TDD principles.
How this skill works
The skill inspects test files and mocking patterns to detect assertions that verify mocks instead of actual behavior, identifies methods only referenced by tests, and flags incomplete or overly complex mock setups. It guides decisions on when to use real dependencies versus mocks, suggests extracting test utilities for cleanup, and recommends completing mock data structures to match real responses. It also provides a checklist and decision steps to choose integration tests when mocks become a liability.
When to use it
- When writing or modifying any test file (.test.ts/.spec.ts, _test.py, test_*.py, *_test.go, *_spec.rb, etc.)
- When adding mocks, stubs, spies, or test doubles to a test suite
- When considering adding a method or property to production code that would only be used by tests
- When test setup is long or complex compared to assertions
- When tests fail and you are tempted to change mocks to make them pass
- During code reviews focused on test implementation and mocking strategies
Best practices
- Assert on real behavior, not the presence or calls of mocks
- Keep production code free of test-only methods; create test utilities instead
- Before mocking, list side effects and run tests once with real implementations
- Mock only external/slow operations at the lowest effective level
- Use complete mock data structures that match real API responses
- Prefer TDD: write a failing test first, then implement minimally
Example use cases
- Refactoring a brittle test that asserts mock implementation details instead of outcomes
- Deciding whether to mock a network call or run an integration test against a sandbox
- Removing a cleanup method from a production class and moving it to a test utility
- Fixing a failing duplicate-detection test by preserving side effects in mocks
- Creating realistic mock API responses with all documented fields to avoid silent failures
FAQ
Mock only the slow external parts (network, DB, heavy I/O) while preserving the behavior your test relies on. Run the test once with real dependencies to identify required side effects, then mock minimally.
How do I avoid adding test-only methods to production classes?
Search the codebase for callers. If a method is used only by tests or the class doesn’t own the resource lifecycle, move the logic into a test utility or fixture rather than the production API.