extract-skill
Extract Skill from Conversation
This skill helps you extract knowledge, patterns, and workflows from the current conversation and persist them as a reusable skill.
When to Use
- The user says "extract a skill", "extract this as a skill", or "save this for next time"
- A useful workflow, pattern, or piece of domain knowledge emerged during the conversation
- The user wants to update an existing skill with new learnings
- The conversation uncovered non-obvious steps, gotchas, or best practices worth preserving
Extraction Process
Phase 1: Identify What to Extract
Review the conversation for:
- Workflows: Multi-step processes that were figured out through trial and error
- Domain knowledge: Non-obvious facts, configurations, or constraints discovered
- Gotchas and fixes: Problems encountered and their solutions
- Patterns: Code patterns, command sequences, or templates that worked well
- Decision rationale: Why certain approaches were chosen over alternatives
Summarize what you plan to extract and confirm with the user before proceeding.
Phase 2: Decide Destination
If the user already specified a skill or the destination is obvious from context, just proceed. Otherwise, use the AskQuestion tool (or ask conversationally) to clarify:
-
New or existing skill?
- If existing: Which skill to update? (list relevant skills from
~/.cursor/skills/and.cursor/skills/) - If new: What should it be named?
- If existing: Which skill to update? (list relevant skills from
-
Storage location (for new skills):
- Personal (
~/.cursor/skills/) — available across all projects - Project (
.cursor/skills/) — shared with the repository
- Personal (
Phase 3: Draft the Skill Content
When extracting into a new skill:
- Choose a descriptive name (lowercase, hyphens, max 64 chars)
- Write a specific description including WHAT and WHEN (third person)
- Distill the conversation into concise, actionable instructions
- Include concrete examples drawn from the conversation
- Add any utility scripts or commands that were used
When updating an existing skill:
- Read the existing SKILL.md
- Identify where new learnings fit (new section, updated steps, additional examples)
- Integrate without duplicating existing content
- Preserve the existing structure and voice
Phase 4: Distillation Guidelines
The goal is to transform a messy conversation into clean, reusable instructions.
Do:
- Extract the final working approach, not the failed attempts (unless gotchas are instructive)
- Generalize from the specific case discussed (replace hardcoded values with placeholders)
- Include the "why" behind non-obvious steps
- Add context the agent wouldn't know without this conversation
- Keep it under 500 lines
Don't:
- Include conversation artifacts ("as we discussed", "you mentioned")
- Repeat information the agent already knows
- Include overly specific details that won't transfer to other situations
- Add verbose explanations where a code example suffices
Phase 5: Write and Verify
- Create/update the skill file(s)
- Verify the SKILL.md is under 500 lines
- Check that the description is specific and includes trigger terms
- Confirm with the user that the captured content is accurate
Example: Extracting a Debugging Workflow
If a conversation involved debugging a tricky deployment issue, the captured skill might look like:
---
name: debug-k8s-deployments
description: Debug Kubernetes deployment failures including CrashLoopBackOff, image pull errors, and resource limits. Use when pods are failing to start or deployments are stuck.
---
# Debug K8s Deployments
## Diagnostic Steps
1. Check pod status: `kubectl get pods -n <namespace> | grep -v Running`
2. Get events: `kubectl describe pod <pod> -n <namespace>`
3. Check logs: `kubectl logs <pod> -n <namespace> --previous`
## Common Issues
### CrashLoopBackOff
- Check if the entrypoint command exists in the container
- Verify environment variables are set (especially secrets)
- Look for OOMKilled in `describe` output → increase memory limits
### ImagePullBackOff
- Verify image tag exists: `docker manifest inspect <image>`
- Check imagePullSecrets are configured for private registries
Note how this extracts the diagnostic sequence and common solutions without any conversation artifacts.
Handling Edge Cases
Conversation had multiple topics: Ask which specific learning to extract, or suggest creating separate skills for distinct topics.
Learning is too small for a skill: Suggest creating a Cursor rule (.cursor/rules/) instead, which is better suited for single-line or short guidelines.
Existing skill needs major rewrite: Confirm with the user whether to restructure the existing skill or create a new one that supersedes it.