| name | tester-detective |
| description | ⚡ PRIMARY TOOL for: 'what's tested', 'find test coverage', 'audit test quality', 'missing tests', 'edge cases', 'test patterns'. Uses claudemem v0.3.0 AST with callers analysis for test discovery. GREP/FIND/GLOB ARE FORBIDDEN. |
| allowed-tools | Bash, Task, Read, AskUserQuestion |
⛔⛔⛔ CRITICAL: AST STRUCTURAL ANALYSIS ONLY ⛔⛔⛔
╔══════════════════════════════════════════════════════════════════════════════╗
║ ║
║ 🧠 THIS SKILL USES claudemem v0.3.0 AST ANALYSIS EXCLUSIVELY ║
║ ║
║ ❌ GREP IS FORBIDDEN ║
║ ❌ FIND IS FORBIDDEN ║
║ ❌ GLOB IS FORBIDDEN ║
║ ║
║ ✅ claudemem --nologo callers <name> --raw TO FIND TESTS ║
║ ✅ claudemem --nologo map "test spec" --raw TO MAP TEST INFRASTRUCTURE ║
║ ║
║ ⭐ v0.3.0: callers shows which tests call each function ║
║ ║
╚══════════════════════════════════════════════════════════════════════════════╝
Tester Detective Skill
Version: 3.3.0
Role: QA Engineer / Test Specialist
Purpose: Test coverage investigation using AST callers analysis and automated test-gaps detection
Role Context
You are investigating this codebase as a QA Engineer. Your focus is on:
- Test coverage - What is tested vs. untested
- Test callers - Which tests call each function
- Edge cases - Boundary conditions in tests
- Test quality - Are tests meaningful or superficial
- Coverage gaps - Functions without test callers
Why callers is Perfect for Test Analysis
The callers command shows you:
- Test callers = Tests appear as callers of the function
- Coverage gaps = No test callers = untested code
- Test distribution = Which tests cover which code
- Direct relationships = Exact test-to-code mapping
Tester-Focused Commands (v0.3.0)
Find Tests for a Function
claudemem --nologo callers processPayment --raw
Map Test Infrastructure
claudemem --nologo map "test spec describe it" --raw
claudemem --nologo map "test helper mock stub" --raw
claudemem --nologo map "fixture factory builder" --raw
Test Coverage Gaps (v0.4.0+ Required)
claudemem --nologo test-gaps --raw
Why test-gaps is better than manual analysis:
- Automatically finds high-PageRank symbols
- Automatically counts test vs production callers
- Prioritized list of coverage gaps
Handling Empty Results:
GAPS=$(claudemem --nologo test-gaps --raw)
if [ -z "$GAPS" ] || echo "$GAPS" | grep -q "No test gaps"; then
echo "Excellent test coverage! All high-importance code has tests."
echo ""
echo "Optional: Check lower-importance code:"
echo " claudemem --nologo test-gaps --min-pagerank 0.005 --raw"
else
echo "Test Coverage Gaps Found:"
echo "$GAPS"
fi
Limitations Note:
Test detection relies on file naming patterns:
*.test.ts, *.spec.ts, *_test.go, etc.
- Integration tests in non-standard locations may not be detected
- Manual test files require naming convention updates
Find Untested Code
Method 1: Automated (v0.4.0+ Required - Recommended)
GAPS=$(claudemem --nologo test-gaps --raw)
if [ -z "$GAPS" ]; then
echo "No high-importance untested code found!"
else
echo "$GAPS"
fi
claudemem --nologo test-gaps --min-pagerank 0.05 --raw
Method 2: Manual (for specific functions, v0.3.0 compatible)
claudemem --nologo callers importantFunction --raw
Test Coverage Analysis
claudemem --nologo callers authenticateUser --raw
claudemem --nologo callers processPayment --raw
claudemem --nologo callers saveToDatabase --raw
PHASE 0: MANDATORY SETUP
Step 1: Verify claudemem v0.3.0
which claudemem && claudemem --version
Step 2: If Not Installed → STOP
Use AskUserQuestion (see ultrathink-detective for template)
Step 3: Check Index Status
claudemem --version && ls -la .claudemem/index.db 2>/dev/null
Step 3.5: Check Index Freshness
Before proceeding with investigation, verify the index is current:
if [ ! -d ".claudemem" ] || [ ! -f ".claudemem/index.db" ]; then
exit 1
fi
STALE_COUNT=$(find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -o -name "*.py" -o -name "*.go" -o -name "*.rs" \) \
-newer .claudemem/index.db 2>/dev/null | grep -v "node_modules" | grep -v ".git" | grep -v "dist" | grep -v "build" | wc -l)
STALE_COUNT=$((STALE_COUNT + 0))
if [ "$STALE_COUNT" -gt 0 ]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
INDEX_TIME=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M" .claudemem/index.db 2>/dev/null)
else
INDEX_TIME=$(stat -c "%y" .claudemem/index.db 2>/dev/null | cut -d'.' -f1)
fi
INDEX_TIME=${INDEX_TIME:-"unknown time"}
STALE_SAMPLE=$(find . -type f \( -name "*.ts" -o -name "*.tsx" \) \
-newer .claudemem/index.db 2>/dev/null | grep -v "node_modules" | grep -v ".git" | head -5)
fi
Step 4: Index if Needed
claudemem index
Workflow: Test Coverage Analysis (v0.3.0)
Phase 0: Automated Gap Detection (v0.4.0+ Required)
GAPS=$(claudemem --nologo test-gaps --raw)
if [ -z "$GAPS" ]; then
echo "No gaps found at default threshold"
echo "Optionally check with lower threshold:"
claudemem --nologo test-gaps --min-pagerank 0.005 --raw
else
echo "$GAPS"
fi
Phase 1: Map Test Infrastructure
claudemem --nologo map "jest vitest mocha config" --raw
claudemem --nologo map "mock stub spy helper" --raw
Phase 2: Identify Critical Functions
claudemem --nologo map "payment processing" --raw
Phase 3: Check Test Coverage via Callers
claudemem --nologo callers PaymentService --raw
Phase 4: Find Coverage Gaps
Phase 5: Analyze Test Quality
Output Format: Test Coverage Report
1. Test Infrastructure Summary
┌─────────────────────────────────────────────────────────┐
│ TEST INFRASTRUCTURE │
├─────────────────────────────────────────────────────────┤
│ Framework: Vitest 2.x │
│ Test Files: 156 files (*.spec.ts, *.test.ts) │
│ Test Utils: src/__tests__/utils/ │
│ Search Method: claudemem v0.3.0 (callers analysis) │
└─────────────────────────────────────────────────────────┘
2. Coverage by Function (via callers)
| Function | Test Callers | Coverage |
|---------------------|--------------|----------|
| authenticateUser | 5 tests | ✅ Good |
| processPayment | 3 tests | ✅ Good |
| calculateDiscount | 0 tests | ❌ None |
| sendEmail | 1 test | ⚠️ Low |
| updateUserProfile | 0 tests | ❌ None |
3. Untested Critical Functions
🔴 HIGH PRIORITY - No Test Callers:
└── calculateDiscount (PageRank: 0.034)
└── callers show: 4 production callers, 0 test callers
└── updateUserProfile (PageRank: 0.028)
└── callers show: 3 production callers, 0 test callers
⚠️ MEDIUM PRIORITY - Few Test Callers:
└── sendEmail (PageRank: 0.021)
└── callers show: 1 test, no edge case tests
4. Test Quality Notes
📝 OBSERVATIONS:
1. calculateDiscount has 4 production callers but 0 test callers
→ Critical business logic untested!
2. sendEmail has 1 test caller
→ Only happy path tested, no error scenarios
3. authenticateUser has 5 test callers
→ Good coverage including edge cases
Scenarios
Scenario: "What's tested?"
claudemem --nologo map "payment" --raw
claudemem --nologo callers processPayment --raw
claudemem --nologo callers validateCard --raw
claudemem --nologo callers chargeCustomer --raw
Scenario: Finding Coverage Gaps
claudemem --nologo map --raw
claudemem --nologo callers importantFunc1 --raw
claudemem --nologo callers importantFunc2 --raw
Scenario: Test Quality Audit
claudemem --nologo callers targetFunction --raw
Result Validation Pattern
After EVERY claudemem command, validate results:
Callers Validation for Tests
When checking test coverage:
CALLERS=$(claudemem --nologo callers processPayment --raw)
EXIT_CODE=$?
if [ "$EXIT_CODE" -ne 0 ]; then
DIAGNOSIS=$(claudemem status 2>&1)
fi
if echo "$CALLERS" | grep -qi "error\|failed"; then
fi
TEST_CALLERS=$(echo "$CALLERS" | grep -E "\.test\.|\.spec\.|_test\." | wc -l)
PROD_CALLERS=$(echo "$CALLERS" | grep -v -E "\.test\.|\.spec\.|_test\." | wc -l)
if [ "$TEST_CALLERS" -eq 0 ]; then
echo "WARNING: No test coverage found for this function"
fi
Empty Results Validation
RESULTS=$(claudemem --nologo map "test spec describe" --raw)
if [ -z "$RESULTS" ]; then
echo "WARNING: No test infrastructure found"
fi
FALLBACK PROTOCOL
CRITICAL: Never use grep/find/Glob without explicit user approval.
If claudemem fails or returns irrelevant results:
- STOP - Do not silently switch tools
- DIAGNOSE - Run
claudemem status
- REPORT - Tell user what happened
- ASK - Use AskUserQuestion for next steps
AskUserQuestion({
questions: [{
question: "claudemem test coverage analysis failed or found no tests. How should I proceed?",
header: "Test Coverage Issue",
multiSelect: false,
options: [
{ label: "Reindex codebase", description: "Run claudemem index (~1-2 min)" },
{ label: "Try different query", description: "Search for different test patterns" },
{ label: "Use grep (not recommended)", description: "Traditional search - loses caller analysis" },
{ label: "Cancel", description: "Stop investigation" }
]
}]
})
See ultrathink-detective skill for complete Fallback Protocol documentation.
Anti-Patterns
| Anti-Pattern | Why Wrong | Correct Approach |
|---|
grep "test" | No caller relationships | claudemem --nologo callers func --raw |
| Assume tests exist | Miss coverage gaps | Verify with callers analysis |
| Count test files | Doesn't show what's tested | Check callers per function |
| Skip PageRank | Miss critical gaps | Focus on high-PageRank untested |
Testing Tips
- Use callers to find tests - Tests appear as callers of functions
- No test callers = no tests - Coverage gap identified
- High PageRank + no tests = critical gap - Prioritize these
- Read test callers - Verify quality, not just existence
- Check edge cases - Are error paths tested?
Notes
callers reveals test coverage - Tests are just callers from test files
- High-PageRank untested = critical gap - Most impactful coverage issues
- Production callers vs test callers - Ratio shows coverage health
- Filter callers by file path (*.test.ts, *.spec.ts) to find tests
- Works best with TypeScript, Go, Python, Rust codebases
Maintained by: MadAppGang
Plugin: code-analysis v2.7.0
Last Updated: December 2025 (v3.3.0 - Cross-platform compatibility, inline templates, improved validation)