Nim Code Organizationのロゴ

Nim Code Organization

コミュニティ
planetis-m
nim-code-organization

状態の所有権を明確にし、まとまりのある境界、限定的なエクスポート、構造化されたオーケストレーションを用いて、Nimモジュールや複数段階のワークフローを整理します。大きなNimファイルをリファクタリングする場合、ロジックを複数のモジュールに分割する場合、パーサーのような状態を持つコードを設計する場合、入れ子になったヘルパーや隠れた可変状態を簡素化する場合に役立ちます。

Add to TypingMind

概要

公開者planetis-m
リポジトリskills
スキル名nim-code-organization
スター
66
フォーク
7
同梱ファイル
2
リンク
  • Markdown形式の指示

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

  • どのLLMでも利用可能

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

  • 2個の同梱ファイル

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

  • オープンソース

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

インストール

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

1

TypingMindにインストール

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

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

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

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

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

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Nim Code Organization

Choose the smallest structure that exposes the real workflow.

Rules

State ownership

  • Use ordinary locals when a workflow fits clearly in one proc.
  • When independently meaningful operations must preserve one invariant, collect that state in a named object and pass it explicitly.
  • Start with a plain object passed by var.
  • Choose ref object when identity, aliasing, or shared lifetime is part of the design.
  • Make shared mutation visible in proc parameters and field updates.

Helper placement

  • Extract a helper when it names a meaningful step, is reused, isolates a contract, or makes an invariant easier to state.
  • To share an implementation across compile-time variants, parameterize one helper with static[bool] or a static enum and branch with when.
  • Keep a short, one-use sequence in its driver when extraction would only move lines elsewhere.
  • Put helpers at module scope when several phases use them or they stand on their own.
  • Use a nested proc for logic local to one caller or for an intentional closure.
  • A nested proc captures outer locals by default. Mark it {.nimcall.} when its non-capturing calling convention is required.

Module boundaries

  • Give each module one cohesive responsibility and public contract. A module may own several related types or pieces of state.
  • Split a module when a part has an independent responsibility, dependency set, lifecycle, or reuse boundary.
  • Export only the types and entry points callers need.
  • Keep orchestration state and helpers private unless another module is meant to use them.
  • Do not use {.define.}/{.undef.} to scope behavior across modules; use a runtime parameter.

Control flow

  • Keep the normal path structured so its invariants remain visible.
  • For a closed set of behaviors, represent the kind as data and branch with case.
  • Use method when runtime subtype dispatch is part of the design, rather than as the default way to divide orchestration steps.

Incremental APIs

  • When the caller drives consumption piecewise, keep the cursor and lifecycle state in the object's fields so it survives between calls.
  • Expose one proc per transition, with open/close-style lifecycle procs only when a resource or ordering constraint spans calls; keep a one-shot operation a single proc.
  • Enforce that ordering with an assert on the lifecycle field (for example assert s.opened) at the start of each next-style proc.

Workflow

  1. Trace the data flow. Identify which values evolve, which steps share them, and which invariants must hold between steps.
  2. Choose the smallest state scope. Use locals for one clear proc, a plain object for operations preserving one invariant, and a reference only for intentional identity or shared lifetime.
  3. Shape the helpers. Extract meaningful operations. Keep local incidental logic near its caller.
  4. Choose module boundaries. Group code by responsibility and contract, then split only at a real dependency, lifecycle, or reuse boundary.
  5. Define the public surface. Export the minimum caller-facing types and operations.
  6. Choose dispatch. Use direct calls and case for closed behavior. Introduce runtime dispatch for an open subtype-based design.

State Scope

SituationDefault shape
One linear operationLocal values in one proc
Several operations share an invariantPlain state object passed by var
One caller owns a short captured operationNested proc
Several phases share a named operationModule-level proc
Identity or shared lifetime is requiredref object

Common Mistakes

MistakeWhy it is wrong
Hiding state shared by several phases in nested capturesThe mutation and cross-phase invariants disappear from proc signatures
Creating a state type for a short linear calculationThe extra type adds ceremony without clarifying ownership or invariants
Extracting every small block into a top-level helperThe reader must jump between names that do not represent meaningful operations
Splitting modules by file size aloneFile length does not identify a responsibility, dependency, lifecycle, or reuse boundary
Using a method hierarchy for a closed set of kindsStatic data plus case keeps the possible behaviors visible to the compiler and reader
Exporting orchestration helpers or state by defaultIt turns implementation details into a public compatibility obligation
Starting with ref object for locally owned stateIt introduces aliasing and identity that the workflow does not require

References

  • references/orchestration_pattern.md — Inventory reservations across independent operations that share a stock invariant, contrasted with a local calculation.
  • references/parser_state_pattern.md — A scanner object for incremental cursor and lifecycle state.

同梱ファイル

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

よくある質問

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

状態の所有権を明確にし、まとまりのある境界、限定的なエクスポート、構造化されたオーケストレーションを用いて、Nimモジュールや複数段階のワークフローを整理します。大きなNimファイルをリファクタリングする場合、ロジックを複数のモジュールに分割する場合、パーサーのような状態を持つコードを設計する場合、入れ子になったヘルパーや隠れた可変状態を簡素化する場合に役立ちます。

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

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

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

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

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

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

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

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

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

planetis-mがGitHubで公開しています。ライセンス条件はリポジトリでご確認ください。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

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

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

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

すべて見る

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

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