Skip to main content
Glama
README.md
<div align="center">

<p>
  <a href="README.md"><strong>English</strong></a> · <a href="README.ru.md">Русский</a>
</p>

<img src="assets/hero-banner.svg" alt="skill-guard hero banner" width="900" />

<br/><br/>

![Tests](https://img.shields.io/badge/tests-node%3Atest%20passing-248A3D?style=flat-square)
![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20npm%20packages-0071E3?style=flat-square)
![Node.js >= 22.5](https://img.shields.io/badge/node-%3E%3D22.5.0-6E6E73?style=flat-square)
![License MIT](https://img.shields.io/badge/license-MIT-6E6E73?style=flat-square)

**Security scanner, Unicode steganography detector, broken-link auditor, and `mcp-lock.json` rug-pull verifier.**

Works with Claude Code, Cursor, Windsurf, Codex CLI, and Antigravity.

</div>

Community `SKILL.md` files and third-party MCP configs run inside the agent's highest-trust instruction layer. A concealed Unicode Tag payload, a base64-encoded curl command inside an HTML comment, or an `npx` MCP server that silently mutates a tool description after install can read `.env` or `~/.ssh/id_rsa` without throwing an error. Broken markdown links and conflicting rules also degrade agent behavior quietly.

`skill-guard` scans skills, rules, and MCP configs offline with zero npm dependencies, generates SARIF 2.1.0 reports for GitHub Code Scanning, and pins live stdio MCP `tools/list` schemas into `mcp-lock.json` to catch post-install rug pulls.

## Quick start

Requires Node.js `>= 22.5.0`.

```bash
# Scan a directory or skill folder
npx -y github:keenfolk1-lgtm/skill-guard scan .

# Fail CI on high or critical findings and export SARIF 2.1.0
npx -y github:keenfolk1-lgtm/skill-guard scan . --format sarif --fail-on high > skill-guard.sarif

# Pin live stdio MCP tool descriptions and skill files into mcp-lock.json
npx -y github:keenfolk1-lgtm/skill-guard lock --config ./.mcp.json --dir ./.agents/skills

# Verify live MCP servers still match mcp-lock.json
npx -y github:keenfolk1-lgtm/skill-guard verify
```

### MCP server registration

```bash
claude mcp add skill-guard -- npx -y github:keenfolk1-lgtm/skill-guard serve
```

Or add it to `mcp.json`:

```json
{
  "mcpServers": {
    "skill-guard": {
      "command": "npx",
      "args": ["-y", "github:keenfolk1-lgtm/skill-guard", "serve"]
    }
  }
}
```

## Example scan output

Running `node ./bin/skill-guard.mjs scan ./fixtures/poisoned-skill` produces:

```text
skill-guard scan: ./fixtures/poisoned-skill
  files scanned: 2 | markdown tokens: 118 | risk score: 100/100
  findings: 10 (critical=5, high=3, medium=2, low=0)

[CRITICAL] SG-INJ-001 SKILL.md:10
  Explicit system or prior instruction override phrase detected
[CRITICAL] SG-SHD-001 SKILL.md:12
  Cross-tool shadowing attempt trying to hijack calls from built-in or peer tools
[CRITICAL] SG-HID-003 SKILL.md:14
  Base64-encoded payload triggers SG-EXF-003: Outbound curl POST/upload targeting local file or secret data
[HIGH] SG-CFG-001 mcp.json:4
  Plaintext HTTP remote MCP server URL exposes tool traffic and tokens
[MEDIUM] SG-STR-003 SKILL.md:8
  Broken relative link target "does-not-exist.md" does not exist on disk
```

## Detection coverage

| Category | Rule IDs | What it catches |
| --- | --- | --- |
| Unicode steganography | `SG-UNI-001` .. `004` | Unicode Tag ASCII smuggling (`U+E0020..007E`, decoded in output), BiDi overrides, zero-width chars, mixed Latin/Cyrillic homoglyphs. |
| Prompt overrides | `SG-INJ-001` .. `006` | System/prior instruction overrides, stealth suppression ("do not tell the user"), spoofed `<system>` role tags. |
| Tool shadowing | `SG-SHD-001` .. `003` | Directives hijacking built-in tools (`read_file`, `bash`) or rerouting peer tool traffic. |
| Secret access & RCE | `SG-SEC-001` .. `006`, `SG-EXF-001` .. `008` | `.ssh`, `.aws`, `.env`, private key literals, `curl \| sh`, `irm \| iex`, outbound uploads, markdown tracking pixels. |
| Concealed payloads | `SG-HID-001` .. `003` | Imperatives and URLs inside HTML comments, recursive base64 decode and rescan. |
| MCP config & integrity | `SG-CFG-001` .. `004`, `SG-STR-001` .. `004` | Plaintext remote `http://` URLs, inline shell wrappers, hardcoded secrets, missing YAML frontmatter, dead local links, conflicting rules. |

## MCP tools

| Tool | Purpose |
| --- | --- |
| `scan_path` | Audits a folder or config file across all security and integrity layers. |
| `scan_text` | Checks untrusted markdown or tool output inline. |
| `verify_lockfile` | Introspects configured stdio servers and compares against `mcp-lock.json`. |

## Limitations

Static regex and base64 rules catch explicit smuggling and common injection phrasing, not subtle natural-language social engineering written with benign words. `mcp-lock.json` verification currently spawns stdio MCP servers (`command` + `args`) and skips remote SSE or HTTP servers. Contradiction checks compare explicit `"always ..."` vs `"never ..."` directives on matching verbs and nouns.

## License

[MIT](LICENSE)

Related tools: [mcp-diet](https://github.com/keenfolk1-lgtm/mcp-diet) · [blast-radius-mcp](https://github.com/keenfolk1-lgtm/blast-radius-mcp) · [flight-recorder-mcp](https://github.com/keenfolk1-lgtm/flight-recorder-mcp) · [agent-undo](https://github.com/keenfolk1-lgtm/agent-undo) · [vibe-to-prod](https://github.com/keenfolk1-lgtm/vibe-to-prod)

TDQS

A3.7/5.0

Scored across 3 tools

Disambiguation4/5

Each tool targets a distinct input type or workflow: filesystem paths, raw text, and lockfile drift verification. scan_path and scan_text overlap in detection goals (injections/Unicode), but their input boundaries are clear enough to avoid most misselection.

Naming Consistency5/5

All three names follow a consistent verb_noun snake_case pattern: scan_path, scan_text, verify_lockfile. The convention is predictable and easy to reason about.

Tool Count5/5

Three tools are well-scoped for a focused security-auditing server, with each covering a clear input mode. No tool feels redundant or out of place.

Completeness4/5

The set covers path auditing, raw text inspection, and lockfile verification, which are the core detection workflows. A minor gap is the absence of a tool to create or update the lockfile, and no remediation/reporting operation, but core scanning is complete.

Maintenance

ActivityNo data
ResponsivenessNo recent community issues