CtrlK
BlogDocsLog inGet started
Tessl Logo
SkillPublic

optimize-approach

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>]".

Quality

82%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

SKILL.md
Quality
Evals
Security

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>
Repository

mthines/agent-skills

Path

skills/quality/optimize-approach/SKILL.md

Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.