Code Complexityのロゴ

Code Complexity

コミュニティ
AnastasiyaW
code-complexity

Keep each unit comprehensible while the code grows: deep modules over shallow ones, information hiding, honest names, small functions with one job, error handling that does not lose the error, DRY and orthogonality, design by contract, and not leaving broken windows. Merges module-complexity management with naming/function/error-handling discipline and the pragmatic meta-rules. Use when writing or reviewing a function, class or module; when an interface feels wide, a class feels shallow, or a change in one place forces edits in three; when the user says "this is hard to follow", "clean this up", "review this code", "is this a good abstraction", "too many parameters", "pass-through method", "duplicated logic", or asks about naming, comments, error handling or unit tests. Do NOT use to decide where a new module LIVES or which modules exist (use architecture-first), to plan capacity or storage (use system-and-data-design), to execute a named transformation on a file that is already too large (use refactoring-safely), or to strip over-engineering on request (use lean-code). This makes a unit comprehensible; it does not draw the system's boundaries.

Add to TypingMind

概要

公開者AnastasiyaW
リポジトリcodex-claude-code-config
スキル名code-complexity
スター
212
フォーク
32
同梱ファイル
21
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 21個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    AnastasiyaWがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Code Complexity」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/AnastasiyaW/codex-claude-code-config/tree/main/skills/development/code-complexity
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AnastasiyaW/codex-claude-code-config.git /tmp/codex-claude-code-config
mkdir -p .claude/skills
cp -r /tmp/codex-claude-code-config/skills/development/code-complexity .claude/skills/code-complexity
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでCode Complexityを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にCode Complexityを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Code Complexityは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Code complexity — keeping a unit comprehensible

Complexity is not how clever the code is. It is how much you must hold in your head to change one line safely. It accumulates by increments that each look acceptable, which is why it is never one bad commit's fault and always everyone's problem.

The two symptoms worth memorising

Change amplification — one decision, many edits. If changing a timeout means editing five files, that decision was not encapsulated anywhere.

Cognitive load — how much you must know to be safe. A function that is correct only if you know that the caller already took a lock has exported its complexity to everyone who reads it.

Both are properties of the interface, not the implementation. Which gives the rule:

Deep over shallow

A module's value is functionality it provides ÷ interface you must learn. Deep = small interface, substantial behaviour behind it. Shallow = large interface, little behind it.

  • A pass-through method that only calls one other method with the same arguments is negative value: it adds an interface without adding behaviour.
  • "One class per concept, many tiny classes" is not automatically good. Many shallow classes cost more total interface than a few deep ones.
  • The right question is never "is this class small?" but "how much do I need to know to use it?"

Information hiding — and its inverse

Every design decision that might change should be known to exactly one module. The inverse — information leakage — is when a decision shows up in two places: a file format known to both the reader and the writer, a status string parsed by three modules, a lock the caller has to remember.

Test: if this decision changed, how many files would I edit? More than one is leakage.

Names, functions, errors — the unit level

  • Names: a name that needs a comment to explain it is the wrong name. If you cannot name it, you do not yet know what it does — that is information, not a naming problem.
  • Functions: one job, one level of abstraction, few parameters. Three or more booleans in a signature is a sign that several functions are hiding in one.
  • Comments: comment the why and the constraint, never the what. A comment that restates the code rots the moment the code changes. A comment that records a ceiling or a reason is the most durable thing in the file.
  • Errors: define them out of existence where you can (an operation that cannot fail needs no error path); where you cannot, fail loudly and early. Silently swallowing is the failure that looks like success — the most expensive kind.
  • Tests: one assertion of behaviour per test, named for the behaviour. A test that needs a comment to say what it proves is not proving it clearly.

The pragmatic meta-rules

  • DRY is about knowledge, not text. Two identical lines expressing two unrelated decisions are not duplication. One decision expressed in two places is, even if the code looks different.
  • Orthogonality: changing one thing should not move another. If it does, they are coupled through something you have not named.
  • Design by contract: state preconditions and invariants, and assert them. An assertion is executable documentation that cannot rot.
  • Broken windows: one tolerated mess licenses the next. Fix it while it is one.
  • Tracer bullets: build one thin end-to-end path first, then widen. It proves the seams; a stack of half-built layers proves nothing.
  • Reversibility: prefer decisions that can be undone. There are fewer final answers than the design meeting suggests.

Review pass — in this order

  1. Does any interface require knowledge it did not give you? (leakage)
  2. Would a change to one decision edit more than one file? (amplification)
  3. Any pass-through methods, or classes whose interface is most of their content?
  4. Any name that needs its comment?
  5. Any error path that continues on failure without saying so?
  6. Any duplicated decision — not duplicated text?

References — load on demand

  • references/software-design-philosophy/deep-modules.md, information-hiding.md, complexity-symptoms.md, general-vs-special.md, strategic-programming.md, comments-as-design.md
  • references/clean-code/naming-conventions.md, functions-and-methods.md, error-handling.md, testing-principles.md, comments-formatting.md, code-smells.md
  • references/pragmatic-programmer/dry-orthogonality.md, contracts-assertions.md, tracer-bullets.md, reversibility.md, broken-windows.md, estimation-portfolio.md
  • *-original.md — the source skills' own framework prose, kept verbatim

Gotchas

  • Small is not simple. Splitting a deep module into six shallow ones raises total interface and lowers comprehensibility while looking like progress.
  • Abstraction without a second caller. An interface with one implementation and no test double is a guess about the future priced as complexity today.
  • DRY applied to text. Merging two coincidentally-identical blocks couples two things that had no reason to change together, and the next change breaks one of them.
  • "Clean" as a rewrite. Restructuring without a behaviour test is not cleaning, it is gambling — see refactoring-safely for the transformation with a net.

Troubleshooting

SymptomCauseFix
Everyone keeps re-reading the same function to use itShallow interface, deep obligationsMove the obligation inside; make the caller's job smaller
A bug fix in one module breaks anotherLeaked decision or hidden couplingFind the shared knowledge, give it one owner
Tests pass and production failsAn error path that continues silentlyMake it loud; assert the precondition
Signature grew a fourth booleanSeveral functions in a trench coatSplit by behaviour, not by parameter

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Code Complexity」では何ができますか?

Keep each unit comprehensible while the code grows: deep modules over shallow ones, information hiding, honest names, small functions with one job, error handling that does not lose the error, DRY and orthogonality, design by contract, and not leaving broken windows. Merges module-complexity management with naming/function/error-handling discipline and the pragmatic meta-rules. Use when writing or reviewing a function, class or module; when an interface feels wide, a class feels shallow, or a change in one place forces edits in three; when the user says "this is hard to follow", "clean this...

TypingMindでCode Complexityを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Code Complexityはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにCode Complexityをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/AnastasiyaW/codex-claude-code-config/tree/main/skills/development/code-complexityを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Code Complexityを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Code Complexityで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもCode Complexityを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Code Complexity」は無料ですか?

はい。AnastasiyaWがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇