claude-code-router-config 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,743 @@
1
+ # AgentSkills Setup Guide
2
+
3
+ ## Quick Start
4
+
5
+ This guide provides step-by-step instructions for integrating AgentSkills into your Claude Code Router configuration.
6
+
7
+ ## Prerequisites
8
+
9
+ - Working Claude Code Router installation (see Homebrew setup)
10
+ - Anthropic API key with Claude Sonnet 4 access
11
+ - Node.js 16+ and pnpm installed
12
+ - Basic understanding of JSON and JavaScript configuration
13
+
14
+ ## Step 1: Update Configuration Files
15
+
16
+ ### 1.1 Update config.json
17
+
18
+ Add AgentSkills as a new provider:
19
+
20
+ ```bash
21
+ # Backup current config
22
+ cp ~/.claude-code-router/config.json ~/.claude-code-router/config.json.backup
23
+ ```
24
+
25
+ Edit `~/.claude-code-router/config.json` and add the AgentSkills provider:
26
+
27
+ ```json
28
+ {
29
+ "_comment": "Claude Code Router Configuration with AgentSkills Integration",
30
+ "_attribution": "Original project: https://github.com/musistudio/claude-code-router",
31
+ "_author": "Configuration by Halil Ertekin",
32
+ "LOG": true,
33
+ "LOG_LEVEL": "info",
34
+ "API_TIMEOUT_MS": 300000,
35
+ "CUSTOM_ROUTER_PATH": "$HOME/.claude-code-router/intent-router.js",
36
+
37
+ "Providers": [
38
+ {
39
+ "name": "openai",
40
+ "api_base_url": "https://api.openai.com/v1/chat/completions",
41
+ "api_key": "$OPENAI_API_KEY",
42
+ "models": ["gpt-4o", "gpt-4-turbo", "gpt-4o-mini", "o1", "o1-mini"],
43
+ "transformer": { "use": [] }
44
+ },
45
+ {
46
+ "name": "anthropic",
47
+ "api_base_url": "https://api.anthropic.com/v1/messages",
48
+ "api_key": "$ANTHROPIC_API_KEY",
49
+ "models": ["claude-sonnet-4-latest", "claude-3-5-sonnet-latest"],
50
+ "transformer": { "use": ["Anthropic"] }
51
+ },
52
+ {
53
+ "name": "agentskills",
54
+ "api_base_url": "https://api.anthropic.com/v1/messages",
55
+ "api_key": "$ANTHROPIC_API_KEY",
56
+ "models": ["claude-sonnet-4-latest"],
57
+ "transformer": { "use": ["Anthropic"] },
58
+ "skills_enabled": true,
59
+ "skills_registry": "$HOME/.claude-code-router/skills"
60
+ }
61
+ // ... other providers
62
+ ],
63
+
64
+ "Router": {
65
+ "default": "openai,gpt-4o",
66
+ "background": "qwen,qwen-turbo",
67
+ "think": "anthropic,claude-sonnet-4-latest",
68
+ "longContext": "gemini,gemini-2.5-flash",
69
+ "longContextThreshold": 60000,
70
+ "skills": "agentskills,claude-sonnet-4-latest"
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### 1.2 Create Skills Directory
76
+
77
+ ```bash
78
+ # Create skills directory
79
+ mkdir -p ~/.claude-code-router/skills
80
+
81
+ # Create skill registry file
82
+ cat > ~/.claude-code-router/skills/registry.json << 'EOF'
83
+ {
84
+ "version": "1.0.0",
85
+ "skills": [
86
+ {
87
+ "name": "business-panel",
88
+ "description": "Business analysis with expert frameworks",
89
+ "provider": "agentskills",
90
+ "model": "claude-sonnet-4-latest",
91
+ "enabled": true,
92
+ "priority": "highest"
93
+ },
94
+ {
95
+ "name": "code-review",
96
+ "description": "Comprehensive code quality analysis",
97
+ "provider": "agentskills",
98
+ "model": "claude-sonnet-4-latest",
99
+ "enabled": true,
100
+ "priority": "high"
101
+ }
102
+ ]
103
+ }
104
+ EOF
105
+ ```
106
+
107
+ ## Step 2: Update Intent Router
108
+
109
+ ### 2.1 Create Enhanced Intent Router
110
+
111
+ ```bash
112
+ # Backup current router
113
+ cp ~/.claude-code-router/intent-router.js ~/.claude-code-router/intent-router.js.backup
114
+ ```
115
+
116
+ Create a new enhanced intent router at `~/.claude-code-router/intent-router.js`:
117
+
118
+ ```javascript
119
+ /**
120
+ * Multi-Provider Intent Router with AgentSkills Integration
121
+ * Routes requests based on task type and skill requirements to optimal provider
122
+ *
123
+ * This router is designed for use with @musistudio/claude-code-router
124
+ * Original project: https://github.com/musistudio/claude-code-router
125
+ *
126
+ * Enhanced with AgentSkills support by Halil Ertekin
127
+ */
128
+
129
+ const fs = require('fs');
130
+ const path = require('path');
131
+
132
+ // Load skills registry
133
+ let skillsRegistry = null;
134
+ try {
135
+ const registryPath = path.join(process.env.HOME || process.env.USERPROFILE, '.claude-code-router/skills/registry.json');
136
+ skillsRegistry = JSON.parse(fs.readFileSync(registryPath, 'utf8'));
137
+ } catch (error) {
138
+ console.log('[Router] Skills registry not found, using standard routing');
139
+ }
140
+
141
+ const INTENTS = {
142
+ // AgentSkills routing - highest priority
143
+ AGENT_SKILLS: {
144
+ patterns: [
145
+ /\b\/sc:[\w-]+\b/i, // All SuperClaude commands
146
+ /\b(skill:|capability:|expertise:)\w+/i,
147
+ /\b(agent|assistant) with \w+ skill/i
148
+ ],
149
+ route: "agentskills,claude-sonnet-4-latest",
150
+ priority: 100
151
+ },
152
+
153
+ // Business Panel - specialized expert analysis
154
+ BUSINESS_PANEL: {
155
+ patterns: [
156
+ /\b\/sc:business-panel\b/i,
157
+ /\b(business analysis|strategic planning|market research)\b/i,
158
+ /\b(porter|christensen|drucker|godin|meadows)\b/i
159
+ ],
160
+ route: "agentskills,business-panel",
161
+ priority: 90,
162
+ fallback: "anthropic,claude-sonnet-4-latest"
163
+ },
164
+
165
+ // Code Review - specialized analysis
166
+ CODE_REVIEW: {
167
+ patterns: [
168
+ /\b\/sc:code-review\b/i,
169
+ /\b(review code|code quality|best practices)\b/i,
170
+ /\b(pr review|pull request|code analysis)\b/i
171
+ ],
172
+ route: "agentskills,code-review",
173
+ priority: 85,
174
+ fallback: "openai,gpt-4o"
175
+ },
176
+
177
+ // Original intents with adjusted priorities
178
+ CODING: {
179
+ patterns: [
180
+ /\b(implement|refactor|debug|fix|write|code|function|class|method|bug|error|compile|syntax)\b/i,
181
+ /\b(typescript|javascript|python|rust|go|java|react|vue|angular|swift|kotlin)\b/i,
182
+ /\b(api|endpoint|database|query|migration|schema|test|unit test)\b/i,
183
+ /\b(codex|o1|reasoning)\b/i
184
+ ],
185
+ route: "openai,gpt-4o",
186
+ priority: 80
187
+ },
188
+
189
+ REASONING: {
190
+ patterns: [
191
+ /\b(architect|design|analyze|plan|strategy|structure|system|trade-?off)\b/i,
192
+ /\b(why|explain|reason|understand|compare|evaluate|consider|review)\b/i,
193
+ /\b(decision|approach|best practice|pattern|principle|philosophy)\b/i
194
+ ],
195
+ route: "anthropic,claude-sonnet-4-latest",
196
+ priority: 75
197
+ },
198
+
199
+ // ... other existing intents
200
+ };
201
+
202
+ // Helper function to extract content
203
+ function extractContent(req) {
204
+ const messages = req.body?.messages || [];
205
+ return messages
206
+ .filter(m => m.role === "user" || m.role === "system")
207
+ .map(m => typeof m.content === "string" ? m.content : JSON.stringify(m.content))
208
+ .join(" ")
209
+ .slice(0, 3000);
210
+ }
211
+
212
+ // Enhanced skill detection
213
+ function detectSkills(content) {
214
+ const skills = [];
215
+
216
+ // Check for SuperClaude commands
217
+ const scMatch = content.match(/\/sc:([\w-]+)/i);
218
+ if (scMatch) {
219
+ skills.push({
220
+ type: 'superclaude',
221
+ command: scMatch[1],
222
+ confidence: 0.95
223
+ });
224
+ }
225
+
226
+ // Check for skill keywords
227
+ if (skillsRegistry) {
228
+ skillsRegistry.skills.forEach(skill => {
229
+ if (skill.enabled && content.toLowerCase().includes(skill.name.toLowerCase())) {
230
+ skills.push({
231
+ type: 'skill',
232
+ name: skill.name,
233
+ provider: skill.provider,
234
+ model: skill.model,
235
+ confidence: 0.8
236
+ });
237
+ }
238
+ });
239
+ }
240
+
241
+ return skills.sort((a, b) => b.confidence - a.confidence);
242
+ }
243
+
244
+ // Enhanced intent detection with skill awareness
245
+ function detectIntent(content) {
246
+ const skills = detectSkills(content);
247
+ const scores = {};
248
+
249
+ // Score intents
250
+ for (const [intent, config] of Object.entries(INTENTS)) {
251
+ scores[intent] = {
252
+ score: config.patterns.reduce((score, pattern) => {
253
+ const matches = (content.match(pattern) || []).length;
254
+ return score + matches;
255
+ }, 0),
256
+ priority: config.priority || 0,
257
+ config: config
258
+ };
259
+ }
260
+
261
+ // Factor in skills
262
+ if (skills.length > 0) {
263
+ // Boost AgentSkills intent if skills detected
264
+ if (scores.AGENT_SKILLS) {
265
+ scores.AGENT_SKILLS.score += skills.length * 2;
266
+ }
267
+ }
268
+
269
+ // Sort by score, then priority
270
+ const sorted = Object.entries(scores)
271
+ .filter(([_, data]) => data.score > 0)
272
+ .sort((a, b) => {
273
+ // Primary sort: score
274
+ if (b[1].score !== a[1].score) {
275
+ return b[1].score - a[1].score;
276
+ }
277
+ // Secondary sort: priority
278
+ return b[1].priority - a[1].priority;
279
+ });
280
+
281
+ return sorted.length > 0 ? sorted[0][0] : null;
282
+ }
283
+
284
+ // Main routing function
285
+ module.exports = async function router(req, config) {
286
+ const content = extractContent(req);
287
+ const skills = detectSkills(content);
288
+ const intent = detectIntent(content);
289
+
290
+ // Log detection for debugging
291
+ if (skills.length > 0) {
292
+ console.log(`[Router] Skills detected: ${skills.map(s => s.name || s.type).join(', ')}`);
293
+ }
294
+
295
+ if (intent && INTENTS[intent]) {
296
+ const route = INTENTS[intent].route;
297
+ console.log(`[Router] ${intent} → ${route}`);
298
+
299
+ // Check if route uses AgentSkills
300
+ if (route.includes('agentskills') && skills.length > 0) {
301
+ // Enhance request with skill information
302
+ if (!req.body) req.body = {};
303
+ if (!req.body.metadata) req.body.metadata = {};
304
+ req.body.metadata.skills = skills;
305
+ req.body.metadata.intent = intent;
306
+ }
307
+
308
+ return route;
309
+ }
310
+
311
+ // Fallback
312
+ console.log("[Router] No match → openai,gpt-4o");
313
+ return null;
314
+ };
315
+
316
+ // Export helper functions for testing
317
+ module.exports.detectSkills = detectSkills;
318
+ module.exports.detectIntent = detectIntent;
319
+ module.exports.INTENTS = INTENTS;
320
+ ```
321
+
322
+ ## Step 3: Create Skill Definitions
323
+
324
+ ### 3.1 Business Panel Skill
325
+
326
+ Create `~/.claude-code-router/skills/business-panel/SKILL.md`:
327
+
328
+ ```markdown
329
+ ---
330
+ name: "business-panel"
331
+ description: "Business analysis with expert frameworks (Porter, Christensen, Drucker, Godin, Meadows)"
332
+ version: "1.0.0"
333
+ license: "MIT"
334
+ compatibility: ["claude-sonnet-4-latest"]
335
+ tags: ["business", "strategy", "analysis", "expert-panel"]
336
+ allowed_tools: ["web-search", "context7", "sequential-thinking"]
337
+ metadata:
338
+ expertise_level: "expert"
339
+ response_time: "slow"
340
+ cost_level: "high"
341
+ experts: ["porter", "christensen", "drucker", "godin", "meadows"]
342
+ ---
343
+
344
+ # Business Panel Skill
345
+
346
+ ## Overview
347
+ This skill activates a virtual expert panel for comprehensive business analysis using established frameworks and methodologies.
348
+
349
+ ## Expert Capabilities
350
+
351
+ ### Michael Porter - Competitive Strategy
352
+ - **Five Forces Analysis**: Industry structure assessment
353
+ - **Value Chain Analysis**: Internal capability evaluation
354
+ - **Generic Strategies**: Cost leadership, differentiation, focus
355
+ - **Competitive Advantage**: Sustainable positioning
356
+
357
+ ### Clayton Christensen - Disruption Theory
358
+ - **Jobs-to-be-Done**: Customer need analysis
359
+ - **Disruption Patterns**: Industry transformation identification
360
+ - **Innovation Metrics**: Growth opportunity assessment
361
+ - **Market Entry Strategy**: Disruptive positioning
362
+
363
+ ### Peter Drucker - Management Principles
364
+ - **Management by Objectives**: Goal alignment
365
+ - **Knowledge Worker Productivity**: Team optimization
366
+ - **Innovation and Entrepreneurship**: Growth frameworks
367
+ - **Effective Executive**: Leadership development
368
+
369
+ ### Seth Godin - Marketing & Remarkability
370
+ - **Purple Cow Theory**: Remarkable product development
371
+ - **Permission Marketing**: Customer relationship building
372
+ - **Tribes**: Community creation and management
373
+ - **Storytelling**: Brand narrative crafting
374
+
375
+ ### Donella Meadows - Systems Thinking
376
+ - **Leverage Points**: System intervention identification
377
+ - **Feedback Loops**: Pattern recognition
378
+ - **System Archetypes**: Common dynamics understanding
379
+ - **Sustainability**: Long-term viability analysis
380
+
381
+ ## Usage Patterns
382
+
383
+ ### Trigger Phrases
384
+ - "/sc:business-panel"
385
+ - "business analysis"
386
+ - "strategic planning"
387
+ - "market research"
388
+ - "competitive analysis"
389
+ - "expert panel"
390
+
391
+ ### Analysis Types
392
+
393
+ 1. **Comprehensive Strategic Analysis**
394
+ - Input: Business plan, market data, competitive landscape
395
+ - Process: Multi-expert framework application
396
+ - Output: Integrated strategic recommendations
397
+
398
+ 2. **Market Entry Strategy**
399
+ - Input: Target market, product/service, resources
400
+ - Process: Disruption + competitive analysis
401
+ - Output: Go-to-market strategy with timing and positioning
402
+
403
+ 3. **Organizational Design**
404
+ - Input: Current structure, goals, constraints
405
+ - Process: Systems thinking + management principles
406
+ - Output: Optimized organizational design
407
+
408
+ ## Implementation Notes
409
+
410
+ ### Best Practices
411
+ - Use for complex, multi-faceted business challenges
412
+ - Combine multiple expert perspectives for comprehensive analysis
413
+ - Apply systems thinking for organizational and market problems
414
+ - Focus on actionable insights rather than theoretical frameworks
415
+
416
+ ### Limitations
417
+ - Requires substantial context for meaningful analysis
418
+ - Best with Claude Sonnet 4 for optimal reasoning
419
+ - Higher token usage due to comprehensive analysis
420
+ - Response time may be longer due to complexity
421
+
422
+ ## Quality Indicators
423
+ - Clear framework identification and application
424
+ - Integration of multiple expert perspectives
425
+ - Actionable, specific recommendations
426
+ - Recognition of system interdependencies
427
+ - Balanced consideration of short-term and long-term factors
428
+ ```
429
+
430
+ ### 3.2 Code Review Skill
431
+
432
+ Create `~/.claude-code-router/skills/code-review/SKILL.md`:
433
+
434
+ ```markdown
435
+ ---
436
+ name: "code-review"
437
+ description: "Comprehensive code quality analysis with security, performance, and maintainability focus"
438
+ version: "1.0.0"
439
+ license: "MIT"
440
+ compatibility: ["claude-sonnet-4-latest", "claude-3-5-sonnet-latest"]
441
+ tags: ["code", "review", "quality", "security", "performance"]
442
+ allowed_tools: ["context7", "sequential-thinking", "lsp"]
443
+ metadata:
444
+ expertise_level: "senior-developer"
445
+ response_time: "medium"
446
+ cost_level: "medium"
447
+ focus_areas: ["security", "performance", "maintainability", "patterns"]
448
+ ---
449
+
450
+ # Code Review Skill
451
+
452
+ ## Overview
453
+ This skill provides comprehensive code analysis covering security vulnerabilities, performance optimization opportunities, maintainability issues, and adherence to best practices.
454
+
455
+ ## Review Dimensions
456
+
457
+ ### Security Analysis
458
+ - **Vulnerability Detection**: SQL injection, XSS, CSRF, authentication flaws
459
+ - **Data Protection**: Sensitive data handling, encryption, access controls
460
+ - **Input Validation**: Sanitization, bounds checking, type safety
461
+ - **Dependency Security**: Known vulnerabilities, license compliance
462
+
463
+ ### Performance Optimization
464
+ - **Algorithm Efficiency**: Time/space complexity analysis
465
+ - **Resource Usage**: Memory, CPU, I/O optimization
466
+ - **Caching Strategies**: Implementation opportunities
467
+ - **Database Optimization**: Query efficiency, indexing, connection pooling
468
+
469
+ ### Code Quality & Maintainability
470
+ - **Design Patterns**: Appropriate pattern usage and anti-patterns
471
+ - **Code Organization**: Modularity, coupling, cohesion
472
+ - **Documentation**: Code comments, API documentation
473
+ - **Testing**: Test coverage, test quality, edge cases
474
+
475
+ ### Best Practices
476
+ - **Language-Specific**: Idiomatic code usage per language
477
+ - **Framework Guidelines**: Framework-specific conventions
478
+ - **Error Handling**: Exception management, graceful degradation
479
+ - **Logging**: Appropriate logging levels and information
480
+
481
+ ## Usage Patterns
482
+
483
+ ### Trigger Phrases
484
+ - "/sc:code-review"
485
+ - "review my code"
486
+ - "code quality check"
487
+ - "security review"
488
+ - "performance analysis"
489
+ - "best practices review"
490
+
491
+ ### Review Types
492
+
493
+ 1. **Security-Focused Review**
494
+ - Priority: Critical vulnerabilities first
495
+ - Scope: Authentication, authorization, data protection
496
+ - Output: Security issues with severity ratings and fixes
497
+
498
+ 2. **Performance Review**
499
+ - Priority: Bottlenecks and optimization opportunities
500
+ - Scope: Algorithm efficiency, resource usage
501
+ - Output: Performance issues with optimization suggestions
502
+
503
+ 3. **Comprehensive Review**
504
+ - All dimensions with equal priority
505
+ - Holistic code quality assessment
506
+ - Detailed improvement roadmap
507
+
508
+ ## Review Process
509
+
510
+ ### Analysis Steps
511
+ 1. **Code Structure Understanding**: Parse and understand architecture
512
+ 2. **Pattern Recognition**: Identify design patterns and anti-patterns
513
+ 3. **Issue Detection**: Find security, performance, and quality issues
514
+ 4. **Impact Assessment**: Rate severity and priority of issues
515
+ 5. **Recommendation Generation**: Provide actionable improvement suggestions
516
+
517
+ ### Output Format
518
+ ```
519
+ ## Code Review Summary
520
+
521
+ ### 🔴 Critical Issues
522
+ [High-priority security or functionality issues]
523
+
524
+ ### 🟡 Important Improvements
525
+ [Performance optimizations, security enhancements]
526
+
527
+ ### 🟢 Suggestions
528
+ [Code quality, maintainability improvements]
529
+
530
+ ### 📊 Metrics
531
+ - Security Score: X/10
532
+ - Performance Score: X/10
533
+ - Maintainability Score: X/10
534
+ ```
535
+
536
+ ## Implementation Notes
537
+
538
+ ### Supported Languages
539
+ - JavaScript/TypeScript
540
+ - Python
541
+ - Java
542
+ - Go
543
+ - Rust
544
+ - C#
545
+ - Ruby
546
+
547
+ ### Integration Points
548
+ - GitHub/GitLab PR reviews
549
+ - CI/CD pipeline integration
550
+ - IDE plugins
551
+ - Code quality dashboards
552
+
553
+ ### Quality Metrics
554
+ - Lines of code analyzed
555
+ - Issues found by category
556
+ - False positive rate
557
+ - Review completion time
558
+
559
+ ## Limitations
560
+ - Cannot replace human code review entirely
561
+ - May miss business logic issues
562
+ - Context-dependent bugs may be overlooked
563
+ - Requires sufficient code context for accurate analysis
564
+ ```
565
+
566
+ ## Step 4: Update Environment Variables
567
+
568
+ Add to your `~/.env` file:
569
+
570
+ ```bash
571
+ # AgentSkills Configuration
572
+ export AGENTSKILLS_ENABLED="true"
573
+ export AGENTSKILLS_REGISTRY_PATH="$HOME/.claude-code-router/skills"
574
+ export AGENTSKILLS_LOG_LEVEL="info"
575
+ export AGENTSKILLS_CACHE_TTL="3600"
576
+
577
+ # Skill-Specific Configuration
578
+ export AGENTSKILLS_BUSINESS_PANEL_ENABLED="true"
579
+ export AGENTSKILLS_CODE_REVIEW_ENABLED="true"
580
+ export AGENTSKILLS_MAX_SKILLS_PER_REQUEST="3"
581
+ ```
582
+
583
+ Reload your shell:
584
+ ```bash
585
+ source ~/.zshrc
586
+ ```
587
+
588
+ ## Step 5: Test the Integration
589
+
590
+ ### 5.1 Test Skill Detection
591
+
592
+ ```bash
593
+ # Test SuperClaude command detection
594
+ echo "Testing skill detection..."
595
+ node -e "
596
+ const router = require('$HOME/.claude-code-router/intent-router.js');
597
+ const mockReq = {
598
+ body: {
599
+ messages: [{ role: 'user', content: '/sc:business-panel analyze our competitive position' }]
600
+ }
601
+ };
602
+ router(mockReq, {}).then(route => console.log('Route:', route));
603
+ "
604
+ ```
605
+
606
+ ### 5.2 Test Business Panel Skill
607
+
608
+ ```bash
609
+ # Start the router
610
+ ccr code
611
+
612
+ # In another terminal, test with curl
613
+ curl -X POST http://localhost:3456/v1/chat/completions \
614
+ -H "Content-Type: application/json" \
615
+ -d '{
616
+ "messages": [
617
+ {"role": "user", "content": "/sc:business-panel Analyze the competitive landscape for electric vehicle startups"}
618
+ ],
619
+ "model": "claude-sonnet-4-latest"
620
+ }'
621
+ ```
622
+
623
+ ### 5.3 Test Code Review Skill
624
+
625
+ ```bash
626
+ # Test code review functionality
627
+ curl -X POST http://localhost:3456/v1/chat/completions \
628
+ -H "Content-Type: application/json" \
629
+ -d '{
630
+ "messages": [
631
+ {"role": "user", "content": "/sc:code-review Review this Python code for security issues:\n\n```python\ndef login(username, password):\n query = \"SELECT * FROM users WHERE username = '\" + username + \"' AND password = '\" + password + \"'\"\n return db.execute(query)\n```"}
632
+ ],
633
+ "model": "claude-sonnet-4-latest"
634
+ }'
635
+ ```
636
+
637
+ ## Step 6: Monitor and Optimize
638
+
639
+ ### 6.1 Enable Logging
640
+
641
+ Add to your `~/.claude-code-router/config.json`:
642
+
643
+ ```json
644
+ {
645
+ "LOG": true,
646
+ "LOG_LEVEL": "debug",
647
+ "AGENTSKILLS_LOG_REQUESTS": true,
648
+ "AGENTSKILLS_LOG_ROUTING_DECISIONS": true
649
+ }
650
+ ```
651
+
652
+ ### 6.2 Monitor Performance
653
+
654
+ Create a monitoring script at `~/.claude-code-router/monitor.js`:
655
+
656
+ ```javascript
657
+ const fs = require('fs');
658
+
659
+ // Log routing decisions
660
+ setInterval(() => {
661
+ const logs = fs.readFileSync('/tmp/claude-router.log', 'utf8');
662
+ const agentSkillsRequests = logs.match(/\[Router\].*agentskills/g) || [];
663
+
664
+ console.log(`AgentSkills requests in last minute: ${agentSkillsRequests.length}`);
665
+
666
+ // Parse skill usage
667
+ const skillUsage = {};
668
+ agentSkillsRequests.forEach(log => {
669
+ const skillMatch = log.match(/Skill route: (\w+)/);
670
+ if (skillMatch) {
671
+ skillUsage[skillMatch[1]] = (skillUsage[skillMatch[1]] || 0) + 1;
672
+ }
673
+ });
674
+
675
+ console.log('Skill usage:', skillUsage);
676
+ }, 60000);
677
+ ```
678
+
679
+ ## Troubleshooting
680
+
681
+ ### Common Issues
682
+
683
+ 1. **Skills not loading**
684
+ ```bash
685
+ # Check skills directory
686
+ ls -la ~/.claude-code-router/skills/
687
+
688
+ # Verify registry file
689
+ cat ~/.claude-code-router/skills/registry.json
690
+ ```
691
+
692
+ 2. **Router not using AgentSkills**
693
+ ```bash
694
+ # Check intent router syntax
695
+ node -c ~/.claude-code-router/intent-router.js
696
+
697
+ # Test routing manually
698
+ node -e "console.log(require('./intent-router.js').detectIntent('/sc:business-panel test'))"
699
+ ```
700
+
701
+ 3. **Skill files not found**
702
+ ```bash
703
+ # Verify skill structure
704
+ find ~/.claude-code-router/skills -name "SKILL.md"
705
+
706
+ # Check skill file format
707
+ cat ~/.claude-code-router/skills/business-panel/SKILL.md | head -20
708
+ ```
709
+
710
+ ### Debug Mode
711
+
712
+ Enable debug logging:
713
+
714
+ ```bash
715
+ # Set debug environment
716
+ export AGENTSKILLS_DEBUG=true
717
+ export AGENTSKILLS_LOG_LEVEL=debug
718
+
719
+ # Restart router with verbose output
720
+ ccr code --verbose
721
+ ```
722
+
723
+ ## Next Steps
724
+
725
+ 1. **Add Custom Skills**: Create domain-specific skills for your use cases
726
+ 2. **Integrate with CI/CD**: Add automated code reviews to your pipeline
727
+ 3. **Build Skill Marketplace**: Share skills with your team
728
+ 4. **Monitor Usage**: Track which skills provide most value
729
+ 5. **Optimize Performance**: Fine-tune routing based on usage patterns
730
+
731
+ ## Support
732
+
733
+ - **Main Repository**: https://github.com/halilertekin/CC-RouterMultiProvider
734
+ - **AgentSkills**: https://github.com/agentskills/agentskills
735
+ - **Issues**: Report via GitHub issues
736
+ - **Documentation**: See `/docs` directory for more guides
737
+
738
+ ## Attribution
739
+
740
+ This setup guide is for the [claude-code-router-config](https://github.com/halilertekin/CC-RouterMultiProvider) project.
741
+ Original project: https://github.com/musistudio/claude-code-router
742
+ AgentSkills: https://github.com/agentskills/agentskills
743
+ Guide by Halil Ertekin