Same behaviour in fewer, clearer lines — covers the judgment gaps that linters cannot catch (reinvention, wrong frame, hidden duplication, derived state, procedural rebuilds, speculative generality, defensive excess, type-system underuse). Trigger when reviewing, refactoring, or simplifying code — and even when the user doesn't explicitly ask for "simplification" but is reviewing code, refactoring, or asking "is there a shorter way to write this?". Complements knip/eslint/ruff/tsc by focusing on the conceptual modelling layer those tools cannot see.
Installation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Same behaviour in fewer, clearer lines — covers the judgment gaps that linters cannot catch (reinvention, wrong frame, hidden duplication, derived state, procedural rebuilds, speculative generality, defensive excess, type-system underuse). Trigger when reviewing, refactoring, or simplifying code — and even when the user doesn't explicitly ask for "simplification" but is reviewing code, refactoring, or asking "is there a shorter way to write this?". Complements knip/eslint/ruff/tsc by focusing on the conceptual modelling layer those tools cannot see.
Community Refactoring Best Practices: Same Results, Less Code
Code-review and refactoring guide focused on the parts of code volume that come from judgment and modelling gaps — wrong abstraction choices, hidden semantic duplication, defensive habits, premature generality. This skill deliberately skips what linters and tools like knip, eslint, ruff, tsc --noUnusedLocals, or formatters already catch. It is the second pass: after the mechanical cleanup, what remains?
Core Principles
Preserve behaviour. Every transformation must produce identical observable behaviour — same outputs, same errors, same side effects, same API surface.
Earlier mistakes cascade. A wrong frame multiplies into wrong shapes, which multiply into duplicate logic. Optimise from the top of the lifecycle.
Explain why, not just what. Each rule explains the cost of the anti-pattern so judgment can transfer to novel cases.
Quantify where possible. Prefer "eliminates N lines / prevents X bug class" over "cleaner."
Don't over-refactor. Rule of three: extract abstractions when duplication has actually appeared three times, not in anticipation.
When to Apply
Use this skill when:
Reviewing a PR for "could this be simpler?" (the question linters can't answer)
Refactoring code that has grown in volume without growing in capability
Auditing a module that "feels heavy" — many flags, many layers, many checks
Onboarding to an unfamiliar codebase and trying to spot the parts that are accidental volume vs essential complexity
Designing a new module and wanting to avoid the common over-abstraction traps
Working alongside knip / eslint / ruff and wanting the layer of judgment those tools can't supply
Don't use this skill for:
Mechanical cleanup that a linter or formatter already does (unused imports, dead exports, style) — use knip, eslint, ruff, or prettier/black instead.
Algorithmic complexity / performance tuning — use complexity-optimizer for that.
General cleanup of recently modified code regardless of mental-model gaps — use code-simplifier.
Rule Categories by Priority
#
Category
Prefix
Impact
Rules
Gist
1
Reinvention
reinvent-
CRITICAL
5
You wrote what the platform/stdlib already provides
2
Wrong Frame
frame-
CRITICAL
5
Wrong abstraction shape — class where a function fits, manager nouns, OO over data