Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:00:36 +08:00
commit c83b4639c5
49 changed files with 18594 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# Design Principles
## 1. Primitives First
Slash commands are the foundation. The skill orchestrates them using the SlashCommand tool. This follows the
multi-agent-composition principle: "Always start with prompts."
### 2. KISS State Management
TodoWrite provides visibility without complexity. No external state files, no databases, no complex checkpointing.
Simple, effective progress tracking.
### 3. Fail Fast
No complex recovery mechanisms. When something can't be auto-fixed or user declines a fix, exit immediately with
clear guidance. Preserves artifacts, provides next steps.
### 4. Context-Aware Entry
Detects workflow path from user's prompt. Explicit research location → Path 1. Ambiguous → Ask user. Natural
language interface.
### 5. Composable & Testable
Every primitive works standalone (power users) or orchestrated (guided users). Each command is independently
testable and verifiable.
### 6. Quality Gates
Sequential dependencies ensure quality: content before compliance, runtime before integration. Tiered validation
with non-blocking audit for comprehensive feedback.

View File

@@ -0,0 +1,181 @@
# Error Handling & Fix Strategy
## Core Principle: Fail Fast
When a phase fails without auto-fix capability, the workflow **stops immediately**. No complex recovery, no
checkpointing, no resume commands—only clean exit with clear error reporting and preserved artifacts.
## Rule-Based Fix Tiers
Issues are categorized into three tiers based on complexity:
### Tier 1: Simple (Auto-Fix)
**Issue Types:**
- Formatting issues (whitespace, indentation)
- Missing frontmatter fields (can be inferred)
- Markdown syntax errors (quote escaping, link formatting)
- File structure issues (missing directories)
**Actions:**
1. Automatically apply fix
2. Auto re-run the failed command ONCE
3. Continue if passes, fail fast if still broken
**Example:**
```text
/meta-claude:skill:review-compliance fails: "Missing frontmatter description field"
Tier: Simple → AUTO-FIX
Fix: Add description field inferred from skill name
Auto re-run: /meta-claude:skill:review-compliance <skill-path>
Result: Pass → Mark todo completed, continue to /meta-claude:skill:validate-runtime
```
### Tier 2: Medium (Guided Fix with Approval)
**Issue Types:**
- Content clarity suggestions
- Example improvements
- Instruction rewording
- Structure optimization
**Actions:**
1. Present issue and suggested fix
2. Ask user: "Apply this fix? [Yes/No/Edit]"
3. If Yes → Apply fix, re-run command once
4. If No → Fail fast
5. If Edit → Show fix, let user modify, apply, re-run
**Example:**
```text
/meta-claude:skill:review-content fails: "Examples section unclear, lacks practical context"
Tier: Medium → GUIDED FIX
Suggested fix: [Shows proposed rewrite with clearer examples]
Ask: "Apply this fix? [Yes/No/Edit]"
User: Yes
Apply fix
Re-run: /meta-claude:skill:review-content <skill-path>
Result: Pass → Mark todo completed, continue to /meta-claude:skill:review-compliance
```
### Tier 3: Complex (Stop and Report)
**Issue Types:**
- Architectural problems (skill design flaws)
- Insufficient research (missing critical information)
- Unsupported use cases (doesn't fit Claude Code model)
- Schema violations (fundamental structure issues)
- Composition rule violations (e.g., attempting to nest sub-agents)
**Actions:**
1. Report the issue with detailed explanation
2. Provide recommendations for manual fixes
3. **Fail fast** - exit workflow immediately
4. User must fix manually and restart workflow
**Example:**
```text
/meta-claude:skill:review-content fails: "Skill attempts to nest sub-agents, violates composition rules"
Tier: Complex → STOP AND REPORT
Report:
❌ Skill creation failed at: Review Content Quality
Issue found:
- [Tier 3: Complex] Skill attempts to nest sub-agents, which violates composition rules
Recommendation:
- Restructure skill to invoke sub-agents via SlashCommand tool instead
- See: plugins/meta/meta-claude/skills/multi-agent-composition/
Workflow stopped. Please fix manually and restart.
Artifacts preserved at:
Research: docs/research/skills/coderabbit/
Partial skill: plugins/meta/meta-claude/skills/coderabbit/
WORKFLOW EXITS (fail fast)
```
## One-Shot Fix Policy
To prevent infinite loops:
```text
Phase fails
Apply fix (auto or guided)
Re-run command ONCE
Result:
- Pass → Continue to next phase
- Fail → FAIL FAST (no second fix attempt)
```
**Rationale:** If the first fix fails, the issue exceeds initial assessment. Stop and let the user investigate rather
than looping infinitely.
## Issue Categorization Response Format
Each primitive command returns errors with tier metadata:
```javascript
{
"status": "fail",
"issues": [
{
"tier": "simple",
"category": "frontmatter",
"description": "Missing description field",
"fix": "Add description: 'Guide for CodeRabbit code review'",
"auto_fixable": true
},
{
"tier": "medium",
"category": "content-clarity",
"description": "Examples section unclear, lacks practical context",
"suggestion": "[Proposed rewrite with clearer examples]",
"auto_fixable": false
},
{
"tier": "complex",
"category": "architectural",
"description": "Skill violates composition rules by nesting sub-agents",
"recommendation": "Restructure to use SlashCommand tool for sub-agent invocation",
"auto_fixable": false
}
]
}
```
## Parsing Command Responses
When a command completes, analyze its output to determine status:
- Look for "Success", "PASS", or exit code 0 → Continue
- Look for "Error", "FAIL", or exit code 1 → Apply fix strategy
- Parse issue tier metadata (if provided) to select fix approach
- If no tier metadata, infer tier from issue description

View File

@@ -0,0 +1,45 @@
# Troubleshooting
## Research Phase Fails
**Symptom:** `/meta-claude:skill:research` command fails with API errors
**Solutions:**
- Verify FIRECRAWL_API_KEY is set: `echo $FIRECRAWL_API_KEY`
- Check network connectivity
- Verify research script permissions: `chmod +x scripts/firecrawl_*.py`
- Try manual research and use Path 1 (skip research phase)
### Content Review Fails Repeatedly
**Symptom:** `/meta-claude:skill:review-content` fails even after applying fixes
**Solutions:**
- Review the specific issues in the quality report
- Check if issues are Tier 3 (complex) - these require manual redesign
- Consider if the skill design matches Claude Code's composition model
- Consult multi-agent-composition skill for architectural guidance
### Compliance Validation Fails
**Symptom:** `/meta-claude:skill:review-compliance` reports frontmatter or naming violations
**Solutions:**
- Run quick_validate.py manually: `scripts/quick_validate.py <skill-path>`
- Check frontmatter YAML syntax (valid YAML, required fields)
- Verify skill name follows hyphen-case convention
- Ensure description is clear and within 1024 characters
### Integration Validation Fails
**Symptom:** `/meta-claude:skill:validate-integration` reports conflicts
**Solutions:**
- Check for duplicate skill names in the plugin
- Review skill description for overlap with existing skills
- Consider renaming or refining scope to avoid conflicts
- Ensure skill complements rather than duplicates existing functionality

View File

@@ -0,0 +1,67 @@
# Workflow Architecture
## Entry Point Detection
The skill analyzes your prompt to determine the workflow path:
**Explicit Research Path (Path 1):**
```text
User: "Create coderabbit skill, research in docs/research/skills/coderabbit/"
→ Detects research location, uses Path 1 (skip research phase)
```
**Ambiguous Path:**
```text
User: "Create coderabbit skill"
→ Asks: "Have you already gathered research?"
→ User response determines path
```
**Research Needed (Path 2):**
```text
User selects "No - Help me gather research"
→ Uses Path 2 (full workflow including research)
```
## Workflow Paths
### Path 1: Research Exists
```text
format → create → review-content → review-compliance →
validate-runtime → validate-integration → validate-audit → complete
```
### Path 2: Research Needed
```text
research → format → create → review-content → review-compliance →
validate-runtime → validate-integration → validate-audit → complete
```
## State Management
Progress tracking uses TodoWrite for real-time visibility:
**Path 2 Example (Full Workflow):**
```javascript
[
{"content": "Research skill domain", "status": "in_progress", "activeForm": "Researching skill domain"},
{"content": "Format research materials", "status": "pending", "activeForm": "Formatting research materials"},
{"content": "Create skill structure", "status": "pending", "activeForm": "Creating skill structure"},
{"content": "Review content quality", "status": "pending", "activeForm": "Reviewing content quality"},
{"content": "Review technical compliance", "status": "pending", "activeForm": "Reviewing technical compliance"},
{"content": "Validate runtime loading", "status": "pending", "activeForm": "Validating runtime loading"},
{"content": "Validate integration", "status": "pending", "activeForm": "Validating integration"},
{"content": "Audit skill (non-blocking)", "status": "pending", "activeForm": "Auditing skill"},
{"content": "Complete workflow", "status": "pending", "activeForm": "Completing workflow"}
]
```
**Path 1 Example (Research Exists):**
Omit first "Research skill domain" task from TodoWrite list.

View File

@@ -0,0 +1,266 @@
# Workflow Examples
## Example 1: Creating Infrastructure Skill (Path 2)
```text
User: "Create terraform-best-practices skill"
skill-factory:
"Have you already gathered research for this skill?
[Yes - I have research at <path>]
[No - Help me gather research]
[Skip - I'll create from knowledge only]"
User: "No - Help me gather research"
skill-factory initializes TodoWrite with 9 tasks, starts workflow:
[Phase 1: Research]
Invokes: /meta-claude:skill:research terraform-best-practices
Mini brainstorm about scope and categories
Executes firecrawl research script
Research saved to docs/research/skills/terraform-best-practices/
✓ Research completed
[Phase 2: Format]
Invokes: /meta-claude:skill:format docs/research/skills/terraform-best-practices
Cleans UI artifacts and navigation elements
✓ Formatting completed
[Phase 3: Create]
Invokes: /meta-claude:skill:create terraform-best-practices docs/research/skills/terraform-best-practices
Delegates to skill-creator skill
Follows Understand → Plan → Initialize → Edit → Package workflow
✓ Skill created at plugins/infrastructure/terraform-skills/skills/terraform-best-practices/
[Phase 4: Review Content]
Invokes: /meta-claude:skill:review-content plugins/infrastructure/terraform-skills/skills/terraform-best-practices
Analyzes clarity, completeness, examples, actionability, usefulness
✓ Content review passed (5/5 quality dimensions)
[Phase 5: Review Compliance]
Invokes: /meta-claude:skill:review-compliance plugins/infrastructure/terraform-skills/skills/terraform-best-practices
Runs quick_validate.py
✓ Compliance check passed
[Phase 6: Validate Runtime]
Invokes: /meta-claude:skill:validate-runtime plugins/infrastructure/terraform-skills/skills/terraform-best-practices
Tests skill loading in Claude Code context
✓ Runtime validation passed
[Phase 7: Validate Integration]
Invokes: /meta-claude:skill:validate-integration plugins/infrastructure/terraform-skills/skills/terraform-best-practices
Checks for conflicts with existing skills
✓ Integration validation passed
[Phase 8: Audit]
Invokes: /meta-claude:skill:validate-audit plugins/infrastructure/terraform-skills/skills/terraform-best-practices
Runs claude-skill-auditor agent
Audit completed with recommendations (non-blocking)
[Phase 9: Complete]
✅ Skill created and validated successfully!
Location: plugins/infrastructure/terraform-skills/skills/terraform-best-practices/
Research materials: docs/research/skills/terraform-best-practices/
Keep research materials? [Keep/Remove] (default: Keep)
User: Keep
Next steps - choose an option:
[1] Test the skill now
[2] Create PR
[3] Add to plugin.json
[4] Done
User: [2] Create PR
skill-factory creates branch, commits skill, pushes, opens PR
Workflow complete!
```
## Example 2: Creating Skill with Existing Research (Path 1)
```text
User: "Create coderabbit skill, research in docs/research/skills/coderabbit/"
skill-factory detects explicit research path, uses Path 1
Initializes TodoWrite with 8 tasks (skips research), starts workflow:
[Phase 1: Format]
Invokes: /meta-claude:skill:format docs/research/skills/coderabbit
✓ Formatting completed
[Phase 2: Create]
Invokes: /meta-claude:skill:create coderabbit docs/research/skills/coderabbit
✓ Skill created
[Continues through remaining phases...]
✓ Workflow complete
```
## Example 3: Workflow Failure with Guided Fix
```text
[Phase 4: Review Content]
Invokes: /meta-claude:skill:review-content plugins/meta/meta-claude/skills/docker-compose
Command response:
{
"status": "fail",
"issues": [
{
"tier": "medium",
"category": "examples",
"description": "Examples section missing practical docker-compose.yml configurations",
"suggestion": "[Shows proposed examples with common patterns]",
"auto_fixable": false
}
]
}
skill-factory detects Tier 2 (guided fix):
"Content review found issues that can be fixed:
Issue: Examples section missing practical docker-compose.yml configurations
Suggested fix:
[Shows proposed docker-compose.yml examples]
Apply this fix? [Yes/No/Edit]"
User: Yes
skill-factory applies fix, re-runs command:
Invokes: /meta-claude:skill:review-content plugins/meta/meta-claude/skills/docker-compose
✓ Content review passed
Continues to next phase...
```
## Example 4: Workflow Failure with Complex Issue
```text
[Phase 4: Review Content]
Invokes: /meta-claude:skill:review-content plugins/meta/meta-claude/skills/advanced-orchestration
Command response:
{
"status": "fail",
"issues": [
{
"tier": "complex",
"category": "architectural",
"description": "Skill attempts to nest sub-agents within sub-agents, which violates Claude Code composition rules",
"recommendation": "Restructure skill to use SlashCommand tool for sub-agent invocation. See multi-agent-composition skill for patterns.",
"auto_fixable": false
}
]
}
skill-factory detects Tier 3 (complex), fails fast:
❌ Skill creation failed at: Review Content Quality
Issue found:
- [Tier 3: Complex] Skill attempts to nest sub-agents within sub-agents, which violates Claude Code composition rules
Recommendation:
- Restructure skill to use SlashCommand tool for sub-agent invocation
- See: plugins/meta/meta-claude/skills/multi-agent-composition/patterns/orchestrator-pattern.md
Workflow stopped. Please fix manually and restart with:
skill-factory advanced-orchestration docs/research/skills/advanced-orchestration/
Artifacts preserved at:
Research: docs/research/skills/advanced-orchestration/
Partial skill: plugins/meta/meta-claude/skills/advanced-orchestration/
WORKFLOW EXITS
```
## Command Output Reference
### Successful Command Outputs
**Research:**
```bash
✓ Research completed for terraform-best-practices
Saved to: docs/research/skills/terraform-best-practices/
Files: 5 documents (github: 3, research: 2)
```
**Format:**
```text
✓ Formatting completed
Cleaned: 5 files, removed 247 UI artifacts
Output: docs/research/skills/terraform-best-practices/
```
**Validation (Pass):**
```text
✓ Content review passed (5/5 quality dimensions)
✓ Compliance check passed
✓ Runtime validation passed
✓ Integration validation passed
```
### Failed Command Outputs
**Tier 1 (Auto-fix):**
```json
{
"status": "fail",
"issues": [
{
"tier": "simple",
"category": "frontmatter",
"description": "Missing description field",
"fix": "Add description: 'Terraform infrastructure best practices'",
"auto_fixable": true
}
]
}
```
**Tier 2 (Guided fix):**
```json
{
"status": "fail",
"issues": [
{
"tier": "medium",
"category": "examples",
"description": "Examples section lacks practical configurations",
"suggestion": "[Proposed examples with common patterns]",
"auto_fixable": false
}
]
}
```
**Tier 3 (Complex):**
```json
{
"status": "fail",
"issues": [
{
"tier": "complex",
"category": "architectural",
"description": "Violates composition rules",
"recommendation": "Restructure to use SlashCommand tool",
"auto_fixable": false
}
]
}
```

View File

@@ -0,0 +1,80 @@
# Workflow Execution
## Phase Invocation Pattern
For each phase in the workflow:
1. **Mark phase as in_progress** (update TodoWrite)
2. **Check dependencies** (verify prior phases completed)
3. **Invoke command** using SlashCommand tool:
```text
/meta-claude:skill:research <skill-name> [sources]
/meta-claude:skill:format <research-dir>
/meta-claude:skill:create <skill-name> <research-dir>
/meta-claude:skill:review-content <skill-path>
/meta-claude:skill:review-compliance <skill-path>
/meta-claude:skill:validate-runtime <skill-path>
/meta-claude:skill:validate-integration <skill-path>
/meta-claude:skill:validate-audit <skill-path>
```
4. **Check result** (success or failure with tier metadata)
5. **Apply fix strategy** (if needed - see Error Handling section)
6. **Mark phase completed** (update TodoWrite)
7. **Continue to next phase** (or exit if fail-fast triggered)
### Dependency Enforcement
Before running each command, verify dependencies:
**Review Phase (Sequential):**
```text
/meta-claude:skill:review-content (no dependency)
↓ (must pass)
/meta-claude:skill:review-compliance (depends on content passing)
```
**Validation Phase (Tiered):**
```text
/meta-claude:skill:validate-runtime (depends on compliance passing)
↓ (must pass)
/meta-claude:skill:validate-integration (depends on runtime passing)
↓ (runs regardless)
/meta-claude:skill:validate-audit (non-blocking, informational)
```
**Dependency Check Pattern:**
```text
Before running /meta-claude:skill:review-compliance:
Check: Is "Review content quality" completed?
- Yes → Invoke /meta-claude:skill:review-compliance
- No → Skip (workflow failed earlier, stop here)
```
### Command Invocation with SlashCommand Tool
Use the SlashCommand tool to invoke each primitive command:
```javascript
// Example: Invoking research phase
SlashCommand({
command: "/meta-claude:skill:research ansible-vault-security"
})
// Example: Invoking format phase
SlashCommand({
command: "/meta-claude:skill:format docs/research/skills/ansible-vault-security"
})
// Example: Invoking create phase
SlashCommand({
command: "/meta-claude:skill:create ansible-vault-security docs/research/skills/ansible-vault-security"
})
```
**IMPORTANT:** Wait for each command to complete before proceeding to the next phase. Check the response status
before continuing.