home / skills / steveclarke / dotfiles / extract-skill

extract-skill skill

/ai/skills/extract-skill

This skill helps you extract conversation learnings into reusable skills for future sessions by preserving workflows, patterns, and best practices.

npx playbooks add skill steveclarke/dotfiles --skill extract-skill

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.0 KB
---
name: extract-skill
description: Extract learnings, patterns, or workflows from the current conversation into a new or existing skill. Use when the user wants to "extract a skill" or save something learned, discovered, or built during a conversation as a reusable skill for future sessions.
---

# 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:

1. **Workflows**: Multi-step processes that were figured out through trial and error
2. **Domain knowledge**: Non-obvious facts, configurations, or constraints discovered
3. **Gotchas and fixes**: Problems encountered and their solutions
4. **Patterns**: Code patterns, command sequences, or templates that worked well
5. **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:

1. **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?

2. **Storage location** (for new skills):
   - Personal (`~/.cursor/skills/`) — available across all projects
   - Project (`.cursor/skills/`) — shared with the repository

### Phase 3: Draft the Skill Content

When extracting into a **new skill**:

1. Choose a descriptive name (lowercase, hyphens, max 64 chars)
2. Write a specific description including WHAT and WHEN (third person)
3. Distill the conversation into concise, actionable instructions
4. Include concrete examples drawn from the conversation
5. Add any utility scripts or commands that were used

When updating an **existing skill**:

1. Read the existing SKILL.md
2. Identify where new learnings fit (new section, updated steps, additional examples)
3. Integrate without duplicating existing content
4. 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

1. Create/update the skill file(s)
2. Verify the SKILL.md is under 500 lines
3. Check that the description is specific and includes trigger terms
4. 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:

```markdown
---
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.

Overview

This skill captures learnings, patterns, and multi-step workflows discovered during a conversation and saves them as a reusable skill file. It helps turn ad-hoc solutions, gotchas, and decision rationale into concise, actionable instructions you can reuse across sessions. Use it when you want to preserve what worked or update an existing skill with new insights.

How this skill works

Scan the current conversation to identify workflows, domain facts, fixes, and patterns worth preserving. Confirm scope and destination (new or existing skill file and storage location), then distill the final working approach into a compact, generalizable skill with examples and commands. Save the resulting skill file and verify it’s clear, focused, and easy to apply later.

When to use it

  • You say “extract a skill”, “save this for next time”, or similar intent.
  • A workflow or pattern emerged through trial-and-error and should be preserved.
  • You found non-obvious configuration, gotchas, or fixes worth documenting.
  • You want to update an existing skill with new, validated steps.
  • Conversation includes reusable command sequences or templates.

Best practices

  • Extract the final working solution; omit irrelevant failed attempts unless the failure is instructive.
  • Replace hardcoded values with placeholders and include examples showing how to fill them.
  • Include the ‘why’ for non-obvious steps so future users understand trade-offs.
  • Keep the skill concise and focused—aim for clear steps and short examples.
  • Confirm destination (personal vs project scope) and get user approval before saving or overwriting.

Example use cases

  • Turn a discovered installation sequence into a reusable installation skill with commands and environment placeholders.
  • Save a debugging checklist assembled during troubleshooting (commands, logs to check, common fixes).
  • Update an existing automation skill with a new, more robust command pattern found in the session.
  • Capture a multi-step configuration (service, env vars, permissions) that is likely to repeat across machines.
  • Convert a pattern of shell one-liners and scripts into a documented utility skill.

FAQ

Should I save every minor tip as a skill?

No—reserve skills for multi-step workflows, patterns, or non-obvious fixes. For one-line tips, create a small rule or note instead.

Where should I store a new skill?

Choose personal storage for cross-project reuse or project storage when the skill is specific to the repository or team.