legacy-code

legacy-code is a skill for Claude Code from bdfinst/agentic-dev-team. It costs 34 tokens per session (1,884 once invoked), scanned A, original, MIT.

A method for changing code that has little or no test coverage. It first records how the code currently behaves, then supports small, safer changes.

In plain words
What is it for?
Use it when modifying legacy code, adding characterization tests, finding places where behavior can be observed, or separating code from difficult dependencies.
Why use it?
It reduces the risk of accidentally changing existing behavior when working in unfamiliar or poorly tested code. Tests provide a safety check before structure is improved.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the dev-team plugin — 98 skills, 54 agents, 4 hooks shipped together

Good fit Use it when modifying legacy code, adding characterization tests, finding places where behavior can be observed, or separating code from difficult dependencies.

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

Made for: Claude Code.

Or install dev-team, the plugin that ships this one along with the rest of its 98 skills, 54 agents, 4 hooks.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/bdfinst/agentic-dev-team/legacy-code/github.svg)](https://agentmods.dev/skills/bdfinst/agentic-dev-team/legacy-code)
Your own site
<a href="https://agentmods.dev/skills/bdfinst/agentic-dev-team/legacy-code"><img src="https://agentmods.dev/badge/skills/bdfinst/agentic-dev-team/legacy-code/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

Your own site · 80×15
<a href="https://agentmods.dev/skills/bdfinst/agentic-dev-team/legacy-code"><img src="https://agentmods.dev/badge/skills/bdfinst/agentic-dev-team/legacy-code.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,884 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00034 $0.01884
Opus 5.5 $0.00014 $0.00754
Sonnet 5.5 $0.00007 $0.00377
Haiku 4.5 $0.00003 $0.00188

Measured 1mo ago against content hash 44849971e661, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

legacy-code 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 1mo 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.

plugins/dev-team/skills/legacy-code/SKILL.md · 133 lines

How it starts

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

Legacy Code

Role: worker. This command applies characterization-testing and dependency-breaking techniques directly to the code under change.

Overview

Techniques for safely modifying code that lacks tests or has poor structure. Based on the principle that legacy code is code without tests (Michael Feathers' definition) — regardless of age. The goal is to get code under test before changing it, then improve structure incrementally.

Constraints

  • Never change behavior and structure in the same step; refactor under green tests only
  • Write characterization tests before modifying legacy code — not after
  • Prefer the smallest dependency break that gets code under test
  • Do not apply aggressive refactoring without test coverage

Core Concepts

Legacy Code Definition

Code without tests. A well-structured 6-month-old codebase with no tests is legacy. A messy 10-year-old codebase with comprehensive tests is not. The presence or absence of tests determines whether you can change code safely.

The Legacy Code Change Algorithm

  1. Identify change points — where in the code does the change need to happen?
  2. Find test points — where can you observe the effects of the change?
  3. Break dependencies — make the code testable without changing its behavior
  4. Write tests — characterization tests that lock down existing behavior
  5. Make changes and refactor — now that tests protect you, modify behavior and improve structure

Seams

A seam is a place where behavior can be altered without editing the code under test:

  • Object seams — use polymorphism to substitute behavior (interfaces, subclasses)
  • Link seams — substitute dependencies at the linking/import level (dependency injection, module mocking)
  • Preprocessing seams — alter behavior via build configuration, feature flags, or compile-time substitution

Characterization Tests

Tests that document what the code actually does, not what it should do. They lock down existing behavior so you can detect unintended changes. Characterization tests answer: "If I make a change here, what breaks?"

Read the full file on GitHub · 133 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. 1mo ago First seen · 133 lines · 34 tokens per session scan A 44849971e661

Subscribe to this mod's changes

legacy-code is a skill published in the GitHub repository bdfinst/agentic-dev-team (295 stars, last pushed 4d ago), licensed MIT. It adds 34 tokens to every session and 1,884 once invoked, about $0.0001 per session on Opus 5.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-09-03.