Characterize
Skill bkitduy/characterization-test-generator/skills/characterize
Claude Code plugin: Generate characterization tests for legacy code before AI modification. Supports Go, Python, TypeScript, JavaScript, Kotlin, Java.
npx -y skills add bkitduy/characterization-test-generator --skill characterizeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Generate characterization tests (approval/snapshot/golden master tests) for legacy code before refactoring or AI modification. Use when asked to characterize, lock behavior, create approval tests, snapshot existing behavior, add safety net tests before refactoring, protect legacy code before AI changes, or generate golden master tests. Supports Go, Python, TypeScript/JavaScript, Kotlin, and Java.
SKILL.md
4.3 KB, as published. Nobody here has run it
Characterization Test Generator
Generate characterization tests that document existing code behavior before modification. These tests are safety nets — they lock current behavior so refactoring or AI-assisted changes can be verified.
For background theory, read references/theory.md. For language-specific patterns, read references/language-patterns.md.
Workflow
Step 1: Identify targets
Read the file or directory specified by the user. Identify all public functions/methods that:
- Have business logic (not simple getters/setters)
- Accept parameters and return values
- Perform transformations, calculations, or orchestration
List targets and confirm with user before proceeding.
Step 2: Analyze each target
For each function:
- Read the implementation thoroughly
- Identify all code paths (if/else, switch, error handling)
- Determine input types and realistic sample values
- Identify output shape and unstable fields (timestamps, IDs, random values)
- Note external dependencies that need mocking
Step 3: Generate characterization tests
Follow the Feathers Method for each function:
- Create test with descriptive name:
TestCharacterize_<FunctionName>_<Scenario> - Provide realistic input (prefer production-like data over trivial examples)
- Call the function
- Scrub unstable data — replace timestamps, UUIDs, random values with placeholders
- Use golden file / snapshot pattern for the target language
- Cover all code paths identified in Step 2
Critical rules:
- Do NOT fix bugs discovered during characterization — document them as comments
- Do NOT modify the production code being characterized
- Do NOT use trivial inputs — use realistic, production-like data
- DO scrub all unstable fields before comparison
- DO name tests to describe discovered behavior, not expected behavior
- DO aim for full branch coverage of the target function
Step 4: Verify with mutations
After generating tests, verify they catch changes:
- Suggest 2-3 mutations the user should try (comment out key lines)
- Explain what test should fail for each mutation
- If a mutation doesn't cause a test failure, add more test cases
Step 5: Output
Generate files following project conventions:
- Place tests in the project's existing test directory structure
- Use the project's existing test framework and assertion library
- Create
testdata/golden/directory for golden files if applicable - Include a helper function for scrubbing unstable data
Output a summary:
Characterization Tests Generated
=================================
Target: <file path>
Functions characterized: X
Test cases generated: Y
Estimated coverage: Z%
Files created:
- tests/characterization/test_char_<name>.py
- tests/characterization/testdata/golden/<name>.json
Next steps:
1. Run tests to capture golden files: <command>
2. Verify coverage: <command>
3. Try mutation: comment out line N in <file>, expect test X to fail
Language Detection
Detect language from file extension and project structure:
.go+go.mod→ Go (usetesting+ golden files).py+requirements.txt/pyproject.toml→ Python (usepytest+approvaltests).ts/.tsx+package.json→ TypeScript (usejestsnapshots).js/.jsx+package.json→ JavaScript (usejestsnapshots).kt+build.gradle→ Kotlin (use JUnit + ApprovalTests).java+pom.xml/build.gradle→ Java (use JUnit + ApprovalTests)
Scrubbing Strategy
Always scrub these fields before capturing golden output:
- Timestamps:
created_at,updated_at,timestamp,date,time - Identifiers:
id,uuid,request_id,job_id,session_id - Performance:
execution_time,duration,elapsed - System:
hostname,pid,port - Secrets: any field containing
key,token,secret,password
Replace with stable placeholders: [TIMESTAMP], [ID], [DURATION], etc.