/skill-from-repo
Purpose
Generate a Claude Code skill from a GitHub repository using C3.x codebase analysis. Extracts patterns, test examples, how-to guides, configuration patterns, and architectural overview.
Syntax
/skill-from-repo <repo> [--depth <basic|c3x>] [--output <path>] [--three-stream]
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
repo | string | Yes | - | GitHub repo (owner/repo or URL) |
--depth | string | No | c3x | Analysis depth: basic (1-2 min) or c3x (20-60 min) |
--output | string | No | ~/.coditect/skills/{name}/ | Output directory |
--three-stream | flag | No | true | Enable Code + Docs + Insights streams |
--include-issues | flag | No | true | Include GitHub issues analysis |
--max-issues | integer | No | 100 | Maximum issues to analyze |
--skip | string | No | - | Skip features: patterns,tests,guides,configs,architecture |
--languages | string | No | auto | Filter languages (python,javascript,typescript) |
--branch | string | No | main | Git branch to analyze |
Examples
Basic Usage
# Analyze GitHub repository
/skill-from-repo facebook/react
# With full URL
/skill-from-repo https://github.com/tiangolo/fastapi
Analysis Depth
# Quick analysis (1-2 minutes)
/skill-from-repo django/django --depth basic
# Full C3.x analysis (20-60 minutes)
/skill-from-repo facebook/react --depth c3x
Advanced Usage
# Skip specific features
/skill-from-repo owner/repo --skip patterns,guides
# Filter languages
/skill-from-repo microsoft/TypeScript --languages typescript,javascript
# Custom output
/skill-from-repo owner/repo --output ~/my-skills/myrepo/
# Specific branch
/skill-from-repo owner/repo --branch develop
Three-Stream Analysis
# Full three-stream analysis
/skill-from-repo facebook/react --three-stream
# Code stream only
/skill-from-repo owner/repo --three-stream --skip docs,insights
Output
~/.coditect/skills/{name}/
├── SKILL.md # 300+ lines, AI-enhanced
├── patterns/
│ ├── index.md # Pattern summary
│ ├── singleton.md # Detected patterns
│ ├── factory.md
│ └── observer.md
├── examples/
│ └── from_tests/ # Extracted test examples
├── guides/
│ ├── getting_started.md # AI-enhanced guides
│ ├── authentication.md
│ └── deployment.md
├── api_reference/
│ ├── index.md
│ └── modules/ # Per-module docs
├── architecture/
│ ├── overview.md # Architecture summary
│ ├── dependency_graph.md
│ └── data_flow.md
└── metadata.json
C3.x Analysis Features
| Feature | Flag | Description |
|---|---|---|
| C3.1 Patterns | --skip patterns | 13 GoF patterns, 9 languages |
| C3.2 Tests | --skip tests | Extract examples from tests |
| C3.3 Guides | --skip guides | Generate how-to guides |
| C3.4 Config | --skip configs | Configuration patterns |
| C3.5 Architecture | --skip architecture | Architecture overview |
| C3.7 Arch Patterns | included | MVC, microservices, etc. |
What Happens
- Repository Clone: Clone or access repository
- AST Parsing: Parse code for 9 supported languages
- C3.1: Detect design patterns
- C3.2: Extract test examples
- C3.3: Generate how-to guides
- C3.4: Extract configuration patterns
- C3.5: Generate architecture overview
- C3.7: Detect architectural patterns
- Three-Stream: Merge Code + Docs + Insights (if enabled)
- AI Enhancement: Enhance all outputs
- Quality Check: Validate against CODITECT standards
Success Output
✅ COMMAND COMPLETE: /skill-from-repo
C3.x Analysis Summary:
- [x] Repository: facebook/react
- [x] Analysis depth: c3x
- [x] Languages: JavaScript, TypeScript
C3.x Results:
- [x] C3.1 Patterns: 15 detected (89% confidence)
- [x] C3.2 Tests: 67 examples extracted
- [x] C3.3 Guides: 12 how-to guides
- [x] C3.4 Config: 8 configuration patterns
- [x] C3.5 Architecture: Overview + dependencies
- [x] C3.7 Arch: component-based, event-driven
Three-Stream Analysis:
- [x] Code: AST analysis complete
- [x] Docs: README, CONTRIBUTING extracted
- [x] Insights: 100 issues analyzed, 24 common problems
Output: ~/.coditect/skills/react/
Quality Score: 8.9/10
When NOT to Use
Do NOT use this command when:
- Analyzing documentation websites - use
/skill-from-docsinstead - Need to combine docs + code sources - use
skill-generator-orchestratorinstead - Repository is private and no GitHub token configured
- Repository requires authentication and no access token available
- Quick one-off code question - just ask Claude directly
- Repository is too large (>100K files) without
--languagesfilter - Analyzing minified/compiled code (dist/, build/) - garbage patterns
- Need PDF analysis - use
/pdfskill instead
Completion Checklist
Before marking this command as complete, verify:
- Repository cloned or local path validated
- C3.1 Design patterns detected and documented
- C3.2 Test examples extracted with quality filtering
- C3.3 How-to guides generated (if depth=c3x)
- C3.4 Configuration patterns extracted
- C3.5 Architecture overview generated
- C3.7 Architectural patterns detected
- SKILL.md generated (300+ lines for c3x, 100+ for basic)
- All output directories created (patterns/, examples/, guides/, etc.)
- metadata.json created with analysis metrics
Failure Indicators
- ❌ Repository not accessible (clone failed, 404, auth required)
- ❌ No supported language files found (9 languages supported)
- ❌ Zero patterns detected (check language filter)
- ❌ SKILL.md under 100 lines
- ❌ GitHub rate limit exceeded (set GITHUB_TOKEN)
- ❌ Zero test examples extracted
- ❌ API reference empty
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| No language filter on huge repos | Memory exhaustion, timeout | Use --languages python,typescript |
| Skipping test extraction | Missing real-world examples | Keep --skip tests off |
| Surface-only pattern detection | Low confidence (0.6) | Use --depth c3x for production |
| Ignoring GitHub insights | Missing community knowledge | Enable --three-stream |
| No AI enhancement | Basic template output | AI enhancement enabled by default |
| Analyzing minified code | Garbage patterns | Exclude dist/, build/ via .gitignore |
| No GITHUB_TOKEN for public repos | Rate limiting (60/hour) | Set env var for 5000/hour |
Verification
After execution, verify success:
# 1. Check output structure exists
ls -la ~/.coditect/skills/{name}/
# 2. Verify SKILL.md length
wc -l ~/.coditect/skills/{name}/SKILL.md # 300+ for c3x, 100+ for basic
# 3. Check pattern detection
ls ~/.coditect/skills/{name}/patterns/
# 4. Validate examples compile (Python example)
python3 -m py_compile ~/.coditect/skills/{name}/examples/from_tests/*.py 2>/dev/null || echo "No Python examples"
# 5. Check architecture output
head -30 ~/.coditect/skills/{name}/architecture/overview.md
# 6. Verify metadata
cat ~/.coditect/skills/{name}/metadata.json | python3 -m json.tool
Troubleshooting
| Issue | Solution |
|---|---|
| Rate limited | Set GITHUB_TOKEN environment variable |
| Repo too large | Use --languages filter |
| Missing patterns | Try --depth full for deeper analysis |
| Timeout | Use --depth basic for quicker analysis |
Related
- Agent:
codebase-skill-extractor - Orchestrator:
skill-generator-orchestrator - Companion:
/skill-from-docs - Skill:
multi-source-skill-generation