simplify
Skill0 starsChanged 32 days agoMITView on GitHub
Reducing code to its simplest correct form without changing behaviour: replaces verbose imperative loops with built-in expressions, collapses redundant conditionals, eliminates unnecessary abstraction layers, removes over-engineered patterns, applies early returns to flatten nesting, and spots where a standard library function already does what 40 lines of custom code is doing. Use when you want to simplify code, reduce lines of code, make this shorter, remove over-engineering, flatten nested ifs, replace a loop with a built-in, remove unnecessary abstraction, or make this more readable.
119 other projects use a version of this.
Adopted by
Most recently taken up by
- thistleknot/skillstheir own version, first seen Nov 8, 2026
- PeanutGT/NutsSkillstheir own version, first seen Nov 8, 2026
- Ovich/charrettetheir own version, first seen Nov 8, 2026
- caidanw/skillstheir own version, first seen Nov 8, 2026
- Ovich/swarmstormtheir own version, first seen Nov 8, 2026
- alexandrosandre/agentic-engineeringtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use codex-system, design-tracker 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.
gaebalaiSkillcodex-system
PROACTIVELY consult Codex CLI, your highly capable supporter with exceptional reasoning and task completion abilities. Codex is a trusted expert you should ALWAYS consult BEFORE making decisions on: design choices, implementation approaches, debugging strategies, refactoring plans, or any non-trivial problem. When uncertain, consult Codex. Don't hesitate - Codex provides better analysis. Explicit triggers: "think deeper", "analyze", "second opinion", "consult codex".
Also in 3 projects that use this
gaebalaiSkilldesign-tracker
PROACTIVELY track and document project design decisions without being asked. Activate automatically when detecting architecture discussions, implementation decisions, pattern choices, library selections, or any technical decisions. Also use when user explicitly says "記録して", "設計どうなってる", "record this". Do NOT wait for user to ask - record important decisions immediately.
Also in 3 projects that use this
mike22890Skillclonedeps
将项目依赖的第三方库源码克隆到本地,便于深入阅读和调试。当需要查看库的实现细节、阅读源码、调试第三方依赖、理解 SDK/framework 内部机制、查看 node_modules 之外的原始代码、分析开源库架构、学习他人代码、查看依赖的 TypeScript 类型定义时使用。
Also in 3 projects that use this
mdrubelamin2Skillverification-planning
Plans how to prove a change works or broke nothing: frames the claim, designs an evidence path from the system itself, and requires every check to be able to fail.
Also in 3 projects that use this
devbrother2024Skillartifact-design
단독 self-contained HTML 산출물(랜딩 페이지, 정적 문서·리포트, 독립 대시보드, 데모·게임, 개발 전 UX/UI 대안 비교 목업)을 만들 때 팔레트·타이포그래피·레이아웃을 의도적으로 설계하고 템플릿·AI스러운 디자인을 피하도록 돕는 디자인 가이드. HTML/CSS를 쓰기 전에 로드한다. "랜딩 만들어줘", "이 내용 단일 HTML로 예쁘게", "UX 대안 HTML로 비교해줘", "디자인 잡아줘"처럼 단독 HTML 아티팩트를 만들거나 비교하는 요청에 활성화하고, 기존 앱(React·Vue 등)의 인앱 컴포넌트 수정이나 순수 백엔드·로직 작업에는 쓰지 않는다.
Also in 3 projects that use this
codebycoreySkillbatch
Create multiple proposals from free-form feature descriptions. Use when planning several features at once, batch creating proposals, or setting up related changes.
Also in 4 projects that use this
- +3 more from gaebalai
Other versions119 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 119
- Z3Prover/z3★ 13ksame name
- aaddrick/claude-desktop-debian★ 5.5ksame name
- CherryHQ/cherry-studio-app★ 4.1ksame name
- elliothux/open-compute★ 3.3ksame name
- meta-pytorch/OpenEnv★ 2.8ksame name
- huggingface/OpenEnv★ 2.8ksame name
- bholmesdev/hubble.md★ 1.5ksame name
- kdlbs/kandev★ 1.1ksame name
- truffle-ai/dexto★ 659same name
- deadlock-mod-manager/deadlock-mod-manager★ 584same name
109 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- api-versioningSkill
- authSkill
- background-jobsSkill
- cachingSkill
- capacity-planningSkill
- changelogSkill
- chaos-engineeringSkill
- ci-cdSkill
- circuit-breakerSkill
- claude-best-practicesSkill
- code-commentsSkill
- code-hygieneSkill
- code-reviewSkill
- code-structureSkill
- commit-styleSkill
- concurrency-and-lockingSkill
- database-transactionsSkill
- data-consistencySkill
- debug-infra-startupSkill
- debug-sessionSkill
- demo-video-creatorSkill
- demo-video-script-creatorSkill
- dependency-injectionSkill
- dependency-updateSkill
- disk-cleanupSkill
- distributed-tracingSkill
- dockerSkill
- env-configSkill
- env-setupSkill
- error-handlingSkill
- event-driven-architectureSkill
- feature-flagsSkill
- file-storageSkill
- graceful-shutdownSkill
- idempotencySkill
- input-validationSkill
- jars-engineering-blogsmithSkill
- jars-workshop-builderSkill
- licensingSkill
- loggingSkill
- memory-and-allocationsSkill
- migrate-dbSkill
- monitoringSkill
- multi-tenancySkill
- notificationsSkill
- openapiSkill
- paginationSkill
- perf-profileSkill
- pr-descriptionSkill
- query-optimizationSkill
- rate-limitingSkill
- refactorSkill
- releaseSkill
- runbook-writerSkill
- searchSkill
- secrets-auditSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 111 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
If there are no tests, write a characterisation test first — call the function with real inputs, record the output, pin it.
- Distinctive: line 16
Never simplify and fix a bug in the same change.
- Distinctive: line 181
Before writing any utility function, check the standard library and the project's existing dependencies.
- Distinctive: line 277
If none of these apply, remove the layer.
- Distinctive: line 335
If the answer is no, remove it.
- Distinctive: line 341
Before marking a simplification done:
- Distinctive: line 354
Never simplify code you do not understand.
- Distinctive: line 356
Remove abstraction layers that add indirection without adding value.
“Common” is measured: kept by at least 6 in 10 of the 111 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.
Files
simplify
Find the simplest correct expression of what the code already does. No behaviour changes.
1. The rule before touching anything
Simplification must produce identical behaviour. Run the tests before and after every change. If there are no tests, write a characterisation test first — call the function with real inputs, record the output, pin it. Then simplify.
Never simplify and fix a bug in the same change. If you find a bug, note it separately.
2. Replace imperative loops with built-ins
The most common source of unnecessary lines. Built-in functions are faster to read, less likely to have off-by-one errors, and optimised by the runtime.
# ❌ 6 lines to filter a list
result = []
for user in users:
if user.is_active:
result.append(user)
# ✅ 1 line
result = [u for u in users if u.is_active]
# ❌ 7 lines to build a lookup map
mapping = {}
for item in items:
mapping[item.id] = item
# ✅ 1 line
mapping = {item.id: item for item in items}
# ❌ 8 lines to sum a field
total = 0
for order in orders:
total += order.amount
# ✅ 1 line
total = sum(order.amount for order in orders)
# ❌ Manual any() check
found = False
for record in records:
if record.status == "failed":
found = True
break
# ✅
found = any(r.status == "failed" for r in records)// ❌ Imperative filter + map in 7 lines
const result = [];
for (const user of users) {
if (user.isActive) {
result.push(user.email);
}
}
// ✅ 1 line
const result = users.filter(u => u.isActive).map(u => u.email);
// ❌ Manual object build
const lookup: Record<string, Item> = {};
for (const item of items) {
lookup[item.id] = item;
}
// ✅
const lookup = Object.fromEntries(items.map(i => [i.id, i]));3. Early returns — flatten nesting, not logic
Deep nesting is the enemy of readability. Guard clauses at the top of a function eliminate the rightward drift that makes code hard to follow.
# ❌ Nested pyramid — 4 levels deep
def process_order(order):
if order:
if order.is_valid():
if order.user:
if order.user.is_active:
return charge(order)
# ✅ Flat — each guard exits immediately, happy path is obvious
def process_order(order):
if not order:
return None
if not order.is_valid():
return None
if not order.user:
return None
if not order.user.is_active:
return None
return charge(order)// ❌ 5-level nesting
function processOrder(order: Order | null) {
if (order) {
if (order.isValid()) {
if (order.user) {
return charge(order);
}
}
}
}
// ✅ Guard clauses
function processOrder(order: Order | null) {
if (!order) return null;
if (!order.isValid()) return null;
if (!order.user) return null;
return charge(order);
}4. Collapse redundant conditionals
# ❌ Returns True/False explicitly from a boolean expression
def is_eligible(user):
if user.age >= 18 and user.is_verified:
return True
else:
return False
# ✅
def is_eligible(user):
return user.age >= 18 and user.is_verified
# ❌ Assigns variable only to return it
def get_label(status):
if status == "active":
label = "Active"
elif status == "inactive":
label = "Inactive"
else:
label = "Unknown"
return label
# ✅ Return directly
def get_label(status):
if status == "active": return "Active"
if status == "inactive": return "Inactive"
return "Unknown"
# ❌ Ternary written as if/else block
if condition:
value = a
else:
value = b
# ✅
value = a if condition else b # Python
value = condition ? a : b; # JS/TS5. Use standard library — don't rewrite what already exists
Before writing any utility function, check the standard library and the project's existing dependencies. Rewriting something that already exists creates two things to maintain.
# ❌ Custom flatten
def flatten(nested):
result = []
for sublist in nested:
for item in sublist:
result.append(item)
return result
# ✅ Already exists
from itertools import chain
flat = list(chain.from_iterable(nested))
# ❌ Custom grouping — 10 lines
groups = {}
for item in items:
key = item.category
if key not in groups:
groups[key] = []
groups[key].append(item)
# ✅
from collections import defaultdict
groups = defaultdict(list)
for item in items:
groups[item.category].append(item)
# ❌ Custom chunk function
def chunks(lst, n):
result = []
for i in range(0, len(lst), n):
result.append(lst[i:i+n])
return result
# ✅ Already a one-liner
chunks = [lst[i:i+n] for i in range(0, len(lst), n)]// ❌ Custom deep clone — 15 lines of recursive copying
// ✅ Already exists (for JSON-serialisable data)
const clone = structuredClone(obj);
// ❌ Custom unique filter
const unique = [];
for (const item of items) {
if (!unique.includes(item)) unique.push(item);
}
// ✅
const unique = [...new Set(items)];
// ❌ Custom last-element getter
function last(arr) { return arr[arr.length - 1]; }
// ✅
const last = arr.at(-1);6. Remove unnecessary abstraction
Abstraction that adds indirection without adding clarity is overhead, not design.
# ❌ A function that wraps a single expression with no added logic
def get_user_email(user):
return user.email
# called as:
email = get_user_email(user)
# ✅ Just use the attribute
email = user.email
# ❌ A class with one method that could be a function
class EmailSender:
def send(self, to: str, body: str):
smtp.send(to, body)
sender = EmailSender()
sender.send(to, body)
# ✅ If there is genuinely no state, use a function
def send_email(to: str, body: str):
smtp.send(to, body)When abstraction IS justified:
- The function encapsulates a decision that could change (e.g. which SMTP provider)
- The wrapper adds error handling, logging, or retry logic
- The class manages state across calls
- The abstraction makes tests significantly easier to write
If none of these apply, remove the layer.
7. Simplify boolean and None checks
# ❌ Verbose None / empty checks
if len(items) > 0: ...
if items != []: ...
if items is not None and len(items) > 0: ...
# ✅
if items: ...
# ❌ Double negative
if not user is None: ...
# ✅
if user is not None: ...
# ❌ Explicit comparison to True/False
if is_valid == True: ...
if is_valid == False: ...
# ✅
if is_valid: ...
if not is_valid: ...// ❌
if (items.length > 0) { ... }
if (value !== null && value !== undefined) { ... }
// ✅
if (items.length) { ... }
if (value != null) { ... } // != null catches both null and undefined8. Spot over-engineered patterns
These patterns appear most often in AI-generated or over-abstracted code. When you see them, ask: does this complexity earn its keep?
| Pattern | Signal it's over-engineered | Simpler form |
| Factory that creates one type | No polymorphism needed | Direct instantiation |
| Strategy pattern for one algorithm | No swappability needed | Inline the logic |
| Event bus for in-process calls | No decoupling benefit | Direct function call |
| DTO that mirrors the model exactly | No transformation happening | Use the model directly |
| Config object passed to every function | Only 1–2 fields actually used | Pass the fields directly |
| Custom error class with no extra fields | Adds nothing over the base | Use base exception |
| Wrapper class around a single dict | Dict is already fine | Use the dict |
Apply the test: if you removed this layer, would anything break or become harder to test? If the answer is no, remove it.
9. Simplification checklist
Before marking a simplification done:
- Tests pass (run the suite, not just syntax check)
- Line count is actually lower — count before and after
- No behaviour was changed (same inputs → same outputs)
- No new dependencies introduced just to simplify
- The simplified version is genuinely easier to read, not just shorter
- Commit is isolated — only simplification, no feature changes
Rules
- Shorter is not always simpler. A one-liner that needs a comment to explain it is not simpler than three readable lines. Optimise for clarity, not character count.
- Never simplify code you do not understand. Read it, trace it, test it first.
- Standard library over custom code — always check before writing a utility function.
- Remove abstraction layers that add indirection without adding value.
- One simplification concern per commit — loops, then conditionals, then abstractions. Mixing them makes the diff unreadable.
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.

