-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add Agent Skill Authoring (SKILL.md) rule to Documentation #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mohitagw15856
wants to merge
2
commits into
PatrickJS:main
Choose a base branch
from
mohitagw15856:add-agent-skill-authoring
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,125 @@ | ||
| --- | ||
| description: Author and review Agent Skills (SKILL.md) — frontmatter contract, the three-part description, which body sections are required, and the quality bar that separates a reusable skill from a saved prompt | ||
| globs: **/SKILL.md | ||
| alwaysApply: false | ||
| --- | ||
|
|
||
| # Authoring Agent Skills (`SKILL.md`) | ||
|
|
||
| A skill is a markdown file an agent loads on demand to do one recurring job to a | ||
| professional standard. It is not a saved prompt: a prompt is used once by the | ||
| person who wrote it, a skill is used repeatedly by people who did not. | ||
|
|
||
| Apply these rules when creating or editing a `SKILL.md`. | ||
|
|
||
| ## File layout | ||
|
|
||
| ``` | ||
| skills/ | ||
| your-skill-name/ | ||
| SKILL.md # required — the skill itself | ||
| references/ # optional — worked examples, deeper method | ||
| scripts/ # optional — standard-library-only helpers | ||
| ``` | ||
|
|
||
| - One skill per folder. Folder name = skill name = frontmatter `name`. | ||
| - Lowercase and hyphenated (`customer-journey-map`, never `CustomerJourneyMap`). | ||
| - The skill must be useful from `SKILL.md` alone. Scripts are an enhancement, | ||
| never a prerequisite. | ||
|
|
||
| ## Frontmatter | ||
|
|
||
| ```yaml | ||
| --- | ||
| name: your-skill-name | ||
| description: "What it does. Use when <trigger phrases>. Produces <the artifact>." | ||
| --- | ||
| ``` | ||
|
|
||
| `description` is the single highest-value line in the file — it is usually all | ||
| the model sees when deciding whether to load the skill at all. It must contain | ||
| three things: | ||
|
|
||
| 1. **What** it does, in one clause. | ||
| 2. **Use when…** — trigger phrases in the user's vocabulary, not internal jargon. | ||
| Write what someone would actually type, including the messy phrasings. | ||
| 3. **Produces…** — the concrete artifact, so the payoff is legible. | ||
|
|
||
| Keep it under ~700 characters. A description that omits triggers is the most | ||
| common reason a good skill never gets loaded. | ||
|
|
||
| ## Body sections | ||
|
|
||
| | Section | Status | Purpose | | ||
| |---|---|---| | ||
| | `# Title` + one-line summary | Required | Restate the value in plain language. | | ||
| | What This Skill Produces | Required | The deliverables, as bullets. Sets expectations. | | ||
| | Required Inputs | Required | What to ask for if not provided. Prevents invention. | | ||
| | Framework / Formula / Scale | Optional | The method, rubric, weights, or formula the skill applies. | | ||
| | Programmatic Helper | Conditional | Required only if the skill ships a script: how to run it and what it returns. | | ||
| | Output Format | Required | A concrete template — headings, tables, fields. | | ||
| | Quality Checks | Required | A checklist the output must pass before hand-over. | | ||
| | Anti-Patterns | Required | Explicit "do not" rules — the mistakes this prevents. | | ||
|
|
||
| Keep them in this order. Not every skill needs the optional rows, but strong | ||
| ones usually carry most of them. | ||
|
|
||
| Quality Checks and Anti-Patterns are what make a skill trustworthy rather than | ||
| merely well-formatted. Write the anti-patterns from real failure, not from | ||
| imagination: they are the part a practitioner recognises. | ||
|
|
||
| ## The quality bar | ||
|
|
||
| - [ ] The description has all three parts (what / use when / produces). | ||
| - [ ] It solves a **recurring** job, not a one-off task. | ||
| - [ ] It asks for missing inputs instead of inventing them. | ||
| - [ ] The output format is concrete enough that two runs look like one product. | ||
| - [ ] It works with no setup beyond reading the file. | ||
| - [ ] Instructions are written **to the model** ("Ask for…", "Flag any…", | ||
| "Never state…"), not to the reader. | ||
|
|
||
| ## Helper scripts | ||
|
|
||
| If the skill ships `scripts/`: | ||
|
|
||
| - **Standard library only.** No `pip install`, no third-party imports — the | ||
| helper must run on whatever interpreter the user already has. | ||
| - **No network access and no surprise file writes.** Read input, print output. | ||
| - Accept input via flags *and* JSON; offer `--json` output for chaining. | ||
| - Include a module docstring with a runnable example and `--help` via `argparse`. | ||
| - If it uses randomness, expose `--seed`. Unreproducible output cannot be verified. | ||
|
|
||
| ## Anti-patterns | ||
|
|
||
| - **A saved prompt with a frontmatter block.** If it does not generalise past | ||
| your own last task, it is not a skill. | ||
| - **A description with no triggers.** The skill never loads, and no amount of | ||
| body quality compensates. | ||
| - **Inventing inputs.** A skill that guesses the user's numbers produces | ||
| confident, wrong artifacts. Ask. | ||
| - **Output format as prose.** "Write a summary" gives two different documents on | ||
| two runs; a template gives one product. | ||
| - **Anti-patterns invented rather than observed.** They are the section | ||
| practitioners judge the skill by. | ||
| - **Scripts that are required.** The moment `SKILL.md` alone stops working, the | ||
| skill has become software with a README. | ||
| - **Letting placeholder text ship.** Scaffolded `TODO` and `[bracketed]` text in | ||
| a description means the skill was never actually written. | ||
|
|
||
| ## Validating | ||
|
|
||
| Structure can be machine-checked before review: | ||
|
|
||
| ```bash | ||
| npx skillspec-check ./skills # or: npx pm-claude-skills skillcheck | ||
| ``` | ||
|
|
||
| It reports a missing trigger clause, a name that does not match its folder, | ||
| placeholder text left in a description, and absent Quality Checks or | ||
| Anti-Patterns sections. | ||
|
|
||
| --- | ||
|
|
||
| *Derived from the [SKILL.md authoring standard](https://github.com/mohitagw15856/pm-claude-skills/blob/main/SKILL-AUTHORING-STANDARD.md) | ||
| used across an open-source library of 1,000+ skills, where the rules above are | ||
| enforced in CI.* | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: PatrickJS/awesome-cursorrules
Length of output: 354
🏁 Script executed:
Repository: PatrickJS/awesome-cursorrules
Length of output: 1455
🌐 Web query:
Cursor .mdc rule frontmatter YAML globs syntax💡 Result:
Cursor uses the.mdc (Markdown Cursor) file format for project-specific rules, which are stored in the.cursor/rules/ directory [1][2][3]. Each.mdc file consists of two sections: a YAML frontmatter block for configuration and a Markdown body for the rule instructions [4][5][6]. Frontmatter Configuration The YAML frontmatter is placed at the top of the file, enclosed within triple-dash lines (---) [5][7]. It supports three primary fields to control when and how the rule is applied [2][8][9]: 1. alwaysApply (boolean): When set to true, the rule is included in every AI interaction [1][8][9]. 2. description (string): Provides context that helps the Cursor AI decide if the rule is relevant to a user's request [1][2]. 3. globs (string or list): Defines specific file patterns that trigger the rule automatically when those files are referenced or in context [1][4][6]. Rule Scoping and Application The combination of these fields determines the behavior of the rule [7][9]: - Always: alwaysApply: true. (Globs and descriptions are ignored.) [1][9] - Auto Attached: alwaysApply: false, plus a defined globs pattern [7][9]. - Agent Requested: alwaysApply: false, with a description but no globs [7][9]. - Manual: alwaysApply: false, with no description and no globs (must be invoked via
@ruleName) [7][9]. Glob Syntax Glob patterns in Cursor support standard wildcard matching to target specific files or directories [1][6]. Multiple patterns can be provided, typically as a comma-separated string or a YAML list [1][4][6]. Common patterns include [1][5][6]: - : Matches any single file name segment. -: Matches any number of directories (recursive). -!: Used at the start of a pattern to exclude files (e.g.,!/test_.py) [4]. - Example: globs: "src//.ts, src//.tsx" or globs: ["src//.ts", "src//.tsx"] [4][6]. Best Practices - Organize rules by concern in the.cursor/rules/ directory using kebab-case filenames (e.g., api-standards.mdc) [2][9]. - Use the Cursor UI or the /create-rule command to generate rules to ensure the frontmatter is formatted correctly [8][3]. - Keep individual rule files focused and concise to optimize context window usage [2][3].Citations:
Quote the recursive glob in the YAML frontmatter.
Cursor
.mdcfiles use YAML frontmatter. The unquoted*causes this value to be rejected as an invalid alias. Useglobs: "**/SKILL.md".🤖 Prompt for AI Agents
Source: MCP tools