agentleFS
akdevsaha-devakdevsaha-dev/factory-skills/skills/simplify-code/SKILL.md

simplify-code

Skill1 starsChanged 18 days agoMITView on GitHub

Simplify recently changed code without changing its behavior. Removes unnecessary wrappers, speculative abstractions, redundant checks, dead code, and narrating comments, one change at a time, rerunning the affected checks after each. Use after implementing a change, when a diff feels heavier than the problem, or when asked to simplify, clean up, or reduce complexity in a change.

37 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use blocked-page-recovery, document-to-action-items and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • nobodyohm-webSkill

    blocked-page-recovery

    Recover blocked/paywalled/WAF'd pages via fallbacks.

    Also in 7 projects that use this

  • Samin12Skill

    document-to-action-items

    Extract cited obligations, deadlines, tasks from documents.

    Also in 7 projects that use this

  • Samin12Skill

    competitor-news-monitor

    Watch named companies for material news; cited digests.

    Also in 7 projects that use this

  • michaellam26Skill

    sdlc-review

    Trigger stage-specific reviews for an SDLC project and save results to reviews/

    Also in 5 projects that use this

  • john-data-chenSkill

    teams-meeting-pipeline

    Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.

    Also in 8 projects that use this

  • mae616Skill

    p5js

    p5.js(クリエイティブコーディング)のProcessing由来「コードでスケッチ」思想を軸に、setup/drawループ・座標系・インタラクション・パフォーマンス最適化を整理する。p5.js、Processing、クリエイティブコーディング、ジェネラティブアート、インタラクティブ表現、ビジュアルプログラミング、Canvas描画、パーティクル、フラクタル、ノイズ表現に関する相談で必ず使うこと。ユーザーが「コードでアート」「動くビジュアル」「インタラクティブな描画」と言った場合にも適用する。

    Also in 11 projects that use this

  • +1 more from Samin12

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 36 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

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

    Read references/operating-rules.md and references/code-quality.md first.

    line 10
  2. Distinctive:

    Apply one at a time: After each, rerun the checks that cover it.

    line 28
  3. Distinctive:

    Stop: when no candidate remains that makes the code clearer.

    line 29
  4. Distinctive:

    Remove an interface, factory, or option with one implementation or caller

    line 34
  5. Distinctive:

    Delete validation that earlier validation or the types already guarantee

    line 35
  6. Distinctive:

    Remove dead code, unused exports, debug output, and narrating comments

    line 38
  7. Distinctive:

    Every applied simplification has passing checks rerun after it, no behavior or interface changed, and nothing outside the scope was touched.

    line 66

“Common” is measured: kept by at least 6 in 10 of the 36 edited versions of this file we could read. “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

Simplify Code

Make a change as plain as the problem allows, so that another engineer can read it quickly and trust it. Behavior stays identical. Fewer lines is a side effect, never the goal; clarity beats brevity.

Read references/operating-rules.md and references/code-quality.md first.

Use when

  • A change is implemented and its checks pass
  • The diff shows complexity signals: new wrappers or layers, single-use helpers or interfaces, options nobody passes, defensive checks for impossible states, duplicated logic, deep nesting, or comments that narrate

Skip it when the diff is small and already plain.

Inputs

  • Scope: the change against a base commit (default: the uncommitted change plus the current branch's commits). Never the whole repository unless the user asks.
  • Checks: the commands that cover the changed code, from verify-work or the project. Without passing checks, there is nothing to preserve behavior against; get them first.

Procedure

  1. Read the whole change with its surrounding code and the project's patterns. Simplification means fitting the codebase, not a personal style.
  2. List the candidates. For each, name the signal from references/code-quality.md and the simpler form. Drop any candidate that would change behavior, a public interface, or code outside the scope.
  3. Apply one at a time. After each, rerun the checks that cover it. If any fails, revert that simplification, and do not retry it.
  4. Stop when no candidate remains that makes the code clearer. Do not cycle on taste.

Typical simplifications:

  • Inline a wrapper or single-use helper that only moves code around
  • Remove an interface, factory, or option with one implementation or caller
  • Delete validation that earlier validation or the types already guarantee
  • Replace nested conditionals with guard clauses
  • Reuse an existing helper instead of a new duplicate
  • Remove dead code, unused exports, debug output, and narrating comments

Output

Simplified   Inlined formatRefundPayload (one caller); removed RefundOptions (no caller passed options);
             dropped a null check already guaranteed by the schema (refund-service.ts:31)
Kept         RefundError subclass: matches the project's error-handling convention
Checks       ✓ npm test -- refunds (23 passed)  ✓ npm run typecheck   rerun after the last edit

Escalate

  • The clearest form needs a behavior or interface change: report it as a suggestion, and do not apply it
  • The simplification would reach code outside the scope: report it, and do not apply it

Hand off

Return the simplified change, and the checks rerun, to the caller: hungry-jack, or the user. If the simplification touched code covered by browser or integration checks, say which ones should be rerun.

Before you finish, check your list of available skills for each skill named in this section. If any is missing, end your report with the missing names, this command, and the question "Should I install them for you, or will you install them yourself?" Follow "Missing companion skills" in references/operating-rules.md for the rest.

npx skills add akdevsaha-dev/factory-skills --skill hungry-jack plan-change implement-feature verify-work simplify-code review-changes reflect

Done when

Every applied simplification has passing checks rerun after it, no behavior or interface changed, and nothing outside the scope was touched.

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.