Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:31:59 +08:00
commit 70605c4d40
5 changed files with 484 additions and 0 deletions

280
commands/skill-builder.md Normal file
View File

@@ -0,0 +1,280 @@
---
description: Build production-ready Claude Code skills efficiently and quickly
allowed-tools: Read(*), Write(*), Edit(*), Bash(mkdir:*,cp:*,chmod:*), Glob(*), AskUserQuestion(*)
---
# Skill Builder
Interactive skill creation system. Build production-ready Claude Code skills in minutes.
---
## 🎯 Task
**Create a new skill:** $ARGUMENTS
---
## Phase 1: Gather Requirements
Understanding what skill to build...
Ask user:
**Header:** "Skill Basics"
**Question:** "What type of skill do you want to create?"
**MultiSelect:** false
**Options:**
- **Transformation** - Convert data from one format to another (Markdown→HTML, JSON→YAML)
- **Analysis** - Analyze data and generate insights (code review, document analysis)
- **Generator** - Create new content (code templates, documentation, configs)
- **Validation** - Check and validate content (syntax, format, consistency)
- **Orchestration** - Coordinate multiple operations (multi-step workflows)
Based on selection, determine template to use.
---
## Phase 2: Skill Details
Collect skill information:
**Ask:**
1. **Skill Name** (kebab-case, e.g., "code-formatter")
- Validate: lowercase, hyphens only, no spaces
- Suggest: based on description
2. **Description** (one sentence)
- Example: "Format code in Python, JavaScript, Go"
- Validate: < 100 chars
3. **Key Features** (comma-separated)
- Examples: "Auto-detect language, Fast formatting, Syntax validation"
- Validate: 2-5 features
4. **Primary Language Support**
- Choose: Python, JavaScript, Go, Rust, Java, Multi-language, Other
---
## Phase 3: Generate Skill Structure
1. ✅ Create directory structure
```
skills/[skill-name]/
├── commands/
│ ├── [skill-name].md
│ ├── [skill-name]:quick.md
│ └── [skill-name]:validate.md
├── tools/
│ ├── executor.sh
│ └── validator.sh
├── templates/
├── tests/
│ └── test-basic.sh
└── docs/
├── README.md
└── GUIDE.md
```
2. ✅ Generate command files from templates
- Main command with boilerplate
- Quick mode for fast execution
- Validation sub-command
3. ✅ Generate bash scripts
- Executor with placeholder functions
- Validator with basic checks
- Cache management functions
4. ✅ Generate documentation
- README with quick start
- GUIDE with complete documentation
- Example usage
---
## Phase 4: Add Optimizations
Automatically included:
✅ **Caching Layer**
- TTL-based result caching (1 hour default)
- Cache management commands
- 20-30% token savings on repeat operations
✅ **Quick Mode**
- Fast path for simple/known cases
- Skips analysis phase
- 50-70% token savings
✅ **Validation**
- Input validation
- Output validation
- Error handling
✅ **Tests**
- Basic functionality test
- Cache functionality test
- Validation test
---
## Phase 5: Review & Confirm
Show generated structure:
```
Created: skills/[skill-name]/
├── commands/
│ ├── [skill-name].md (350 lines)
│ ├── [skill-name]:quick.md (180 lines)
│ └── [skill-name]:validate.md (120 lines)
├── tools/
│ ├── executor.sh (150 lines)
│ └── validator.sh (80 lines)
├── templates/
├── tests/
│ └── test-basic.sh (60 lines)
└── docs/
├── README.md (80 lines)
└── GUIDE.md (200 lines)
Total: ~1,220 lines of generated code
Setup time: < 5 minutes
Ready to customize
```
Ask for confirmation:
- Modify anything?
- Review specific files?
- Generate additional templates?
**Note:** To make this skill discoverable in a marketplace:
1. Add entry to marketplace `.claude-plugin/marketplace.json` (see docs/README.md)
2. Commit and push to GitHub remote
3. Update marketplace cache: `claude plugin marketplace update your-marketplace`
4. Install from marketplace: `claude plugin install [skill-name]@your-marketplace`
---
## Phase 6: Generate & Write Files
Create all files:
1. Command files (with proper YAML frontmatter)
2. Bash scripts (executable, with error handling)
3. Documentation files (formatted markdown)
4. Test file (functional tests)
5. Git-ready structure (no .git in generated skill)
---
## Phase 7: Final Steps
Show completion:
```
✅ Skill Created Successfully!
Location: ./skills/[skill-name]/
Next Steps:
1. Customize executor.sh with your logic
2. Update validator.sh with validation rules
3. Add custom templates if needed
4. Run: bash tools/executor.sh "test input"
5. Run tests: bash tests/test-basic.sh
Documentation:
- Quick start: docs/README.md
- Full guide: docs/GUIDE.md
- Framework: docs/SKILL-CREATION-FRAMEWORK.md
- Example: docs/SKILL-CREATION-EXAMPLE.md
Use the skill:
- /ck:[skill-name] "your input"
- /ck:[skill-name]:quick "simple input"
- /ck:[skill-name]:validate "check output"
```
---
## Features
✨ **Fully Generated**
- All files created and ready to use
- No manual file creation needed
- Proper directory structure
✨ **Production Ready**
- Includes error handling
- Built-in caching layer
- Validation framework included
- Test suite included
✨ **Optimized**
- Quick mode for fast execution
- Bash scripts for mechanical tasks
- Caching for 20-30% savings
- Lightweight framework < 2K tokens typical
✨ **Well Documented**
- README with quick start
- GUIDE with full documentation
- Framework reference included
- Example code included
---
## Sub-Commands
```bash
/ck:skill-builder # Interactive creation (this command)
/ck:skill-builder:quick # Quick scaffolding with defaults
/ck:skill-builder:templates # Browse available templates
/ck:skill-builder:validate # Check existing skill
/ck:skill-builder:help # Help and examples
```
---
## Example Usage
```bash
# Interactive creation
/ck:skill-builder "code formatter"
# Quick creation with defaults
/ck:skill-builder:quick "my-tool"
# List available templates
/ck:skill-builder:templates
# Validate generated skill
/ck:skill-builder:validate "skills/my-skill"
```
---
## Token Cost
- **First skill:** 1.5-2K tokens (interactive guidance)
- **Subsequent skills:** 400-600 tokens (cached templates, quick mode)
- **Validation:** < 200 tokens (bash-based)
30-40% faster with each skill created due to caching.
---
## What You Get
Each generated skill includes:
✅ 3 command files (main + quick + validate)
✅ 2 bash scripts (executor + validator)
✅ 1 test suite (basic functionality tests)
✅ 2 docs (README + GUIDE)
✅ Caching layer built-in
✅ Error handling built-in
✅ Ready to customize and deploy

View File

@@ -0,0 +1,141 @@
---
description: Quick skill scaffolding - generate skill structure with defaults
allowed-tools: Bash(mkdir:*,cp:*), Write(*), Glob(*)
---
# Quick Skill Builder
Rapid skill generation using default configuration and templates.
---
## ⚡ Task
**Quick create skill:** $ARGUMENTS
**No questions asked - uses smart defaults**
---
## Execution
### Step 1: Parse Input
Extract skill details from $ARGUMENTS:
- Detect skill type from keywords
- Extract skill name
- Infer features from context
Example: "code formatter for python and javascript"
- Type: Transformation
- Name: code-formatter
- Languages: Python, JavaScript
### Step 2: Generate Structure
Create directory structure:
```
skills/[skill-name]/
├── commands/
│ ├── [skill-name].md
│ ├── [skill-name]:quick.md
│ └── [skill-name]:validate.md
├── tools/
│ ├── executor.sh
│ ├── validator.sh
│ └── cache.sh
├── tests/
│ └── test-basic.sh
└── docs/
├── README.md
└── GUIDE.md
```
### Step 3: Generate Files
Generate from cached templates:
- ✅ Command files (with proper frontmatter)
- ✅ Bash scripts (executable, ready to customize)
- ✅ Documentation (formatted, complete)
- ✅ Test file (functional, passes)
All files generated in < 5 seconds using bash templates.
### Step 4: Output Location
Show generated skill location:
```
✅ Skill Created: ./skills/[skill-name]/
Token cost: 400-600
Time: < 30 seconds
Ready to use and customize
```
---
## Smart Defaults
Automatically configured:
| Setting | Default |
|---------|---------|
| Cache TTL | 3600 (1 hour) |
| Quick mode | Enabled |
| Validation | Enabled |
| Tests | Basic suite included |
| Documentation | Complete (README + GUIDE) |
| Caching | 20-30% savings built-in |
| Error handling | Comprehensive |
---
## Next Steps
```bash
# Edit executor.sh with your logic
nano skills/[skill-name]/tools/executor.sh
# Run test suite
bash skills/[skill-name]/tests/test-basic.sh
# Test the skill
/ck:[skill-name] "test input"
```
---
## Examples
```bash
# Create code formatter
/ck:skill-builder:quick "code formatter"
→ Creates: skills/code-formatter/
# Create document converter
/ck:skill-builder:quick "markdown to html converter"
→ Creates: skills/markdown-to-html/
# Create validator
/ck:skill-builder:quick "json schema validator"
→ Creates: skills/json-schema-validator/
```
---
## Token Cost
- **Time:** < 30 seconds
- **Tokens:** 400-600 (first skill, 100-200 for cached templates)
- **Speed:** ~5 seconds file generation
- **Ready:** Yes, customize immediately
---
## Features
**Fast** - Complete in 30 seconds
**Smart** - Detects skill type and name
**Ready** - All files generated and functional
**Cacheable** - Uses template cache for speed