YAGNI-ladder coding discipline for writing changes — existence-first, reuse before writing, dependency ladder, shortest correct diff, with non-negotiables that
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-minimal-code-discipline-cffd3b8de4e8 ,按照其中的说明把「minimal-code-discipline」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Use this skill to apply a minimal-code (YAGNI-ladder) discipline while planning and writing code changes. It keeps diffs small and obviously correct without sacrificing the checks that keep users safe.
This skill complements ai-slop-cleaner: that skill cleans slop after it lands; this one keeps it from being written.
Use this skill when:
Do not use this skill when:
Existence first. Ask whether the change needs to exist at all; skip work that serves only a speculative future need.
Reuse before writing. Search the codebase for an existing helper, type, or pattern before writing anything new. Never copy a helper that already lives a few files away — reuse it or extract it to one shared location.
Dependency ladder. Reach for the standard library first, then platform-native capability, then an already-installed dependency. Hand-written code is the last resort. Do not introduce a new dependency when a few lines of code suffice, unless the user explicitly requested or approved it.
Understand before minimizing. Read the affected code and follow its execution path first. Ship the shortest correct diff once the problem is understood — code you never write never breaks.
Boring over clever. Prefer boring, obviously-correct code over clever code.
Mark the ceiling. Record deliberate simplifications with a short comment naming the accepted limit and what would justify replacing it.
Root cause, not symptoms. Fix bugs at the root cause shared by every caller, not with a separate patch for each reported symptom.
Never minimize away:
Before reporting completion, confirm: