TDD with RGRC cycle and Baby Steps methodology. Triggers: TDD, テスト駆動開発, Red-Green-Refactor, Baby Steps, test generation, テスト生成, テスト設計, テストケース, boundary value, 境界値分析, coverage, カバレッジ, unit test
/plugin marketplace add thkt/claude-config/plugin install complete-workflow-system@thkt-development-workflowsThis skill is limited to using the following tools:
EVALUATIONS.mdREADME.mdassets/jest.config.jsassets/vitest.config.tsreferences/bug-driven.mdreferences/feature-driven.mdSystematic Test-Driven Development combining RGRC cycle, Baby Steps, and test design techniques.
"Make the smallest possible change at each step" - t_wada
| Step | Time | Action |
|---|---|---|
| 1 | 30s | Write smallest failing test |
| 2 | 1min | Make it pass minimally |
| 3 | 10s | Run tests |
| 4 | 30s | Tiny refactor (if needed) |
| 5 | 20s | Commit if green |
Why: Bug is always in last 2-minute change. Always seconds from green.
Copy and track progress:
TDD Cycle:
- [ ] Red - 失敗するテスト作成 (verify correct failure reason)
- [ ] Green - 最小限のコードで通過 (dirty OK)
- [ ] Refactor - コード改善 (keep tests green)
- [ ] Commit - 変更をコミット (all checks pass)
| Phase | Goal | Rule |
|---|---|---|
| Red | Failing test | Verify failure reason is correct |
| Green | Pass test | "You can sin" - quick/dirty OK |
| Refactor | Clean code | Apply SOLID/DRY, keep green |
| Commit | Save state | All checks pass |
| Technique | Use For | Example |
|---|---|---|
| Equivalence Partitioning | Group inputs with same behavior | Age: <18, 18-120, >120 |
| Boundary Value | Test edges | 17, 18, 120, 121 |
| Decision Table | Complex multi-condition logic | isLoggedIn × isPremium → access |
| Level | Target | Focus |
|---|---|---|
| C0 (Statement) | 80% | All lines executed |
| C1 (Branch) | 70% | All branches taken |
Why these targets: Cost-benefit balance, focus on critical paths.
test("descriptive name", () => {
// Arrange - Setup
// Act - Execute
// Assert - Verify
});
Not everything needs to be tested. Prioritize by impact.
Decision Criteria: "If this logic breaks, will it impact users?"
Consistent naming makes test intent clear.
describe("[TargetClass/FunctionName]", () => {
describe("[MethodName/Scenario]", () => {
it("when [condition], should [expected result]", () => {
// Arrange - Act - Assert
});
});
});
describe("PriceCalculator", () => {
describe("calculateTotal", () => {
it("when empty array, should return 0", () => {
expect(calculator.calculateTotal([])).toBe(0);
});
it("when discount code applied, should return discounted total", () => {
const items = [{ price: 1000, quantity: 2 }];
expect(calculator.calculateTotal(items, "SAVE10")).toBe(1800);
});
it("when tax included, should return total with correct tax", () => {
const items = [{ price: 1000, quantity: 1 }];
expect(calculator.calculateTotal(items, null, { includeTax: true })).toBe(
1100,
);
});
});
});
| Element | Good | Bad |
|---|---|---|
| Condition | when empty array | test1 |
| Expected | should return 0 | works correctly |
| Context | when discount applied | discount |
Tip: Use descriptive names that serve as documentation
The test-generator agent creates test scaffolding from specifications or bug descriptions.
Use Case: Generating tests from spec.md for /code command
Task({
subagent_type: "test-generator",
description: "Generate skipped tests from specification",
prompt: `
Feature: "${featureDescription}"
Spec: ${specContent}
Generate tests in SKIP MODE:
1. FR-xxx requirements → skipped test cases
2. Given-When-Then scenarios → skipped executable tests
3. Order tests: simple → complex (Baby Steps order)
4. Use framework-appropriate skip markers:
- Jest/Vitest: it.skip() + // TODO: [SKIP] comment
`,
});
Use Case: Generating regression tests for /fix command
Task({
subagent_type: "test-generator",
description: "Generate regression test for bug fix",
prompt: `
Bug: "${bugDescription}"
Root Cause: "${rootCause}"
Fix Applied: "${fixSummary}"
Generate:
1. Test that reproduces original bug (should now pass)
2. Edge case tests related to the fix
3. Integration test if cross-component fix
`,
});
Use Case: Adding tests to improve coverage
Task({
subagent_type: "test-generator",
description: "Generate tests for uncovered code paths",
prompt: `
File: ${filePath}
Uncovered lines: ${uncoveredLines}
Existing test style: ${testStyle}
Generate tests for uncovered code paths.
Target coverage: 80%+
`,
});
| Framework | Skip Syntax |
|---|---|
| Jest/Vitest | it.skip('test', () => { // TODO: [SKIP] FR-001 }) |
| Mocha | it.skip('test', function() { }) or xit('test', ...) |
| Unknown | Comment out with // TODO: [SKIP] marker |
| Practice | Good | Bad |
|---|---|---|
| Context | Specific requirements | "Generate tests" |
| Markers | Clear skip marker with FR-xxx | No marker |
| Order | Simple → Complex (Baby Steps) | Random order |
| Focus | One behavior per test | Multiple assertions |
applying-code-principles - コード原則適用/code - TDD実装サイクル/fix - バグ修正のリグレッションテスト/test - テスト実行・検証This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.