create-code-headers

A command that adds searchable header comments to Swift source files, with options for all files, changed files, selected folders, patterns, or named files.

In plain words
What is it for?
Use it to add or update headers across a project, only on Git-changed files, or on specific Swift files and directories.
Why use it?
It makes Swift files easier for an AI assistant to find and understand while avoiding unnecessary changes to the code itself.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/blueeventhorizon/swift-selena/create-code-headers
Clone the repo
git clone --depth 1 https://github.com/BlueEventHorizon/Swift-Selena

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,050 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01050
Opus 5 $0.00000 $0.00525
Sonnet 5 $0.00000 $0.00210
Haiku 4.5 $0.00000 $0.00105

Measured 2d ago against content hash d76e8e5b2c46, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

create-code-headers scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/create-code-headers.md · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

全SwiftファイルにAI検索可能なコードヘッダーコメントを生成・追加する

使用方法

/create-code-headers                              # 全ファイル対象
/create-code-headers --update                     # 全ファイル上書き
/create-code-headers --changed                    # git変更ファイルのみ
/create-code-headers DI/*                         # DIディレクトリ配下のみ
/create-code-headers Tools/Core/*.swift           # 特定パターン
/create-code-headers StreamManager.swift MockAssertion.swift  # 個別ファイル指定

モード:

  • デフォルト: [Code Header Format]マーカーがあるファイルはスキップ
  • --update: すべてのファイルで生成・上書き
  • --changed: git変更ファイルのみ対象

ファイル指定:

  • ワイルドカード対応(*, **
  • 拡張子省略時は自動的に.swiftを追加
  • 相対パス/絶対パス両対応
  • 複数ファイル/パターン指定可能(スペース区切り)

実行フロー

Step 1: ファイルスキャン

スキャン方法の判定:

ファイル/パターン指定あり

実行:

引数からファイルパターンを取得
→ ワイルドカード展開(Glob)
→ 拡張子省略時は自動的に.swift追加
→ 除外パターンでフィルタリング

:

DI/* → Glob("DI/*.swift")
Tools/Core/StreamManager → Tools/Core/StreamManager.swift
Tools/**/*.swift → そのままGlob実行
--changed の場合

実行:

git status --porcelain

処理:

  1. 変更ファイルリストから.swiftファイルのみ抽出
  2. 除外パターンでフィルタリング
  3. ファイル数を表示
デフォルト・--update(引数なし)

対象ディレクトリ:

Tools/**/*.swift
Library/**/*.swift
Domain/**/*.swift
App/**/*.swift
Infrastructure/**/*.swift
DI/**/*.swift

実行:

  • Glob()で対象ファイルをスキャン
  • 除外パターンでフィルタリング
  • ファイル数を表示

除外パターン(共通):

  • ファイル名に Test または Tests を含む
  • ファイル名が Mock で始まる
  • Preview Content/ ディレクトリ配下

出力例:

対象ファイルをスキャン中...
✅ 対象: 166ファイル
✅ 対象: 5ファイル(--changedモード)
✅ 対象: 2ファイル(DI/*)

Step 2: 並行処理でヘッダー生成

複数Agentを並行起動:

  • code-header-generator Agentを並行起動
  • 各Agentが1ファイルずつ処理
  • 同時実行数: 5-10 Agent(システム負荷に応じて調整)

重要: 複数のTask toolを1つのメッセージで同時に呼び出す

Agent起動:

  • デフォルトモード: Task(prompt="対象ファイル: AppVersion.swift")(モード指定なし)
  • 更新モード: Task(prompt="対象ファイル: AppVersion.swift, モード: update")

進捗表示:

コードヘッダー生成中...
[=========>        ] 50/166 (30%)
- 生成: 30件
- スキップ: 20件

Step 3: 完了報告

出力例:

✅ コードヘッダー生成完了

処理結果:
- 対象ファイル: 166件
- 新規生成: 50件
- 更新: 0件(--updateモード時のみ)
- スキップ: 116件(既存ヘッダーあり)
- エラー: 0件

次のステップ:
- Swift-Selena MCPでDB構築(将来実装)
- search_code()で検索可能

Read the full file on GitHub · 134 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 134 lines · 0 tokens per session scan A d76e8e5b2c46

Subscribe to this mod's changes

create-code-headers is a command published in the GitHub repository BlueEventHorizon/Swift-Selena (5 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,050 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.