New to Claude Skills? Learn how to install them →

affaan-m on GitHub

Security Scan

Free

Audit your Claude Code settings for security vulnerabilities.

by affaan-m239.3k stars on affaan-m/ecc
2 views
Updated Aug 10, 2026
Get this skill

Free · Opens the source repo

What Security Scan does

The Security Scan skill leverages AgentShield to perform a thorough audit of your Claude Code settings, identifying potential security vulnerabilities, misconfigurations, and injection risks. It specifically examines files in the .claude/ directory, including CLAUDE.md, settings.json, and MCP server configurations, ensuring that your project adheres to security best practices. By scanning for hard-coded secrets, overly permissive access lists, and other common pitfalls, this skill helps maintain a secure development environment.

This skill is particularly useful during the setup of new Claude Code projects, after making changes to configuration files, or prior to committing any modifications. It can also be employed for onboarding existing projects into new repositories and for regular security hygiene checks. The ability to run scans with varying severity levels and output formats—such as terminal output, JSON, Markdown, or HTML—provides flexibility for different use cases, whether for immediate review or integration into CI/CD pipelines.

Additionally, the skill offers an automated fix capability for certain issues, allowing developers to quickly address vulnerabilities like hard-coded secrets and excessive permissions. For deeper analysis, it can execute a comprehensive pipeline that simulates both offensive and defensive strategies, providing a holistic view of potential attack vectors and recommended mitigations. This makes it an essential tool for developers and security professionals aiming to enhance the security posture of their applications.

When to use it

Use this skill when setting up new Claude Code projects, after making configuration changes, or for regular security audits.

When not to use it

This skill may not be suitable for projects that do not utilize Claude Code or for those that do not require regular security assessments.

What you can build with it

Initial Project Setup

Run the Security Scan immediately after setting up a new Claude Code project to ensure secure configurations.

Post-Configuration Changes

Use the skill after modifying `.claude/settings.json` or other configuration files to catch any new vulnerabilities.

Regular Security Audits

Schedule regular scans to maintain security hygiene and address any potential issues before they become critical.

How to install Security Scan

View source

1. Install with the skills CLI

npx skills add affaan-m/ecc/security-scan --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by affaan-m

Security Scan Skill

AgentShield を使用して、Claude Code の設定のセキュリティ問題を監査します。

起動タイミング

  • 新しい Claude Code プロジェクトのセットアップ時
  • .claude/settings.jsonCLAUDE.md、または MCP 設定の変更後
  • 設定変更をコミットする前
  • 既存の Claude Code 設定を持つ新しいリポジトリにオンボーディングする際
  • 定期的なセキュリティ衛生チェック

スキャン対象

ファイルチェック内容
CLAUDE.mdハードコードされたシークレット、自動実行命令、プロンプトインジェクションパターン
settings.json過度に寛容な許可リスト、欠落した拒否リスト、危険なバイパスフラグ
mcp.jsonリスクのある MCP サーバー、ハードコードされた環境シークレット、npx サプライチェーンリスク
hooks/補間によるコマンドインジェクション、データ流出、サイレントエラー抑制
agents/*.md無制限のツールアクセス、プロンプトインジェクション表面、欠落したモデル仕様

前提条件

AgentShield がインストールされている必要があります。確認し、必要に応じてインストールします:

# インストール済みか確認
npx ecc-agentshield --version

# グローバルにインストール(推奨)
npm install -g ecc-agentshield

# または npx 経由で直接実行(インストール不要)
npx ecc-agentshield scan .

使用方法

基本スキャン

現在のプロジェクトの .claude/ ディレクトリに対して実行します:

# 現在のプロジェクトをスキャン
npx ecc-agentshield scan

# 特定のパスをスキャン
npx ecc-agentshield scan --path /path/to/.claude

# 最小深刻度フィルタでスキャン
npx ecc-agentshield scan --min-severity medium

出力フォーマット

# ターミナル出力(デフォルト) — グレード付きのカラーレポート
npx ecc-agentshield scan

# JSON — CI/CD 統合用
npx ecc-agentshield scan --format json

# Markdown — ドキュメント用
npx ecc-agentshield scan --format markdown

# HTML — 自己完結型のダークテーマレポート
npx ecc-agentshield scan --format html > security-report.html

自動修正

安全な修正を自動的に適用します(自動修正可能とマークされた修正のみ):

npx ecc-agentshield scan --fix

これにより以下が実行されます:

  • ハードコードされたシークレットを環境変数参照に置き換え
  • ワイルドカード権限をスコープ付き代替に厳格化
  • 手動のみの提案は変更しない

Opus 4.6 ディープ分析

より深い分析のために敵対的な3エージェントパイプラインを実行します:

# ANTHROPIC_API_KEY が必要
export ANTHROPIC_API_KEY=your-key
npx ecc-agentshield scan --opus --stream

これにより以下が実行されます:

  1. 攻撃者(レッドチーム) — 攻撃ベクトルを発見
  2. 防御者(ブルーチーム) — 強化を推奨
  3. 監査人(最終判定) — 両方の観点を統合

安全な設定の初期化

新しい安全な .claude/ 設定をゼロから構築します:

npx ecc-agentshield init

作成されるもの:

  • スコープ付き権限と拒否リストを持つ settings.json
  • セキュリティベストプラクティスを含む CLAUDE.md
  • mcp.json プレースホルダー

GitHub Action

CI パイプラインに追加します:

- uses: affaan-m/agentshield@v1
  with:
    path: '.'
    min-severity: 'medium'
    fail-on-findings: true

深刻度レベル

グレードスコア意味
A90-100安全な設定
B75-89軽微な問題
C60-74注意が必要
D40-59重大なリスク
F0-39クリティカルな脆弱性

結果の解釈

クリティカルな発見(即座に修正)

  • 設定ファイル内のハードコードされた API キーまたはトークン
  • 許可リスト内の Bash(*)(無制限のシェルアクセス)
  • ${file} 補間によるフック内のコマンドインジェクション
  • シェルを実行する MCP サーバー

高い発見(本番前に修正)

  • CLAUDE.md 内の自動実行命令(プロンプトインジェクションベクトル)
  • 権限内の欠落した拒否リスト
  • 不要な Bash アクセスを持つエージェント

中程度の発見(推奨)

  • フック内のサイレントエラー抑制(2>/dev/null|| true
  • 欠落した PreToolUse セキュリティフック
  • MCP サーバー設定内の npx -y 自動インストール

情報の発見(認識)

  • MCP サーバーの欠落した説明
  • 正しくフラグ付けされた禁止命令(グッドプラクティス)

リンク

Frequently asked questions about Security Scan

Similar skills