8.5 KiB
name, description
| name | description |
|---|---|
| meta-skill-generator | Creates Claude Code skills with intelligent separation of deterministic operations into Go scripts. Use when users want to create a new skill or improve an existing skill by identifying repetitive code patterns that should be extracted into compiled Go scripts for performance and reliability. Analyzes workflows to determine what requires agent interaction versus what can be pre-compiled into efficient Go binaries. |
Meta Skill Generator
Overview
This skill generates high-quality Claude Code skills with intelligent workflow analysis. It identifies deterministic operations that don't require agent interaction and generates efficient Go scripts for them, while preserving dynamic agent-based workflows for tasks requiring reasoning and adaptation.
Workflow
Creating a skill follows these steps:
- Understanding phase: Gather concrete examples and use cases
- Analysis phase: Identify deterministic vs dynamic operations
- Planning phase: Design skill structure with appropriate degrees of freedom
- Implementation phase: Generate Go scripts, Python utilities, and SKILL.md
- Testing phase: Validate scripts and skill structure
- Packaging phase: Create distributable .skill file
Step 1: Understanding the Skill with Concrete Examples
Begin by gathering concrete examples of how the skill will be used. Ask targeted questions:
- What specific tasks should this skill handle?
- Can you provide 3-5 example user requests?
- What would trigger this skill?
- Are there existing workflows or tools this should integrate with?
Example questions for an image-processing skill:
- "What image operations do you need? Resizing, format conversion, filtering?"
- "Can you show me an example image and what you'd want to do with it?"
- "How would you phrase a request to use this skill?"
Conclude when you have clear use cases and triggering patterns.
Step 2: Analyze for Deterministic vs Dynamic Operations
For each concrete example, categorize operations:
Deterministic operations (candidates for Go scripts):
- File format conversions (PDF → images, DOCX → text)
- Data transformations with fixed logic (CSV parsing, JSON manipulation)
- Batch operations on multiple files
- Validation checks with clear pass/fail criteria
- Template-based generation with fixed structure
- Mathematical computations
- File system operations (copying, organizing, renaming)
Dynamic operations (keep as agent workflows):
- Content analysis requiring understanding (sentiment, summarization)
- Decision-making based on context
- Creative generation (writing, design suggestions)
- Interactive troubleshooting
- Adapting to unexpected inputs
- Multi-step reasoning chains
Indicators for Go script extraction:
- Same code pattern rewritten >3 times
- Performance-critical operations (large files, many iterations)
- Binary/low-level data manipulation
- Zero decision-making required
- Clear input/output contract
Step 3: Plan Skill Structure
Design the skill's organization based on complexity:
Simple skills (1-3 operations):
- SKILL.md with direct instructions
- 1-3 Go scripts in
scripts/ - Optional: single reference file
Medium skills (4-10 operations):
- SKILL.md with workflow decision tree
- Multiple Go scripts organized by function
- References for detailed documentation
- Optional: assets for templates
Complex skills (10+ operations):
- SKILL.md with high-level workflow
- Multiple reference files by category
- Go scripts organized in subdirectories
- Assets for templates and examples
- Consider: Go package with multiple binaries
Degrees of Freedom
Match specificity to task fragility:
High freedom (natural language instructions):
Analyze the document and identify key themes, then structure your
findings based on what you discover.
Medium freedom (parameterized scripts):
Run: ./scripts/analyze --format=json --depth=2 input.txt
Interpret the results and determine next steps.
Low freedom (specific scripts, fixed sequence):
1. Run: ./scripts/extract_fields input.pdf > fields.json
2. Run: ./scripts/validate_fields fields.json
3. If validation passes, run: ./scripts/fill_form fields.json template.pdf
Step 4: Implementation
Initialize the Skill
python3 /mnt/skills/examples/skill-creator/scripts/init_skill.py <skill-name> --path <output-dir>
Generate Go Scripts
For each deterministic operation identified in Step 2, use scripts/generate_go_script.py:
scripts/generate_go_script.py \
--name <operation-name> \
--description "<what it does>" \
--input "<input description>" \
--output "<output description>" \
--logic "<transformation logic>" \
--skill-path <path/to/skill>
Example:
scripts/generate_go_script.py \
--name pdf-to-images \
--description "Convert PDF pages to PNG images" \
--input "PDF file path" \
--output "Directory of PNG files" \
--logic "Extract each page as separate image, 300 DPI" \
--skill-path ./my-pdf-skill
The script will:
- Generate efficient Go code with proper error handling
- Include CLI argument parsing
- Add progress reporting for long operations
- Create binary in
scripts/bin/ - Update SKILL.md with usage instructions
Python Utilities
For operations requiring Python libraries (data science, ML, complex APIs), create Python scripts instead. Use Go for performance-critical, low-level operations.
Write SKILL.md
Follow the skill-creator patterns:
Frontmatter:
---
name: skill-name
description: Comprehensive description including WHAT it does and WHEN to use it. Mention specific triggers: file types, keywords, task patterns.
---
Body structure:
- Overview (1-2 sentences)
- Workflow or Quick Start
- Detailed sections for each major capability
- Reference to scripts with clear usage examples
- Troubleshooting (if applicable)
Writing style:
- Imperative/infinitive form ("Extract text" not "Extracts text")
- Concise - every word must justify its token cost
- Examples over explanations
- Reference bundled resources clearly
Reference Files
Create reference files for:
- API documentation
- Complex workflows (>10 steps)
- Domain knowledge (schemas, specifications)
- Large examples (>100 lines)
Keep SKILL.md lean by moving detailed content to references:
## Advanced Features
For form field extraction, see [references/form-fields.md](references/form-fields.md)
For batch processing patterns, see [references/batch-operations.md](references/batch-operations.md)
Assets
Include files to be used in output:
- Templates (.pptx, .docx, .html)
- Images (logos, icons)
- Boilerplate code (starter projects)
- Fonts, stylesheets
Step 5: Testing
Test each Go script:
cd scripts/bin
./script-name --help # Verify CLI works
./script-name test-input.txt # Test with real data
./script-name invalid-input # Test error handling
Test Python scripts:
cd scripts
python3 script-name.py test-input
Verify SKILL.md:
- All script references are accurate
- Examples run successfully
- No broken links to references/assets
Step 6: Package the Skill
python3 /mnt/skills/examples/skill-creator/scripts/package_skill.py <path/to/skill>
This automatically validates:
- YAML frontmatter completeness
- Naming conventions
- File organization
- Script executability
Fix any validation errors and repackage.
Go Script Best Practices
Performance:
- Use goroutines for parallel operations
- Stream large files instead of loading into memory
- Buffer I/O operations
Error handling:
- Return descriptive error messages
- Use exit codes (0=success, 1=error, 2=invalid input)
- Validate inputs before processing
CLI design:
- Support
--helpflag - Use standard flags package
- Accept input from stdin or file
- Write output to stdout or file
Logging:
- Progress indicators for long operations
- Verbose mode for debugging (
--verboseflag) - Errors to stderr, output to stdout
Resources
scripts/
generate_go_script.py: Generate Go scripts from specificationstest_skill_scripts.py: Automated testing for all scriptsinit_skill_with_analysis.py: End-to-end skill creation with workflow analysis
references/
go-patterns.md: Common Go patterns for skill scriptsworkflow-analysis.md: Detailed guide for identifying deterministic operationsskill-examples.md: Real-world examples of well-structured skills
Run scripts/generate_go_script.py --help for detailed usage.