skill-extractor
# Skill Extractor
What this skill does
# Skill Extractor
---
name: skill-extractor
description: Analyzes Claude Code commands and agents to identify and extract reusable components into properly structured skills with migration reports
---
## Purpose
This skill analyzes existing Claude Code commands and agents to identify reusable components that should be extracted into standalone skills. It creates properly structured skills following Claude Code conventions while preserving the original files and providing detailed migration guidance.
## When to Use
Use this skill when you:
- Have commands or agents with embedded templates, reference materials, or reusable scripts
- Want to modularize large, complex commands/agents
- Need to identify opportunities for code reuse across your Claude Code ecosystem
- Want to refactor commands/agents to follow skill-based architecture
## How It Works
The skill performs comprehensive analysis to identify extractable components:
### 1. Component Analysis
The analyzer scans for:
**Scripts Candidates (`scripts/` directory)**:
- Repeated code blocks that execute deterministic operations
- Shell scripts, Python scripts, or other executables
- File manipulation utilities
- Processing pipelines
**Reference Material (`references/` directory)**:
- Templates and format specifications
- Style guides and writing standards
- Documentation that should be loaded on-demand
- Large reference tables or datasets
- API specifications
**Assets (`assets/` directory)**:
- Template files used in output generation
- Boilerplate code or project structures
- Images, fonts, or design resources
- Example files or starter kits
**Core Workflow (stays in SKILL.md)**:
- Primary procedural instructions
- Workflow orchestration
- Decision trees and logic
- User interaction patterns
### 2. Extraction Process
When you invoke the skill with a command or agent file path:
```bash
# Analyze and extract from a command
@skill-extractor analyze --input ~/.claude/commands/mine/agent-forge.md
# Analyze and extract from an agent
@skill-extractor analyze --input ~/.claude/agents/mine/novel-chapter-writer.md
# Batch analyze multiple files
@skill-extractor analyze --input ~/.claude/commands/mine/*.md
```
The skill will:
1. **Parse** the input file to understand structure and content
2. **Identify** extractable components using pattern matching
3. **Extract** components into appropriate directories
4. **Generate** the skill structure with proper SKILL.md
5. **Create** migration report detailing required changes
### 3. Output Structure
All extracted skills are created in the current working directory:
```
{current_working_directory}/
└── {extracted-skill-name}/
├── SKILL.md # Main skill definition
├── scripts/ # Executable scripts (if applicable)
│ └── example_script.py
├── references/ # Reference documentation (if applicable)
│ ├── templates.md
│ └── style-guide.md
├── assets/ # Output resources (if applicable)
│ └── template.txt
└── migration-report.md # Detailed migration instructions
```
## Analysis Methodology
### Pattern Recognition
The analyzer uses sophisticated pattern matching to identify:
**Template Patterns**:
- Markdown code blocks with repeated structure
- YAML/JSON configuration templates
- Format specifications and examples
- Document structure definitions
**Reference Documentation**:
- Large explanatory blocks (>1000 words)
- Style guides and conventions
- Comprehensive lists and tables
- API documentation sections
**Script Candidates**:
- Bash command sequences
- Python code blocks
- File processing operations
- Deterministic workflows
**Workflow Logic** (remains in SKILL.md):
- Conditional decision points
- User interaction flows
- Orchestration steps
- High-level procedures
### Extraction Criteria
Components are extracted when they meet these criteria:
1. **Reusability**: Used or could be used in multiple contexts
2. **Size**: Large enough to warrant separation (scripts >50 lines, references >500 words)
3. **Independence**: Can function standalone without core workflow context
4. **Stability**: Unlikely to change with each workflow execution
## Migration Report
The migration report provides step-by-step guidance for updating the original command/agent:
```markdown
# Migration Report: {Original File Name}
## Executive Summary
- **Extraction Date**: [timestamp]
- **Components Extracted**: [count]
- **Original File Size**: [size]
- **New Skill Size**: [size]
- **Reduction**: [percentage]
## Extracted Components
### 1. Scripts Extracted
- **Location**: `scripts/process_data.py`
- **Original Lines**: 145-298
- **Purpose**: Data processing pipeline
- **Usage**: Execute via `python scripts/process_data.py [args]`
### 2. References Extracted
- **Location**: `references/template-guide.md`
- **Original Lines**: 50-430
- **Purpose**: Template formatting specifications
- **Usage**: Read when formatting templates
### 3. Assets Extracted
- **Location**: `assets/report-template.md`
- **Original Lines**: 500-650
- **Purpose**: Report output template
- **Usage**: Copy and populate for report generation
## Required Changes to Original File
### Update SKILL.md References
Replace embedded content with skill references:
**Before**:
```markdown
<large template section>
```
**After**:
```markdown
For template specifications, refer to `references/template-guide.md` in this skill directory.
```
### Update Script Execution
**Before**:
```bash
# Inline bash commands
mkdir -p output/
python << EOF
[large Python script]
EOF
```
**After**:
```bash
# Execute extracted script
python scripts/process_data.py --output output/
```
### Update Asset References
**Before**:
```markdown
## Report Template
[entire template embedded]
```
**After**:
```markdown
## Report Template
Use template from `assets/report-template.md`, customize as needed.
```
## Testing Checklist
After migration, verify:
- [ ] All script executions work correctly
- [ ] Reference materials are accessible when needed
- [ ] Asset files are properly utilized
- [ ] Original functionality is preserved
- [ ] Skill can be reused in other contexts
```
## Integration with Skill Creation Workflow
This skill works in conjunction with `skill-creator`:
1. **skill-extractor**: Analyzes existing commands/agents, extracts components
2. **skill-creator**: Creates new skills from scratch with user requirements
3. **Together**: Refactor existing code into modular, reusable skills
## Advanced Features
### Dependency Detection
Identifies dependencies between extracted components:
- Scripts that reference assets
- References that link to other references
- Cross-component relationships
### Size Optimization
Recommends which components to extract based on:
- Token usage reduction
- Loading time optimization
- Memory footprint
- Reusability potential
### Conflict Detection
Flags potential issues:
- Name conflicts with existing skills
- Circular dependencies
- Missing file references
- Broken paths after extraction
## Best Practices
### When to Extract
**DO extract** when:
- Component is reused in multiple places
- Content is large and rarely changes
- Material is reference-only (not procedural)
- Script can run independently
**DON'T extract** when:
- Content is core to workflow logic
- Extraction would reduce clarity
- Component is tightly coupled to parent
- Size is minimal (<100 words for references, <20 lines for scripts)
### Naming Conventions
**Skill Names**:
- Use kebab-case: `template-processor`, `style-validator`
- Be descriptive: `novel-writing-templates` not `templates`
- Indicate domain: `publishing-formats`, `data-processing-utils`
**File Names**:
- Scripts: `action_noun.py` (e.g., `generate_report.py`)
- References: `topic-name.md` (e.g., `style-guide.md`)
- Assets: `purpose.extension` (e.g., `report-template.md`)
## Error Handling
The skill handles common issues:
**InvaRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.