skill-trust
CLAUDE.md1 starsChanged 8 months agoMITView on GitHub
This file helps AI agents (Claude Code, Cursor, Copilot, etc.) understand, build, test, and extend this project. skill-trust is a transparency verifier for Agent Skills. It: 1. Parses a SKILL.md file containing a YAML trust declaration 2. Scans the skill's source code for actual behavior (network, filesystem, shell, env access) 3. Compares declarations vs. actual code patterns 4. Reports inconsistencies as findings with severity levels Trust levels: VERIFIED | PARTIAL | UNDECLARED | INCONSISTENT Read src/types.ts first — it defines…
- Reads credentials
- Installs packages
In this repository2 other files it gives its agents.
- .github/AGENTS.mdAGENTS.md
- csv-analyzerSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 68
Read src/types.ts first — it defines the entire data model:
- Very specific: line 113
Add tests in tests/rules.test.ts — use makeSkill() and baseTrust() helpers
- Very specific: line 114
Update TRUST-SPEC.md if adding new trust declaration fields
- Very specific: line 122
Create src/integrations/my-scanner.ts — follow cisco.ts pattern
- Very specific: line 124
Add to the --scan option handler in src/cli.ts
- Very specific: line 129
Node.js imports: Use node: prefix (import * as fs from "node:fs")
- Very specific: line 134
No
any: Use explicit types. Read types.ts for all interfaces. - Very specific: line 167
No AST parser library — context stripping is done with a custom state machine in src/ast/context.ts.
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md — Agent Guide for skill-trust
This file helps AI agents (Claude Code, Cursor, Copilot, etc.) understand, build, test, and extend this project.
Quick Start
npm install # install dependencies
npm test # run all tests (vitest)
npm run build # compile TypeScript → dist/
npx tsc --noEmit # type-check without emittingWhat This Project Does
skill-trust is a transparency verifier for Agent Skills. It:
- Parses a
SKILL.mdfile containing a YAMLtrustdeclaration - Scans the skill's source code for actual behavior (network, filesystem, shell, env access)
- Compares declarations vs. actual code patterns
- Reports inconsistencies as findings with severity levels
Trust levels: VERIFIED | PARTIAL | UNDECLARED | INCONSISTENT
Architecture
src/
├── cli.ts # CLI entry (commander.js) — commands: verify, verify-all, init, badge, lookup
├── parser.ts # Parses SKILL.md frontmatter (gray-matter), validates trust schema
├── verifier.ts # Runs all rules, calculates trust level
├── reporter.ts # Output: terminal (chalk), JSON, SARIF
├── badge.ts # SVG badge generator
├── registry.ts # Agent Skills registry API (lookup/publish)
├── monorepo.ts # Multi-skill discovery & batch verification
├── wizard.ts # Interactive trust declaration generator (readline/promises)
├── types.ts # ★ All TypeScript interfaces — start here to understand the data model
├── index.ts # Public API exports
├── ast/ # AST-based code analysis (context-aware scanning)
│ ├── context.ts # Strips comments/strings from code (preserves line numbers)
│ ├── analyzer.ts # Extracts imports, function calls from code
│ └── index.ts
├── integrations/ # External scanner adapters
│ ├── cisco.ts # Cisco Skill Scanner API adapter
│ ├── aguara.ts # Aguara API adapter
│ ├── combined-report.ts # Merges trust + external scan results
│ ├── types.ts # Integration-specific types
│ └── index.ts
├── rules/ # Verification rules (each implements Rule interface)
│ ├── index.ts # Rule registry — allRules array
│ ├── utils.ts # Pattern scanning utilities (scanContent, scanFiles)
│ ├── network.ts # Detects network access (fetch, curl, requests, axios, URLs)
│ ├── filesystem.ts # Detects file writes + scope violations
│ ├── shell.ts # Detects shell execution (subprocess, child_process, eval)
│ ├── environment.ts # Detects env var access (process.env, os.environ)
│ ├── data-flow.ts # Detects undeclared exfiltration endpoints
│ └── obfuscation.ts # Detects obfuscation (base64, hex, eval with dynamic args)
└── action/
└── index.ts # GitHub Action entry point
tests/ # Vitest tests — mirrors src/ structure
examples/ # Example skills for testing
├── trusted-skill/ # Clean skill → VERIFIED
└── untrusted-skill/ # Intentional violations → INCONSISTENTKey Type Definitions (src/types.ts)
Read src/types.ts first — it defines the entire data model:
TrustDeclaration— the YAML trust block schema (permissions, data-flow, dependencies, boundaries)ParsedSkill— parsed SKILL.md + collected source filesSkillFile— single source file with content, path, detected languageRule— verification rule interface:{ id, name, description, check(skill): Finding[] }Finding— a single verification finding (rule, severity, message, file, line)VerificationResult— full result: skill name, trust level, findings array, summary counts
How to Add a New Verification Rule
- Create
src/rules/my-rule.ts:import type { Rule, ParsedSkill, Finding } from "../types.js"; import { scanContent, type PatternDef } from "./utils.js"; const MY_PATTERNS: PatternDef[] = [ { regex: /pattern/, id: "my-pattern", label: "description" }, ]; export const myRule: Rule = { id: "my-rule", name: "My Rule", description: "What this rule checks", check(skill: ParsedSkill): Finding[] { if (!skill.trust) return []; const findings: Finding[] = []; for (const file of skill.files) { // Pass file.language for AST-aware scanning (skips comments/strings) const matches = scanContent(file.content, MY_PATTERNS, file.language); if (matches.length > 0) { findings.push({ rule: "my-rule", severity: "error", message: `Description of violation`, file: file.relativePath, line: matches[0].line, }); } } return findings; }, }; - Register in
src/rules/index.ts— add toallRulesarray - Add tests in
tests/rules.test.ts— usemakeSkill()andbaseTrust()helpers - Update
TRUST-SPEC.mdif adding new trust declaration fields
How to Add a New CLI Command
Edit src/cli.ts — add a new program.command(...) block. Follow the existing pattern (verify, verify-all, init, badge, lookup).
How to Add a New External Scanner Integration
- Create
src/integrations/my-scanner.ts— followcisco.tspattern - Export from
src/integrations/index.ts - Add to the
--scanoption handler insrc/cli.ts
Conventions
- Module system: ESM (
"type": "module"in package.json), use.jsextensions in imports - Node.js imports: Use
node:prefix (import * as fs from "node:fs") - Error handling: Throw
ParseErrorfor validation errors, let others bubble up - Security: Validate at boundaries, strip ANSI in output, check symlinks, limit file sizes
- Testing: Vitest with
describe/it/expect, usemakeSkill()helper for test data - AST scanning: Pass
file.languagetoscanContent()for context-aware matching - No
any: Use explicit types. Readtypes.tsfor all interfaces.
Testing
npm test # run all tests
npx vitest run # run once (no watch)
npx vitest tests/ast.test.ts # run single test fileTest structure:
tests/rules.test.ts— unit tests per ruletests/e2e.test.ts— end-to-end with example skillstests/ast.test.ts— AST stripping & analyzertests/monorepo.test.ts— multi-skill discoverytests/wizard.test.ts— SKILL.md generationtests/integrations.test.ts— combined report logic
Build & Publish
npm run build # tsc → dist/
node dist/cli.js verify examples/trusted-skill # smoke test
node dist/cli.js verify-all examples/ # monorepo smoke testDependencies (keep minimal)
- chalk — terminal colors
- commander — CLI framework
- glob — file pattern matching
- gray-matter — YAML frontmatter parsing
No AST parser library — context stripping is done with a custom state machine in src/ast/context.ts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

