mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 13:43:26 +08:00
feat: add skill-create and continuous-learning-v2 commands
New commands: - /skill-create: Local git history analysis to generate SKILL.md files - /instinct-status: Show learned instincts with confidence levels - /instinct-import: Import instincts from files or repos - /instinct-export: Export instincts for sharing - /evolve: Cluster instincts into skills/commands/agents These integrate the continuous-learning-v2 system and provide a local alternative to the Skill Creator GitHub App for pattern extraction.
This commit is contained in:
186
commands/evolve.md
Normal file
186
commands/evolve.md
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
---
|
||||||
|
name: evolve
|
||||||
|
description: Cluster related instincts into skills, commands, or agents
|
||||||
|
command: /evolve
|
||||||
|
implementation: python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve
|
||||||
|
---
|
||||||
|
|
||||||
|
# Evolve Command
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py evolve [--generate]
|
||||||
|
```
|
||||||
|
|
||||||
|
Analyzes instincts and clusters related ones into higher-level structures:
|
||||||
|
- **Commands**: When instincts describe user-invoked actions
|
||||||
|
- **Skills**: When instincts describe auto-triggered behaviors
|
||||||
|
- **Agents**: When instincts describe complex, multi-step processes
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/evolve # Analyze all instincts and suggest evolutions
|
||||||
|
/evolve --domain testing # Only evolve instincts in testing domain
|
||||||
|
/evolve --dry-run # Show what would be created without creating
|
||||||
|
/evolve --threshold 5 # Require 5+ related instincts to cluster
|
||||||
|
```
|
||||||
|
|
||||||
|
## Evolution Rules
|
||||||
|
|
||||||
|
### → Command (User-Invoked)
|
||||||
|
When instincts describe actions a user would explicitly request:
|
||||||
|
- Multiple instincts about "when user asks to..."
|
||||||
|
- Instincts with triggers like "when creating a new X"
|
||||||
|
- Instincts that follow a repeatable sequence
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- `new-table-step1`: "when adding a database table, create migration"
|
||||||
|
- `new-table-step2`: "when adding a database table, update schema"
|
||||||
|
- `new-table-step3`: "when adding a database table, regenerate types"
|
||||||
|
|
||||||
|
→ Creates: `/new-table` command
|
||||||
|
|
||||||
|
### → Skill (Auto-Triggered)
|
||||||
|
When instincts describe behaviors that should happen automatically:
|
||||||
|
- Pattern-matching triggers
|
||||||
|
- Error handling responses
|
||||||
|
- Code style enforcement
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- `prefer-functional`: "when writing functions, prefer functional style"
|
||||||
|
- `use-immutable`: "when modifying state, use immutable patterns"
|
||||||
|
- `avoid-classes`: "when designing modules, avoid class-based design"
|
||||||
|
|
||||||
|
→ Creates: `functional-patterns` skill
|
||||||
|
|
||||||
|
### → Agent (Needs Depth/Isolation)
|
||||||
|
When instincts describe complex, multi-step processes that benefit from isolation:
|
||||||
|
- Debugging workflows
|
||||||
|
- Refactoring sequences
|
||||||
|
- Research tasks
|
||||||
|
|
||||||
|
Example:
|
||||||
|
- `debug-step1`: "when debugging, first check logs"
|
||||||
|
- `debug-step2`: "when debugging, isolate the failing component"
|
||||||
|
- `debug-step3`: "when debugging, create minimal reproduction"
|
||||||
|
- `debug-step4`: "when debugging, verify fix with test"
|
||||||
|
|
||||||
|
→ Creates: `debugger` agent
|
||||||
|
|
||||||
|
## What to Do
|
||||||
|
|
||||||
|
1. Read all instincts from `~/.claude/homunculus/instincts/`
|
||||||
|
2. Group instincts by:
|
||||||
|
- Domain similarity
|
||||||
|
- Trigger pattern overlap
|
||||||
|
- Action sequence relationship
|
||||||
|
3. For each cluster of 3+ related instincts:
|
||||||
|
- Determine evolution type (command/skill/agent)
|
||||||
|
- Generate the appropriate file
|
||||||
|
- Save to `~/.claude/homunculus/evolved/{commands,skills,agents}/`
|
||||||
|
4. Link evolved structure back to source instincts
|
||||||
|
|
||||||
|
## Output Format
|
||||||
|
|
||||||
|
```
|
||||||
|
🧬 Evolve Analysis
|
||||||
|
==================
|
||||||
|
|
||||||
|
Found 3 clusters ready for evolution:
|
||||||
|
|
||||||
|
## Cluster 1: Database Migration Workflow
|
||||||
|
Instincts: new-table-migration, update-schema, regenerate-types
|
||||||
|
Type: Command
|
||||||
|
Confidence: 85% (based on 12 observations)
|
||||||
|
|
||||||
|
Would create: /new-table command
|
||||||
|
Files:
|
||||||
|
- ~/.claude/homunculus/evolved/commands/new-table.md
|
||||||
|
|
||||||
|
## Cluster 2: Functional Code Style
|
||||||
|
Instincts: prefer-functional, use-immutable, avoid-classes, pure-functions
|
||||||
|
Type: Skill
|
||||||
|
Confidence: 78% (based on 8 observations)
|
||||||
|
|
||||||
|
Would create: functional-patterns skill
|
||||||
|
Files:
|
||||||
|
- ~/.claude/homunculus/evolved/skills/functional-patterns.md
|
||||||
|
|
||||||
|
## Cluster 3: Debugging Process
|
||||||
|
Instincts: debug-check-logs, debug-isolate, debug-reproduce, debug-verify
|
||||||
|
Type: Agent
|
||||||
|
Confidence: 72% (based on 6 observations)
|
||||||
|
|
||||||
|
Would create: debugger agent
|
||||||
|
Files:
|
||||||
|
- ~/.claude/homunculus/evolved/agents/debugger.md
|
||||||
|
|
||||||
|
---
|
||||||
|
Run `/evolve --execute` to create these files.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
- `--execute`: Actually create the evolved structures (default is preview)
|
||||||
|
- `--dry-run`: Preview without creating
|
||||||
|
- `--domain <name>`: Only evolve instincts in specified domain
|
||||||
|
- `--threshold <n>`: Minimum instincts required to form cluster (default: 3)
|
||||||
|
- `--type <command|skill|agent>`: Only create specified type
|
||||||
|
|
||||||
|
## Generated File Format
|
||||||
|
|
||||||
|
### Command
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
name: new-table
|
||||||
|
description: Create a new database table with migration, schema update, and type generation
|
||||||
|
command: /new-table
|
||||||
|
evolved_from:
|
||||||
|
- new-table-migration
|
||||||
|
- update-schema
|
||||||
|
- regenerate-types
|
||||||
|
---
|
||||||
|
|
||||||
|
# New Table Command
|
||||||
|
|
||||||
|
[Generated content based on clustered instincts]
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. ...
|
||||||
|
2. ...
|
||||||
|
```
|
||||||
|
|
||||||
|
### Skill
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
name: functional-patterns
|
||||||
|
description: Enforce functional programming patterns
|
||||||
|
evolved_from:
|
||||||
|
- prefer-functional
|
||||||
|
- use-immutable
|
||||||
|
- avoid-classes
|
||||||
|
---
|
||||||
|
|
||||||
|
# Functional Patterns Skill
|
||||||
|
|
||||||
|
[Generated content based on clustered instincts]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Agent
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
name: debugger
|
||||||
|
description: Systematic debugging agent
|
||||||
|
model: sonnet
|
||||||
|
evolved_from:
|
||||||
|
- debug-check-logs
|
||||||
|
- debug-isolate
|
||||||
|
- debug-reproduce
|
||||||
|
---
|
||||||
|
|
||||||
|
# Debugger Agent
|
||||||
|
|
||||||
|
[Generated content based on clustered instincts]
|
||||||
|
```
|
||||||
91
commands/instinct-export.md
Normal file
91
commands/instinct-export.md
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
---
|
||||||
|
name: instinct-export
|
||||||
|
description: Export instincts for sharing with teammates or other projects
|
||||||
|
command: /instinct-export
|
||||||
|
---
|
||||||
|
|
||||||
|
# Instinct Export Command
|
||||||
|
|
||||||
|
Exports instincts to a shareable format. Perfect for:
|
||||||
|
- Sharing with teammates
|
||||||
|
- Transferring to a new machine
|
||||||
|
- Contributing to project conventions
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/instinct-export # Export all personal instincts
|
||||||
|
/instinct-export --domain testing # Export only testing instincts
|
||||||
|
/instinct-export --min-confidence 0.7 # Only export high-confidence instincts
|
||||||
|
/instinct-export --output team-instincts.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
## What to Do
|
||||||
|
|
||||||
|
1. Read instincts from `~/.claude/homunculus/instincts/personal/`
|
||||||
|
2. Filter based on flags
|
||||||
|
3. Strip sensitive information:
|
||||||
|
- Remove session IDs
|
||||||
|
- Remove file paths (keep only patterns)
|
||||||
|
- Remove timestamps older than "last week"
|
||||||
|
4. Generate export file
|
||||||
|
|
||||||
|
## Output Format
|
||||||
|
|
||||||
|
Creates a YAML file:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Instincts Export
|
||||||
|
# Generated: 2025-01-22
|
||||||
|
# Source: personal
|
||||||
|
# Count: 12 instincts
|
||||||
|
|
||||||
|
version: "2.0"
|
||||||
|
exported_by: "continuous-learning-v2"
|
||||||
|
export_date: "2025-01-22T10:30:00Z"
|
||||||
|
|
||||||
|
instincts:
|
||||||
|
- id: prefer-functional-style
|
||||||
|
trigger: "when writing new functions"
|
||||||
|
action: "Use functional patterns over classes"
|
||||||
|
confidence: 0.8
|
||||||
|
domain: code-style
|
||||||
|
observations: 8
|
||||||
|
|
||||||
|
- id: test-first-workflow
|
||||||
|
trigger: "when adding new functionality"
|
||||||
|
action: "Write test first, then implementation"
|
||||||
|
confidence: 0.9
|
||||||
|
domain: testing
|
||||||
|
observations: 12
|
||||||
|
|
||||||
|
- id: grep-before-edit
|
||||||
|
trigger: "when modifying code"
|
||||||
|
action: "Search with Grep, confirm with Read, then Edit"
|
||||||
|
confidence: 0.7
|
||||||
|
domain: workflow
|
||||||
|
observations: 6
|
||||||
|
```
|
||||||
|
|
||||||
|
## Privacy Considerations
|
||||||
|
|
||||||
|
Exports include:
|
||||||
|
- ✅ Trigger patterns
|
||||||
|
- ✅ Actions
|
||||||
|
- ✅ Confidence scores
|
||||||
|
- ✅ Domains
|
||||||
|
- ✅ Observation counts
|
||||||
|
|
||||||
|
Exports do NOT include:
|
||||||
|
- ❌ Actual code snippets
|
||||||
|
- ❌ File paths
|
||||||
|
- ❌ Session transcripts
|
||||||
|
- ❌ Personal identifiers
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
- `--domain <name>`: Export only specified domain
|
||||||
|
- `--min-confidence <n>`: Minimum confidence threshold (default: 0.3)
|
||||||
|
- `--output <file>`: Output file path (default: instincts-export-YYYYMMDD.yaml)
|
||||||
|
- `--format <yaml|json|md>`: Output format (default: yaml)
|
||||||
|
- `--include-evidence`: Include evidence text (default: excluded)
|
||||||
135
commands/instinct-import.md
Normal file
135
commands/instinct-import.md
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
---
|
||||||
|
name: instinct-import
|
||||||
|
description: Import instincts from teammates, Skill Creator, or other sources
|
||||||
|
command: /instinct-import
|
||||||
|
implementation: python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file>
|
||||||
|
---
|
||||||
|
|
||||||
|
# Instinct Import Command
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py import <file-or-url> [--dry-run] [--force] [--min-confidence 0.7]
|
||||||
|
```
|
||||||
|
|
||||||
|
Import instincts from:
|
||||||
|
- Teammates' exports
|
||||||
|
- Skill Creator (repo analysis)
|
||||||
|
- Community collections
|
||||||
|
- Previous machine backups
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/instinct-import team-instincts.yaml
|
||||||
|
/instinct-import https://github.com/org/repo/instincts.yaml
|
||||||
|
/instinct-import --from-skill-creator acme/webapp
|
||||||
|
```
|
||||||
|
|
||||||
|
## What to Do
|
||||||
|
|
||||||
|
1. Fetch the instinct file (local path or URL)
|
||||||
|
2. Parse and validate the format
|
||||||
|
3. Check for duplicates with existing instincts
|
||||||
|
4. Merge or add new instincts
|
||||||
|
5. Save to `~/.claude/homunculus/instincts/inherited/`
|
||||||
|
|
||||||
|
## Import Process
|
||||||
|
|
||||||
|
```
|
||||||
|
📥 Importing instincts from: team-instincts.yaml
|
||||||
|
================================================
|
||||||
|
|
||||||
|
Found 12 instincts to import.
|
||||||
|
|
||||||
|
Analyzing conflicts...
|
||||||
|
|
||||||
|
## New Instincts (8)
|
||||||
|
These will be added:
|
||||||
|
✓ use-zod-validation (confidence: 0.7)
|
||||||
|
✓ prefer-named-exports (confidence: 0.65)
|
||||||
|
✓ test-async-functions (confidence: 0.8)
|
||||||
|
...
|
||||||
|
|
||||||
|
## Duplicate Instincts (3)
|
||||||
|
Already have similar instincts:
|
||||||
|
⚠️ prefer-functional-style
|
||||||
|
Local: 0.8 confidence, 12 observations
|
||||||
|
Import: 0.7 confidence
|
||||||
|
→ Keep local (higher confidence)
|
||||||
|
|
||||||
|
⚠️ test-first-workflow
|
||||||
|
Local: 0.75 confidence
|
||||||
|
Import: 0.9 confidence
|
||||||
|
→ Update to import (higher confidence)
|
||||||
|
|
||||||
|
## Conflicting Instincts (1)
|
||||||
|
These contradict local instincts:
|
||||||
|
❌ use-classes-for-services
|
||||||
|
Conflicts with: avoid-classes
|
||||||
|
→ Skip (requires manual resolution)
|
||||||
|
|
||||||
|
---
|
||||||
|
Import 8 new, update 1, skip 3?
|
||||||
|
```
|
||||||
|
|
||||||
|
## Merge Strategies
|
||||||
|
|
||||||
|
### For Duplicates
|
||||||
|
When importing an instinct that matches an existing one:
|
||||||
|
- **Higher confidence wins**: Keep the one with higher confidence
|
||||||
|
- **Merge evidence**: Combine observation counts
|
||||||
|
- **Update timestamp**: Mark as recently validated
|
||||||
|
|
||||||
|
### For Conflicts
|
||||||
|
When importing an instinct that contradicts an existing one:
|
||||||
|
- **Skip by default**: Don't import conflicting instincts
|
||||||
|
- **Flag for review**: Mark both as needing attention
|
||||||
|
- **Manual resolution**: User decides which to keep
|
||||||
|
|
||||||
|
## Source Tracking
|
||||||
|
|
||||||
|
Imported instincts are marked with:
|
||||||
|
```yaml
|
||||||
|
source: "inherited"
|
||||||
|
imported_from: "team-instincts.yaml"
|
||||||
|
imported_at: "2025-01-22T10:30:00Z"
|
||||||
|
original_source: "session-observation" # or "repo-analysis"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Skill Creator Integration
|
||||||
|
|
||||||
|
When importing from Skill Creator:
|
||||||
|
|
||||||
|
```
|
||||||
|
/instinct-import --from-skill-creator acme/webapp
|
||||||
|
```
|
||||||
|
|
||||||
|
This fetches instincts generated from repo analysis:
|
||||||
|
- Source: `repo-analysis`
|
||||||
|
- Higher initial confidence (0.7+)
|
||||||
|
- Linked to source repository
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
- `--dry-run`: Preview without importing
|
||||||
|
- `--force`: Import even if conflicts exist
|
||||||
|
- `--merge-strategy <higher|local|import>`: How to handle duplicates
|
||||||
|
- `--from-skill-creator <owner/repo>`: Import from Skill Creator analysis
|
||||||
|
- `--min-confidence <n>`: Only import instincts above threshold
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|
After import:
|
||||||
|
```
|
||||||
|
✅ Import complete!
|
||||||
|
|
||||||
|
Added: 8 instincts
|
||||||
|
Updated: 1 instinct
|
||||||
|
Skipped: 3 instincts (2 duplicates, 1 conflict)
|
||||||
|
|
||||||
|
New instincts saved to: ~/.claude/homunculus/instincts/inherited/
|
||||||
|
|
||||||
|
Run /instinct-status to see all instincts.
|
||||||
|
```
|
||||||
79
commands/instinct-status.md
Normal file
79
commands/instinct-status.md
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
---
|
||||||
|
name: instinct-status
|
||||||
|
description: Show all learned instincts with their confidence levels
|
||||||
|
command: /instinct-status
|
||||||
|
implementation: python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py status
|
||||||
|
---
|
||||||
|
|
||||||
|
# Instinct Status Command
|
||||||
|
|
||||||
|
Shows all learned instincts with their confidence scores, grouped by domain.
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 ~/.claude/skills/continuous-learning-v2/scripts/instinct-cli.py status
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/instinct-status
|
||||||
|
/instinct-status --domain code-style
|
||||||
|
/instinct-status --low-confidence
|
||||||
|
```
|
||||||
|
|
||||||
|
## What to Do
|
||||||
|
|
||||||
|
1. Read all instinct files from `~/.claude/homunculus/instincts/personal/`
|
||||||
|
2. Read inherited instincts from `~/.claude/homunculus/instincts/inherited/`
|
||||||
|
3. Display them grouped by domain with confidence bars
|
||||||
|
|
||||||
|
## Output Format
|
||||||
|
|
||||||
|
```
|
||||||
|
📊 Instinct Status
|
||||||
|
==================
|
||||||
|
|
||||||
|
## Code Style (4 instincts)
|
||||||
|
|
||||||
|
### prefer-functional-style
|
||||||
|
Trigger: when writing new functions
|
||||||
|
Action: Use functional patterns over classes
|
||||||
|
Confidence: ████████░░ 80%
|
||||||
|
Source: session-observation | Last updated: 2025-01-22
|
||||||
|
|
||||||
|
### use-path-aliases
|
||||||
|
Trigger: when importing modules
|
||||||
|
Action: Use @/ path aliases instead of relative imports
|
||||||
|
Confidence: ██████░░░░ 60%
|
||||||
|
Source: repo-analysis (github.com/acme/webapp)
|
||||||
|
|
||||||
|
## Testing (2 instincts)
|
||||||
|
|
||||||
|
### test-first-workflow
|
||||||
|
Trigger: when adding new functionality
|
||||||
|
Action: Write test first, then implementation
|
||||||
|
Confidence: █████████░ 90%
|
||||||
|
Source: session-observation
|
||||||
|
|
||||||
|
## Workflow (3 instincts)
|
||||||
|
|
||||||
|
### grep-before-edit
|
||||||
|
Trigger: when modifying code
|
||||||
|
Action: Search with Grep, confirm with Read, then Edit
|
||||||
|
Confidence: ███████░░░ 70%
|
||||||
|
Source: session-observation
|
||||||
|
|
||||||
|
---
|
||||||
|
Total: 9 instincts (4 personal, 5 inherited)
|
||||||
|
Observer: Running (last analysis: 5 min ago)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Flags
|
||||||
|
|
||||||
|
- `--domain <name>`: Filter by domain (code-style, testing, git, etc.)
|
||||||
|
- `--low-confidence`: Show only instincts with confidence < 0.5
|
||||||
|
- `--high-confidence`: Show only instincts with confidence >= 0.7
|
||||||
|
- `--source <type>`: Filter by source (session-observation, repo-analysis, inherited)
|
||||||
|
- `--json`: Output as JSON for programmatic use
|
||||||
174
commands/skill-create.md
Normal file
174
commands/skill-create.md
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
---
|
||||||
|
name: skill-create
|
||||||
|
description: Analyze local git history to extract coding patterns and generate SKILL.md files. Local version of the Skill Creator GitHub App.
|
||||||
|
allowed_tools: ["Bash", "Read", "Write", "Grep", "Glob"]
|
||||||
|
---
|
||||||
|
|
||||||
|
# /skill-create - Local Skill Generation
|
||||||
|
|
||||||
|
Analyze your repository's git history to extract coding patterns and generate SKILL.md files that teach Claude your team's practices.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/skill-create # Analyze current repo
|
||||||
|
/skill-create --commits 100 # Analyze last 100 commits
|
||||||
|
/skill-create --output ./skills # Custom output directory
|
||||||
|
/skill-create --instincts # Also generate instincts for continuous-learning-v2
|
||||||
|
```
|
||||||
|
|
||||||
|
## What It Does
|
||||||
|
|
||||||
|
1. **Parses Git History** - Analyzes commits, file changes, and patterns
|
||||||
|
2. **Detects Patterns** - Identifies recurring workflows and conventions
|
||||||
|
3. **Generates SKILL.md** - Creates valid Claude Code skill files
|
||||||
|
4. **Optionally Creates Instincts** - For the continuous-learning-v2 system
|
||||||
|
|
||||||
|
## Analysis Steps
|
||||||
|
|
||||||
|
### Step 1: Gather Git Data
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Get recent commits with file changes
|
||||||
|
git log --oneline -n ${COMMITS:-200} --name-only --pretty=format:"%H|%s|%ad" --date=short
|
||||||
|
|
||||||
|
# Get commit frequency by file
|
||||||
|
git log --oneline -n 200 --name-only | grep -v "^$" | grep -v "^[a-f0-9]" | sort | uniq -c | sort -rn | head -20
|
||||||
|
|
||||||
|
# Get commit message patterns
|
||||||
|
git log --oneline -n 200 | cut -d' ' -f2- | head -50
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2: Detect Patterns
|
||||||
|
|
||||||
|
Look for these pattern types:
|
||||||
|
|
||||||
|
| Pattern | Detection Method |
|
||||||
|
|---------|-----------------|
|
||||||
|
| **Commit conventions** | Regex on commit messages (feat:, fix:, chore:) |
|
||||||
|
| **File co-changes** | Files that always change together |
|
||||||
|
| **Workflow sequences** | Repeated file change patterns |
|
||||||
|
| **Architecture** | Folder structure and naming conventions |
|
||||||
|
| **Testing patterns** | Test file locations, naming, coverage |
|
||||||
|
|
||||||
|
### Step 3: Generate SKILL.md
|
||||||
|
|
||||||
|
Output format:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
name: {repo-name}-patterns
|
||||||
|
description: Coding patterns extracted from {repo-name}
|
||||||
|
version: 1.0.0
|
||||||
|
source: local-git-analysis
|
||||||
|
analyzed_commits: {count}
|
||||||
|
---
|
||||||
|
|
||||||
|
# {Repo Name} Patterns
|
||||||
|
|
||||||
|
## Commit Conventions
|
||||||
|
{detected commit message patterns}
|
||||||
|
|
||||||
|
## Code Architecture
|
||||||
|
{detected folder structure and organization}
|
||||||
|
|
||||||
|
## Workflows
|
||||||
|
{detected repeating file change patterns}
|
||||||
|
|
||||||
|
## Testing Patterns
|
||||||
|
{detected test conventions}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Generate Instincts (if --instincts)
|
||||||
|
|
||||||
|
For continuous-learning-v2 integration:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
id: {repo}-commit-convention
|
||||||
|
trigger: "when writing a commit message"
|
||||||
|
confidence: 0.8
|
||||||
|
domain: git
|
||||||
|
source: local-repo-analysis
|
||||||
|
---
|
||||||
|
|
||||||
|
# Use Conventional Commits
|
||||||
|
|
||||||
|
## Action
|
||||||
|
Prefix commits with: feat:, fix:, chore:, docs:, test:, refactor:
|
||||||
|
|
||||||
|
## Evidence
|
||||||
|
- Analyzed {n} commits
|
||||||
|
- {percentage}% follow conventional commit format
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example Output
|
||||||
|
|
||||||
|
Running `/skill-create` on a TypeScript project might produce:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
---
|
||||||
|
name: my-app-patterns
|
||||||
|
description: Coding patterns from my-app repository
|
||||||
|
version: 1.0.0
|
||||||
|
source: local-git-analysis
|
||||||
|
analyzed_commits: 150
|
||||||
|
---
|
||||||
|
|
||||||
|
# My App Patterns
|
||||||
|
|
||||||
|
## Commit Conventions
|
||||||
|
|
||||||
|
This project uses **conventional commits**:
|
||||||
|
- `feat:` - New features
|
||||||
|
- `fix:` - Bug fixes
|
||||||
|
- `chore:` - Maintenance tasks
|
||||||
|
- `docs:` - Documentation updates
|
||||||
|
|
||||||
|
## Code Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
├── components/ # React components (PascalCase.tsx)
|
||||||
|
├── hooks/ # Custom hooks (use*.ts)
|
||||||
|
├── utils/ # Utility functions
|
||||||
|
├── types/ # TypeScript type definitions
|
||||||
|
└── services/ # API and external services
|
||||||
|
```
|
||||||
|
|
||||||
|
## Workflows
|
||||||
|
|
||||||
|
### Adding a New Component
|
||||||
|
1. Create `src/components/ComponentName.tsx`
|
||||||
|
2. Add tests in `src/components/__tests__/ComponentName.test.tsx`
|
||||||
|
3. Export from `src/components/index.ts`
|
||||||
|
|
||||||
|
### Database Migration
|
||||||
|
1. Modify `src/db/schema.ts`
|
||||||
|
2. Run `pnpm db:generate`
|
||||||
|
3. Run `pnpm db:migrate`
|
||||||
|
|
||||||
|
## Testing Patterns
|
||||||
|
|
||||||
|
- Test files: `__tests__/` directories or `.test.ts` suffix
|
||||||
|
- Coverage target: 80%+
|
||||||
|
- Framework: Vitest
|
||||||
|
```
|
||||||
|
|
||||||
|
## GitHub App Integration
|
||||||
|
|
||||||
|
For advanced features (10k+ commits, team sharing, auto-PRs), use the [Skill Creator GitHub App](https://github.com/apps/skill-creator):
|
||||||
|
|
||||||
|
- Install: [github.com/apps/skill-creator](https://github.com/apps/skill-creator)
|
||||||
|
- Comment `/skill-creator analyze` on any issue
|
||||||
|
- Receives PR with generated skills
|
||||||
|
|
||||||
|
## Related Commands
|
||||||
|
|
||||||
|
- `/instinct-import` - Import generated instincts
|
||||||
|
- `/instinct-status` - View learned instincts
|
||||||
|
- `/evolve` - Cluster instincts into skills/agents
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*Part of [Everything Claude Code](https://github.com/affaan-m/everything-claude-code)*
|
||||||
Reference in New Issue
Block a user