skillpack/verify/schema.rs
1//! The Claude Code schema constants that `verify` enforces.
2//!
3//! Every literal here is grounded in the public docs (code.claude.com/docs/en/
4//! plugins-reference, plugin-marketplaces, skills) as checked against the live
5//! spec. Keep a comment citing the source for each rule so future-me can
6//! re-verify against an updated spec without guessing where a number came from.
7
8/// The combined `description` + `when_to_use` text in the SKILL.md skill
9/// listing is capped at 1,536 characters.
10///
11/// Source: code.claude.com/docs/en/skills — "the combined `description` and
12/// `when_to_use` text is truncated at 1,536 characters in the skill listing."
13pub const SKILL_LISTING_CHAR_CAP: usize = 1_536;
14
15/// A skill `name` is capped at 64 characters.
16///
17/// Source: skill-authoring docs — "name: Maximum 64 characters."
18pub const SKILL_NAME_MAX_CHARS: usize = 64;
19
20// `when_to_use` advertises trigger phrases; we flag if it's present but empty
21// or only whitespace, since that defeats the whole point of the field.
22// (We do not enforce a hard length — the listing cap covers the upper bound.)
23
24/// Plugin / marketplace `name` must be kebab-case and contain no spaces.
25/// Source: plugin-marketplaces — "kebab-case, no spaces." We use a permissive
26/// regex that matches the AgentSkills.io open standard `^[a-z][a-z0-9-]*[a-z0-9]$`,
27/// which allows no consecutive hyphens and a trailing alnum.
28pub const NAME_KEBAB_REGEX: &str = r"^[a-z][a-z0-9-]*[a-z0-9]$";
29
30// A name that is a single lowercase letter is a degenerate corner not covered
31// by the regex above (which requires ≥2 chars); we accept it explicitly below
32// by treating length-1 names as valid iff they're `[a-z]`.
33
34// The relative-path form of a marketplace plugin `source` MUST start with
35// `./`. We only flag structural problems; absolute and `../` are flagged.
36// Source: plugin-marketplaces — "Relative path ... Must start with `./`.
37// Resolved relative to the marketplace root."
38
39/// Names we refuse outright. The design doc listed a candidate set; the live
40/// docs did not confirm Anthropic publishes an authoritative reserved list, so
41/// these are treated as WARNINGS (not hard failures), per the honest-verifier
42/// posture in design §13 Mitigation ("verify is deliberately conservative").
43/// A maintainer can ignore a warning; they cannot ignore the reputation cost of
44/// clobbering an Anthropic-owned name.
45pub const RESERVED_NAMES: &[&str] = &[
46 "claude-code-marketplace",
47 "claude-code-plugins",
48 "claude-plugins-official",
49 "anthropic-marketplace",
50 "anthropic-plugins",
51 "anthropic",
52 "claude",
53 // `agent-skills` is the AgentSkills.io open-standard namespace; flag it so
54 // a plugin doesn't squat the standard's name. Generic words like
55 // `skills`/`official` are deliberately NOT listed (too common to warn on).
56 "agent-skills",
57];
58
59/// `plugin.json` MUST live at `.claude-plugin/plugin.json`. Source:
60/// anthropics/claude-code manifest-reference.md — "Required path:
61/// `.claude-plugin/plugin.json`."
62pub const PLUGIN_JSON_PATH: &str = ".claude-plugin/plugin.json";
63/// The `.claude-plugin/` directory houses the marketplace + plugin manifests.
64/// Source: anthropics/claude-code plugin-reference.md. Verified July 2026.
65pub const CLAUDE_PLUGIN_DIR: &str = ".claude-plugin";
66
67/// `marketplace.json` lives at `.claude-plugin/marketplace.json`. Source:
68/// plugin-marketplaces — "Create `.claude-plugin/marketplace.json`."
69pub const MARKETPLACE_JSON_PATH: &str = ".claude-plugin/marketplace.json";
70/// Cursor project rules live under `.cursor/rules/<name>.mdc`. Source:
71/// cursor.com/docs/rules — "Project rules are stored as `.mdc` files in
72/// `.cursor/rules/`." Verified July 2026.
73pub const CURSOR_RULES_DIR: &str = ".cursor/rules";
74/// Codex CLI skills live under `.codex/skills/<name>/SKILL.md`. Source:
75/// the AgentSkills open standard (agskills.dev) and the Codex CLI skill
76/// convention — same `SKILL.md` frontmatter shape as Claude, installed under
77/// `.codex/skills/`. Verified July 2026.
78pub const CODEX_SKILLS_DIR: &str = ".codex/skills";
79/// Native Claude Code skills directory `.claude/skills/<name>/SKILL.md`.
80/// Source: code.claude.com/docs/en/skills — Claude Code scans `.claude/skills/`
81/// and auto-loads each skill with no plugin-install step. Same `SKILL.md`
82/// frontmatter shape as the plugin `skills/<name>/SKILL.md` path, different
83/// directory (native vs plugin-installed). Verified August 2026.
84pub const CLAUDE_SKILLS_DIR: &str = ".claude/skills";
85/// OpenCode agent definitions live under `.opencode/agents/<name>.md`. Source:
86/// opencode.ai/docs/agents — "Place them in: Per-project:
87/// `.opencode/agents/`". The markdown file name becomes the agent name.
88/// Frontmatter: `description` (required), `mode`/`temperature`/`permissions`
89/// (optional). Verified July 2026.
90pub const OPENCODE_AGENTS_DIR: &str = ".opencode/agents";
91
92/// GitHub Copilot custom instructions live at
93/// `.github/copilot-instructions.md`. Source:
94/// docs.github.com/copilot/how-tos/copilot-on-github/customize-copilot/
95/// add-repository-instructions — "The path is always
96/// `.github/copilot-instructions.md`." Plain markdown, no frontmatter.
97/// Verified July 2026.
98pub const COPILOT_INSTRUCTIONS_PATH: &str = ".github/copilot-instructions.md";
99
100/// AGENTS.md lives at the repository root. Source: agents.md (Linux Foundation
101/// stewarded, aaif.io/projects/agents-md) — "AGENTS.md is just standard Markdown.
102/// Use any headings you like; the agent simply parses the text you provide."
103/// Plain markdown, no frontmatter, no required fields. Read natively by 20+
104/// coding agents (Codex, Cursor, Windsurf, Copilot, Aider, Zed, Warp, JetBrains
105/// Junie, Freebuff, etc.). Verified July 2026.
106pub const AGENTS_MD_PATH: &str = "AGENTS.md";
107
108/// `CLAUDE.md` lives at the repository root. Source: the Claude Code
109/// ecosystem convention — Claude Code, Cline, Roo Code, and their forks read
110/// a root `CLAUDE.md` for project instructions. Plain markdown, no
111/// frontmatter (same structural contract as AGENTS.md). Verified July 2026.
112pub const CLAUDE_MD_PATH: &str = "CLAUDE.md";
113
114/// `GEMINI.md` lives at the repository root. Source:
115/// google-gemini.github.io/gemini-cli/docs/cli/gemini-md.html — "You can use
116/// these files to give project-specific instructions ... to make the AI's
117/// responses more accurate." Plain markdown, no frontmatter. Verified July 2026.
118pub const GEMINI_MD_PATH: &str = "GEMINI.md";
119
120/// Windsurf (Cascade) project rules live under `.windsurf/rules/<name>.md`.
121/// Source: the Windsurf docs and the cursor↔windsurf converter ecosystem —
122/// the same `description`/`globs`/`alwaysApply` frontmatter shape as Cursor
123/// rules, `.md` files under `.windsurf/rules/`. Verified July 2026.
124pub const WINDSURF_RULES_DIR: &str = ".windsurf/rules";
125
126/// Aider reads a root-level `CONVENTIONS.md` for repo conventions. Plain
127/// markdown, no frontmatter. Verified July 2026 against the aider docs.
128pub const CONVENTIONS_MD_PATH: &str = "CONVENTIONS.md";
129
130/// Cline workspace rules live in `.clinerules/` (`.md`/`.txt` files, optional
131/// `paths:` YAML frontmatter for conditional rules). Source:
132/// docs.cline.bot/customization/cline-rules — "Workspace rules go in
133/// `.clinerules/` at your project root." Verified August 2026.
134pub const CLINE_RULES_DIR: &str = ".clinerules";
135
136/// Roo Code workspace rules live in `.roo/rules/` (markdown; mode-specific
137/// rules live in `.roo/rules-{modeSlug}/`). Source: docs.roocode.com custom
138/// modes / rules — "Instructions can also live in `.roo/rules/`
139/// (workspace-wide)." Verified August 2026.
140pub const ROO_RULES_DIR: &str = ".roo/rules";
141
142/// Kilo Code project rules. The current format references `.kilo/rules/*.md`
143/// via `kilo.jsonc`'s `instructions` array, but `.kilocode/rules/` is
144/// auto-included for backward compatibility (kilo.ai/docs/customize/custom-rules
145/// — "The extension is backward compatible with `.kilocode/rules/` directories").
146/// Emitting into the backward-compatible directory loads with zero config edit.
147/// Verified August 2026.
148pub const KILOCODE_RULES_DIR: &str = ".kilocode/rules";
149
150/// Goose (Block's open-source agent) reads a project-wide
151/// `.goose/instructions.md`. Plain markdown, no frontmatter. Verified August
152/// 2026 against the Goose docs + the ctxlint context-file registry.
153pub const GOOSE_INSTRUCTIONS_PATH: &str = ".goose/instructions.md";
154
155// Action-verb heuristic: the first word of a good skill description is an
156// action verb (e.g. "Lint", "Generate", "Format"). We don't enforce grammar —
157// we only flag descriptions that don't begin with an alphabetic word, a
158// strong signal the description was written as a name/title. Source: skill
159// best-practices — open with "one sentence describing what the skill does";
160// the listing places the key use case first.