Best use case
cfn-provider-routing is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Teams using cfn-provider-routing should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/provider/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cfn-provider-routing Compares
| Feature / Agent | cfn-provider-routing | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
This skill provides specific capabilities for your AI agent. See the About section for full details.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# CFN Provider Routing - Cross-Provider Model Compatibility **Status:** Production Ready | **Category:** Provider Integration | **Complexity:** Low ## Overview Translates agent-specified models (sonnet/haiku/opus) to provider-specific model names. Enables seamless cross-provider compatibility without modifying agent profiles. ## Core Function **Primary Use Case:** Agent spawning with provider-specific model resolution **Secondary Use Case:** Cost optimization through tier-based model selection **Validation:** Model mapping completeness and provider support verification ## Usage Patterns ### Direct Model Resolution ```bash # Basic usage - resolve sonnet for Z.ai ./resolve-provider-model.ts --provider zai --model sonnet # Returns: glm-4.6 # With cost optimization ./resolve-provider-model.ts --provider kimi --model haiku --tier economy # Returns: kimi-k2-turbo-preview ``` ### Integration with Agent Spawning ```bash # In agent spawning scripts AGENT_MODEL="sonnet" PROVIDER="zai" RESOLVED_MODEL=$(./resolve-provider-model.ts --provider "$PROVIDER" --model "$AGENT_MODEL") export ANTHROPIC_MODEL="$RESOLVED_MODEL" ``` ### Configuration Validation ```bash # Check provider support ./resolve-provider-model.ts --summary # Returns JSON with supported providers and models ``` ## Parameters ### Required Parameters - `--provider <provider>`: Target provider (zai, kimi, openrouter, gemini, xai, anthropic) ### Optional Parameters - `--model <agent-model>`: Agent-specified model (sonnet, haiku, opus) - `--tier <cost-tier>`: Cost optimization tier (economy, standard, premium) - `--summary`: Show configuration summary ## Return Values ### Success - **Model resolution**: Returns provider-specific model name as string - **Configuration summary**: Returns JSON with provider/model mappings ### Error Conditions - **Provider not supported**: Returns error with supported providers list - **Configuration missing**: Falls back to basic mappings with warning - **Invalid parameters**: Returns usage information ## Integration Points ### Agent Spawning Pipeline ``` Agent Profile (model: sonnet) → Provider Router → Z.ai (glm-4.6) ``` ### CLI Mode Provider Selection ``` /cfn-loop-cli "task" --provider zai → Router → Agent with glm-4.6 ``` ### Cost Optimization ``` --tier economy → Router → Fast models for simple tasks --tier premium → Router → High-quality models for complex tasks ``` ## Examples ### Basic Provider Routing ```bash # Spawn backend-developer with Z.ai AGENT_TYPE="backend-developer" # Has model: sonnet PROVIDER="zai" MODEL=$(./resolve-provider-model.ts --provider "$PROVIDER" --model sonnet) # MODEL="glm-4.6" ``` ### Cross-Provider Compatibility ```bash # Same agent, different providers ./resolve-provider-model.ts --provider zai --model sonnet # glm-4.6 ./resolve-provider-model.ts --provider kimi --model sonnet # kimi-k2-turbo-preview ./resolve-provider-model.ts --provider openrouter --model sonnet # anthropic/claude-sonnet-4.5 ``` ### Cost-Optimized Execution ```bash # Economy mode for bulk operations ECONOMY_MODEL=$(./resolve-provider-model.ts --provider kimi --model haiku --tier economy) # Returns: kimi-k2-turbo-preview (fast, cost-effective) # Premium mode for critical tasks PREMIUM_MODEL=$(./resolve-provider-model.ts --provider openrouter --model sonnet --tier premium) # Returns: anthropic/claude-sonnet-4.5 (high quality) ``` ## Dependencies ### External Dependencies - **Node.js**: Runtime environment - **js-yaml**: YAML configuration parsing (bundled) ### Configuration Dependencies - **provider-model-mappings.yaml**: Model mapping configuration - **No Redis required**: Pure configuration resolution ## Anti-Patterns ### ❌ Manual Model Hardcoding ```bash # AVOID: Hardcoded provider-specific models if [[ "$PROVIDER" == "zai" ]]; then export ANTHROPIC_MODEL="glm-4.6" fi ``` ### ❌ Agent Profile Modification ```yaml # AVOID: Updating 65+ agent files for new provider <!-- PROVIDER_PARAMETERS provider: zai model: glm-4.6 # Wrong approach - maintenance nightmare --> ``` ### ✅ Centralized Mapping ```bash # CORRECT: Use centralized resolver MODEL=$(./resolve-provider-model.ts --provider "$PROVIDER" --model "$AGENT_MODEL") export ANTHROPIC_MODEL="$MODEL" ``` ## Performance Characteristics - **Resolution latency**: <1ms per lookup - **Memory footprint**: <1MB configuration object - **Startup time**: <10ms YAML file load - **Scalability**: O(1) lookup time, unlimited concurrent requests ## Monitoring & Troubleshooting ### Configuration Validation ```bash # Check if all providers are supported ./resolve-provider-model.ts --summary ``` ### Model Resolution Testing ```bash # Test all agent models for a provider for model in sonnet haiku opus; do echo "$model → $(./resolve-provider-model.ts --provider zai --model "$model")" done ``` ### Common Issues - **Provider not found**: Check provider name spelling in configuration - **Model resolution fails**: Verify agent model exists in mappings - **Configuration missing**: Fallback to basic mappings automatically ## Evolution Path ### Phase 1: Current Implementation - Basic model mapping resolution - Configuration file-based approach - CLI integration for agent spawning ### Phase 2: Enhanced Features - Dynamic model capability detection - Provider-specific optimization hints - Integration with cost tracking ### Phase 3: Advanced Routing - AI-driven model selection based on task complexity - Performance-based model switching - Multi-provider failover routing
Related Skills
cfn-hybrid-routing
Adaptive routing strategies for distributed systems with multi-channel communication
cfn-routing-config
Provider routing and hybrid configuration for CFN
supabase-schema-sync
Introspects Supabase DB after migrations and updates project db-query skill with current schema. Run after any migration to keep agent context accurate.
commit
Stage, commit, and push changes using a background github-commit-agent. Accepts optional args for message override or push control.
cfn-vote-implement
MUST BE USED after cfn-dry-review or cfn-alpha-launch:manifest produces a manifest. Also the verification phase of /cfn-loop-task. Do not manually implement code review suggestions - always route through this skill. 3-agent specialized voting. Unanimous (3/3) auto-implemented with TDD. 2/3 routed to product-owner agent. 1/3 surfaced to user via AskUserQuestion (batched 4 per call, at end).
cfn-utilities
Reusable bash utility functions for CFN Loop - logging, error handling, retry, file operations. Use when you need structured logging, atomic file operations, retry logic with exponential backoff, or standardized error handling in bash scripts.
CFN Test Runner Skill
**Version:** 1.0.0
cfn-test-framework
Test execution, running, and webapp testing for CFN
cfn-task-planning
Classify tasks, initialize structured configs with scope boundaries, decompose complex tasks
Specialist Injection Skill
## Purpose
!/bin/bash
# cfn-task-intelligence.sh
Task Complexity Estimator
**Version:** 1.0.0