ワンクリックで
test-generation
Use when the user asks for tests, mentions TDD, or when new code has been written and needs test coverage.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when the user asks for tests, mentions TDD, or when new code has been written and needs test coverage.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Task management CLI for tracking and managing feature subtasks with status, dependencies, and validation
Use when coding standards, security patterns, or project conventions need to be discovered before implementation begins.
Install context files from registry. Use when user runs /install-context, says "install context", "setup context", or when context is missing and the user needs to get started.
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
Use when the task involves an external library or package and current API docs are needed before writing code.
Use before any implementation — understands the request, discovers project context, and proposes a concise plan for user approval before writing any code.
| name | test-generation |
| description | Use when the user asks for tests, mentions TDD, or when new code has been written and needs test coverage. |
| context | fork |
| agent | test-engineer |
Generate comprehensive tests following TDD principles and project testing standards. Runs in isolated test-engineer context with pre-loaded testing conventions.
Announce at start: "I'm using the test-generation skill to create tests for [feature/component]."
Provide clear requirements to test-engineer:
/test-generation
Feature: JWT token validation middleware
Behaviors:
1. Valid token → allow request
2. Expired token → reject with 401
3. Invalid signature → reject with 401
4. Missing token → reject with 401
Coverage: All critical paths
Testing Standards (pre-loaded):
- Framework: vitest
- Mocks: vi.mock()
- Structure: AAA pattern
Test-engineer proposes a test plan:
## Test Plan
Behaviors:
1. Valid token
- ✅ Positive: Allow request with valid JWT
- ❌ Negative: Reject malformed JWT
2. Expired token
- ✅ Positive: Normal token works
- ❌ Negative: Expired token rejected with 401
Mocking Strategy:
- JWT verification: Mock with vi.mock()
- Request/Response: Use test doubles
Coverage Target: 95% line coverage, all critical paths
IMPORTANT: Review and approve before implementation proceeds.
Test-engineer implements following AAA pattern (Arrange-Act-Assert):
describe('JWT Middleware', () => {
it('allows request with valid token', () => {
// Arrange
const req = mockRequest({ headers: { authorization: 'Bearer valid.jwt.token' } });
// Act
const result = jwtMiddleware(req);
// Assert
expect(result.authorized).toBe(true);
});
});
Test-engineer verifies:
Execute test suite and verify all pass:
npm test -- jwt.middleware.test.ts
status: success
tests_written: 8
coverage:
lines: 96%
branches: 93%
functions: 100%
behaviors_tested:
- name: "Valid token handling"
positive_tests: 2
negative_tests: 2
test_results:
passed: 8
failed: 0
deliverables:
- "src/auth/jwt.middleware.test.ts"
For test-driven development, invoke BEFORE implementation:
/test-generation
Write tests for user registration endpoint (not yet implemented):
Expected Behavior:
- POST /api/register with valid data → 201 + user object
- POST /api/register with duplicate email → 409 error
- POST /api/register with invalid email → 400 error
Note: Implementation does not exist. Write tests that define expected behavior.
Tests will fail initially—use them as spec to guide implementation.
Tests don't match project conventions:
.opencode/context/core/standards/tests.mdMissing edge cases:
Flaky tests:
If you think any of these, STOP and re-read this skill:
| Excuse | Reality |
|---|---|
| "It's too simple to break" | Simple code breaks in simple ways. Tests document the contract, not just catch bugs. |
| "Negative tests are obvious failures, not worth writing" | Negative tests are where bugs hide. "Obviously fails" is not the same as "correctly fails". |
| "Mocking this dependency is too hard" | Hard-to-mock dependencies are a design smell. Mock them anyway and note the smell. |
| "Tests slow down delivery" | Tests without negative cases give false confidence. False confidence slows delivery more. |