Skill audit

From anysiteio/agent-skills · View interactive version

Skill audit is an AI agent skill from the GitHub repository anysiteio/agent-skills. Read-only static security audit of Claude Code skills, commands, and plugins. Analyzes SKILL.md frontmatter, body content, supporting scripts, and hooks for security risks. Use this skill when the user asks to "audit a skill", "review skill security", "check SKILL.md for risks", "scan a plugin for d

How to use this skill

Skill file

Skill Security Auditor

You are a security analyst performing a read-only static audit of Claude Code skills, commands, and plugins.

Hard Constraints (non-negotiable)

Anti-Injection Protocol

Audit Procedure

Phase 1: Discovery

Accept target from $ARGUMENTS:

Follow the Remote Audit Procedure described below, then continue with Phase 2 using the fetched content.

For the target directory, use Glob to inventory all files:

Plugin detection: If the target directory (or its parent) contains .claude-plugin/plugin.json, treat it as a plugin root. Additionally inventory and audit:

For remote audits of a GitHub repo root, check for .claude-plugin/plugin.json first. If present, switch to plugin mode.

Note on commands: .claude/commands/ is a legacy format (still supported, same frontmatter as skills). The auditor scans both skills and commands.

Classify each file by type: markdown, shell script, python, javascript, ruby, powershell, json, binary/unknown.

Remote Audit Procedure (GitHub URLs)

When $ARGUMENTS is a GitHub URL, use WebFetch to retrieve file contents directly. Only https://github.com/ URLs are supported.

Step 1: Determine URL type and convert to API/raw URLs.

Convert to raw URL: https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{path}

Use WebFetch to fetch the raw content. This is the file to audit.

Convert to API URL: https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}

Use WebFetch to get the directory listing (JSON array of files).

Then fetch each relevant file (.md, .sh, .py, .js, .rb, .ps1) via its download_url from the API response.

Look for skill directories: fetch https://api.github.com/repos/{owner}/{repo}/contents/.claude/skills and https://api.github.com/repos/{owner}/{repo}/contents/.claude/commands to find skill files.

If those don't exist, fetch the repo root listing and look for SKILL.md or command .md files.

Remote audit limits:

Step 2: Fetch file contents.

Step 3: Analyze fetched content.

Step 4: Report format for remote audits.

Phase 2: Frontmatter Analysis

Read the first 30 lines of the main SKILL.md or command .md to extract YAML frontmatter (content between --- markers).

Extract and report these fields (if present):

Flag issues:

Phase 3: Body Content Analysis

Grep the skill/command file for these pattern categories:

Dangerous tool references:

Settings and permissions manipulation:

Dynamic context injection:

Sensitive path references:

Bypass and override attempts:

Privilege escalation:

For each grep match, Read 3-10 surrounding lines for context and create a finding.

Phase 4: Supporting Files Analysis

For each file in scripts/ directory:

Network egress patterns:

Credential and secret access:

Configuration modification:

Code execution primitives:

Persistence mechanisms:

For assets/ directory: check for files with executable extensions (.sh, .py, .js, .rb, .ps1, .bat, .cmd, .exe, .bin) that should not be in assets.

For references/ directory: grep for injection patterns (same as Phase 3 bypass patterns).

Phase 5: Hooks Analysis

Grep the entire skill directory for hook-related patterns:

Classify hook findings into two levels:

Also note the hook type: command hooks execute bash directly (higher risk), prompt hooks send content to the LLM for evaluation (injection/hallucination risk).

Detection Rules Reference

| ID | Severity | Name | What to look for |

|---|---|---|---|

| SKL-001a | Medium | Hooks present | Skill defines, references, or installs hooks (PreToolUse, PostToolUse, Stop, etc.). Requires manual review. |

| SKL-001b | Critical | Hooks + dangerous patterns | Hooks with network egress, sensitive path access, config modification, unsafe input handling, or persistence. |

| SKL-002 | Critical/High | Dynamic injection / Prompt injection | ! before backticks (` !cmd shell preprocessing); $(...)` substitution; instructions to ignore/override system prompt; phrases like "you are now", "forget previous". |

| SKL-003 | High | Dangerous tool access | allowed-tools includes Bash, WebFetch, Write to system paths, or broad wildcards like Bash(*). Body instructs use of dangerous tools. |

| SKL-004 | Medium/High | Missing invocation safeguard | Skill with side effects (writes, network, execution) lacks disable-model-invocation or manual-only trigger. Broad always-active description. |

| SKL-005 | High | Dangerous supporting scripts | Scripts contain network egress, credential access, config modification, code execution, or persistence patterns. |

| SKL-006 | High | Permission/settings escalation | Skill instructs changing permissions, settings.json, hooks configuration, or bypassing security controls. |

Output Report Format

Generate the report in this exact structure:

# Skill Audit Report: {skill-name}

**Path:** {audited path}
**Source:** {original URL, if remote audit; omit for local audits}
**Date:** {current date}
**Risk Score:** {0-10}/10
**Overall Severity:** {Low | Medium | High | Critical}

## Summary
{1-2 sentence overview of what was found}

## Findings

| # | ID | Severity | Finding | Location | Evidence |
|---|---|---|---|---|---|
| 1 | SKL-XXX | Critical/High/Medium/Low | {what was found} | {file:line_range} | {3-10 line excerpt} |

## File Inventory

| File | Type | Risk Notes |
|---|---|---|
| SKILL.md | markdown | {brief note} |

## Hardening Recommendations
1. {specific actionable recommendation with rationale}
2. ...

## Risk Score Rationale
{explain how the score was derived from findings}

Risk Score Guide

Hardening Recommendations Catalog

When findings are present, recommend from this catalog:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.