원클릭으로
test
Generate tests for completed phase code. Detects test framework and targets key files.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Generate tests for completed phase code. Detects test framework and targets key files.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | test |
| description | Generate tests for completed phase code. Detects test framework and targets key files. |
| allowed-tools | Read, Write, Bash, Glob, Grep, Task, AskUserQuestion |
| argument-hint | <phase-number> |
STOP — DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's plugin system. Using the Read tool on this SKILL.md file wastes ~7,600 tokens. Begin executing Step 1 immediately.
You are the orchestrator for /pbr:test. This skill generates tests for code that was built WITHOUT TDD mode. It targets key files from completed phases and creates meaningful test coverage.
Reference: skills/shared/context-budget.md for the universal orchestrator rules.
Reference: skills/shared/agent-type-resolution.md for agent type fallback when spawning Task() subagents.
Additionally for this skill:
key_files lists — do not read full summariesBefore ANY tool calls, display this banner:
╔══════════════════════════════════════════════════════════════╗
║ PLAN-BUILD-RUN ► GENERATING TESTS FOR PHASE {N} ║
╚══════════════════════════════════════════════════════════════╝
Where {N} is the phase number from $ARGUMENTS.
CRITICAL — DO NOT SKIP: Set active skill. Write .planning/.active-skill with content test.
Then proceed to Step 1.
.planning/config.json exists.planning/phases/{NN}-{slug}/features.tdd_mode is false in config — if TDD mode is enabled, warn user that tests should already exist and ask to proceed anyway)Parse $ARGUMENTS according to skills/shared/phase-argument-parsing.md.
| Argument | Meaning |
|---|---|
3 | Generate tests for phase 3 |
| (no number) | Use current phase from STATE.md |
CRITICAL: Run init command to load project state efficiently.
pbr-tools" init execute-phase {phase_number}
This returns STATE.md snapshot, phase plans, ROADMAP excerpt, and config — all in one call.
The init command returns files_to_read context. Ensure SUMMARY.md files are read before spawning test agents.
Scan the project root for test framework indicators:
package.json for jest, vitest, mocha, ava in devDependenciespytest.ini, pyproject.toml (with [tool.pytest]), setup.cfg (with [tool:pytest])jest.config.*, vitest.config.*, .mocharc.*tests/, test/, __tests__/, spec/*.test.*, *.spec.*, test_*.pyIf no test framework is detected, ask the user:
Use AskUserQuestion: question: "No test framework detected. Which should I use?" header: "Framework" options: - label: "Jest" description: "JavaScript/TypeScript testing (most common)" - label: "Vitest" description: "Vite-native testing (faster, ESM-friendly)" - label: "pytest" description: "Python testing framework" multiSelect: false
Read SUMMARY.md frontmatter from each plan in the phase to extract key_files:
pbr-tools" frontmatter .planning/phases/{NN}-{slug}/SUMMARY.md
Collect all key_files across all plans in the phase. Filter to only source files (exclude config, docs, assets). Group by:
Present the file list to the user:
Use AskUserQuestion: question: "Found {N} source files from phase {P}. Generate tests for which?" header: "Scope" options: - label: "High priority only" description: "{X} files — business logic, APIs, models" - label: "High + Medium" description: "{Y} files — adds utilities and helpers" - label: "All files" description: "{Z} files — comprehensive coverage" multiSelect: false
For each target file, create a lightweight test plan (NOT a full PBR PLAN.md — just a task list):
File: src/auth/login.js
Tests to generate:
- Happy path: valid credentials return token
- Error: invalid password returns 401
- Error: missing email returns 400
- Edge: expired session handling
Framework: jest
Output: tests/auth/login.test.js
CRITICAL: Delegate ALL test writing to subagents. Do NOT write test code in the main context.
For each target file (or batch of related files), spawn an executor agent:
Spawn subagent_type: "pbr:executor"
Task: Generate tests for the following file(s):
<files_to_test>
{file_path}: {brief description from SUMMARY}
</files_to_test>
<test_framework>
{detected framework name and version}
Existing test directory: {path}
Test file naming: {pattern, e.g., *.test.js}
</test_framework>
<test_plan>
{test plan from Step 4}
</test_plan>
Instructions:
1. Read each source file to understand the implementation
2. Write test files following the project's existing test patterns
3. Each test file should cover: happy path, error cases, edge cases
4. Use the project's existing mocking patterns if any exist
5. Run the tests to verify they pass: {test command}
6. Commit with format: test({phase}-tests): add tests for {file}
Spawn up to parallelization.max_concurrent_agents agents in parallel for independent files.
After all agents complete, check results:
{test_command}
Display completion:
╔══════════════════════════════════════════════════════════════╗
║ PLAN-BUILD-RUN ► TESTS GENERATED ✓ ║
╚══════════════════════════════════════════════════════════════╝
Phase {N}: {X} test files created, {Y} tests passing
Files tested:
- src/auth/login.js → tests/auth/login.test.js (8 tests)
- src/api/users.js → tests/api/users.test.js (12 tests)
╔══════════════════════════════════════════════════════════════╗
║ ▶ NEXT UP ║
╚══════════════════════════════════════════════════════════════╝
**Run quality gate** to check for requirement-to-test gaps
`/pbr:validate-phase {N}`
**Run coverage check** to see how much is covered
`npm test -- --coverage`
<sub>`/clear` first → fresh context window</sub>
**Also available:**
- `/pbr:verify-work {N}` — verify the full phase
- `/pbr:continue` — execute next logical step
Clear active skill: Delete .planning/.active-skill.
Reference: skills/shared/state-update.md for state update patterns.
Update STATE.md last_activity: "Tests generated for phase {N} ({X} files, {Y} tests)"
Reference: skills/shared/commit-planning-docs.md for the commit pattern.
If planning.commit_docs is true in config.json, commit test files:
test({N}-tests): add tests for phase {N} ({X} test files)
Reference: skills/shared/error-reporting.md for error output patterns.
If test framework detection fails or no key_files found, display branded error and clear .planning/.active-skill.
Run multiple phases hands-free. Chains discuss, plan, build, and verify automatically.
Start a new project. Deep questioning, research, requirements, and roadmap.
Execute all plans in a phase. Spawns agents to build in parallel, commits atomically.
Configure settings: depth, model profiles, features, git, and gates.
Execute the next logical step automatically. No prompts, no decisions — just do it.
Systematic debugging with hypothesis testing. Persistent across sessions.