claude-code-router-config 1.0.0 → 1.1.0

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,500 @@
1
+ # AgentSkills Integration Guide
2
+
3
+ ## Overview
4
+
5
+ [AgentSkills](https://github.com/agentskills/agentskills) is an open format for giving AI agents new capabilities and expertise. This document outlines how to integrate AgentSkills into the Claude Code Router configuration to create an intelligent, skill-aware routing system.
6
+
7
+ ## What is AgentSkills?
8
+
9
+ AgentSkills provides:
10
+ - **Standardized skill format**: YAML frontmatter + markdown for skill definition
11
+ - **Dynamic skill loading**: Discover and load skills at runtime
12
+ - **Skill distribution**: Share specialized capabilities across different agents
13
+ - **Interoperability**: Works with multiple AI providers and systems
14
+
15
+ ## Integration Architecture
16
+
17
+ ### Current vs Enhanced Routing
18
+
19
+ **Current System:**
20
+ ```
21
+ User Request → Intent Detection → Provider Selection → API Call
22
+ ```
23
+
24
+ **Enhanced with AgentSkills:**
25
+ ```
26
+ User Request → Intent/Skill Detection → Skill-Provider Matching → Enhanced API Call
27
+ ```
28
+
29
+ ### Key Components
30
+
31
+ 1. **Skill Registry**: Database of available skills and their provider compatibility
32
+ 2. **Skill Detection**: Analyze requests for skill requirements
33
+ 3. **Provider-Skill Mapping**: Match skills to optimal providers
34
+ 4. **Hybrid Routing**: Combine intent-based and skill-based routing
35
+
36
+ ## Implementation Strategy
37
+
38
+ ### Phase 1: Foundation Setup
39
+
40
+ 1. **Add AgentSkills Provider Configuration**
41
+ - Extend `config.json` with AgentSkills provider
42
+ - Define skill compatibility matrix
43
+ - Set up skill-specific endpoints
44
+
45
+ 2. **Create Skill Registry**
46
+ - Initialize skill metadata storage
47
+ - Define skill categories and types
48
+ - Create skill-provider mapping database
49
+
50
+ ### Phase 2: Skill Detection
51
+
52
+ 1. **Request Analysis**
53
+ - Extract skill requirements from user input
54
+ - Identify SuperClaude commands and their skill needs
55
+ - Parse skill-specific keywords and patterns
56
+
57
+ 2. **Skill Matching Algorithm**
58
+ - Score providers based on skill compatibility
59
+ - Consider provider strengths and specializations
60
+ - Handle skill combinations and conflicts
61
+
62
+ ### Phase 3: Enhanced Routing
63
+
64
+ 1. **Hybrid Decision Engine**
65
+ - Combine intent-based routing with skill matching
66
+ - Priority system for specialized skills
67
+ - Fallback to standard routing when skills unavailable
68
+
69
+ 2. **Dynamic Skill Loading**
70
+ - Load skills on-demand from registry
71
+ - Cache frequently used skills
72
+ - Update skill definitions periodically
73
+
74
+ ## Configuration Examples
75
+
76
+ ### Provider Configuration with AgentSkills
77
+
78
+ ```json
79
+ {
80
+ "name": "agentskills",
81
+ "api_base_url": "https://api.anthropic.com/v1/messages",
82
+ "api_key": "$ANTHROPIC_API_KEY",
83
+ "models": ["claude-sonnet-4-latest"],
84
+ "transformer": { "use": ["Anthropic"] },
85
+ "skills": [
86
+ {
87
+ "name": "business-analysis",
88
+ "description": "Strategic business analysis and planning",
89
+ "compatibility": ["claude-sonnet-4-latest"],
90
+ "priority": "high",
91
+ "patterns": [
92
+ "/sc:business-panel",
93
+ "strategic analysis",
94
+ "market research",
95
+ "competitive analysis"
96
+ ],
97
+ "experts": ["porter", "christensen", "drucker", "meadows"]
98
+ },
99
+ {
100
+ "name": "code-review",
101
+ "description": "Comprehensive code quality analysis",
102
+ "compatibility": ["claude-sonnet-4-latest", "claude-3-5-sonnet-latest"],
103
+ "priority": "medium",
104
+ "patterns": [
105
+ "/sc:code-review",
106
+ "review code",
107
+ "code quality",
108
+ "best practices"
109
+ ],
110
+ "focus": ["security", "performance", "maintainability", "patterns"]
111
+ },
112
+ {
113
+ "name": "system-architecture",
114
+ "description": "System design and architecture planning",
115
+ "compatibility": ["claude-sonnet-4-latest"],
116
+ "priority": "high",
117
+ "patterns": [
118
+ "architecture",
119
+ "system design",
120
+ "scalability",
121
+ "microservices"
122
+ ],
123
+ "considerations": ["scalability", "maintainability", "security", "performance"]
124
+ }
125
+ ]
126
+ }
127
+ ```
128
+
129
+ ### Enhanced Intent Router
130
+
131
+ ```javascript
132
+ /**
133
+ * Enhanced Intent Router with AgentSkills Integration
134
+ */
135
+
136
+ const INTENTS = {
137
+ // Existing intents...
138
+ CODING: { /* ... */ },
139
+ REASONING: { /* ... */ },
140
+
141
+ // AgentSkills-specific intents
142
+ AGENT_SKILLS: {
143
+ patterns: [
144
+ /\b\/sc:[\w-]+\b/i, // SuperClaude commands
145
+ /\b(skill:|capability:|expertise:)\w+/i,
146
+ /\b(agent|assistant) with \w+ skill/i
147
+ ],
148
+ route: "agentskills,claude-sonnet-4-latest",
149
+ priority: "high",
150
+ fallback: "anthropic,claude-sonnet-4-latest"
151
+ },
152
+
153
+ BUSINESS_PANEL: {
154
+ patterns: [
155
+ /\b\/sc:business-panel\b/i,
156
+ /\b(business analysis|strategic planning|market research)\b/i,
157
+ /\b(porter|christensen|drucker|godin|meadows)\b/i
158
+ ],
159
+ route: "agentskills,business-analysis",
160
+ priority: "highest",
161
+ fallback: "anthropic,claude-sonnet-4-latest"
162
+ },
163
+
164
+ CODE_REVIEW: {
165
+ patterns: [
166
+ /\b\/sc:code-review\b/i,
167
+ /\b(review code|code quality|best practices)\b/i,
168
+ /\b(refactor|optimize|improve) code/i
169
+ ],
170
+ route: "agentskills,code-review",
171
+ priority: "high",
172
+ fallback: "openai,gpt-4o"
173
+ }
174
+ };
175
+
176
+ // Skill-based routing function
177
+ function routeWithSkills(req, config) {
178
+ const content = extractContent(req);
179
+ const detectedSkills = detectRequiredSkills(content);
180
+ const intent = detectIntent(content);
181
+
182
+ // Priority 1: Direct skill matches
183
+ if (detectedSkills.length > 0) {
184
+ const bestSkill = selectBestSkill(detectedSkills, config.skills);
185
+ if (bestSkill) {
186
+ console.log(`[Router] Skill route: ${bestSkill.name} → ${bestSkill.route}`);
187
+ return bestSkill.route;
188
+ }
189
+ }
190
+
191
+ // Priority 2: Intent-based routing
192
+ if (intent && INTENTS[intent]) {
193
+ const route = INTENTS[intent].route;
194
+ console.log(`[Router] Intent route: ${intent} → ${route}`);
195
+ return route;
196
+ }
197
+
198
+ // Priority 3: Default fallback
199
+ console.log("[Router] Fallback → openai,gpt-4o");
200
+ return null;
201
+ }
202
+
203
+ // Skill detection algorithm
204
+ function detectRequiredSkills(content) {
205
+ const skills = [];
206
+
207
+ // Check for SuperClaude commands
208
+ const scMatch = content.match(/\/sc:([\w-]+)/i);
209
+ if (scMatch) {
210
+ skills.push({
211
+ type: 'superclaude',
212
+ command: scMatch[1],
213
+ confidence: 0.9
214
+ });
215
+ }
216
+
217
+ // Check for domain-specific keywords
218
+ const domainPatterns = {
219
+ 'business': /\b(business|strategy|market|competitive|analysis)\b/i,
220
+ 'security': /\b(security|vulnerability|exploit|penetration)\b/i,
221
+ 'performance': /\b(performance|optimization|speed|latency)\b/i,
222
+ 'architecture': /\b(architecture|design|system|scalability)\b/i
223
+ };
224
+
225
+ for (const [domain, pattern] of Object.entries(domainPatterns)) {
226
+ if (pattern.test(content)) {
227
+ skills.push({
228
+ type: 'domain',
229
+ domain: domain,
230
+ confidence: 0.7
231
+ });
232
+ }
233
+ }
234
+
235
+ return skills.sort((a, b) => b.confidence - a.confidence);
236
+ }
237
+ ```
238
+
239
+ ### Environment Configuration
240
+
241
+ ```bash
242
+ # AgentSkills Configuration
243
+ export AGENTSKILLS_API_KEY="your_anthropic_api_key"
244
+ export AGENTSKILLS_BASE_URL="https://api.anthropic.com/v1/messages"
245
+ export AGENTSKILLS_MODEL="claude-sonnet-4-latest"
246
+
247
+ # Skill Registry Configuration
248
+ export AGENTSKILLS_REGISTRY_PATH="$HOME/.claude-code-router/skills"
249
+ export AGENTSKILLS_REGISTRY_URL="https://registry.anthropic.com/skills"
250
+ export AGENTSKILLS_CACHE_TTL="3600"
251
+ export AGENTSKILLS_UPDATE_INTERVAL="86400"
252
+
253
+ # Skill Routing Configuration
254
+ export AGENTSKILLS_ROUTING_ENABLED="true"
255
+ export AGENTSKILLS_FALLBACK_ENABLED="true"
256
+ export AGENTSKILLS_LOG_LEVEL="info"
257
+ export AGENTSKILLS_METRICS_ENABLED="true"
258
+ ```
259
+
260
+ ## Skill Definition Format
261
+
262
+ ### Skill Structure
263
+
264
+ ```
265
+ skill-name/
266
+ ├── SKILL.md # Required: Skill definition
267
+ ├── scripts/ # Optional: Helper scripts
268
+ │ ├── validate.js # Validation logic
269
+ │ └── transform.js # Data transformation
270
+ ├── references/ # Optional: Reference materials
271
+ │ ├── guide.md # Usage guide
272
+ │ └── examples.md # Examples
273
+ └── assets/ # Optional: Images, diagrams
274
+ └── workflow.png # Visual workflow
275
+ ```
276
+
277
+ ### Skill Definition Example
278
+
279
+ ```markdown
280
+ ---
281
+ name: "business-analysis"
282
+ description: "Strategic business analysis and competitive intelligence"
283
+ version: "1.0.0"
284
+ license: "MIT"
285
+ compatibility: ["claude-sonnet-4-latest"]
286
+ tags: ["business", "strategy", "analysis"]
287
+ allowed_tools: ["web-search", "context7", "sequential-thinking"]
288
+ metadata:
289
+ expertise_level: "expert"
290
+ response_time: "slow"
291
+ cost_level: "high"
292
+ ---
293
+
294
+ # Business Analysis Skill
295
+
296
+ ## Overview
297
+ This skill provides comprehensive business analysis capabilities including:
298
+ - Competitive analysis using Porter's Five Forces
299
+ - Disruption analysis using Christensen's framework
300
+ - Systems thinking using Meadows' approach
301
+ - Strategic planning and market research
302
+
303
+ ## Usage Patterns
304
+
305
+ ### Trigger Phrases
306
+ - "business analysis"
307
+ - "competitive strategy"
308
+ - "market research"
309
+ - "strategic planning"
310
+ - "/sc:business-panel"
311
+
312
+ ### Expert Frameworks
313
+ - **Porter**: Industry analysis, competitive positioning
314
+ - **Christensen**: Disruption analysis, jobs-to-be-done
315
+ - **Drucker**: Management principles, organizational effectiveness
316
+ - **Meadows**: Systems thinking, leverage points
317
+ - **Godin**: Marketing, remarkable products
318
+
319
+ ## Configuration
320
+ ```json
321
+ {
322
+ "experts": ["porter", "christensen", "drucker", "meadows", "godin"],
323
+ "analysis_depth": "comprehensive",
324
+ "time_horizon": "strategic",
325
+ "focus_areas": ["competition", "innovation", "systems"]
326
+ }
327
+ ```
328
+
329
+ ## Implementation Notes
330
+ - Requires strong analytical capabilities
331
+ - Benefits from large context windows
332
+ - Works best with Claude Sonnet 4 or higher
333
+ ```
334
+
335
+ ## Integration Benefits
336
+
337
+ ### Enhanced Capabilities
338
+
339
+ 1. **Specialized Expertise**
340
+ - Domain-specific knowledge routing
341
+ - Expert framework integration
342
+ - Specialized tool usage
343
+
344
+ 2. **Improved Accuracy**
345
+ - Right model for right task
346
+ - Reduced hallucinations in specialized domains
347
+ - Context-aware responses
348
+
349
+ 3. **Better User Experience**
350
+ - Transparent skill usage
351
+ - Consistent expert voices
352
+ - Predictable response quality
353
+
354
+ ### Operational Benefits
355
+
356
+ 1. **Performance Optimization**
357
+ - Efficient resource utilization
358
+ - Reduced unnecessary API calls
359
+ - Optimized routing decisions
360
+
361
+ 2. **Cost Management**
362
+ - Route to cost-effective providers
363
+ - Avoid over-provisioning for simple tasks
364
+ - Track skill-specific costs
365
+
366
+ 3. **Scalability**
367
+ - Add new skills without code changes
368
+ - Community skill contributions
369
+ - Dynamic skill loading
370
+
371
+ ## Migration Guide
372
+
373
+ ### From Current Setup
374
+
375
+ 1. **Backup Configuration**
376
+ ```bash
377
+ cp ~/.claude-code-router/config.json ~/.claude-code-router/config.json.backup
378
+ cp ~/.claude-code-router/intent-router.js ~/.claude-code-router/intent-router.js.backup
379
+ ```
380
+
381
+ 2. **Add AgentSkills Provider**
382
+ - Extend `config.json` with AgentSkills configuration
383
+ - Add skill compatibility matrix
384
+ - Update provider priorities
385
+
386
+ 3. **Update Intent Router**
387
+ - Add skill detection logic
388
+ - Implement hybrid routing
389
+ - Add fallback mechanisms
390
+
391
+ 4. **Test Integration**
392
+ - Verify skill detection works
393
+ - Test routing decisions
394
+ - Monitor performance
395
+
396
+ ### Testing Procedure
397
+
398
+ 1. **Unit Tests**
399
+ ```bash
400
+ # Test skill detection
401
+ node -e "
402
+ const { detectRequiredSkills } = require('./intent-router.js');
403
+ console.log(detectRequiredSkills('/sc:business-panel analyze market'));
404
+ "
405
+ ```
406
+
407
+ 2. **Integration Tests**
408
+ ```bash
409
+ # Test full routing
410
+ ccr test --request "analyze competitive landscape"
411
+ ```
412
+
413
+ 3. **Performance Tests**
414
+ ```bash
415
+ # Benchmark routing decisions
416
+ time ccr test --request "business strategy analysis"
417
+ ```
418
+
419
+ ## Monitoring and Analytics
420
+
421
+ ### Metrics to Track
422
+
423
+ 1. **Skill Usage**
424
+ - Most requested skills
425
+ - Skill success rates
426
+ - User satisfaction scores
427
+
428
+ 2. **Routing Performance**
429
+ - Decision latency
430
+ - Routing accuracy
431
+ - Fallback frequency
432
+
433
+ 3. **Cost Analysis**
434
+ - Skill-specific costs
435
+ - Provider utilization
436
+ - ROI by skill type
437
+
438
+ ### Logging Configuration
439
+
440
+ ```javascript
441
+ // Enable detailed logging
442
+ const LOG_CONFIG = {
443
+ skill_detection: true,
444
+ routing_decisions: true,
445
+ performance_metrics: true,
446
+ error_tracking: true
447
+ };
448
+ ```
449
+
450
+ ## Future Enhancements
451
+
452
+ ### Planned Features
453
+
454
+ 1. **Skill Marketplace**
455
+ - Community skill sharing
456
+ - Skill rating system
457
+ - Automated skill discovery
458
+
459
+ 2. **Advanced Routing**
460
+ - Machine learning-based routing
461
+ - User preference learning
462
+ - Context-aware routing
463
+
464
+ 3. **Performance Optimization**
465
+ - Skill pre-loading
466
+ - Intelligent caching
467
+ - Parallel processing
468
+
469
+ ### Roadmap
470
+
471
+ - **Q1 2025**: Basic skill detection and routing
472
+ - **Q2 2025**: Advanced skill registry and marketplace
473
+ - **Q3 2025**: ML-based routing optimization
474
+ - **Q4 2025**: Full skill ecosystem integration
475
+
476
+ ## Security Considerations
477
+
478
+ ### Skill Validation
479
+
480
+ 1. **Code Review**
481
+ - Validate all skill code
482
+ - Check for malicious patterns
483
+ - Verify API usage
484
+
485
+ 2. **Sandboxing**
486
+ - Isolate skill execution
487
+ - Limit system access
488
+ - Monitor resource usage
489
+
490
+ 3. **Access Control**
491
+ - User permissions for skills
492
+ - Skill usage quotas
493
+ - Audit logging
494
+
495
+ ## Attribution
496
+
497
+ This integration guide is for the [claude-code-router-config](https://github.com/halilertekin/CC-RouterMultiProvider) project.
498
+ Original project: https://github.com/musistudio/claude-code-router
499
+ AgentSkills: https://github.com/agentskills/agentskills
500
+ Configuration by Halil Ertekin