Repository navigation
Add legacy-code-and-refactoring skill - #224
federicobartoli wants to merge 7 commits into
Conversation
|
Strong skill, well grounded in the Feathers playbook. The characterization test workflow (write a deliberately wrong assertion, run it, copy the actual value) is concrete enough for an agent to follow without interpretation. The seam example with One structural fix: Also: the skill is not added to the numbered lifecycle sequence in |
Thanks @nucliweb ! Renamed to ## Process in 15c2cd6. |
|
This is nice work. Honestly, the way you split the commits between the refactor and the behavior change is my favorite part. I did notice one real gap in step 5, though. The "run both, log diffs" approach is a classic Scientist-style shadow pattern, but it's only safe if the legacy path doesn't have side effects, right? If someone runs both paths on code that writes to a database, charges a card, or sends an email, they're going to double those side effects in production. It’s definitely worth adding a quick warning sentence: shadow the read paths, but for writes, either suppress the new path's side effects or compare against a dry run. We just want to make sure nobody accidentally double-charges a customer while trying to "compare outputs." One other small thing: the text leans pretty heavily on inline references to other skills (about ten of them, like Individually they all make sense, but stacked together mid-process, it starts to feel like a "go read six other skills first" homework assignment. That sort of undercuts the tight, self-contained scope we want agents to maintain. I'd suggest keeping just the most important, load-bearing ones inline (like Everything else looks totally merge-ready, and I appreciate you already flagging the #223 rebase for the skill count. Nice job! |
Thanks Addy! Fixed in 27ee8b3 and a88b2f0. |
|
This is exactly the fix, and then some. The shadow-writes warning covers the gap I flagged, and the two you layered on top are the ones people usually learn the hard way: normalizing timestamps and IDs before diffing, and sampling the shadow load because even reads double backend traffic. To your open question, leave the three references in When to Use. Those are exclusions ("use code-simplification / deprecation-and-migration / debugging-and-error-recovery instead"), so they route the agent to the right skill rather than assign mid-process homework. Moving them would bury a signal that belongs exactly where a reader decides whether this skill applies at all. The Related Skills split reads better too: TDD and git-workflow stay inline where the process leans on them, and the rest sit in the footer with a one-line why each, which is more useful than the bare inline mentions were. Nothing left on my side, so this is an approve. The only tie is the skill-count line you share with #223, so whichever lands second takes the trivial rebase. Great addition. |
a88b2f0 to
830f1b1
Compare
Thanks Addy! |
|
I've read this one closely and it's genuinely good. The characterization-test-first backbone is the right approach for legacy code and it doesn't duplicate anything we have. The only reason it isn't merged already is that a new skill is a catalog decision rather than a quick yes, and I've been batching those. Consider it approved on merit, I just want to land new skills deliberately. It's near the front of that queue. |
addyosmani
left a comment
There was a problem hiding this comment.
Really like this, and it fills a real gap: code-simplification is about clarity, this is about changing untested code safely (characterization tests, seams, strangler fig, never refactor and change behavior together). Two things before it merges: it's from June so the skill counts and the CLAUDE.md list have drifted and it needs a rebase, and please confirm there's an evals/cases/legacy-code-and-refactoring.json since CI requires one per skill. Approving on the content.
Fills a gap in the Build phase: every existing skill assumes new or healthy code, but the most common real-world task is changing untested, unfamiliar code. code-simplification explicitly targets code that is already readable and tested; this skill covers the step before that. Covers characterization/golden-master tests, seams and the sprout method, the refactor-vs-behavior-change commit separation rule, and strangler fig over big-bang rewrites. Cross-references code-simplification, deprecation-and-migration, tdd, and doubt-driven-development instead of duplicating them. Registered in README tables/structure, CLAUDE.md phases, and the using-agent-skills discovery tree (hooks/session-start-test.sh passes). Note: branched from main; if the observability PR merges first, the skill-count lines in README will need a trivial conflict resolution.
Add side-effect warning to the strangler fig step (shadow reads only, dry-run the writes) and move non-load-bearing skill references to a Related Skills section, keeping tdd and git-workflow inline.
Qualify the strangler list step itself (reads only), explain the recording adapter concretely, and note diff normalization and the doubled read load.
…ms in the description
830f1b1 to
001c55d
Compare
|
Rebased onto main at dc27a9c. The count-bump commit from the earlier rebase became empty against main and was dropped; the four content commits are unchanged. Eval case added at evals/cases/legacy-code-and-refactoring.json: 5 positive triggers, 3 negative triggers with owners (code-simplification, test-driven-development, deprecation-and-migration), and two execution evals backed by a small untested Node fixture under evals/fixtures/legacy-code-and-refactoring/ (a pricing module with a hidden date dependency and a requested discount rule, so a seam is the natural first move). One line changed in the skill itself: the description now names characterization tests and seams. The routing run showed "Add characterization tests before I touch this function" ranking 4th because the description did not contain the term, so I followed the evals README and fixed the description rather than the prompt. If you would rather keep the description as approved and drop that prompt instead, that is a one-line revert. Counts moved to 26 in README, CLAUDE.md, using-agent-skills, the skill-gap issue template and the three setup docs that state the total. Routing run at 100% rank-1 (93/93), no collision warnings; validators, eval runner tests and hook tests all green locally. |
All the current skills assume new or at least tested code, but the most common thing I actually point an agent at is old untested code that nobody remembers why it works. code-simplification doesn't cover it — it explicitly wants code that's already readable and tested.
So this adds the classic Feathers playbook as a skill: characterization tests before touching anything, seams and sprout to make untestable code testable, refactor and behavior change always in separate commits, strangler fig instead of rewrites.
Wired into README, CLAUDE.md and the using-agent-skills tree. session-start-test.sh passes since I touched the meta-skill.