Writes unit/integration tests and mock data for existing code: 'write tests', 'unit test', 'mock data', 'coverage', '테스트 작성', '커버리지'. Generates unit tests, integration tests, and mock data by analyzing existing code and test conventions. Auto-detects test framework, follows project patterns, covers happy path, edge cases, and error scenarios. Use when user says 'write tests', 'test', 'unit test', 'integration test', 'mock data', 'fixture', 'coverage', '테스트', '테스트 작성', '목데이터', '커버리지'. Not for E2E story/scenario tests — that's the e2e-generator skill.
Ships in toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Detect conventions, analyze target code, generate comprehensive tests.
# Find test framework config
ls jest.config* vitest.config* .mocharc* pytest.ini setup.cfg pyproject.toml karma.conf* go.mod build.gradle* pom.xml Cargo.toml *.csproj Gemfile 2>/dev/null
# Find existing tests
find . -path ./node_modules -prune -o -path ./vendor -prune -o -path ./target -prune -o \( -name "*.test.*" -o -name "*.spec.*" -o -name "test_*" -o -name "*_test.*" -o -name "*_spec.rb" -o -name "*Test.java" -o -name "*Test.kt" -o -name "*_test.go" \) -print 2>/dev/null | head -20
# Find test utilities
find . -path ./node_modules -prune -o -path ./vendor -prune -o \( -name "testUtils*" -o -name "helpers*" -o -name "fixtures*" -o -name "factories*" -o -name "conftest*" -o -name "testdata" -o -name "testcontainers*" \) -print 2>/dev/null | head -10
Before writing any import in a generated test, check how the project's existing tests import shared test infrastructure (helpers, fixtures, factories, test DI setup):
import { helper } from '@scope/testing') vs deep path (import { helper } from '@scope/testing/unit/helper').Read 2-3 existing test files to extract:
If no existing tests found: Ask user for preferred framework, or default to:
| Language | Default Framework |
|---|---|
| TypeScript/JavaScript | Vitest |
| Python | pytest |
| Go | testing (stdlib) |
| Java | JUnit 5 |
| C# | xUnit |
| Ruby | RSpec |
For the file/function to test, extract:
When a test file already exists for the target source, detect newly added methods that lack test coverage and fill the gaps.
*.spec.ts, *.test.ts, test_*.py, *_test.go, *Test.java)describe, test_*, func Test*, @Test, class Test*)COVERAGE GAP ANALYSIS
=====================
Source: [source file path]
Tests: [test file path]
Covered: [N]
- methodA ✅
- methodB ✅
Uncovered: [M] ← generate tests
- methodC ❌ (newly added)
- methodD ❌ (newly added)
Dead tests: [K] ← review for removal
- oldMethodE (no matching source method)
For each target, identify applicable risk triggers. Mark N/A for inapplicable categories. Use the "What to Test" column to guide test case generation:
| Risk Category | Trigger Examples | Priority | What to Test |
|---|---|---|---|
| Concurrency / shared state | async, caches, globals | Critical | Simultaneous calls, shared state mutation, callback ordering |
| Resource usage | files, sockets, DB, timers | Critical | Handles/connections closed after use; repeated calls don't leak; cleanup on error path |
| Persistence / transactions | — | Critical | Partial failures leave consistent state; transactions rollback; no silent data drop |
| Security surface | user input, auth, file paths | Critical | Reject injection payloads (SQL, XSS, command); enforce auth on protected paths; sanitize file paths |
| Numeric / time handling | — | High | Off-by-one at boundaries, integer overflow/underflow, float comparison (epsilon), timezone conversion, DST, leap year |
| Text / encoding | — | High | UTF-8 multibyte, emoji, null bytes, control characters, mixed encodings, max-length strings |
| External I/O | network, disk, APIs | High | Network timeout handling, permission denied, disk full, connection reset recovery |
| Complex structures | — | Medium | Empty input, single element, deeply nested (10+ levels), circular refs, very large (10k+ items) |
| State lifecycle | — | Medium | Valid transitions succeed, invalid transitions rejected, lifecycle (init → active → disposed) |
| Error propagation | — | Medium | Errors bubble with correct type/message, error chains preserved, custom errors distinguishable |
Output: Before writing tests, produce a brief risk assessment noting which triggers apply and which are N/A.
Follow the project's existing pattern. If no pattern exists, use:
[Test file]
├── Imports & setup
├── Mock declarations (if dependencies exist)
├── describe "[Module/Function name]"
│ ├── describe "[method name]" (if class)
│ │ ├── test "returns X when given valid input" (happy path)
│ │ ├── test "returns Y when given edge case" (boundary)
│ │ ├── test "throws Z when given invalid input" (error)
│ │ └── test "calls dependency with correct args" (interaction)
│ └── ...
└── Cleanup / teardown
For each function/method, generate tests covering:
| Category | Count | Examples |
|---|---|---|
| Happy path | 1-2 | Normal input, expected output |
| Edge cases | 2-3 | Empty input, boundary values, max/min |
| Error cases | 1-2 | Invalid input, null, throws expected error |
| Async behavior | 1 | If async: success + failure paths |
| Dependencies | 1-2 | Mock returns, mock errors |
Add tests for each applicable category from the Risk-Based Test Planning table in Step 2.5. Skip inapplicable categories with brief justification.
Match project style. If none:
"should [verb] when [condition]" or "[verb]s [result] when [condition]"def test_[function]_[scenario]_[expected]():func Test[Function]_[Scenario](t *testing.T)Generate integration tests when the target involves external boundaries:
| Boundary | Test Approach |
|---|---|
| API endpoints | Status codes, headers, auth enforcement, request/response schema validation |
| Database | Transaction commit/rollback, constraint violations, isolation behavior |
| Message queues | Publish/consume round-trip, retry behavior, dead letter handling |
| Filesystem | Read/write with temp dirs, permission errors, path edge cases (spaces, unicode) |
| External services | Mock/fake by default; use sandbox only if already configured in project |
When a known bug is described or discovered:
// Regression: [bug description] - [date or issue ref]Core rules, non-negotiable:
Read references/mock-strategy.md in full before generating any mocks — it covers forbidden vs. correct mock patterns, layer-specific mock rules, passthrough vs. has-logic test sizing, the mandatory test validation checklist, and authorization/permission test boundaries.
When user asks for mock/test data:
@example.com domain (RFC 2606)__fixtures__/ or fixtures/factories/ or inlineconftest.pyFactory pattern preferred over static JSON when data is used across multiple tests.
# Run generated tests
[detected test command] [generated test file]
# Check coverage if available
[detected coverage command] [target file]
Report results:
TEST RESULTS
============
File: [test file path]
Tests: N passed, M failed, K skipped
Coverage: X% statements, Y% branches
RISK ASSESSMENT
===============
- [x] Concurrency: [tested / N/A - reason]
- [x] Resource cleanup: [tested / N/A - reason]
- [x] Security: [tested / N/A - reason]
- [x] Data integrity: [tested / N/A - reason]
- [x] Numeric/time: [tested / N/A - reason]
- [x] Encoding: [tested / N/A - reason]
- [x] I/O errors: [tested / N/A - reason]
GENERATED
=========
- [x] [N] unit tests for [target]
- [x] [M] edge case tests
- [x] [K] error handling tests
- [x] [J] integration tests (if applicable)
- [x] [L] regression tests (if applicable)
- [x] Mock data: [fixture file or inline]
If tests fail, fix them. Generated tests must pass.
@example.com for email fixtures, example.com for URL fixtures| Failure | Action |
|---|---|
| No test framework detected | Ask user, or suggest default for language |
| Target code has no types | Infer from usage, note uncertainty in test comments |
| Tests fail after generation | Debug and fix — never deliver failing tests |
| Circular dependencies in mocks | Restructure mocks, use dependency injection pattern |
| Complex class hierarchy | Focus on leaf classes first, mock parent behavior |
| Concurrency tests flaky | Use deterministic scheduling (fake timers, controlled async); avoid real delays |
| Integration test env unavailable | Fall back to unit tests with mocks; note skipped integration scope |
| Security test payloads blocked | Use allowlisted test payloads; document which injections were tested |
| Large dataset tests slow | Use representative subset; note full-scale was not tested |
| Time-dependent tests fail across timezones | Use UTC fixtures and fixed clock; never rely on system timezone |
Test fails with ReferenceError for a Web/runtime API (e.g. crypto, File) at import time | DO NOT polyfill it. This is a barrel anti-pattern — the barrel re-exported a module with runtime side effects. Follow Step 1.5 import-path check: import the specific symbol via its direct/subpath import instead of the barrel. |
What SKILL.md sets; muted values are Claude Code's defaults
/toolkit:test-generatorfrom toolkit
npx claudepluginhub siu9068/ggyul-skills --plugin toolkit49 skills in this plugin
/artifact-build디자인 소스 링크 하나(Claude 아티팩트, Claude Design 캔버스, Claude Docs, Figma, Open Design)를 받아 앱을 처음부터 완성까지 끌고 가는 오케스트레이터. claude.ai 채팅 링크(`claude.ai/chat/...?artifact=...`)나 아티팩트 링크를 붙여넣고 그대로 만들어 달라는 요청이면 링크가 문서인지 캔버스인지 확인하는 일까지 이 스킬이 맡으니 docs 도구로 먼저 가지 말고 이 스킬을 켠다. 모든 페이지를 읽어 스펙을 만들고, 프로젝트가 아직 없으면 project-setup 질문지만 사용자에게 묻고 세팅한 뒤, 나머지 결정은 자동승인 게이트가 내리며 api-creator, screen-creator, android-screen-creator, ios-screen-creator로 병렬 구현하고, 아티팩트 기준 검증에서 FAIL이 0이 될 때까지 갭을 고치고 다시 검증하기를 반복한다. 트리거: "이 아티팩트 링크대로 앱 만들어줘", "claude.ai/artifact/... 이거 보고 완성까지 자동으로 개발해줘", "피그마 링크 줄게 백엔드랑 안드로이드 iOS까지 다 만들어", "디자인 캔버스에 작업목록까지 있으니 끝까지 구현하고 검증해줘", "Open Design 시안대로 처음부터 끝까지". Do NOT use for: 링크 없이 스택만 세팅 (`project-setup`), 이미 있는 스펙 문서 구현 (`spec-implementer`), 한 줄 요청 구체화 후 구현 (`feature-builder`), 아티팩트에서 스펙만 뽑기 (`artifact-build-ingest`), 검증만 (`artifact-build-verify`), 레퍼런스로 토큰만 (`design-system-import`)./artifact-build-ingest디자인 소스 링크(Claude 아티팩트, Claude Design 캔버스, Claude Docs 문서, Figma 파일, Open Design 같은 웹 디자인 도구)의 모든 페이지를 로컬로 받아, 페이지 묶음마다 서브에이전트를 병렬로 돌려 요구사항을 뽑고, 출처 페이지가 달린 spec-creator 형식의 스펙(`docs/specs/` 아래 마크다운)과 소스 매니페스트로 만든다. 아티팩트에 작업목록 페이지가 있으면 그 목록을 작업 표의 뼈대로 쓴다. 트리거: "이 아티팩트 읽어서 스펙으로 뽑아줘", "피그마 링크 전체 페이지 요구사항 정리해줘", "claude.ai/artifact 링크 화면 목록이랑 작업 표로 만들어줘", "이 디자인 캔버스 모든 페이지 보고 docs/specs에 정리". 링크를 받아 세팅, 구현, 검증까지 끝까지 가는 전체 요청이면 `artifact-build` 경유. Do NOT use for: 인터뷰로 스펙을 새로 쓰는 일 (`spec-creator`), 이미 있는 스펙을 구현하는 일 (`spec-implementer`), 구현이 아티팩트를 충족하는지 판정하는 일 (`artifact-build-verify`), 레퍼런스로 디자인 토큰만 뽑는 일 (`design-system-import`, `native-design-system-import`).Other plugins' skills for the same job