> **Writing Agent Skills (`SKILL.md`) for Claude Code, Codex or any agent? Start here.** > One command tells you why a skill will not load, will not trigger, or leaks a secret.
# agent-skill-lint **A fast, focused linter for Agent Skills folders.** [![CI](https://github.com/purkat0301-sys/agent-skill-lint/actions/workflows/ci.yml/badge.svg)](https://github.com/purkat0301-sys/agent-skill-lint/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-3776AB.svg)](pyproject.toml) agent-skill-lint output on the bundled example skills Real output of agent-skill-lint examples/skills on the broken example skill in this repo.
--- ## Why A skill that breaks the spec usually fails **silently**: the agent never loads it, or loads it but never picks it. The common causes are boring and easy to miss by eye: - a `name` with capitals or underscores, or one that does not match its folder - a `description` that says *what* the skill does but never *when* to use it - a `scripts/...` or `references/...` file mentioned in the body that was never committed - an API key pasted into a helper script, or a `/Users/you/...` path that only works on your laptop `agent-skill-lint` catches all of these before you share or install the skill. ## Features - ✅ **Spec checks** for frontmatter: `name` format and length, name = folder, `description` present and under 1024 chars, `compatibility`, `metadata`, `allowed-tools`, unknown fields - 🎯 **Trigger check**: warns when the description never says when the skill should be used - 🔗 **Broken references**: every relative link and `scripts/`, `references/`, `assets/` path in the body must exist - 🔒 **Secret scan** across the whole skill folder (AWS, GitHub, Slack, Google, OpenAI-style keys, private key blocks, hard-coded passwords) - 📏 **Size budget**: body over 500 lines or about 5000 tokens (CJK-aware estimate); limits are configurable - 👯 **Duplicate names** across every skill you scan - 🛠️ **`--fix`** for safe mechanical fixes (name normalization, BOM, CRLF, trailing spaces) and **`--init`** to scaffold a valid skill - 📤 Output as **text, JSON or SARIF** (shows up in GitHub code scanning); every rule has an id you can ignore - ⚙️ **Config file** (`.skill-lint.toml` or `pyproject.toml`): ignore lists, exclude globs, per-folder ignores, custom limits - 🪝 **pre-commit hook** included - 🪶 Pure Python, one runtime dependency (PyYAML; plus `tomli` on Python 3.10), works offline ## Quick start ```bash pip install git+https://github.com/purkat0301-sys/agent-skill-lint agent-skill-lint ~/.claude/skills # or any folder that contains skills agent-skill-lint . --format sarif > skills.sarif ``` Exit code is `1` when there are errors (`--strict` also fails on warnings), so it drops straight into CI or a pre-commit hook. ## How it works ```mermaid flowchart LR A[paths you pass] --> B{find every SKILL.md} B --> C[parse YAML frontmatter] C --> D[spec rules E0xx / W0xx] B --> E[scan body: links, paths, size] B --> F[scan all text files: secrets] D & E & F --> G[cross-skill check: duplicate names] G --> H[text / JSON / SARIF + exit code] ``` Rules (run `agent-skill-lint --list-rules` for the full list): | Group | Ids | Examples | |---|---|---| | Structure | E001-E003 | missing `SKILL.md`, missing or invalid frontmatter | | Name | E010-E012 | missing, bad format, does not match folder | | Description | E020-W023 | missing, too long, no "when to use", too short | | Other fields | E030-W033 | `compatibility` length, `metadata` types, unknown keys | | Body | W040-E050 | too long, empty, broken file references | | Safety | E060-W061 | secrets, machine-specific home paths | | Collection | W070 | the same name used by two skills | ## Configure it Put a `.skill-lint.toml` next to your skills (or a `[tool.agent-skill-lint]` table in `pyproject.toml`). It is found automatically by searching up from the current folder to the repo root. ```toml ignore = ["W022"] # rule ids, everywhere strict = true # fail on warnings too exclude = ["vendor/**"] # skill folders to skip [limits] # body-lines, body-tokens, description-min, description-max, compatibility-max body-lines = 800 [[per-path]] # ignore rules only in some folders paths = ["legacy/*"] ignore = ["W041"] ``` Unknown keys and unknown rule ids are rejected (exit code `2`), so a typo never silently disables a check. Use `--config FILE` to pick a file or `--no-config` to ignore it. `--ignore` and `--strict` on the command line add to the file. ## Use it with pre-commit ```yaml repos: - repo: https://github.com/purkat0301-sys/agent-skill-lint rev: # a commit on main; there are no release tags yet hooks: - id: agent-skill-lint ``` Changed files are mapped to the skill folder that contains them; files outside any skill are skipped. ## Use it in GitHub Actions ```yaml - uses: purkat0301-sys/agent-skill-lint@main with: path: skills ``` ## Compared with similar tools Inspired by [RiriXt1/skillcheck](https://github.com/RiriXt1/skillcheck) (MIT) and the much larger [agent-sh/agnix](https://github.com/agent-sh/agnix). The code here is written from scratch. | | agent-skill-lint | skillcheck | agnix | |---|---|---|---| | Scope | SKILL.md folders only | SKILL.md | Many agent file types (CLAUDE.md, hooks, MCP, ...) | | Language / install | Python, `pip` | Python | Rust, npm / cargo / brew | | Broken file references | ✅ | see project | ✅ | | Secret scan of the whole skill folder | ✅ | ✅ | see project | | SARIF output | ✅ | see project | ✅ | | Duplicate names across folders | ✅ | ✅ | see project | | Scaffold a new skill (`--init`) | ✅ | see project | see project | | Number of rules | 21 | see project | 700+ | "see project" means we did not verify it; check their README. If you need every agent format, use agnix. If you want a small, readable Python linter just for skills, use this. ## FAQ **Does it call an LLM or send my files anywhere?** No. It reads files locally and prints results. **Which agents does this work with?** Any agent that uses the open Agent Skills layout (`folder/SKILL.md` with YAML frontmatter), for example Claude Code and Codex. **The "when to use" warning is wrong for my skill.** It is a heuristic. It accepts phrasings such as "Use when…", "When the user…", "Before any…", "For any … task", "Read this first…", "During any…" and "Applies to…". If yours is still flagged, ignore it with `--ignore W022` or open an issue with the description. **Can `--fix` damage my skill?** It only touches the frontmatter `name`, line endings, BOM and trailing spaces. It never rewrites your description or body. ## Limitations - The secret scan is pattern based; it will not find every secret and can flag test fixtures. - Token counts are estimates, not a real tokenizer. - Not published on PyPI yet; install from GitHub. ## Roadmap See [ROADMAP.md](ROADMAP.md). Next up: a check that `allowed-tools` names are real tools. ## Related tools Other open-source tools by the same author: [invoice-pdf-extractor](https://github.com/purkat0301-sys/invoice-pdf-extractor) · [recon-kit](https://github.com/purkat0301-sys/recon-kit) · [n8n-verified-templates](https://github.com/purkat0301-sys/n8n-verified-templates) ## Contributing Issues and pull requests are welcome. Run `pip install -e '.[dev]' && pytest` before you open a PR. New rules need a test in `tests/` and an entry in `RULES`. ## License [MIT](LICENSE)