ghost-scan-secrets について
秘密情報スキャンを調整し、リポジトリのスキャン、候補の分析、レポート作成をサブエージェントに委任するスキルです。Poltergeist を使い、失敗したタスクを1回再試行します。
主な機能
- 01Poltergeist スキャナーの初期化
- 02リポジトリ内の秘密候補をスキャン
- 03候補分析の委任
- 04検出結果の要約作成
- 05失敗タスクの1回再試行
活用シーン
- 01コードベース内の秘密情報をスキャン
- 02検出された候補を評価
- 03スキャン結果レポートの作成
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ ghostsecurity/ skills --skill ghost-scan-secretsインストール後、Claude Code で/ghost-scan-secretsを入力して読み込まれたか確認します。
同梱ファイル
SKILL.md と一緒にインストールされる参考資料やスクリプト。
README.mdagents/analyze/agent.mdanalyzer.mdtemplate-finding.mdagents/init/agent.mdagents/scan/agent.mdagents/summarize/agent.mdtemplate-report.md詳細
Ghost Security Secrets Scanner — Orchestrator
シークレットスキャンの最上位オーケストレーターです。唯一の役割は、実際の作業を行うサブエージェントを起動するために Task ツールを呼び出すことです。以下の各ステップでは、使用する Task ツールのパラメーターを正確に指定します。自分で作業を行わないでください。
デフォルト
- repo_path: 現在の作業ディレクトリ
- scan_dir:
~/.ghost/repos/<repo_id>/scans/<short_sha>/secrets - short_sha:
git rev-parse --short HEAD(Git 管理外のディレクトリではYYYYMMDDにフォールバック)
$ARGUMENTS
上記で指定された値は、デフォルトより優先されます。
実行
- セットアップ — パスを計算し、出力ディレクトリを作成する
- Poltergeist の初期化 — poltergeist バイナリをインストールする
- シークレットのスキャン — コードベースに対して poltergeist を実行する
- 候補の分析 — 各候補を評価し、確認する
- 結果の要約 — 最終スキャンレポートを生成する
Step 0: セットアップ
この Bash コマンドを実行して、リポジトリ固有の出力ディレクトリを計算して作成し、スキルファイルの場所を特定します。
repo_name=$(basename "$(pwd)") && remote_url=$(git remote get-url origin 2>/dev/null || pwd) && short_hash=$(printf '%s' "$remote_url" | git hash-object --stdin | cut -c1-8) && repo_id="${repo_name}-${short_hash}" && short_sha=$(git rev-parse --short HEAD 2>/dev/null || date +%Y%m%d) && ghost_repo_dir="$HOME/.ghost/repos/${repo_id}" && scan_dir="${ghost_repo_dir}/scans/${short_sha}/secrets" && cache_dir="${ghost_repo_dir}/cache" && mkdir -p "$scan_dir/findings" && skill_dir=$(find . -path '*skills/scan-secrets/SKILL.md' 2>/dev/null | head -1 | xargs dirname) && echo "scan_dir=$scan_dir cache_dir=$cache_dir skill_dir=$skill_dir"
scan_dir(~/.ghost/repos/ 配下の絶対パス)、cache_dir(リポジトリレベルのキャッシュディレクトリ)、skill_dir(agents/、scripts/ などを含むスキルディレクトリの絶対パス)を保存します。
このステップ以降に使用できるツールは Task のみです。ステップ 1〜4 では Bash、Read、Grep、Glob、その他のツールを使用しないでください。
Step 1: Poltergeist の初期化
Task ツールを呼び出して、poltergeist バイナリを初期化します。
{
"description": "Initialize poltergeist binary",
"subagent_type": "general-purpose",
"prompt": "You are the init agent. Read and follow the instructions in <skill_dir>/agents/init/agent.md.\n\n## Inputs\n- skill_dir: <skill_dir>"
}
初期化エージェントは poltergeist を ~/.ghost/bin/poltergeist(Windows では poltergeist.exe)にインストールします。
Step 2: シークレットのスキャン
Task ツールを呼び出して、poltergeist スキャナーを実行します。
{
"description": "Scan for secret candidates",
"subagent_type": "general-purpose",
"prompt": "You are the scan agent. Read and follow the instructions in <skill_dir>/agents/scan/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>"
}
スキャンエージェントは候補の数を返し、<scan_dir>/candidates.json に書き込みます。
候補数が 0 の場合:検出結果なしとして、ステップ 4(要約)に進みます。
Step 3: 候補の分析
Task ツールを呼び出して、候補を分析します。
{
"description": "Analyze secret candidates",
"subagent_type": "general-purpose",
"prompt": "You are the analysis agent. Read and follow the instructions in <skill_dir>/agents/analyze/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>\n- skill_dir: <skill_dir>\n- cache_dir: <cache_dir>"
}
分析エージェントは候補ごとに並列分析エージェントを起動し、<scan_dir>/findings/ に検出結果ファイルを書き込みます。
Step 4: 結果の要約
Task ツールを呼び出して、検出結果を要約します。
{
"description": "Summarize scan results",
"subagent_type": "general-purpose",
"prompt": "You are the summarize agent. Read and follow the instructions in <skill_dir>/agents/summarize/agent.md.\n\n## Inputs\n- repo_path: <repo_path>\n- scan_dir: <scan_dir>\n- skill_dir: <skill_dir>\n- cache_dir: <cache_dir>"
}
すべてのタスクを実行した後、スキャン結果をユーザーに報告します。
エラー処理
Task の呼び出しが失敗した場合は、1 回だけ再試行します。再試行も失敗した場合は停止し、失敗を報告します。