Agent skill · Testing & QA

characterization-test-generator

Generates tests that capture current behavior of existing code before refactoring. Use when you need a safety net before AI-assisted refactoring or modifying legacy code.

rshankrasgithub.com/rshankrasGitHub ↗
claude-codecan modify filesMIT
Install
npx skills add rshankras/claude-code-apple-skills --skill characterization-test-generator --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 8 KB
Bundled scripts: none
Allowed tools: ReadWriteEditGlobGrepBashAskUserQuestion
Path: skills/testing/characterization-test-generator/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 589
Language: Swift

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Characterization Test Generator Generate tests that document what existing code **actually does** — not what it should do. These tests capture current behavior so you can refactor with confidence, especially when using AI to modify code. ## When This Skill Activates Use this skill when the user: - Says "I need to refactor this" or "help me refactor" - Wants to "add tests before changing code" - Asks for "characterization tests" or "golden master tests" - Says "I want to safely modify this class/module" - Mentions "legacy code" or "untested code" - Wants AI to refactor but is worried about breaking things ## Why This Matters for AI-Generated Code AI refactoring is powerful but risky: - AI doesn't remember **why** code works a certain way - AI may "improve" code and break subtle behavior - Characterization tests freeze current behavior as a regression suite - If any test fails after refactoring, you know something changed ## Process ### Phase 1: Discover Code Under Test ``` Glob: **/*.swift (in the target module) Grep: "class |struct |enum |protocol |func " (public API surface) ``` Identify: - [ ] Public types and their public methods - [ ] Input types and return types - [ ] Side e

What's inside
Steps it walks through
  1. When This Skill Activates
  2. Why This Matters for AI-Generated Code
  3. Process
  4. Phase 1: Discover Code Under Test
  5. Phase 2: Classify Behavior
  6. Phase 3: Generate Tests
  7. Phase 4: Fill in Actual Values
  8. Phase 5: Verify and Lock
  9. Output Format
  10. When NOT to Use This
  11. References
Commands it runs
Run only characterization tests
xcodebuild test -scheme YourApp \
More from claude-code-apple-skills
All skills →
About this skill
What does the characterization-test-generator skill do?

Generates tests that capture current behavior of existing code before refactoring. Use when you need a safety net before AI-assisted refactoring or modifying legacy code.

How do I install it?

Run `npx skills add rshankras/claude-code-apple-skills --skill characterization-test-generator --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going