agentleFS
jon-devlapazjon-devlapaz/tink-skills/skills/skill-gate/SKILL.md

skill-gate

Skill16 starsChanged 59 days agoMITView on GitHub

Statically extract normalized feature vectors, profile multi-factor execution risks, and evaluate harness compatibility for agent skills without third-party dependencies. Use when analyzing untrusted or new skills, auditing capabilities, or gating skill adoption in workflows.

  • Reads credentials
  • Deletes or force-pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. ElliotJLT/Claude-Skill-Potions★ 60same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository4 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When evaluating a candidate skill (e.g.

    line 22
  2. Distinctive:

    Strictly Static: No file execution, dynamic imports, or process spawning of candidate code.

    line 159

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill Gate

Skill Gate provides standard-library-only static feature extraction, multi-factor risk profiling, and harness compatibility evaluation for AI agent skills.

Invariant: Skill Gate is strictly static and read-only. It never executes untrusted skill code, executes shell scripts, or makes network calls. It inspects SKILL.md, AST nodes from Python scripts, and lexical tokens from shell scripts to derive deterministic vectors and evaluate risk boundaries.

Audit Workflow

When evaluating a candidate skill (e.g. under skills/<name> or an untrusted external directory):

  1. Run Static Audit: Execute skill_gate.py against the target skill directory from the repo root:
    python3 skills/skill-gate/skill_gate.py <skill_dir> --json --check-compat pi
  2. Evaluate the Risk Verdict:
    • ALLOW (score < 0.30, no redlines): Safe for adoption; conforms to static boundaries.
    • WARN (0.30 <= score < 0.70, no redlines): Contains network imports or sensitive environment variable lookups. Review findings before adopting.
    • BLOCK (score >= 0.70 or redline triggered): Contains critical threats (dynamic code evaluation, root filesystem operations, raw secret exfiltration). Do not adopt or execute without remediation.
  3. Verify Harness Compatibility: Confirm whether declared tools match the target harness (pi, claude, codex, generic). If incompatible, review missing tools before continuing.

Architecture

The engine runs as a multi-stage static analysis pipeline:

Skill Directory (SKILL.md, *.py, *.sh)
                 │
                 ├── 1. parse_frontmatter() ── YAML frontmatter (name, tools, metadata)
                 ├── 2. analyze_python_code() ── AST imports, dangerous calls, env lookups, writes
                 └── 3. scan_shell_script() ── Lexical tokens (destructive, network, creds, autonomy)
                                 │
                                 ▼
                 extract_features()
                 ├── Asset metrics (file counts, total bytes)
                 ├── 8D continuous normalized vector [0.0 - 1.0]
                 └── Canonical sha256:<hex> vector hash
                                 │
                 ┌───────────────┴───────────────┐
                 ▼                               ▼
          profile_risk()              evaluate_compatibility()
    - destructive_ops (0.35)           - Target harness: pi, claude, codex, generic
    - external_network (0.25)          - Tool presence check
    - credential_exposure (0.25)       - Missing tool detection
    - autonomy_escalation (0.15)       - Compatibility verdict
    - Critical redline triggers
    - ALLOW / WARN / BLOCK
                 │                               │
                 └───────────────┬───────────────┘
                                 ▼
                         analyze_skill()
                   Unified SkillAuditReport

Risk Factors & Weights

FactorWeightScope
destructive_ops0.35shutil.rmtree, os.system removals, rm -rf, truncate, dd if=
external_network0.25urllib, requests, socket, curl, wget, nc
credential_exposure0.25Private keys (~/.ssh, id_rsa), .env, secret tokens, passwords
autonomy_escalation0.15nohup, backgrounding &, kill -9, daemon processes

Critical Redlines

Any critical redline immediately produces a BLOCK verdict and forces overall_score >= 0.70:

  • Destructive commands against root/system filesystems (rm -rf /, shutil.rmtree('/'))
  • Dynamic code evaluation (eval, exec)
  • Raw credential exfiltration via network utilities (e.g. cat ~/.ssh/... | nc ...)

Verdicts

  • ALLOW: Overall score < 0.30 and no redlines triggered.
  • WARN: Overall score 0.30 <= score < 0.70 and no redlines triggered.
  • BLOCK: Overall score >= 0.70 or any redline triggered.

CLI Command Reference

# Basic summary audit of a skill (run from the repo root)
python3 skills/skill-gate/skill_gate.py <skill_dir>

# JSON output with harness compatibility check
python3 skills/skill-gate/skill_gate.py <skill_dir> --json --check-compat pi

# Check compatibility against another harness
python3 skills/skill-gate/skill_gate.py <skill_dir> --check-compat claude

# Custom risk threshold gating
python3 skills/skill-gate/skill_gate.py <skill_dir> --risk-threshold 0.50

# Save audit report to file
python3 skills/skill-gate/skill_gate.py <skill_dir> --json --output audit.json

Options

FlagArgumentDescription
skill_pathPositionalDirectory path of the agent skill to analyze
--jsonFlagOutput full audit report as formatted JSON
--check-compat[HARNESS]Evaluate compatibility against harness (pi, claude, codex, generic; default: pi when flag is given without argument)
--risk-thresholdFloatScore threshold above which the skill is blocked (default: 0.70)
--outputPathWrite report to file instead of stdout

Exit Codes

Exit CodeMeaning
0Pass / Allow (risk within threshold; compatible if compatibility check requested)
1Invalid path, missing SKILL.md, or parse error
2Blocked by risk policy (overall score $\ge$ threshold or redline triggered)
3Incompatible with target harness (missing required tools; only when --check-compat is specified)

Python API

import skill_gate

# High-level unified audit
audit = skill_gate.analyze_skill("/path/to/skill", target_harness="pi")
report_dict = audit.to_dict()

# Feature extraction & deterministic hashing
features = skill_gate.extract_features("/path/to/skill")
print(features.vector_hash)  # sha256:<64-char-hex>

# Risk profiling
risk = skill_gate.profile_risk(features)
print(risk.verdict)        # ALLOW, WARN, BLOCK
print(risk.overall_score)  # 0.0 - 1.0

# Compatibility evaluation
compat = skill_gate.evaluate_compatibility(features, target_harness="pi")
print(compat.status)       # compatible, incompatible

# Low-level AST & lexical parsers
fm, body = skill_gate.parse_frontmatter(skill_md_content)
py_analysis = skill_gate.analyze_python_code(python_source)
sh_analysis = skill_gate.scan_shell_script(shell_source)

Security & Reliability Guarantees

  1. Strictly Static: No file execution, dynamic imports, or process spawning of candidate code.
  2. Zero Third-Party Dependencies: Implemented exclusively with Python 3.9+ standard library (ast, hashlib, json, pathlib, re, argparse).
  3. Cryptographic Determinism: Canonical sorted JSON serialization guarantees byte-identical vector hashes across platforms.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.