agentleFS
theseus-runtheseus-run/theseus/.agents/skills/refactoring-discipline/SKILL.md

refactoring-discipline

Skill1 starsChanged 6 months agoMITView on GitHub

Use when intentionally restructuring, splitting, renaming, replacing, or reducing complexity in this POC/WIP repo, especially when choosing a clean single path over compatibility, stale aliases, or parallel implementations.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 13 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    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:

    Use this skill for authorized restructure and replacement work in this POC/WIP repo.

    line 8
  2. Distinctive:

    Prefer replacing bad or obsolete structure over preserving it.

    line 16
  3. Distinctive:

    If current behavior is accidental or WIP, improve it directly and say what changed.

    line 19
  4. Distinctive:

    Search current callers and tests so the blast radius is known.

    line 24
  5. Distinctive:

    Update tests to the intended behavior, or add tests for the new boundary when behavior matters.

    line 27
  6. Distinctive:

    Run the narrowest useful test/typecheck, then broader verification when public signatures changed.

    line 28
  7. Distinctive:

    Do not preserve obsolete APIs just because tests or local callers use them.

    line 33
  8. Distinctive:

    Do not add migration shims unless the user explicitly says back compatibility is required.

    line 34
  9. Distinctive:

    Keep diffs reviewable: one conceptual replacement per pass is better than several unrelated cleanups.

    line 35
  10. Distinctive:

    If the work reveals an unrelated design problem, report it or make it a separate pass.

    line 36
  11. Distinctive:

    Prefer package-local tests while iterating.

    line 59
  12. Distinctive:

    Run root typecheck when public signatures, package exports, schemas, or Effect requirements change.

    line 60
  13. Distinctive:

    Use lint/format tooling for mechanical formatting.

    line 61

≈ “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

Refactoring Discipline

Use this skill for authorized restructure and replacement work in this POC/WIP repo. We are the only expected consumers unless the user says otherwise, so prefer clean one-way changes over compatibility-preserving migrations.

For package boundaries and public export shape, also use monorepo-maintenance. For tests, also use testing-patterns. After substantial edits, use cleanup-audit as a finishing pass to remove confirmed non-behavioral leftovers and report risky compatibility cleanup before changing it.

Ground Rule

This repo optimizes for a clean golden path, not compatibility layers.

  • Prefer replacing bad or obsolete structure over preserving it.
  • During an authorized refactor/replacement, delete stale aliases, compatibility exports, comments, tests, docs, and duplicate paths when the new boundary supersedes them.
  • Preserve behavior only when that behavior is still part of the intended model.
  • If current behavior is accidental or WIP, improve it directly and say what changed.

Workflow

  1. Identify the intended model, not just the current behavior.
  2. Search current callers and tests so the blast radius is known.
  3. Choose the clean target shape before patching.
  4. Replace in one coherent direction; avoid old/new parallel paths.
  5. Update tests to the intended behavior, or add tests for the new boundary when behavior matters.
  6. Run the narrowest useful test/typecheck, then broader verification when public signatures changed.

Scope Control

  • It is fine to combine renames, moves, and behavior correction when they are all part of an authorized replacement of one bad model with one better model.
  • Do not preserve obsolete APIs just because tests or local callers use them. Update the callers/tests.
  • Do not add migration shims unless the user explicitly says back compatibility is required.
  • Keep diffs reviewable: one conceptual replacement per pass is better than several unrelated cleanups.
  • If the work reveals an unrelated design problem, report it or make it a separate pass.

Good Targets

  • duplicated protocol construction
  • large modules with unrelated reasons to change
  • hidden dependencies or ambient state
  • repeated validation/stringification inside domain code
  • unclear names that force readers to inspect implementation
  • tests that only assert legacy shape instead of intended behavior
  • old aliases, stale barrels, and compatibility re-exports during authorized replacement work
  • parallel implementations of the same concept

Poor Targets

  • style-only churn in unrelated files
  • mechanical renames without a clearer model
  • abstractions created for one caller
  • preserving a second path "just in case"
  • characterization tests that freeze known-bad WIP behavior

Verification

  • Prefer package-local tests while iterating.
  • Run root typecheck when public signatures, package exports, schemas, or Effect requirements change.
  • Use lint/format tooling for mechanical formatting; do not hand-normalize formatting across unrelated files.
  • In the final report, say whether behavior was intentionally changed, which stale paths were removed, and what verification covered.

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.