Preface¶
After using Cursor to write code for a long time, you will inevitably encounter a class of “familiar” scenarios: you have to run lint, tsc, and tests before every merge; you have to go through the same set of deployment commands every time you push a preview branch; you correct your Agent once by saying “You can’t use raw SQL here, you must go through the repository layer”, but it will forget this in the next conversation.
These steps themselves are not complicated. The difficulty is that they repeat across different tasks. The Agent has to re-derive them every time, and you have to repeat the explanation every time. Time is thus wasted on “muscle memory”.
The emergence of Agent Skills was originally meant to固化这类可复用的工作流. But the problem is: by the time you realize a workflow is worth encapsulating, it has often already been repeated three or four times. building-skills-from-patterns is designed exactly for this gap—it is a “meta-skill” that teaches the Agent to recognize repetitive patterns and turn them into SKILL.md files under .cursor/skills/, so that subsequent sessions can automatically load and trigger them on demand.
This article is cross-checked against the official SKILL.md from the awesome-cursor-skills repository and the Cursor official Skills documentation, introducing what this meta-skill is, when to use it, how to install it, and how to collaborate with Rules and Hooks.
What is this¶
building-skills-from-patterns is a meta-skill for the Cursor Agent, maintained in the resources/building-skills-from-patterns/ directory of the GitHub repository spencerpauly/awesome-cursor-skills.
Its core positioning can be summarized in one sentence: When the same multi-step workflow repeats in Cursor, capture it into a reusable SKILL.md, research once, code once, reuse forever.
Essentially, Skills are version-controllable SKILL.md file packages that follow the open Agent Skills standard, and can be used in tools that support the standard such as Cursor, Claude Code, Codex CLI, etc. Unlike Anthropic’s official skill-creator (which focuses on zero-cost creation and eval evaluation), building-skills-from-patterns emphasizes passively discovering patterns from daily repetitions, making it ideal for teams that already have a lot of “verbal agreements” but have not yet written them into documents.
Core Features and Highlights¶
1. Clear Trigger Conditions¶
The official SKILL.md lists three typical trigger scenarios:
- The user requests the same sequence of operations three or more times, such as “Always run lint, tsc, and test before committing”.
- The Agent finds itself re-deriving the same set of steps in every task, such as “How to deploy a preview branch for this repository”.
- The user’s correction sounds like a policy. If it needs to take effect at all times, it should be written as a Rule with suggesting-cursor-rules; if it is a procedure with branches and steps, it is more suitable to be written as a Skill.
These three judgment criteria are very practical: they help you distinguish between “whether to write a Rule or a Skill”, avoiding cluttering all conventions into Rules and causing context bloat.
2. Four-Step Standardized Workflow¶
After being triggered, the Agent executes the following process:
1. Name the pattern
Pick a short slug in lowercase with hyphens, such as verifying-api-before-merge, releasing-mobile-build.
-
Draft SKILL.md
Create the file at.cursor/skills/<slug>/SKILL.md. If contributing upstream to awesome-cursor-skills, place it atresources/<slug>/SKILL.md. -
Validate
Check if the description is specific enough for the Agent to match; whether the steps are executable and do not contain secrets or machine-specific paths. -
Point the user to it
Explain the file location and remind the Agent will automatically detect it when starting a new chat in this workspace.
3. Division of Labor Table with Rules and Hooks¶
The official documentation uses a comparison table to clarify the three mechanisms:
| Mechanism | Applicable Scenarios |
|---|---|
| Skill | On-demand callable workflows with branching steps and tool usage |
Rule (.cursor/rules/) |
Always-effective conventions, styles, file patterns |
Hook (.cursor/hooks.json) |
Automation after events such as file save, Agent stop |
Simple mnemonic: “Run X every time you save” → Hook; “Global code style” → Rule; “Multi-step process that only runs when I ask to publish/merge” → Skill.
4. Writing Specifications and Best Practices¶
- Each Skill only covers one workflow, avoid creating an “all-purpose mega Skill”.
- When the workflow evolves, update the existing Skill instead of creating duplicates from scratch.
- Keep the body concise: title, when to use, numbered steps, notes; write commands specifically, avoid unnecessary talk.
- The
descriptionfield should clearly state “what to do + when to trigger”, which is the key to the Agent’s automatic matching.
Installation and Activation¶
Directory Structure¶
Cursor will automatically scan for Skills in the following paths at startup (official documentation):
| Path | Scope |
|---|---|
.cursor/skills/ |
Project-level |
.agents/skills/ |
Project-level |
~/.cursor/skills/ |
User-level (global) |
~/.agents/skills/ |
User-level (global) |
To be compatible with Claude Code and Codex CLI, .claude/skills/, .codex/skills/ and their corresponding user directories are also supported.
Each Skill is a folder containing SKILL.md; optional subdirectories include scripts/, references/, assets/.
Install building-skills-from-patterns¶
Method 1: Manual Copy (Recommended)¶
mkdir -p .cursor/skills/building-skills-from-patterns
curl -o .cursor/skills/building-skills-from-patterns/SKILL.md \
https://raw.githubusercontent.com/spencerpauly/awesome-cursor-skills/main/resources/building-skills-from-patterns/SKILL.md
Method 2: Clone the Repository and Copy¶
git clone https://github.com/spencerpauly/awesome-cursor-skills.git
cp -r awesome-cursor-skills/resources/building-skills-from-patterns .cursor/skills/
Method 3: Import Remotely from GitHub¶
Open Customize → Rules → Add Rule → Remote Rule (Github) in the Cursor sidebar, and fill in the repository URL. This method is suitable for importing entire rule/skill repositories, please refer to the Cursor interface for specific details.
Activation and Invocation¶
- Automatic Discovery: After the file is in place, restart Cursor or start a new Agent session. The Agent will judge when to load based on the
description. - Manual Invocation: Type
/in the Agent chat box and search forbuilding-skills-from-patternsor its Chinese description keywords. - View Installed Skills: Go to Customize → Skills, you can see project and user-level Skills in the Agent Decides area.
The frontmatter of this Skill includes user-invocable: true, which means the user can explicitly invoke it by name.
Use in Other AI Programming Tools¶
SKILL.md is an open standard format. Claude Code usually uses .claude/skills/; Codex CLI uses .codex/skills/. Just copy the same folder to the corresponding directory, and the name in the frontmatter must match the parent folder name.
Typical Usage Examples¶
Scenario: Pre-Merge Check Workflow Repeats Repeatedly¶
Suppose you have told the Agent three PRs in a row: “First run npm run lint, then npx tsc --noEmit, finally npm test, and commit only after all pass.”
At this point, you can actively say to the Agent:
Our pre-merge check workflow has been repeated many times. Please follow building-skills-from-patterns
to turn it into a Skill.
The Agent will follow the meta-skill process and produce a structure similar to:
---
name: verifying-api-before-merge
description: Run lint, tsc and tests before merging. Use when the user asks to merge, land a PR or say "check again before merging".
user-invocable: true
---
# Pre-Merge API Verification
## When to Use
- User requests merge, land PR or verify before committing
- Feature branches involving API layer changes
## Steps
1. Detect package manager (npm / pnpm / yarn) from lockfile
2. Run lint: `npm run lint`
3. Run type check: `npx tsc --noEmit`
4. Run tests: `npm test`
5. Perform git operations only after all steps pass
## Notes
- Stop and report specific errors to the user if any step fails
- Do not skip tests and commit directly
After saving the file as .cursor/skills/verifying-api-before-merge/SKILL.md, next time you say “Help me merge this PR”, the Agent will automatically match and execute it without you having to dictate the steps again.
Collaboration with Built-in Cursor Skills¶
Since Cursor 2.4, multiple related Skills are built-in and can be used in combination:
| Built-in Skill | Function |
|---|---|
/create-skill |
Guide to create the directory structure and SKILL.md for Agent Skills |
/migrate-to-skills |
Migrate eligible dynamic Rules and slash commands to Skills |
/create-rule |
Create an always-effective Cursor Rule |
Recommended workflow: First use building-skills-from-patterns to identify repetitive workflows and draft content, then call /create-skill to complete the structure if the format is uncertain; if there are already a large number of dynamic Rules in the old project, use /migrate-to-skills for batch conversion.
SKILL.md Frontmatter Reference¶
Required fields required by Cursor official:
---
name: my-skill # Lowercase letters, numbers, hyphens; must match the folder name
description: One sentence explaining what to do and when to trigger; the Agent relies on it for relevance matching
---
Common optional fields:
- paths: Glob pattern, limiting the Skill to only take effect for matching files
- disable-model-invocation: true: Do not automatically match unless the user explicitly calls it via /skill-name
- user-invocable: true: Allow users to search and call in the / menu
Applicable Scenarios and Notes¶
Who It Is For¶
- Individual developers or small teams that have formed fixed workflows in Cursor but have not documented them.
- Engineers maintaining monorepos or multi-package repositories, where different subdirectories have their own deployment/test conventions.
- Readers who want to systematically understand the Skill ecosystem and advance from “using others’ Skills” to “building your own Skills”.
Patterns Suitable for Precipitating into Skills¶
- Multi-command chained publishing, deployment, verification workflows
- Operation sequences relying on specific MCP tools or CLIs (such as
gh,kubectl) - Tasks that require branch judgment (staging / production) but still belong to “on-demand triggering”
Situations Not Suitable for Writing as Skills¶
- Always-effective code style → Use Rule (
.cursor/rules/) - Triggered immediately when saving files → Use Hook (
.cursor/hooks.json) - One-time, unrepeatable tasks → Just talk directly, no need to encapsulate
Common Pitfalls¶
-
Too vague description
Descriptions like “help with development” cannot be matched by the Agent. Instead, write “When the user mentions deploy preview, follow these steps…” -
Steps depend on unspecified repository layout
The official requirement is that steps must be executable, or explicitly write “Detect package manager from lockfile”, to avoid the Agent guessing paths. -
Mixing in secrets or local absolute paths
Skills will be committed to Git, Secrets should use environment variables, and paths should use relative paths or detection logic. -
Duplication with Rules
Writing the same “Never use var” into both a Skill and a Rule wastes context. Policies belong to Rules, workflows belong to Skills. -
One Skill trying to do everything
The official clearly recommends one skill per workflow; for complex domains, you can group by subdirectories, for example.cursor/skills/shipping/land-it/SKILL.md, and Cursor will discover them recursively.
Summary¶
building-skills-from-patterns does not solve the problem of “whether you can write SKILL.md”, but rather “when you should write it, where to put it after writing, and how to collaborate with Rule/Hook”. It turns the workflows that the team has verbally repeated many times into muscle memory that the Agent can automatically load next time.
If you are explaining the same workflow to the Agent for the third time in Cursor, let the Agent固化 it using this meta-skill. The official Skill source code and sample frontmatter can be found at:
- Skill directory: https://github.com/spencerpauly/awesome-cursor-skills/tree/main/resources/building-skills-from-patterns
- Cursor Skills documentation: https://cursor.com/docs/skills
- Agent Skills open standard: https://agentskills.io