﻿# Package Skill for DistributionValidate and package a Claude Code Skill into a distributable zip file## InstructionsThis command validates and packages an existing skill for distribution. Follow these steps:### Phase 1: Skill Selection1. **Identify the skill to package**   - Determine skill location (personal or project)   - Verify skill exists and has SKILL.md   - Check current state of the skill2. **Pre-package checks**   - Ensure all TODOs are completed   - Verify documentation is finalized   - Check that examples are tested### Phase 2: Validation1. **Run quick validation**   - Use the quick_validate.py script   - Check YAML frontmatter validity   - Verify required fields (name, description)   - Check for prohibited characters   - Validate directory structure2. **Run comprehensive validation** (if quick validation passes)   - Use validate-skill.sh for detailed checks   - Verify all 10 validation phases   - Check word counts for progressive disclosure   - Validate file references   - Test script syntax3. **Review validation results**   - Fix any critical errors   - Address warnings if needed   - Re-validate after fixes### Phase 3: Packaging1. **Execute packaging script**   ```bash   python .claude/commands/skills/scripts/package_skill.py <skill-path> [output-dir]   ```2. **Package creation process**   - Script validates again before packaging   - Creates zip file with skill name   - Includes all files while maintaining structure   - Excludes hidden files and __pycache__3. **Verify package**   - Check zip file created successfully   - Note file count and size   - Confirm ready for distribution### Phase 4: Distribution Options1. **Personal distribution**   - Share zip file directly   - Upload to file sharing service   - Include installation instructions2. **Team distribution**   - Add to shared repository   - Upload to team storage   - Document in team wiki3. **Public distribution**   - Upload to skill marketplace (if available)   - Share on GitHub   - Add to community repositories## Command Execution Flow### Step 1: Locate Skill```bash# Personal skillsls ~/.claude/skills/# Project skillsls .claude/skills/```### Step 2: Quick Validation```bashpython .claude/commands/skills/scripts/quick_validate.py <skill-path>```Expected output:- Ô£à Skill validation passed!- Or specific error messages to fix### Step 3: Comprehensive Validation (Optional)```bash.claude/commands/skills/scripts/validate-skill.sh <skill-path>```Expected output:- Detailed 10-phase validation report- Score and recommendations### Step 4: Package Creation```bash# Package to current directorypython .claude/commands/skills/scripts/package_skill.py ~/.claude/skills/my-skill# Package to specific directorypython .claude/commands/skills/scripts/package_skill.py ~/.claude/skills/my-skill ./dist```Expected output:```­ƒöì Validating skill...Ô£à Skill validation passed!­ƒôª Creating package...  Added: my-skill/SKILL.md  Added: my-skill/scripts/helper.py  Added: my-skill/references/api-docs.md  ...Ô£à Successfully packaged skill!   ­ƒôª Package: ./my-skill.zip   ­ƒôè Files: 8   ­ƒÆ¥ Size: 0.15 MB­ƒôñ Ready for distribution!```## Validation CriteriaThe packaging script checks:### Required Elements- SKILL.md exists- Valid YAML frontmatter- Name and description fields present- No TODO markers in description### Quality Checks- Description in third-person format- Description mentions when to use skill- No angle brackets in description- Word count within limits (<5,000 for SKILL.md)### Structure Validation- Proper directory organization- Scripts are executable- File references are valid- No duplicate content between SKILL.md and references/## Distribution Guidelines### Installation Instructions TemplateInclude with your packaged skill:```markdown# Installing {{SKILL_NAME}}## Personal Installation1. Download {{skill-name}}.zip2. Extract to ~/.claude/skills/3. Restart Claude Code## Project Installation1. Extract to .claude/skills/ in your project2. Commit to version control3. Team members get skill on pull## VerificationAfter installation, test with:"Use the {{SKILL_NAME}} skill to {{example task}}"```### Version ManagementFor skill updates:1. Update skill files2. Document changes in SKILL.md3. Increment version if using versioning4. Re-package with same process5. Distribute new package## Troubleshooting### Validation Fails**Issue**: Package script reports validation errors**Solution**:1. Run quick_validate.py to see specific errors2. Fix reported issues3. Re-run validation4. Try packaging again### Package Not Created**Issue**: Zip file not generated**Possible causes**:- Validation failed (fix errors first)- No write permissions (check directory)- Disk space issues (check available space)### Scripts Not Executable**Issue**: Warning about non-executable scripts**Solution**:```bashchmod +x <skill-path>/scripts/*.pychmod +x <skill-path>/scripts/*.sh```### Large Package Size**Issue**: Package is very large**Solutions**:- Move large docs to references/ directory- Remove unnecessary files- Compress images if included- Use .gitignore patterns## Best Practices1. **Complete all TODOs** before packaging2. **Test the skill** thoroughly before distribution3. **Document dependencies** clearly4. **Include examples** that work5. **Version your skills** for updates6. **Test installation** on clean system7. **Include uninstall instructions** if complex## Examples### Example 1: Package Simple Skill```bash# Validate firstpython .claude/commands/skills/scripts/quick_validate.py ~/.claude/skills/commit-helper# Package if validpython .claude/commands/skills/scripts/package_skill.py ~/.claude/skills/commit-helper# Result: commit-helper.zip created```### Example 2: Package to Distribution Directory```bash# Create dist directorymkdir -p ~/skill-packages# Package to specific locationpython .claude/commands/skills/scripts/package_skill.py \  ~/.claude/skills/pdf-processor \  ~/skill-packages# Result: ~/skill-packages/pdf-processor.zip```### Example 3: Fix and Re-package```bash# Initial validation failspython .claude/commands/skills/scripts/quick_validate.py ~/.claude/skills/my-skill# ÔØî Description contains TODO markers# Fix the issue# Edit SKILL.md to complete TODOs# Re-validatepython .claude/commands/skills/scripts/quick_validate.py ~/.claude/skills/my-skill# Ô£à Skill validation passed!# Packagepython .claude/commands/skills/scripts/package_skill.py ~/.claude/skills/my-skill# Ô£à Successfully packaged!```## Output FormatThe command provides clear feedback:```­ƒôª Packaging skill: {{skill-name}}­ƒöì Validating skill...[Validation results]­ƒôª Creating package...[File listing]Ô£à Successfully packaged skill!   ­ƒôª Package: {{path/to/package.zip}}   ­ƒôè Files: {{count}}   ­ƒÆ¥ Size: {{size}} MB­ƒôñ Ready for distribution!```## Next StepsAfter packaging:1. **Test installation** on another system2. **Share with team** or community3. **Document** in skill catalog4. **Gather feedback** for improvements5. **Plan updates** based on usage## Related Commands- `/skills:build-skill` - Create new skills- `/skills:init-skill` - Initialize skill from template- `/skills:validate-skill` - Run validation only## Scripts Used- `package_skill.py` - Main packaging script- `quick_validate.py` - Fast validation- `validate-skill.sh` - Comprehensive validationYour skill is now ready for distribution! ­ƒôª