agentleFS
mthinesmthines/agent-skills/skills/quality/optimize-approach/SKILL.md

optimize-approach

Skill20 starsChanged 13 days agoMITView on GitHub

Judges whether a change or plan takes the best approach for its intent (codebase-fit, simplicity, performance, robustness) and proposes at most two materially better ones; says nothing when the approach is already sound. Slash-invoked: "/optimize-approach [<files>|<plan path>]".

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 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.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read every unit in full, plus its callers and any existing utility or pattern an alternative would reuse (grep before you claim one exists).

    line 31
  2. Very specific:

    No axis fires → the unit is optimal.

    line 42
  3. Distinctive:

    When in doubt, say nothing: silence on a sound approach costs nothing.

    line 61
  4. Very specific:

    Every unit optimal → print exactly Approach: optimal — no materially better approach found.

    line 72

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

Optimize approach

Answer one question: is this the best approach for what the change is trying to do — and if not, what is? Judge the shape of the solution, not its lines. Report only; never edit files.

Lens-eligible for the pr-reviewer agent: lens.md auto-loads on deep reviews.

Step 0 — Scope

  1. Target: the named files or plan.md; else the branch diff (git diff <base>...HEAD, base default origin/main).
  2. Intent: one or two lines from the plan, the PR title and body, or the commit messages.
  3. Split the target into approach units — one cohesive way of solving one sub-goal. Judge each unit separately.
  4. Read every unit in full, plus its callers and any existing utility or pattern an alternative would reuse (grep before you claim one exists).

Step 1 — Score the four axes

AxisA better approach would…Look for
Codebase-fitreuse a utility, hook, or pattern the change reinventsa hand-rolled helper duplicating an export; a bespoke pattern next to a shared one
Simplicityremove a structural layer the goal does not needa class where a function suffices; premature generality; needless indirection
Performancechange complexity or cut work the current shape forcesO(n²) where O(n) is natural; per-item queries where one batch works
Robustnesspick a shape that cannot hit a failure class the current one invitesinvariants kept by hand that a type or DB constraint would enforce; a race the shape allows

No axis fires → the unit is optimal.

Step 2 — Drop what another lens owns

Drop the candidate (the unit stays optimal) when any of these holds:

  1. Mechanical tidy — a rename, guard-clause flip, dead-code removal, or constant extraction. That is /polish.
  2. Failure mode without a better shape — "this could fail because X" with no approach that structurally avoids X. That is /critical.
  3. Wrong behaviour — the change does not do what it claims, or breaks a caller. That is a review finding, not an approach.
  4. Taste — the alternative is equally good, just different.

Step 3 — The materiality bar

Propose only when the alternative is all three:

  • Material — a namable win: a reused util, a complexity class dropped, a race removed.
  • Grounded — stated in two sentences with file:line evidence you read, not a guess.
  • Worth the switch — the win outweighs the blast radius of changing approach now.

When in doubt, say nothing: silence on a sound approach costs nothing; a weak "better way" costs trust.

✗ Wrong — "`const timeoutMs = 5000` could be a named constant"     (mechanical tidy → /polish)
✓ Right — "src/api/client.ts:40 adds retryWithBackoff; src/lib/retry.ts:12 already exports
          withRetry with the same semantics. Reuse it: one call site, removes a duplicate."

Output

At most two proposals, strongest first. Every unit optimal → print exactly Approach: optimal — no materially better approach found. and stop.

### <unit> — <axis>
**Now:** <the current approach, one line, with file:line>
**Better:** <the alternative, one or two lines, with the file:line it reuses or the constraint it relies on>
**Why it wins:** <the material gain>
**Cost:** <files touched, risk>

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.