agentleFS
MaximSTHMaximSTH/meta-layer-starter/.agents/skills/refactor-extract/SKILL.md

refactor-extract

Skill2 starsChanged 5 months agoMITView on GitHub

Walk the 4-phase refactor extraction protocol when a mechanical signal fires (duplication cluster, file-size warn or fail) or an authoring-time near-match surfaces. Tier 1.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Execute: Write the helper / land the split + test pin first.

    line 15

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/refactor-extract

Substance lives in markdowns/protocols/refactor-extraction.md.

Steps:

  1. Discriminate kickoff vs iteration per auto-trigger-discriminator.md. If iteration / polish / investigation, exit silently. Explicit /refactor-extract invocation bypasses; mechanical signals (duplication / file-size) and authoring-time near-match are kickoff by definition.
  2. Detect. Cite the mechanical signal (duplication cluster file:line ↔ file:line from jscpd or similar, file-size LOC warn or fail). No mechanical signal, no advance — the duplication policy is the gate.
  3. Decide. Produce a structured rationale (the 4+ duplicates that justify extraction, the proposed helper signature, the ≥70% applicability check, the FCPSS coverage). Run cross-vendor plan-review against the rationale markdown via scripts/cross-vendor-review.sh. Iterate to a clean pass (Tier 1: no decline path).
  4. Execute. Write the helper / land the split + test pin first. Migrate callers one at a time with the suite green between each. Verify the signal cleared (re-run the duplication checker, re-count file size). No half-migration.
  5. Prevent regression. The test pin is the durable guard; the duplication checker + file-size hook keep watching the surface; the duplication policy in root AGENTS.md Definition of Done is the steady-state authoring rule.

Execution diff goes through standard cross-vendor code review at PR time per cross-vendor-review.md. Supervision pattern per supervision.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.