Communitygithub.com

最小限のコード規律

YAGNIラダーに基づくコード変更の規律——存在を最優先し、再利用を優先し、依存関係の階層を守り、最短で正しい差分を実現。絶対に省略してはいけない非妥協項目も定義します。

最小限のコード規律 とは?

このスキルは、AIエージェント(Claude Code、Cursor、Codexなど)がコード変更を計画・記述する際に、最小限のコード規律(YAGNIラダー)を適用するためのガイドラインです。変更が必要かどうかを最初に問い、既存のヘルパーやパターンを再利用し、標準ライブラリや既存の依存関係を優先することで、無駄なコードの発生を防ぎます。また、理解してから最小化する、退屈で明らかに正しいコードを好む、妥協点を明示する、根本原因を修正するというステップを踏みます。非妥協項目として、バリデーション、エラーハンドリング、セキュリティ、アクセシビリティ、ユーザーが明示的に要求したスコープは決して省略しないことを強制します。これにより、コードレビューやテストの負担を減らし、安全で保守しやすいコードベースを維持できます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Yeachan-Heo/oh-my-claudecode/tree/main/skills/minimal-code-discipline

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

最小限のコード規律 は何をしますか?

このスキルを使用して、コード変更の計画と記述に最小限のコード(YAGNIラダー)規律を適用します。差分を小さく保ち、明らかに正しいコードにしつつ、ユーザーの安全を守るチェックを犠牲にしません。

このスキルは ai-slop-cleaner を補完します。ai-slop-cleaner がスロップを後から掃除するのに対し、このスキルはスロップが書かれるのを未然に防ぎます。

使用すべきタイミング

以下の場合にこのスキルを使用します:

  • ユーザーが最小限、軽量、YAGNI、または可能な限り小さな差分の実装を求める場合
  • 計画や進行中の変更が明示された要求を超えて大きくなっている場合
  • スコープクリープ、既存ヘルパーの再発明、または推測による汎用化が発生しやすい新しいコードを書く場合
  • 実装前に提案された差分のサイズをレビューする場合

使用すべきでないタイミング

以下の場合にはこのスキルを使用しないでください:

  • ユーザーが広範で豊富な機能、または将来に備えたビルドを明示的に要求した場合(ユーザーの明示的なスコープが優先されます)
  • タスクが探索的なスキャフォールディングであり、ユーザーが使い捨てと明示している場合
  • 最小化の圧力が保護された動作に影響を与える場合(非妥協項目を参照)

規律

存在を最優先。 変更がそもそも存在する必要があるかどうかを問い、推測による将来のニーズにのみ役立つ作業はスキップします。

書く前に再利用。 何か新しいものを書く前に、コードベースで既存のヘルパー、型、またはパターンを検索します。数ファイル先にすでに存在するヘルパーをコピーしてはいけません。再利用するか、共通の場所に抽出します。

依存関係の階層。 最初に標準ライブラリ、次にプラットフォームネイティブの機能、次に既にインストールされている依存関係を利用します。手書きのコードは最後の手段です。数行のコードで十分な場合、新しい依存関係を導入しないでください。ただし、ユーザーが明示的に要求または承認した場合は除きます。

最小化する前に理解する。 影響を受けるコードを読み、その実行経路を追跡します。問題を理解したら、最短で正しい差分を提供します。書かれなかったコードは決して壊れません。

巧妙より退屈を。 巧妙なコードよりも、退屈で明らかに正しいコードを優先します。

限界を明示する。 意図的な簡略化を、受け入れた限界とそれを置き換える正当性を記した短いコメントで記録します。

症状ではなく根本原因を。 バグは、各呼び出し元に個別のパッチを適用するのではなく、全ての呼び出し元に共通する根本原因で修正します。

非妥協項目

以下のものを決して最小化してはなりません:

  • 信頼境界を越える場所でのバリデーション
  • データ損失を防ぐエラーハンドリング
  • セキュリティ制御
  • アクセシビリティの基本
  • ユーザーが明示的に要求したスコープ

検証

完了を報告する前に、以下を確認します:

  • 追加された各行が正当な役割を果たしている(推測による汎用化、重複したヘルパーがない)
  • 差分が、問題を正しく解決する最短のものである
  • 非妥協項目がそのまま保持されている
  • テストがまだ成功し、要求された以外の動作変更がない

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

agent-doc-discipline

Writing-time discipline for documents agents consume (the five surfaces, specs, tickets, .omc/skills/) — every rule checkable and carrying a why, steps before reference, one meaning in one home, no restating what the environment already says. Mandatory at drydock seed generation and the launch C5 sediment pass; opt-in for any other agent-facing doc edit. The companion of minimal-code-discipline: that one disciplines code, this one disciplines papers.

ai-slop-cleaner

Clean AI-generated code slop with a regression-safe, deletion-first workflow and optional reviewer-only mode

ask

Process-first advisor routing for Claude, Codex, Gemini, Antigravity, Grok, or Cursor via `omc ask`, with artifact capture and no raw CLI assembly

ask-navigator

Shipyard

autopilot

Full autonomous execution from idea to working code

autoresearch

Stateful single-mission improvement loop with strict evaluator contract, markdown decision logs, and max-runtime stop behavior

cancel

Cancel any active OMC mode (autopilot, ralph, ultragoal, swarm, ultrapilot, pipeline, team) and clean up retired legacy state

configure-notifications

Configure notification integrations (Telegram, Discord, Slack) via natural language

debug

Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction

deepinit

Deep codebase initialization with hierarchical AGENTS.md documentation

deep-interview

Socratic deep interview with mathematical ambiguity gating before explicit execution approval

drydock

Lay the keel of the shipyard harness in any repo — the 4-pillar shared environment (Context, Rules, Tools, Standards) across 5 surfaces (CLAUDE.md, skills, design-system, mcp/cli, shared context) so that every human and agent inherits the same design language and anyone can ship. Run once per repo; re-run with --check to audit drift.

execute

Carry an approved task through to working, verified code

external-context

Invoke parallel document-specialist agents for external web searches and documentation lookup

graph

Deterministic orchestration graph runtime - declarative DAG pipelines with journal-based crash recovery

harbor

Harbor intake for external work — the captain only handles unresolved decisions. Sweeps incoming issues and PRs, verifies every claim before disposition, reuses every decision already made, and hands the maintainer a docket whose pending items each carry one question with options, recommendation, impact and evidence. Agent-autonomous for facts and for actions covered by standing authorization; signed for every new judgment. Never merges.

hud

Configure HUD display options (layout, presets, display elements)

launch

Shipyard

loft

Loft the shape before cutting steel — answer a design question that prose cannot settle by building a throwaway artifact: a pure logic module in a clickable shell, or structurally different UI variants behind one route. The captain reacts to the artifact; the answer folds into the decision; the artifact never docks. Use when a design question stalls in words, when a navigator map carries a loft ticket, or when a spec discussion reaches

omc-doctor

Diagnose and fix oh-my-claudecode installation issues

関連スキル