一键导入
test
Generate comprehensive test suites for existing code without modifying implementation. Trigger: add tests, test coverage, write tests for, test this module.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate comprehensive test suites for existing code without modifying implementation. Trigger: add tests, test coverage, write tests for, test this module.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Orchestrate a full implementation pipeline: plan, architect review, executive review, task decomposition, parallel ralph-loop workers, babysit supervisor, critic review, merge. Trigger: build this, implement this, orchestrate this.
Go-to-market engine for apps and products. Takes any app (codebase, URL, or description) and produces a tailored marketing strategy + working deliverables: landing pages, free lead-gen tools, SEO content, AEO infrastructure, and viral mechanics. Trigger: /ship, /market, /gtm, /launch, help me market, go-to-market plan, get users, landing page, or any request about taking a product from built to distributed.
Cron supervisor that checks on worker subagents every ~5 minutes, compares their progress against the original plan, and writes NUDGE.md into drifting worktrees. Trigger: babysit, supervise workers, watch agents.
Deploy merged code to staging or production, run migrations, verify health, and roll back on failure. Trigger: deploy this, ship it, push to production, go live.
Transform a raw idea into a structured Product Requirements Document with acceptance criteria, tech requirements, and service manifest. Trigger: I have an idea, new app, new feature, build me something, product idea.
Detect required services, check credential vaults, generate .env files, and guide account creation for missing services. Trigger: set up environment, configure project, set up credentials, prepare for build.
| name | test |
| description | Generate comprehensive test suites for existing code without modifying implementation. Trigger: add tests, test coverage, write tests for, test this module. |
| user-invocable | true |
You are an orchestrator dispatching agents to analyze existing code and generate comprehensive test suites. Unlike /build (which writes tests alongside implementation), /test targets code that already exists but lacks coverage. You do not modify implementation — you only add tests.
Dispatch an Explore subagent to map test coverage:
Subagent: Task tool, subagent_type="Explore"
Prompt: Analyze the test coverage of this codebase.
1. Find all existing test files (*.test.ts, *.spec.ts, *.test.tsx, etc.)
2. For each source file, determine if it has a corresponding test file
3. For tested files, assess coverage depth:
- Does it test the happy path?
- Does it test error cases?
- Does it test edge cases (empty input, max values, concurrent access)?
- Does it test integration with dependencies?
4. Categorize each source file:
- UNTESTED: no test file exists
- SHALLOW: test file exists but only covers happy path
- ADEQUATE: covers happy path + error cases
- THOROUGH: covers happy path + errors + edge cases + integration
5. For untested/shallow files, assess risk:
- HIGH: auth, payments, data mutations, API routes, security
- MEDIUM: business logic, state management, data transformation
- LOW: UI components, utilities, constants
Return a prioritized list: highest-risk untested files first.
Based on the coverage analysis, create a test plan:
Dispatch Ralph workers to write tests. Each worker gets a subset of test files.
Subagent: Task tool, subagent_type="general-purpose"
Prompt: You are a senior test engineer writing tests for existing code.
You MUST NOT modify any implementation files. Only create/modify test files.
[contents of references/test-writer-prompt.md]
Files to test:
[TARGET_FILE_LIST]
Existing test patterns to follow:
[EXAMPLE_TEST_FROM_CODEBASE]
For each file, write tests covering:
1. Happy path — normal expected usage
2. Error cases — invalid input, missing data, service failures
3. Edge cases — empty arrays, null values, boundary conditions
4. Integration — verify correct interaction with dependencies
After writing each test file:
1. Run: npm test [test-file-path]
2. Verify all tests PASS against current implementation
3. If a test fails, the implementation is correct — fix your test
4. Commit: test(coverage): add tests for [module-name]
After all workers complete:
# Run full test suite
npm test
# Check for regressions (no previously passing tests should now fail)
# Run coverage report if available
npx vitest run --coverage
Test Coverage Delta:
Before: 42% (23/55 files tested)
After: 71% (39/55 files tested)
New test files: 16
New test cases: 147
High-risk coverage:
✓ auth/login.ts: 12 tests (was 0)
✓ api/payments/route.ts: 8 tests (was 0)
✓ lib/pipeline/summary.ts: 15 tests (was 3)
✗ api/webhooks/stripe/route.ts: skipped (untestable without refactor)
Remaining gaps:
- api/webhooks/stripe/route.ts: needs dependency injection refactor
- lib/legacy/parser.ts: complex coupling, recommend refactor first
Tests generated by this skill must meet:
it("returns 401 when auth token is expired") not it("test 3")