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.
npx agentmods add skills/clubpay/ronykit/working-with-legacy-codenpx skills add clubpay/ronykit --skill working-with-legacy-codegit clone --depth 1 https://github.com/clubpay/ronykitWrote 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.
[](https://agentmods.dev/skills/clubpay/ronykit/working-with-legacy-code)<a href="https://agentmods.dev/skills/clubpay/ronykit/working-with-legacy-code"><img src="https://agentmods.dev/badge/skills/clubpay/ronykit/working-with-legacy-code.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00069 | $0.04341 |
| Opus 5 | $0.00034 | $0.02171 |
| Sonnet 5 | $0.00014 | $0.00868 |
| Haiku 4.5 | $0.00007 | $0.00434 |
Grade A, and why
working-with-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 5d 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.
This is a copy
97% identical to working-with-legacy-code — 49 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.
How it starts
The opening of the file, as written. The whole thing — 250 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Working Effectively with Legacy Code
A field manual for changing code that has no tests, distilled from Michael C. Feathers' Working Effectively with Legacy Code. Use it to get untestable classes into a harness, pin down current behavior with characterization tests, and make changes one safe, verifiable step at a time — without resorting to a rewrite.
When to use
- Touching a RonyKit feature module that lacks app unit or repo integration tests (even "new" code without tests is legacy).
- Bug fixes in
internal/apporinternal/repowith no failing test to start from. - Before
refactoring-patternswhen the safety net is missing.
RonyKit testing order
After pinning behavior with characterization tests here, bring coverage up to workspace standard:
- Repo ports —
x/testkitintegration tests ininternal/repo/integration_test/(happy path, not-found, conflict). MCParchitecture/integration-tests. - App methods — unit tests for every exported
Appmethod ininternal/app/. - Verify —
make verifyin the feature module before claiming done.
Use constructor injection (x/di) and repo ports as natural seams. Never
silently "fix" wrong behavior you discover while characterizing — pin it, file
it, fix deliberately in a separate commit.
Core Principle
Legacy code is simply code without tests. Not old code, not ugly code — untested code: without tests you cannot know whether a change preserves behavior, so every edit is a gamble. The craft is breaking dependencies just enough to get tests in place before changing anything — cover and modify, never edit and pray.
Scoring
Goal: 10/10. Rate changes to untested code 0-10 against the principles below. Report the current score and the specific steps needed to reach 10/10.
- 9-10: Change points covered by characterization tests before any edit; behavior changes and refactoring shipped as separate verified steps; dependencies broken with the least invasive technique
- 7-8: Tests at most change points, but occasional mixed refactor-plus-behavior commits or heavier dependency surgery than needed
- 5-6: Some characterization tests, yet key paths still changed on faith; sprouted code accumulating with no payback plan
- 3-4: Edit-and-pray with manual verification; tests written after the change, asserting whatever the new code happens to do
- 0-2: Untested edits straight into tangled code, refactoring and behavior change mixed in one commit, rewrite proposed instead of tests
What ships with it
5 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.
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.
- 5d ago First seen · 250 lines · 69 tokens per session scan A 17b6a28a234d
working-with-legacy-code is a skill published in the GitHub repository clubpay/ronykit (38 stars, last pushed 4d ago), licensed BSD-3-Clause. It adds 69 tokens to every session and 4,341 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 97% identical to working-with-legacy-code, differing in 49 lines, and is treated as a copy.
Other skills, from other repositories
ast-introspection
Use Go AST-aware analysis to enumerate symbols, extract signatures, and propose mechanically safe refactors (read-only by default).
dependency-auditor
Inspect Go module dependencies, detect outdated or vulnerable modules, and recommend safe updates or pinning strategies.
test-runner
Run and triage Go tests with correct environment handling; produce compact, actionable failure summaries.
rpc
Vovk.ts RPC client — how vovk generate turns controllers into type-safe client modules, composed vovk-client vs segmented clients, call shape (apiRoot, params, body, query, meta, init, disableClientValidation, validateOnClient, interpretAs, transform, fetcher), customizing generation via outputConfig.imports.fetcher +…
bundle
Vovk.ts vovk bundle CLI — packages composed TypeScript client as zero-dep publishable npm package. Covers bundle.build async fn, [email protected] recipe, outputConfig.origin / package / reExports / imports.validateOnClient: null, prebundleOutDir / outDir / keepPrebundleDir, --include/--exclude segments, --openapi- mixin…
decorators
Vovk.ts decorators — built-in (@prefix, @operation, @get/@post/@put/@patch/@del, .auto()) and custom via createDecorator. Covers authorization / auth decorators, middleware-style wrapping (pre-handler + post-handler logic), req.vovk.meta() for cross-decorator state, stacking order, the decorate() alternative for…