Self Documented Codeのロゴ

Self Documented Code

コミュニティ
marekkirejczyk
self-documented-code

Rename everything in a scope (a repository, a PR, a directory, a concept) so each name explains itself and each concept has one name, keep comments only for what code cannot say, and update the project's glossary to match. Semantics, lint and tests stay intact.

概要

公開者marekkirejczyk
リポジトリskills
スキル名self-documented-code
スター
157
フォーク
1
同梱ファイル
1
ライセンスMIT
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 1個の同梱ファイル

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

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Self-documented code

Rename the code in a scope so that every name says what it means and the same thing has the same name everywhere, and leave comments only for what the code cannot say. Arguments: $ARGUMENTS. If your agent does not fill that in, take them from the user's message.

The scope is what the user names: the repository, a PR or branch (only the names and comments that PR adds or changes, plus whatever must change with them), a directory, a file, a module, or a concept ("everything about payments"). With no scope given, use the whole repository.

Run from start to finish without asking for approval. The one stop is a failing baseline (rule 2).

Goal

A reader who sees only a name, at the place it is used, knows what it holds or does, without opening its definition or reading a comment.

You are done when all four hold:

  1. Every name is self-explanatory. Every variable, parameter, function, method, class, type, field, constant, file and test helper in scope has been reviewed, and renamed if it falls short of the naming standard.
  2. Every concept has one name. Across the scope, one concept has one term, and one term means one concept.
  3. Every comment earns its place. Each comment left in scope meets the comment standard.
  4. Every project dictionary matches the code. Each glossary or word list the project keeps uses the final terms (see Dictionaries).

Rules

These hold after every round. A round that breaks one is undone.

  1. Semantics stay the same. Same answers, errors, writes and calls, in the same order. Change only names, comments and dictionaries: logic, control flow, parameter order and the formatting of unrelated code stay as they are.
  2. Lint, type checks, build and tests pass, using the project's own commands. They must pass before you start: if they fail, stop and report it.
  3. Tests change only in names and comments. Their assertions, expected values and logic stay exactly as they are.
  4. External contracts keep their names. That covers anything code outside this repository depends on, or that is stored or sent: published package exports, public API routes and fields, database tables and columns, serialized keys, event names, environment variables, config keys, CLI flags, and names required by a framework or interface you don't own. Report a bad name of this kind and leave it.
  5. Every reference moves with its name. Use the language server's or compiler's rename where there is one. Then search for what tools can't see: strings, reflection, dynamic lookups, templates, mocks, docs, comments, scripts and CI config.
  6. Stay in scope. A rename may spread beyond the scope only when the code would otherwise break, and the report lists it. Dictionaries are updated wherever they live.

Naming standard

A name is good when:

  • It states meaning, not type or mechanics: unpaidInvoices, not list or invoiceArray.
  • It uses the domain's words, and the language's own conventions for case and idiom.
  • Its abbreviations are universal in the domain or language (id, url, i as the index of a short loop). Spell out the rest.
  • It carries its unit or qualifier when that matters: timeoutSeconds, priceInPence, isExpired, hasPaid.
  • A function says what it does and returns: a verb phrase for an action, a noun or question for a query. A function with a side effect sounds like one.
  • Its length tracks how far it travels: short in a three-line lambda, full for an export. Drop words the context already gives (order.orderId → order.id).
  • Every word carries meaning. data, info, manager, helper, util, temp, foo and a 2 suffix go, unless the word truly is the meaning.
  • It is true. It describes all of what the code does today.

A name that already meets the standard stays: rename for meaning, never for taste.

Comment standard

Code says what happens. A comment exists only for what a reader could not work out from well-named code:

  • Why this and not the obvious alternative: a decision, a trade-off, an approach that was tried and failed.
  • A non-trivial fact the code can't show: a vendor's undocumented behaviour, a workaround and its cause, an ordering constraint, a performance or security reason, a link to the issue or spec behind it.

Delete every other comment: one that narrates the code, restates a name or signature, labels a section, or holds dead code. Before deleting one, check whether it says something the code doesn't. If it does, move that into a name, or keep only that part as a why comment. Correct any comment you keep that the code contradicts.

New comments are rare: write one only for something you learned that a name cannot carry and this standard calls for.

Linter and compiler directives, licence headers, and doc comments that generate published documentation stay as they are.

Dictionaries

A dictionary is any place the project defines its words: GLOSSARY.md, a domain or ubiquitous-language doc, a terms section in the docs, a spell-check word list (cspell, codespell). Search for them before the vocabulary step. A project with none stays with none.

A dictionary's term is the default for its concept. When you choose a different one, or split or merge terms, change the entry in the same round as the rename: the new term, an accurate definition, the retired word gone. Add an entry for each domain concept the dictionary should have but lacks. Historical records such as ADRs and changelogs keep the words of their time.

Method

  1. Baseline. On a new branch, run lint, type checks, build and tests, and record the results. Done when all pass.
  2. Vocabulary. Read the scope and the dictionaries, and write a table: each concept, the names it has today, the one term it will use. Include each term with several meanings, and how it splits. Done when every name in scope maps to a row or is marked as already good.
  3. Rename in rounds. One concept or one module per round, outermost names first, with its dictionary entries. After each round run the checks, then commit. If a check goes red, undo the round and take a smaller step. Leave the branch unpushed. Done when every row of the table is applied.
  4. Comments. Now that the names are done, apply the comment standard across the scope, in a round of its own, so the new names can replace what the comments said.
  5. Sweep. Go through the scope once more, file by file, against both standards. Done when you have opened every file in scope, no old term from the table remains in the code or the dictionaries, and all checks pass.

When a name reveals a problem

A name that can't be made honest usually means the code does two things or is wrong. Leave the code as it is, give it the most accurate name you can, and report it.

Report

  • The vocabulary table, the number of names reviewed and renamed, and the number of comments deleted, rewritten and kept.
  • The dictionary entries changed, added and removed, or that the project has no dictionary.
  • Check results before and after.
  • Renames that went beyond the scope.
  • External names left alone that should change, with where they are defined.
  • Code the naming exposed as misleading, buggy or doing too much.

同梱ファイル

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

よくある質問

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

Rename everything in a scope (a repository, a PR, a directory, a concept) so each name explains itself and each concept has one name, keep comments only for what code cannot say, and update the project's glossary to match. Semantics, lint and tests stay intact.

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

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

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

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

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

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

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

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

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

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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