agentsclimarketplace

Dev refactor

Skill amjadjibon/skills/skills/dev/dev-refactor

Refactor existing code without changing behavior — extract functions, reduce duplication, simplify logic, improve naming, against a test baseline taken before and verified after. Use on "refactor this", "clean up", "simplify", "extract", "reduce duplication", "improve naming", or a request for structural improvement without new features.From its SKILL.md

Install
npx -y skills add amjadjibon/skills --skill dev-refactor

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.9 KB, as published. Nobody here has run it

Refactor

Improve structure without changing observable behavior. Tests pass before and after every change.

Delivery Mode (lite | full | ultra, default lite)

Mode is the trailing argument when it is exactly lite, full, or ultra; everything else is the task/feature description. No mode given → lite.

  • lite (default) — all steps squashed into one commit on the current branch.
  • full — one commit per step, same branch.
  • ultra — independent targets (no shared files/types) each get their own branch + worktree + PR.

1. Scope

Named target → use it. Vague ("clean this up") → read the code, name the specific smell (duplication, long function, deep nesting), state it before starting.

2. Baseline

Run the test suite; record the result. Failing before you touch anything → stop and tell the user — refactoring broken code hides bugs. No coverage on the target → "No tests cover <target>. Proceed anyway, or add tests first?" (autonomous mode: proceed, note the gap).

3. Refactor in Steps

One coherent change per step: make it → tests pass → (full: commit refactor: <what and why>; lite: hold, commit once at the end). Tests break → revert the step, explain why it isn't safe as written.

Rules: touch only what the refactor needs; match existing style — no whole-file reformats; mention unrelated issues, don't fix inline; no behavior changes — a refactor that would alter a side effect, edge case, or error message stops and asks.

4. Patterns (apply on the smell, never speculatively)

SmellRefactor
Function > ~40 linesExtract named sub-functions
Same code 2+ placesExtract shared utility (not on first duplication)
Nesting > 3 levelsEarly returns / guard clauses
Unclear namesRename to intent
4+ params traveling togetherGroup into struct/object
Boolean flag controlling flowSplit into two functions
Dead codeDelete

5. Commit & Report

Commit hygiene and message style: see the git-safe skill (no Co-authored-by:, git add -u not -A, imperative why-focused subject).

lite: git add -u && git commit -m "refactor: <summary of all steps>". full: already committed per step.

Push: only if a remote is configured and you're on a feature branch. On main/master, ask first. Called by dev-loop: don't push — the loop pushes after approval.

Report: target, step count, tests passing, what was restructured, "behavior unchanged" (note any unverifiable edge cases).

Keep looking

Skills are one crate of 626,474. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.