Audits Claude Code configuration for security vulnerabilities, misconfigurations and injection risks using AgentShield.
- What it does
- This skill instructs the agent to run the AgentShield CLI against a project's .claude/ directory to audit Claude Code configuration. It covers CLAUDE.md, settings.json, mcp.json, hooks and agent definitions, checking for hardcoded secrets, overly permissive allowlists, missing denylists, command injection via interpolation, data exfiltration and risky MCP servers. It can produce terminal, JSON, Markdown or HTML reports, apply safe automatic fixes, run a deeper adversarial analysis, and initialize a hardened configuration from scratch.
- When to use it
- Use it when setting up a new Claude Code project, after changing settings.json, CLAUDE.md or MCP configuration, before committing configuration changes, when onboarding a repository that already has Claude Code configuration, or for periodic security hygiene checks.
- Requirements
- Requires Node.js/npm and the AgentShield CLI (ecc-agentshield), installed globally or run via npx; the optional deep analysis mode needs an ANTHROPIC_API_KEY. No scripts ship with the skill; it provides instructions only.
Security Scan Skill
AgentShield を使用して、Claude Code の設定のセキュリティ問題を監査します。
起動タイミング
- 新しい Claude Code プロジェクトのセットアップ時
.claude/settings.json、CLAUDE.md、または MCP 設定の変更後
- 設定変更をコミットする前
- 既存の Claude Code 設定を持つ新しいリポジトリにオンボーディングする際
- 定期的なセキュリティ衛生チェック
スキャン対象
前提条件
AgentShield がインストールされている必要があります。確認し、必要に応じてインストールします:
使用方法
基本スキャン
現在のプロジェクトの .claude/ ディレクトリに対して実行します:
出力フォーマット
自動修正
安全な修正を自動的に適用します(自動修正可能とマークされた修正のみ):
これにより以下が実行されます:
- ハードコードされたシークレットを環境変数参照に置き換え
- ワイルドカード権限をスコープ付き代替に厳格化
- 手動のみの提案は変更しない
Opus 4.6 ディープ分析
より深い分析のために敵対的な3エージェントパイプラインを実行します:
これにより以下が実行されます:
- 攻撃者(レッドチーム) — 攻撃ベクトルを発見
- 防御者(ブルーチーム) — 強化を推奨
- 監査人(最終判定) — 両方の観点を統合
安全な設定の初期化
新しい安全な .claude/ 設定をゼロから構築します:
作成されるもの:
- スコープ付き権限と拒否リストを持つ
settings.json
- セキュリティベストプラクティスを含む
CLAUDE.md
mcp.json プレースホルダー
GitHub Action
CI パイプラインに追加します:
深刻度レベル
結果の解釈
クリティカルな発見(即座に修正)
- 設定ファイル内のハードコードされた API キーまたはトークン
- 許可リスト内の
Bash(*)(無制限のシェルアクセス)
${file} 補間によるフック内のコマンドインジェクション
- シェルを実行する MCP サーバー
高い発見(本番前に修正)
- CLAUDE.md 内の自動実行命令(プロンプトインジェクションベクトル)
- 権限内の欠落した拒否リスト
- 不要な Bash アクセスを持つエージェント
中程度の発見(推奨)
- フック内のサイレントエラー抑制(
2>/dev/null、|| true)
- 欠落した PreToolUse セキュリティフック
- MCP サーバー設定内の
npx -y 自動インストール
情報の発見(認識)
- MCP サーバーの欠落した説明
- 正しくフラグ付けされた禁止命令(グッドプラクティス)
リンク