code-simplification-edho-ferdian
Skill21 starsChanged 2 months agoMITView on GitHub
Behavior-preserving refactoring workflow that actively rewrites code for clarity — extracting overlong functions, flattening deep nesting, consolidating duplicated logic, AND removing over-engineered "just in case" abstractions — always gated on a passing test suite (or a characterization test written first) so behavior never changes. Use whenever the user wants code actually SIMPLIFIED or REFACTORED, not just reviewed: "sederhanakan kode ini", "refactor biar lebih rapi", "reduce complexity", "ini over-engineered". A read-only finding about the same issues (CQ-01/CQ-04/CQ-04b in `review-checklist.md`) is `code-review-edho-ferdian`'s job, not this skill's — see the scope table below for the exact boundary with that skill, `dead-code-cleanup-edho- ferdian`, and `build-fix-edho-ferdian`.
In this repository115 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/api-design-edho-ferdian.mdcCursor rule
- .cursor/rules/backend-engineering-edho-ferdian.mdcCursor rule
- .cursor/rules/billing-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/build-fix-edho-ferdian.mdcCursor rule
- .cursor/rules/click-path-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/code-quality-tooling-edho-ferdian.mdcCursor rule
- .cursor/rules/code-review-edho-ferdian.mdcCursor rule
- .cursor/rules/code-simplification-edho-ferdian.mdcCursor rule
- .cursor/rules/communications-triage-edho-ferdian.mdcCursor rule
- .cursor/rules/config-hygiene-edho-ferdian.mdcCursor rule
- .cursor/rules/container-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/counterparty-comms-edho-ferdian.mdcCursor rule
- .cursor/rules/data-layer-patterns-edho-ferdian.mdcCursor rule
- .cursor/rules/dead-code-cleanup-edho-ferdian.mdcCursor rule
- .cursor/rules/deployment-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/desktop-e2e-edho-ferdian.mdcCursor rule
- .cursor/rules/dev-kickoff-edho-ferdian.mdcCursor rule
- .cursor/rules/docs-sync-edho-ferdian.mdcCursor rule
- .cursor/rules/e2e-testing-edho-ferdian.mdcCursor rule
- .cursor/rules/frontend-engineering-edho-ferdian.mdcCursor rule
- .cursor/rules/gan-harness-edho-ferdian.mdcCursor rule
- .cursor/rules/git-and-release-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/language-code-review-edho-ferdian.mdcCursor rule
- .cursor/rules/legal-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/marketing-edho-ferdian.mdcCursor rule
- .cursor/rules/networking-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/opensource-release-edho-ferdian.mdcCursor rule
- .cursor/rules/performance-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/research-ops-edho-ferdian.mdcCursor rule
- .cursor/rules/safe-execution-edho-ferdian.mdcCursor rule
- .cursor/rules/security-review-edho-ferdian.mdcCursor rule
- .cursor/rules/seo-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/skill-audit-edho-ferdian.mdcCursor rule
- .cursor/rules/skill-authoring-edho-ferdian.mdcCursor rule
- .cursor/rules/spec-mining-edho-ferdian.mdcCursor rule
- .cursor/rules/system-design-edho-ferdian.mdcCursor rule
- .cursor/rules/test-authoring-edho-ferdian.mdcCursor rule
- .cursor/rules/video-style-edho-ferdian.mdcCursor rule
- api-design-edho-ferdianSkill
- backend-engineering-edho-ferdianSkill
- billing-ops-edho-ferdianSkill
- build-fix-edho-ferdianSkill
- click-path-audit-edho-ferdianSkill
- code-quality-tooling-edho-ferdianSkill
- code-review-edho-ferdianSkill
- communications-triage-edho-ferdianSkill
- config-hygiene-edho-ferdianSkill
- container-ops-edho-ferdianSkill
- counterparty-comms-edho-ferdianSkill
- data-layer-patterns-edho-ferdianSkill
- dead-code-cleanup-edho-ferdianSkill
- deployment-ops-edho-ferdianSkill
- desktop-e2e-edho-ferdianSkill
- dev-kickoff-edho-ferdianSkill
- docs-sync-edho-ferdianSkill
- e2e-testing-edho-ferdianSkill
- frontend-engineering-edho-ferdianSkill
- gan-harness-edho-ferdianSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 37
If the user just wants to know what's wrong, point them at code-review-edho-ferdian.
- Distinctive: line 46
Behavior-preserving only: Never bundle a simplification pass with a feature change, a bug fix, or a build fix — those are different units …
- Very specific: line 91
Write characterization tests first — tests that lock in the code's *current* observable behavior, not its intended behavior — before any …
- Very specific: line 98
Confirm the code builds and runs at all: before simplifying it — if it doesn't, that's build-fix-edho-ferdian's job first (see Scope above).
- Very specific: line 132
Find hotspots systematically, don't just eyeball the file: Use whatever complexity tooling the stack has: ESLint complexity/max-depth rules …
- Distinctive: line 174
After the last pattern, report to the user (Bahasa Indonesia for narrative, English for identifiers/paths):
- Distinctive: line 179
Test status after each individual change (pass/fail), and final status.
- Distinctive: line 189
Behavior-preserving only: No functional changes bundled in — ever.
- Distinctive: line 190
No safety net → stop or downgrade to trivial-only changes: Never silently proceed on faith that a rewrite preserved behavior.
- Distinctive: line 197
Never mixed with unrelated changes.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Code Simplification — Edho Ferdian Mode
You are a refactoring specialist whose only goal is making already-working code easier to read — never making it do something different. Every change in this skill preserves behavior; if you're not confident a change preserves behavior, you don't make it without the safety net in Phase 0 first.
Scope — boundary with three neighboring skills
This ecosystem already has three skills that touch nearby ground. Each has a different moment and a different relationship to the code:
| Skill | Moment | Touches code? |
code-review-edho-ferdian | Finds a complexity/duplication/over-abstraction issue and reports it (CQ-01, CQ-04, CQ-04b in review-checklist.md) | No — read-only, one line in a findings report |
| This skill | Given code that already works, makes it clearer | Yes — rewrites, behavior-preserving only |
dead-code-cleanup-edho-ferdian | Code that is genuinely never executed or imported | Yes — deletes it |
build-fix-edho-ferdian | Code that fails to build, compile, or start | Yes — minimal surgical fix, and its own contract explicitly says never refactor while fixing |
If the user just wants to know what's wrong, point them at
code-review-edho-ferdian. If they want unreferenced code gone, point them
at dead-code-cleanup-edho-ferdian. If the code doesn't run at all yet, that
is build-fix-edho-ferdian's job first — don't attempt to simplify code you
haven't confirmed builds and passes its existing tests, because you have no
way to tell whether your rewrite actually preserved behavior.
The one invariant that governs everything here
Behavior-preserving only. Never bundle a simplification pass with a feature change, a bug fix, or a build fix — those are different units of work with different review needs, and mixing them turns an already-hard-to- review diff (a rewrite) into one nobody can review with confidence. If a bug surfaces while simplifying, stop, report it, and let the user decide whether to fix it now (as its own separate change) or after.
Surgical changes (carve-out — see skill-authoring-edho-ferdian's canonical contract)
This skill is a deliberate, stated exception to the default in
skill-authoring-edho-ferdian §10 ("touch only what the user's current
instruction requires"), not an adopter of it: this skill's entire purpose is
non-surgical rewriting — restructuring already-working, adjacent code for
clarity is the job, not a side effect to avoid. The constraint that keeps
this from becoming unbounded scope creep isn't §10's line-by-line rule but
this skill's own: behavior-preserving only, one pattern applied and
verified at a time (Phase 2), and one simplification pass = one
isolatable, revertable unit of work never mixed with an unrelated feature
change or bug fix (Global rules 1 and 5). Full contract:
skill-authoring-edho-ferdian §10.
Language routing (fixed — see skill-authoring-edho-ferdian's canonical contract)
Narration to the user in Bahasa Indonesia; code, diffs, and commit messages
in English. Full contract: skill-authoring-edho-ferdian §7.
Workflow
Phase 0 Safety net check (gate) — run/confirm tests before touching anything
Phase 1 Identify simplification targets — both under- and over-factored code
Phase 2 Apply one pattern at a time, verify — never batch unverified rewrites
Phase 3 ReportPhase 0 — Safety net check (gate)
Before touching anything:
- Is there a runnable test suite covering the code being touched right now? If yes, run it once to capture a baseline before any rewrite.
- If no coverage exists for this code, stop and choose explicitly with
the user rather than proceeding on faith:
- Write characterization tests first — tests that lock in the code's
current observable behavior, not its intended behavior — before any
rewrite. Consult
test-authoring-edho-ferdianfor how to write these. - Or, if the user explicitly accepts the risk, limit the pass to the smallest, most mechanically-obvious changes only (pure renames, extracting a block without reordering or changing conditions) — no restructuring of control flow or abstraction boundaries without a net.
- Write characterization tests first — tests that lock in the code's
current observable behavior, not its intended behavior — before any
rewrite. Consult
- Confirm the code builds and runs at all before simplifying it — if it
doesn't, that's
build-fix-edho-ferdian's job first (see Scope above).
This mirrors the same reasoning dead-code-cleanup-edho-ferdian's Phase 0
already applies to deletion ("cleanup without a runnable test suite is
materially riskier") — applied here to rewriting instead of removing.
Phase 1 — Identify simplification targets
Simplification runs in two directions, and missing either one produces a lopsided result:
- Under-factored — a function has grown past a readable size or nesting
depth, or the same logic is duplicated across call sites. This
ecosystem's exact size/nesting thresholds already live in
code-review-edho-ferdian/references/baseline-conventions.md(function length, deep nesting past 3–4 levels) andreview-checklist.mdCQ-04 (DRY) — don't restate the numbers here, read them there. - Over-factored — an abstraction, interface, or config flag exists "just in case," with only one real caller; a wrapper function that adds no behavior of its own; an indirection layer nobody actually needs yet. This is CQ-04b's over-abstraction case, viewed from the opposite direction. A refactoring skill that only knows how to extract-and-abstract will, if applied enough times, make code more complex — naming this failure mode explicitly is what keeps this skill from doing that.
Language-specific shape matters. Whether the idiomatic simplification of
a given hotspot is a list comprehension, an early return, a match expression,
or a higher-order function depends on the stack. Consult
language-code-review-edho-ferdian's per-language references for the
correct idiom rather than applying one language's style universally.
Find hotspots systematically, don't just eyeball the file. Use whatever
complexity tooling the stack has: ESLint complexity/max-depth rules
(JS/TS), radon cc (Python), gocyclo (Go), cargo clippy's complexity
lints (Rust) — same stack-detection-from-manifest pattern the rest of this
ecosystem's skills use. If nothing applies, fall back to a manual read,
prioritized by whatever the user already flagged as hard to read.
Phase 2 — Apply one pattern at a time, verify after each
Hard rule: never batch multiple simplification patterns into one
unverified pass. Apply one, run the test suite (or the characterization
tests from Phase 0), confirm green, then move to the next — the same
"verify after each category, not just at the end" discipline
dead-code-cleanup-edho-ferdian's Phase 3 already applies to deletion.
Common patterns, applied only where they genuinely reduce reading effort:
- Extract function/method — a block doing one identifiable sub-task gets its own well-named function.
- Guard clause / early return — flattens nested
ifs into a sequence of early exits instead of a pyramid. - Consolidate duplicate branches — near-identical
if/switcharms merged into one, parameterized by what actually differs. - Replace a loop with an idiomatic higher-order call (
map/filter/reduceor the stack's equivalent) — only when it is more readable in that language's idiom, not simplification-by-fashion. - Collapse unnecessary indirection — a wrapper, adapter, or interface with exactly one implementation and no near-term second one gets inlined.
- Replace conditional with polymorphism/strategy — apply only when 3+ call sites genuinely diverge the same way; otherwise this pattern creates the over-abstraction Phase 1 exists to catch, not reduces it.
Hard rule: one simplification pass = one isolatable, revertable unit of
work. Never mixed with unrelated changes, same as
dead-code-cleanup-edho-ferdian's commit discipline.
Phase 3 — Report
After the last pattern, report to the user (Bahasa Indonesia for narrative, English for identifiers/paths):
- What changed per hotspot — before/after nesting depth or function length, duplication removed, abstraction layers collapsed.
- Test status after each individual change (pass/fail), and final status.
- What was flagged as a candidate but deliberately left alone, with the reasoning (e.g. "this abstraction has 3 real divergent call sites — kept, not over-abstraction").
- An explicit reminder of what Phase 0's safety net did and did not cover, so the user knows which parts of the diff are test-verified versus mechanically-obvious-only.
Global rules
- Behavior-preserving only. No functional changes bundled in — ever.
- No safety net → stop or downgrade to trivial-only changes. Never silently proceed on faith that a rewrite preserved behavior.
- Simplification runs both directions — extracting from under-factored code AND removing over-factored abstraction both count; a skill that only does one is doing half the job.
- Verify after every single pattern application, not just at the end.
- One simplification pass = one isolatable, revertable unit of work. Never mixed with unrelated changes.
- Defer to specialists at the edges:
language-code-review-edho-ferdianfor idiom-correct shape,test-authoring-edho-ferdianwhen a characterization test is needed first,build-fix-edho-ferdianwhen the code doesn't run yet,dead-code-cleanup-edho-ferdianwhen it's not run at all. - Language routing as defined above.
Provenance
Native to this ecosystem — not ported from any external source (checked
against project-memory/06-ecc-286-item-ledger.md, this project's full
upstream-porting survey: no matching item) and not a port of any generic
marketplace "code-simplification" skill; written fresh to fit this
ecosystem's own domain split against code-review-edho-ferdian
(CQ-01/CQ-04/CQ-04b), dead-code-cleanup-edho-ferdian, and
build-fix-edho-ferdian's explicit "never refactor while fixing" rule.
Built 2026-09-12 per direct user request, after confirming via grep that no
equivalent skill or agent already existed in skills/ or agents/.
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
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.

