Characterization Test Writer

Characterization Test Writer is a skill for Claude Code, Codex from SkillMedev/legacy-modernization. It costs 148 tokens per session (1,415 once invoked), scanned A, a copy of Characterization Test Writer, MIT.

Tests that record what untested legacy code currently does, including its bugs. They act as a safety net while the code is refactored.

In plain words
What is it for?
Use it before changing a module with few or no tests, especially when it depends on databases, clocks, networks, files, or global settings.
Why use it?
A refactor can quietly change an output that other parts of the system depend on. These tests make such changes visible by failing when behavior changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it before changing a module with few or no tests, especially when it depends on databases, clocks, networks, files, or global settings.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/skillmedev/legacy-modernization/characterization-test-writer
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add SkillMedev/legacy-modernization --skill characterization-test-writer
Clone the repo
git clone --depth 1 https://github.com/SkillMedev/legacy-modernization

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Characterization Test Writer

README.md
[![agentmods](https://agentmods.dev/badge/skills/skillmedev/legacy-modernization/characterization-test-writer.svg)](https://agentmods.dev/skills/skillmedev/legacy-modernization/characterization-test-writer)
Your own site
<a href="https://agentmods.dev/skills/skillmedev/legacy-modernization/characterization-test-writer"><img src="https://agentmods.dev/badge/skills/skillmedev/legacy-modernization/characterization-test-writer.svg" alt="Measured on agentmods" height="20"></a>
Per session 148 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,415 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00148 $0.01415
Opus 5 $0.00074 $0.00707
Sonnet 5 $0.00030 $0.00283
Haiku 4.5 $0.00015 $0.00142

Measured 7d ago against content hash cc3de90e398b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

Characterization Test Writer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to Characterization Test Writer — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/characterization-test-writer/SKILL.md · 81 lines

How it starts

The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Characterization Test Writer

Pin what legacy code currently does - bugs included - so a refactor that changes behavior fails loudly instead of silently. The costly mistake this prevents is the "clean" refactor that quietly changes an output nobody noticed was load-bearing, discovered weeks later in production. A characterization test records reality; it never judges it.

Operating procedure

Order matters: the seam must exist before you can capture output, output must be captured before you can stabilize it, and coverage is only measurable once tests run.

Step 1: Gather inputs

  • The exact function/module about to change, and the refactor's blast radius - which code paths will the change touch? Only those need pinning.
  • The dependency list: database, clock, RNG, network, filesystem, globals, environment. Each is a nondeterminism source to control in Step 4.
  • Any recorded production inputs or logs available for replay. Label assumptions about "typical inputs" as guesses.

Step 2: Find the smallest seam

Untested legacy code reaches for databases, clocks, network, and globals, so it usually cannot be called in isolation. Introduce the minimum seam that lets you invoke it: extract a method, parameterize a constructor, inject the dependency, or subclass-and-override (the "subclass to sense" technique from Working Effectively with Legacy Code). Do not refactor the body before the net exists - seam-introduction edits must be mechanical and behavior-preserving (rename, extract, inject), nothing that changes logic.

Step 3: Capture actual output, not expected

Write a deliberately failing assertion, run it, read the real value from the failure message, and paste it in:

def test_characterize_shipping_for_oversize_order():
    result = calc_shipping(weight_kg=32, region="EU")
    assert result == "PLACEHOLDER"   # run -> failure says: AssertionError: 47.6 != PLACEHOLDER

becomes, after one run:

def test_characterizes_oversize_eu_shipping():
    result = calc_shipping(weight_kg=32, region="EU")
    assert result == 47.6  # observed 47.6, not the 45.0 the spec claims - see pins_known_bug below

Read the full file on GitHub · 81 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 81 lines · 148 tokens per session scan A cc3de90e398b

Subscribe to this mod's changes

Characterization Test Writer is a skill published in the GitHub repository SkillMedev/legacy-modernization (2 stars, last pushed 2mo ago), licensed MIT. It adds 148 tokens to every session and 1,415 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to Characterization Test Writer, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

Unit Test Improver

Reviews existing unit tests for gaps, weak assertions, and missing edge cases, then rewrites them to be more robust.

Notysoty/openagentskills · 29 tokens

Unit Test Writer

Generates comprehensive unit tests for any function or module with edge cases.

Notysoty/openagentskills · 18 tokens

writing-tests

Write unit tests, component tests, and integration tests for AiderDesk using Vitest and React Testing Library. Use when creating new tests, adding test coverage, configuring mocks, setting up test files, or debugging failing tests.

hotovo/aider-desk · 48 tokens

review-ugc-render

Mandatory pre-publish review gate for a UGC video render. Transcribes the finished render's AUDIO with Whisper and word-diffs it against the approved spoken script, then gates setfinalrender — blocking a render whose generated audio mis-voices a word (e.g. the approved "human-vetted" spoken as "human witted"), drops…

gooseworks-ai/goose-skills · 116 tokens

test-generator

A test-writing helper that creates unit or integration tests from the code's actual behavior and contracts. Unit tests check small pieces of code, while integration tests check how real components work together.

laolaoshiren/claude-code-skills-zh · 79 tokens

testing-r-packages

Best practices for writing R package tests using testthat version 3+. Use when writing, organizing, or improving tests for R packages. Covers test structure, expectations, fixtures, snapshots, mocking, and modern testthat 3 patterns including self-sufficient tests, proper cleanup with withr, and snapshot testing.

posit-dev/skills · 67 tokens