Install
openclaw skills install bookforge-legacy-code-symptom-routerDiagnose any legacy-code situation in plain language and route to the right technique. Use as the FIRST skill when a developer has a vague or specific complaint about a codebase — 'I have to change this but there are no tests', 'this method is huge', 'can't test this class', 'library is killing us', 'changes take forever', 'don't know where to start', 'overwhelmed', 'inherited this mess'. Activates for 'legacy code', 'untested code', 'where do I start', 'what should I do with this code', 'help me plan a refactor', 'I'm stuck with legacy', 'how do I change X safely', 'symptom triage'. Dispatches to technique-specific skills.
openclaw skills install bookforge-legacy-code-symptom-routerYou have legacy code (code without tests, or with very few tests) and you need to change it, understand it, or improve it — but you are not sure which technique applies. You may be feeling one of these:
This skill takes your situation in plain language and matches it to one of the 19 symptom chapters in Part II of Working Effectively with Legacy Code (Feathers, 2004). Each chapter maps to a downstream skill with the specific technique you need.
Use this skill BEFORE any other skill in this set, unless you already know the technique. The outer procedure is always legacy-code-change-algorithm; this skill tells you which sub-procedure to invoke.
The only required input is a plain-language description of the situation in the developer's own words.
Helpful additional context (ask if not provided):
If the developer's description maps unambiguously to one symptom (e.g., "500-line method"), proceed to classification without asking. If the description is ambiguous between two symptoms (e.g., "everything takes forever" could be comprehension lag or build lag), ask the one diagnostic question that distinguishes them.
Ask the developer to describe their situation in plain language. If they have given you a description already, extract the core symptom phrase — the thing that feels wrong.
If the description is vague, ask one targeted question from this list:
Match the description to one of the 19 symptom categories below. The full routing table with technique details is in references/symptom-routing-table.md. Use the quick-reference summary here to classify.
19 Symptoms — Quick Reference
| # | Plain-Language Symptom | Chapter | Root Cause | Downstream Skill |
|---|---|---|---|---|
| 1 | "I have no time and must change it now" | Ch 6 | Time pressure | legacy-code-addition-techniques |
| 2 | "Changes take forever" | Ch 7 | Lag: build or comprehension | scratch-refactoring-for-code-understanding (comprehension) or dependency-breaking-technique-executor (build) |
| 3 | "How do I add a feature?" | Ch 8 | Feature addition with tests | tdd-and-programming-by-difference |
| 4 | "Can't get this class into a test harness" | Ch 9 | Class testability | test-harness-entry-diagnostics |
| 5 | "Can't run this method in a test harness" | Ch 10 | Method testability | test-harness-entry-diagnostics |
| 6 | "What methods should I test?" | Ch 11 | Effect radius unknown | change-effect-analysis |
| 7 | "Many changes in one area" | Ch 12 | Multi-class change cluster | change-effect-analysis (pinch points) |
| 8 | "Don't know what tests to write" | Ch 13 | Behavior unknown | characterization-test-writing |
| 9 | "Library dependencies are killing me" | Ch 14 | Library coupling | library-seam-wrapper |
| 10 | "My app is all API calls" | Ch 15 | API coupling | library-seam-wrapper |
| 11 | "Don't understand code well enough to change it" | Ch 16 | Comprehension failure | scratch-refactoring-for-code-understanding |
| 12 | "App has no structure" | Ch 17 | Architectural opacity | scratch-refactoring-for-code-understanding + big-class-responsibility-extraction |
| 13 | "Test code is in the way" | Ch 18 | Test organization | unit-test-quality-checker + conventions |
| 14 | "Not object oriented" | Ch 19 | No OO seams | dependency-breaking-technique-executor (link/procedural techniques) |
| 15 | "Class is too big" | Ch 20 | SRP violation | big-class-responsibility-extraction |
| 16 | "Changing same code all over the place" | Ch 21 | Duplication | duplication-removal-via-extraction |
| 17 | "Monster method" | Ch 22 | Method too large to test | monster-method-decomposition |
| 18 | "How do I know I'm not breaking anything?" | Ch 23 | No safety net | safe-legacy-editing-discipline + characterization-test-writing |
| 19 | "We feel overwhelmed" | Ch 24 | Morale / no procedure | legacy-code-change-algorithm (start here) |
Confirm with the developer: "I'm reading your situation as: [symptom summary]. Does that match what you're experiencing?" If yes, proceed. If no, ask the diagnostic question that disambiguates.
Classify the root cause into one of five categories. This shapes the technique approach:
Some symptoms span categories (Symptom 2 = build lag OR comprehension lag; Symptom 18 = safety discipline AND characterization tests). Where two root causes apply, identify the primary one to address first.
Recommend the downstream skill by name with a 1-paragraph preview of what the developer should expect. See references/symptom-routing-table.md for full technique previews for each symptom.
Provide:
Write a triage.md file in the working directory capturing the session output.
See triage.md template in the Outputs section below.
| Input | Required | Description |
|---|---|---|
| Developer's symptom description | Yes | Plain-language description of what is wrong or difficult |
| Language / runtime | Recommended | Determines which seam types and techniques apply |
| Test suite status | Recommended | Whether any tests exist and whether they run |
| Specific code pointer (file, class, method) | Optional | Narrows classification for ambiguous symptoms |
| Output | Description |
|---|---|
triage.md | Written triage record: symptom, chapter match, recommended skill, rationale, fallback |
| Verbal recommendation | Immediate dispatch with 1-paragraph technique preview |
# Legacy Code Triage
## Symptom
[Developer's description in their own words]
## Symptom Category
[Symptom number] — [Chapter title] (Chapter [N], Part II)
Root cause: [time pressure / testability / design / comprehension / morale]
## Recommended Skill
`[skill-name]`
## Rationale
[1-2 sentences: why this symptom maps to this skill, what the skill does]
## What to Expect
[1 paragraph: brief preview of the technique the developer is about to use]
## Prerequisites
[Any skills to run first, or "none"]
## Fallback (if skill not installed)
[One sentence: what to do manually without the skill]
## Related Symptoms
[Other symptoms that may also be relevant, with chapter references]
The book's 19 Part II chapters ARE the decision tree — respect the taxonomy. Feathers organized the book explicitly as symptom → technique. The chapter titles are the decision branches. Each chapter was written to answer a single real developer question. Treating this as an arbitrary classification and rerouting arbitrarily loses the structural knowledge in the book's architecture.
Route by symptom, not by technique. Developers experiencing legacy code problems cannot name the technique they need — that is why they need routing. A developer says "I can't understand this code" and needs to be routed to scratch refactoring; they do not say "I need scratch refactoring." The symptom description is the input; the technique is the output. Never ask "which technique do you want?" — that inverts the skill.
Some symptoms have multiple legitimate routes — let the developer choose. Symptom 2 (changes take forever) has two root causes with different solutions. Symptom 18 (fear of breaking things) has two applicable skills. When a symptom branches, name both routes, explain the key diagnostic question that separates them, and let the developer identify which applies. Do not pick for them.
When in doubt, route to legacy-code-change-algorithm as the outer procedure. If the symptom is vague, if the developer is overwhelmed, or if no specific chapter match is clear, start the 5-step Legacy Code Change Algorithm. It is the master procedure. Every other skill is a sub-procedure that plugs into one of its five steps. Starting the algorithm always surfaces the specific symptom on the first step that blocks progress.
Developer input: "I'm trying to write a unit test for InvoiceCalculator. When I try to instantiate it in my test, I get a compile error because the constructor requires a live DatabaseConnection object. I can't create one of those in tests."
Classification: Symptom 4 — "I Can't Get This Class into a Test Harness" (Ch 9). Root cause: testability obstacle — constructor has a hard dependency on a concrete class.
Recommendation: Run test-harness-entry-diagnostics. It will walk through the 7-case triage from Chapter 9. In this case the pattern is "Irritating Parameter" (constructor requires a hard-to-create object) — the solution is either Extract Interface on DatabaseConnection and Parameterize Constructor, or pass null if InvoiceCalculator has logic to check for it.
Triage entry:
Symptom: Constructor requires a live DatabaseConnection
Chapter: Ch 9 — I Can't Get This Class into a Test Harness
Root cause: testability — class-level obstacle
Recommended skill: test-harness-entry-diagnostics
Fallback: Apply Parameterize Constructor manually (pass a DatabaseConnection interface instead of creating it in the constructor)
Developer input: "We have a processOrder() method that's 600 lines. It handles everything: validation, pricing, inventory, notifications. I can't test it because it's too big — I don't know what inputs to use or what assertions to write. And it's tangled — calls methods all over the class."
Classification: Symptom 17 — "I Need to Change a Monster Method and I Can't Write Tests for It" (Ch 22). Root cause: design — method too large to test.
Recommendation: Run monster-method-decomposition. First classify the method type: is it Bulleted (sequential chunks with low indentation between logical sections) or Snarled (dominated by one deeply nested block)? From the description, this sounds Bulleted (validation, then pricing, then inventory, then notifications = sequential chunks). The strategy is Find Sequences: identify the overarching sequence of operations, then extract each operation to a named method, working from smallest chunks outward. Use automated refactoring only — no manual copy-paste.
Triage entry:
Symptom: 600-line processOrder() method, too complex to test
Chapter: Ch 22 — I Need to Change a Monster Method
Root cause: design — method too large, no seam to test individual operations
Recommended skill: monster-method-decomposition
Fallback: Classify as Bulleted or Snarled, then extract the smallest identifiable chunk first using automated Extract Method
Developer input: "Any time we change a file in our core library, we have to recompile everything. A 40-second wait every change. It's killing our velocity. We don't know which parts of the build depend on which others."
Classification: Symptom 2 — "It Takes Forever to Make a Change" (Ch 7), specifically the build lag variant (not comprehension lag — they know what to change, they're just waiting for builds).
Diagnostic question asked: "Are you spending time figuring out WHAT to change, or waiting for the build after you've already changed it?" Developer said: "I know exactly what to change — I'm just waiting for the build."
Recommendation: Run dependency-breaking-technique-executor targeting the inter-module dependency structure. The goal is to break compilation dependencies between the core library and its consumers so a change to one area does not force recompilation of everything. Feathers' target: isolated class/module compilation + test run in under 10 seconds. Technique likely needed: Extract Interface to decouple consumers from the concrete class, allowing separate compilation.
Triage entry:
Symptom: 40-second builds on every change to core library
Chapter: Ch 7 — It Takes Forever to Make a Change (build lag variant)
Root cause: build lag — architecture creates excessive recompilation fan-out
Recommended skill: dependency-breaking-technique-executor
Fallback: Identify which concrete class is included by everything; introduce an interface for it so consumers compile against the interface, not the implementation
Full 19-symptom routing table with complete technique previews and diagnostic guidance:
references/symptom-routing-table.md
This skill is licensed under CC-BY-SA-4.0. Source: BookForge — Working Effectively with Legacy Code by Michael C. Feathers (2004, Prentice Hall).
This skill is the primary entry point. It dispatches to the following skills:
Depends on (prerequisite):
legacy-code-change-algorithm — the 5-step master procedure this skill routes into. When in doubt, start here.Dispatches to (downstream skills):
legacy-code-addition-techniques — Symptoms 1 (time pressure): Sprout Method, Sprout Class, Wrap Method, Wrap Classtdd-and-programming-by-difference — Symptom 3 (add feature to tested code): TDD + Programming by Differencetest-harness-entry-diagnostics — Symptoms 4, 5 (class/method can't be tested): 7-case class triage + method-level triagechange-effect-analysis — Symptoms 6, 7 (what to test, many changes): effect sketching + pinch pointscharacterization-test-writing — Symptom 8 (don't know what tests to write): behavior-pinning test algorithmlibrary-seam-wrapper — Symptoms 9, 10 (library/API coupling): wrapper interface patternscratch-refactoring-for-code-understanding — Symptoms 11, 12 (comprehension, no structure): throwaway refactoringbig-class-responsibility-extraction — Symptoms 12, 15 (no structure, class too big): 7-heuristic extractionunit-test-quality-checker — Symptom 13 (test code in the way): test classification and organizationdependency-breaking-technique-executor — Symptoms 2, 14 (build lag, non-OO): 24-technique catalogduplication-removal-via-extraction — Symptom 16 (same code everywhere): deduplication via extractionmonster-method-decomposition — Symptom 17 (monster method): Bulleted/Snarled decompositionsafe-legacy-editing-discipline — Symptom 18 (fear of breaking things): 4 editing safety disciplinesseam-type-selector — prerequisite for Symptom 14 (non-OO language): Object/Link/Preprocessor seam selectionInstall the full book skill set: bookforge-skills — working-effectively-with-legacy-code