legacy-code-safety

legacy-code-safety is a skill for Claude Code, Codex from tottinge/otter-skills. It costs 75 tokens per session (2,334 once invoked), scanned A, original, Apache-2.0.

A method for making one change safely in existing code whose behavior is poorly understood or weakly tested. It first creates trustworthy tests or test access that capture what the code currently does.

In plain words
What is it for?
Use it for characterization tests, approval tests, test harnesses, seams, separating side effects, breaking dependencies, and incremental replacement of risky live code.
Why use it?
It reduces the risk of breaking important behavior when documentation or tests are missing, slow, flaky, or tied to unrelated details. It gives the requested change a reliable feedback loop without requiring a full rewrite.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the otter-skills plugin — 7 skills shipped together

Good fit Use it for characterization tests, approval tests, test harnesses, seams, separating side effects, breaking dependencies, and incremental replacement of risky live code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tottinge/otter-skills/legacy-code-safety
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 tottinge/otter-skills --skill legacy-code-safety
Clone the repo
git clone --depth 1 https://github.com/tottinge/otter-skills

Made for: Claude Code, Codex.

Or install otter-skills, the plugin that ships this one along with the rest of its 7 skills.

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 legacy-code-safety

README.md
[![agentmods](https://agentmods.dev/badge/skills/tottinge/otter-skills/legacy-code-safety/github.svg)](https://agentmods.dev/skills/tottinge/otter-skills/legacy-code-safety)
Your own site
<a href="https://agentmods.dev/skills/tottinge/otter-skills/legacy-code-safety"><img src="https://agentmods.dev/badge/skills/tottinge/otter-skills/legacy-code-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for legacy-code-safety

Your own site · 80×15
<a href="https://agentmods.dev/skills/tottinge/otter-skills/legacy-code-safety"><img src="https://agentmods.dev/badge/skills/tottinge/otter-skills/legacy-code-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,334 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 original No closer match found 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.00075 $0.02334
Opus 5 $0.00037 $0.01167
Sonnet 5 $0.00015 $0.00467
Haiku 4.5 $0.00007 $0.00233

Measured yesterday against content hash b420ca891cd0, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

legacy-code-safety 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 yesterday.

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.

plugins/otter-skills/skills/legacy-code-safety/SKILL.md · 244 lines

How it starts

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

Legacy Code Safety

Make one requested change safe without demanding a cleanup campaign or rewrite first.

Legacy code is code for which the relevant behavior cannot be verified quickly and reliably. Existing tests may be absent, slow, flaky, too broad, or coupled to irrelevant structure. The immediate job is to establish enough trustworthy feedback for the change at hand.

Ownership and boundaries

Use this skill when:

  • relevant behavior is undocumented, surprising, or poorly understood
  • existing tests do not protect the intended change
  • dependencies or side effects keep code out of a test harness
  • the task calls for characterization, pinning, approval tests, seams, sensing, separation, or safe legacy-code change
  • a large brownfield transformation needs an incremental path through live code

Do not use it as the primary skill when:

  • a fast trustworthy test boundary already exists; use unit-testing
  • the request is review-only; use representation-refactor-review
  • the task is only to choose delivery slices; use story-splitting-for-delivery
  • the user requested a wholesale replacement; do not silently turn this skill into authorization for one

This skill owns establishing safety. unit-testing owns specifying and implementing the new behavior after that boundary exists.

Safety invariants

  • Start from an intentional workspace and record relevant inherited failures before editing.
  • Characterization describes observed behavior, not desired behavior.
  • Separate observations, suspected defects, and requested changes.
  • Break only the dependencies that block sensing or separation for this change.
  • Do not manufacture a unit-test target from code that merely composes effectful calls.
  • Production code must not branch on whether it is under test.
  • A test is not a safety net until it has demonstrated that it can fail for a relevant change.
  • Every caller-visible regression within scope must be capable of failing a test somewhere.
  • Prefer small, reversible changes through live code over a parallel rewrite.
  • Preserve unrelated user work. Create commits or external changes only when authorized.

Read the full file on GitHub · 244 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. yesterday Changed · +86 lines · +7 tokens per session b420ca891cd0
  2. 10d ago First seen · 158 lines · 68 tokens per session scan A 8cdd447ae1c2

Subscribe to this mod's changes

legacy-code-safety is a skill published in the GitHub repository tottinge/otter-skills (3 stars, last pushed 2d ago), licensed Apache-2.0. It adds 75 tokens to every session and 2,334 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

4-phase root cause debugging: understand bugs before fixing.

NousResearch/hermes-agent · 16 tokens

langsmith-observability

LLM observability platform for tracing, evaluation, and monitoring. Use when debugging LLM applications, evaluating model outputs against datasets, monitoring production systems, or building systematic testing pipelines for AI applications.

davila7/claude-code-templates · 45 tokens

experimental-code-coverage-local-debugger

Runs code coverage locally via Universal Test Runner (UTR) or helper scripts, mimicking LUCI trybots. Activate when CQ tryjobs fail or underreport coverage, to test local GN/recipe repairs before uploading, or to debug hermetic crashes.

chromium/chromium · 59 tokens

adversarial-reviewer

Adversarial code review that assumes bugs exist and hunts for them. Use when asked to review code, find bugs, audit for correctness, stress-test a PR, or when someone says "tear this apart" or "what's wrong with this". Give no benefit of the doubt — every line is guilty until proven innocent.

emdash-cms/emdash · 71 tokens

cli-e2e

Write, modify, or debug Docker-based Composio CLI end-to-end tests under ts/e2e-tests/cli, including binary invocation, fixture isolation, output assertions, and package manifests. Use for CLI E2E test suites only; use cli-command for CLI source implementation.

ComposioHQ/composio · 62 tokens

work

Deliver one maintainer-approved EmDash issue, choosing the bug-fix path for a defect and the direct implementation path for an enhancement or task.

emdash-cms/emdash · 31 tokens