skills/coding/test-think/SKILL.md
Master the thinking process behind effective testing decisions. This skill encapsulates the judgment of WHAT to test, WHAT NOT to test, and the prioritization framework for test coverage. Use when user mentions test strategy, testing decisions, what cases to cover, over-testing concerns, or asks "should I test this?". Triggers especially when user is unsure about testing scope, test coverage decisions, or when they say things like "should I write a test for this?", "is this worth testing?", "what test cases do I need?", or "how much testing is enough?".
npx skillsauth add ImaginerLabs/skill-manager test-thinkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Test-think is a behavioral specification skill that encapsulates expert judgment about testing decisions. It's not about HOW to write tests — it's about the mental framework for deciding WHAT to test, WHAT NOT to test, and in WHAT ORDER.
This skill embodies the thinking process of an experienced test architect: the judgment calls, prioritization frameworks, and risk-based reasoning that determines optimal test coverage.
"Perfect testing is the enemy of good development."
The goal isn't 100% coverage — it's confidence at reasonable cost. Every test has a price: write time, run time, maintenance cost, and opportunity cost.
Before writing ANY test, answer these three questions:
Low Cost to Break High Cost to Break
┌─────────────────────┬─────────────────────┐
Low Test Cost │ ⚡ Quick wins │ 🎯 Priority target │
├─────────────────────┼─────────────────────┤
High Test Cost │ 🤔 Consider carefully │ 📊 Evaluate ROI │
└─────────────────────┴─────────────────────┘
Write a test when:
| Condition | Rationale | |-----------|-----------| | Logic is complex | Complex logic has hidden edge cases | | Error handling exists | Error paths are often untested | | Edge cases are unclear | "What if someone passes null?" | | Regression risk is high | Old bugs WILL recur without tests | | API contract exists | Tests document and protect the contract | | Refactoring planned | Tests enable safe refactoring |
Don't write a test when:
| Anti-pattern | Why | Alternative | |--------------|-----|-------------| | Trivial one-liners | Tests cost more than the code | Trust the type system | | Implementation details | Fragile tests, blocks refactoring | Test behavior, not implementation | | Coverage theater | False sense of security | Test meaningful scenarios | | Duplicating other tests | Maintenance burden | One good test, well-named | | Speculative edge cases | YAGNI applies to tests too | Wait for actual bugs |
Use this decision tree:
┌─ Is this a simple getter/setter?
│ └─ NO → Continue
│ └─ YES → SKIP (trust the type system)
│
└─ Does this logic have branching?
└─ NO → Consider SKIP (may be covered by integration test)
└─ YES → Continue
│
└─ What's the business impact if this breaks?
│
├─ High (money, data, security) → WRITE TEST
├─ Medium → Write if test cost is low
└─ Low → SKIP or document decision
▲
/│\ P0: Critical paths (happy path + main edge cases)
/ │ \ - Core business logic
/ │ \ - Data integrity
/ │ \ - Security boundaries
/────│────\
/ │ \ P1: Important paths
/ │ \ - Secondary flows
/ │ \ - Error handling
/ │ \ - Important edge cases
/─────────│─────────\
/ │ \ P2: Nice to have
/ │ \ - Edge cases
/ │ \ - Performance tests
/─────────────│─────────────\
/ │ P3: Luxury
/ │ - Documentation tests
└────────────────┘ - Legacy code coverage
P0 — Critical (Always test):
P1 — Important (Usually test):
P2 — Nice to have (Test if easy):
P3 — Luxury (Consider skipping):
"High coverage ≠ good tests. Good tests ≠ high coverage."
Coverage metrics measure QUANTITY, not QUALITY. A suite with 90% coverage that tests the wrong things is worse than 50% coverage that tests the right things.
| Code Type | Target | Rationale | |-----------|--------|-----------| | Business logic | 80-90% | Core value, high ROI | | Utility functions | 60-70% | Lower risk, simpler | | I/O operations | 70-80% | External dependencies | | Configuration | 50-60% | Low mutation rate | | UI components | 60-70% | Behavior matters more | | Integration | 40-60% | End-to-end coverage |
20% of your tests likely cover 80% of your risk. Find that 20% and protect it fiercely.
// BAD: Testing to hit a number
it('should have 100% coverage', () => {
expect(coverage).toBe(100);
});
// GOOD: Testing meaningful behavior
it('should reject negative amounts', () => {
expect(() => processPayment(-10)).toThrow(InsufficientAmountError);
});
// BAD: Testing HOW (fragile)
it('should call validate() then save()', () => {
const validate = vi.fn();
const save = vi.fn();
// This breaks on refactor!
});
// GOOD: Testing WHAT (resilient)
it('should persist valid payment', () => {
const payment = createPayment({ amount: 100 });
const result = processPayment(payment);
expect(result.status).toBe('persisted');
});
// BAD: Testing every internal call
it('should call logger.info() then emit() then save()', () => {
// This is testing the implementation, not the behavior
});
// GOOD: Testing the outcome
it('should complete payment and notify user', () => {
const payment = createPayment({ amount: 100 });
const result = processPayment(payment);
expect(result.notified).toBe(true);
});
Before finalizing any test, run through this checklist:
┌─ Is it pure (no side effects)?
│ └─ NO → Test the calling code instead
│ └─ YES → Continue
│
└─ Does it contain complex logic?
└─ NO → Skip (trust TypeScript types)
└─ YES → Test the complex branches only
Ask them to justify each test with:
Don't add tests for coverage. Instead:
| Use mocks when | Don't use mocks when | |----------------|---------------------| | Testing units in isolation | Testing integration | | External services (API, DB) | Real behavior matters | | Slow operations | Fast operations | | Non-deterministic | Deterministic |
When analyzing test decisions, structure your output as:
## Test Coverage Analysis
### Recommended Tests
| Component | Test Case | Priority | Rationale |
|-----------|-----------|----------|-----------|
| payment.ts | reject negative | P0 | Security boundary |
| payment.ts | insufficient funds | P0 | Core business logic |
### Skipping (Justified)
| Component | Reason | Alternative |
|-----------|--------|-------------|
| getUserById | Simple lookup | Trust ORM |
| formatDate | Trivial wrapper | Covered E2E |
### Test Coverage Target
- Business logic: 85%
- Utilities: 60%
- Integration: 50%
- Overall: ~65%
generate-mock — After deciding WHAT to test, use generate-mock for HOW to mock dependenciessetup-test-data — Use after deciding WHAT to test for creating meaningful test fixturessafe-refactor — Use before refactoring to ensure critical paths are covereddebug-test — When tests fail, use this to determine if it's a real bug or test issuedevelopment
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
devops
Create a new implementation plan file for new features, refactoring existing code or upgrading packages, design, architecture or infrastructure.
tools
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
documentation
Generates standardized porting documentation from completed feature changes. Analyzes commit diffs or file contents, extracts change intent, and outputs Markdown documentation for cross-team understanding. Should be used when the user needs to document a change for cross-team or cross-project consumption. Distinguished from cross-branch-fix-porter which actively re-implements fixes, this skill documents changes.