Pattern Extraction Skill
Extract reusable patterns from conversations and code, determine appropriate artifact types, and suggest organization locations.
When to Use
- •Use when extracting patterns from conversations
- •Use when identifying reusable patterns in code
- •Use when determining what artifacts to create
- •Use when organizing patterns into categories
Instructions
Pattern Extraction Process
- •Identify patterns: Find recurring themes, instructions, or workflows
- •Abstract patterns: Extract generalizable patterns from specific instances
- •Determine type: Decide if pattern should be rule, skill, command, or subagent
- •Suggest location: Recommend where artifact should be placed
- •Document pattern: Document the pattern clearly
Pattern Types
Instruction Patterns
- •Repeated instructions or corrections
- •User preferences and style choices
- •Domain-specific conventions
- •Team standards
Workflow Patterns
- •Common sequences of actions
- •Standardized processes
- •Multi-step procedures
- •Recurring task flows
Error Patterns
- •Systematic errors and corrections
- •Common mistakes and fixes
- •Prevention strategies
- •Error handling approaches
Context Patterns
- •Context-specific behaviors
- •File-type specific patterns
- •Domain-specific knowledge
- •Environment-specific configurations
Artifact Type Determination
Use decision framework:
- •Rule: Persistent guidance, domain knowledge, standards
- •Skill: Domain knowledge with scripts, automation needs
- •Command: Manual workflows, checklists, step-by-step
- •Subagent: Complex tasks, context isolation, parallel work
Organization Suggestions
- •Category selection: Choose appropriate category (meta, organization, etc.)
- •Naming: Suggest name following conventions
- •Location: Recommend full path for artifact
- •Relationships: Identify related artifacts
Examples
Example 1: Instruction Pattern
Pattern: "Always use async/await instead of promises"
Extraction:
- •Type: Rule
- •Location:
cursor/rules/organization/async-await.mdc - •Content: Rule enforcing async/await usage
- •Related: JavaScript/TypeScript rules
Example 2: Workflow Pattern
Pattern: Standard code review process with checklist
Extraction:
- •Type: Command
- •Location:
cursor/commands/meta/code-review-checklist.md - •Content: Step-by-step review checklist
- •Related: Review-related artifacts
Best Practices
- •Extract generalizable patterns, not one-off instances
- •Consider frequency and significance
- •Validate pattern worth creating artifact
- •Document pattern clearly
- •Suggest appropriate organization