Test Specification Generator Skill
Generates production-grade test specifications for any application through multi-agent exploration, research, and specialist generation.
UX Contract
- User runs
/test-spec-gen [optional-filter] - Skill enters plan mode, presents approach, gets approval
- Executes multi-agent pipeline silently
- Presents test spec document for review
- Iterates with quick-clarify until satisfied
- Offers Trello card conversion
Phase 0: Plan Mode Entry (CRITICAL)
HARD GATE: Do NOT proceed with any exploration, research, or generation until plan mode is approved.
Upon invocation:
- Read existing codebase to understand project type (web/desktop/mobile)
- Present the multi-agent approach with estimated agent count
- Ask user approval to proceed
- Only AFTER approval, begin the exploration phase
Plan Mode Presentation Template
# Test Specification Generator
I will generate a comprehensive test specification for this project using multi-agent orchestration:
## Discovery Phase (5 parallel agents)
- Agent 1: Routes & Pages exploration
- Agent 2: Auth & RBAC mapping
- Agent 3: Data & Backend analysis
- Agent 4: Framework & Config discovery
- Agent 5: Navigation & UX flows
## Research Phase
- /research-before-coding based on discovery findings
## Generation Phase (5 specialist agents)
- Domains determined from exploration + research
- Each generates TC-XXX formatted test cases
## Verification Phase
- Doubt agent review for maintenance burden prevention
- Traceability matrix generation
## Output
- Hermes-style test specification document
- Optional Trello card conversion via /trello-test
Proceed?
EnterPlanMode Trigger
Call EnterPlanMode() immediately after UX Contract section with this prompt:
Generate test specification for [project_name] using multi-agent orchestration:
1. Discovery: 5 parallel explore agents map codebase
2. Research: /research-before-coding for best practices
3. Generation: 5 specialist agents create TC-XXX test cases
4. Verification: Doubt agent review + traceability matrix
5. Output: Test spec doc + optional Trello conversion
Wait for user approval before proceeding to Phase 1.
Phase 0.5: Dependency Pre-flight Check
After plan approval, BEFORE any exploration:
Check Required MCP Servers
# Check if MCP servers are configured
grep -E "perplexity|context7|playwright|trello" ~/.claude/mcp_config.json || echo "MISSING"
Check Test Frameworks
Detect project type and verify:
# Node.js projects
[ -f "package.json" ] && grep -E "(playwright|pytest|vitest|jest)" package.json || echo "NO TEST FRAMEWORK"
# Python projects
[ -f "pyproject.toml" ] && grep -E "(pytest|playwright)" pyproject.toml || echo "NO TEST FRAMEWORK"
Auto-fix with Confirmation
For each missing dependency:
❌ Missing: [dependency]
Impact: [what breaks without it]
Auto-fix: [command to install]
Approve? (Y/n)
If user declines:
- Log the refusal
- Continue only if non-critical
- Refuse to proceed if critical blocker
Critical vs Non-critical
Critical (must refuse without):
- MCP servers for exploration (file read tools)
- Basic test framework detection
Non-critical (can continue with warning):
- Trello API (only needed for card conversion)
- Visual regression tools
- Performance monitoring tools
MCP Discovery Commands
# Check MCP config directly
grep -E "perplexity|context7|playwright|trello" ~/.claude/mcp_config.json 2>/dev/null && echo "MCP servers configured" || echo "Some MCP servers missing"
# Alternative: check ~/.claude.json (Claude Code's actual registry)
grep -E "perplexity|context7|playwright|trello" ~/.claude.json 2>/dev/null | grep -q "mcp" && echo "MCP servers registered" || echo "Some MCP servers missing"
Phase 1: Codebase Discovery (5 Parallel Agents)
Spawn 5 independent explore agents using Task tool. All agents run in parallel with no shared state.
Agent 1: Routes & Pages Explorer
Task(
subagent_type: "Explore",
model: "haiku",
description: "Explore routes and pages",
prompt: `You are a route and page discovery agent.
OBJECTIVE: Map ALL routes, pages, and UI components in this codebase.
OUTPUT FORMAT (JSON):
{
"routes": [
{"path": "/path", "component": "ComponentName", "file": "src/file.tsx", "type": "page|api|static"}
],
"pages": [
{"name": "Dashboard", "route": "/", "file": "src/pages/Dashboard.tsx", "key_elements": ["stats", "charts"]}
],
"navigation": [
{"from": "Sidebar", "to": "Dashboard", "label": "Home"}
]
}
SEARCH STRATEGY:
1. Find router configuration (App.tsx, router.ts, routes/)
2. Find page components (pages/, views/, screens/)
3. Find navigation components (Nav.tsx, Sidebar.tsx, Header.tsx)
4. Extract route-to-component mappings
Return ONLY the JSON. No explanation.`
)
Agent 2: Auth & RBAC Explorer
Task(
subagent_type: "Explore",
model: "haiku",
description: "Explore auth and RBAC",
prompt: `You are an authentication and authorization discovery agent.
OBJECTIVE: Map ALL auth mechanisms, roles, permissions, and access controls.
OUTPUT FORMAT (JSON):
{
"auth_mechanism": "jwt|session|oauth|none",
"roles": ["admin", "user", "guest"],
"permissions": ["create:resource", "read:resource"],
"auth_files": ["src/middleware/auth.ts"],
"protected_routes": [
{"route": "/admin", "roles": ["admin"], "guard": "requireAuth"}
],
"login_endpoint": "/api/auth/login"
}
SEARCH STRATEGY:
1. Find auth middleware (auth.ts, middleware/, guards/)
2. Find role definitions (roles.ts, permissions.ts)
3. Find protected route decorators/middleware
4. Find login/logout endpoints
Return ONLY the JSON. No explanation.`
)
Agent 3: Data & Backend Explorer
Task(
subagent_type: "Explore",
model: "haiku",
description: "Explore data and backend",
prompt: `You are a data and backend discovery agent.
OBJECTIVE: Map ALL data models, API endpoints, and persistence mechanisms.
OUTPUT FORMAT (JSON):
{
"database": "postgres|mongodb|sqlite|none",
"orm": "prisma|drizzle|sequelize|none",
"models": [
{"name": "User", "fields": ["id", "email", "role"], "file": "models/User.ts"}
],
"api_endpoints": [
{"method": "GET", "path": "/api/users", "controller": "UserController"}
],
"persistence_files": ["db/schema.prisma"]
}
SEARCH STRATEGY:
1. Find schema definitions (schema.prisma, models/, entities/)
2. Find API routes (api/, routes/, controllers/)
3. Find database config (db.ts, database.ts)
4. Find ORM usage (prisma., drizzle., sequelize.)
Return ONLY the JSON. No explanation.`
)
Agent 4: Framework & Config Explorer
Task(
subagent_type: "Explore",
model: "haiku",
description: "Explore framework and config",
prompt: `You are a framework and configuration discovery agent.
OBJECTIVE: Map framework, build tooling, CI config, and environment setup.
OUTPUT FORMAT (JSON):
{
"framework": "react|vue|svelte|next|nuxt|custom",
"language": "typescript|javascript|python",
"build_tool": "vite|webpack|rollup|none",
"test_framework": "playwright|jest|vitest|pytest|none",
"ci_system": "github-actions|gitlab-ci|none",
"env_files": [".env", ".env.example"],
"config_files": ["next.config.js", "vite.config.ts"]
}
SEARCH STRATEGY:
1. Check package.json for dependencies
2. Check for framework config files
3. Check .github/workflows/ for CI
4. Check for .env files
Return ONLY the JSON. No explanation.`
)
Agent 5: Navigation & UX Explorer
Task(
subagent_type: "Explore",
model: "haiku",
description: "Explore navigation and UX",
prompt: `You are a navigation and user experience discovery agent.
OBJECTIVE: Map navigation flows, state management, and user interactions.
OUTPUT FORMAT (JSON):
{
"navigation_structure": {
"main": ["Dashboard", "Settings"],
"sidebar": ["Items", "Reports"]
},
"state_management": "redux|zustand|context|none",
"k