Skill: mpelissari/dynamic-model-selector (version 1.0.0)

--- name: dynamic-model-selector description: Dynamically select the best AI model for a task based on complexity, cost, and availability in GitHub Copilot. Use when deciding between free/paid models, or when you want automatic model routing based on query analysis. --- # Dynamic Model Selector ## Overview This skill analyzes user queries to recommend the optimal AI model from available GitHub Copilot options, balancing performance, cost, and task requirements. ## How to Use 1. Provide the user query or task description. 2. Run the classification script to analyze complexity. 3. Choose the suggested model or adjust based on preferences. ## Classification Criteria - **Simple tasks** (short responses, basic chat): Use faster, free models like grok-code-fast-1. - **Complex reasoning** (analysis, multi-step): Use advanced models like gpt-4o or claude-3.5-sonnet. - **Code generation**: Prefer code-optimized models. - **Cost sensitivity**: Favor free models when possible. ## Example Usage For a query like "Explain quantum computing": Classify as medium complexity -> Recommend gpt-4o. For "Write a Python function to sort a list": Classify as code task -> Recommend grok-code-fast-1. ## Resources ### scripts/ - `classify_task.py`: Analyzes the query and outputs model recommendation. ### references/ - `models.md`: Detailed list of available models, pros/cons, costs.

path: references/models.md
content: # Available GitHub Copilot Models - Detailed Specs

Based on GitHub Copilot model specifications.

## Claude Models (Anthropic)
- **Claude Haiku 4.5**: Context 128K/32K, Tools+Vision, 0.33x multiplier (fast, cheap)
- **Claude Opus 4.5**: Context 128K/32K, Tools+Vision, 3x multiplier (powerful, expensive)
- **Claude Opus 4.6**: Context 128K/64K, Tools+Vision, 3x multiplier (latest Opus, high output)
- **Claude Sonnet 4**: Context 128K/16K, Tools+Vision, 1x multiplier (balanced)
- **Claude Sonnet 4.5**: Context 128K/32K, Tools+Vision, 1x multiplier (current Sonnet)

## Gemini Models (Google)
- **Gemini 2.5 Pro**: Context 109K/64K, Tools+Vision, 1x multiplier (high performance)
- **Gemini 3 Flash (Preview)**: Context 109K/64K, Tools+Vision, 0.33x multiplier (fast, preview)
- **Gemini 3 Pro (Preview)**: Context 109K/64K, Tools+Vision, 1x multiplier (advanced, preview)

## GPT Models (OpenAI)
- **GPT-4.1**: Context 111K/16K, Tools+Vision, 0x multiplier (free?)
- **GPT-4o**: Context 64K/4K, Tools+Vision, 0x multiplier (free, classic)
- **GPT-5**: Context 128K/128K, Tools+Vision, 1x multiplier (latest, balanced)
- **GPT-5 mini**: Context 128K/64K, Tools+Vision, 0x multiplier (fast mini)
- **GPT-5-Codex (Preview)**: Context 128K/128K, Tools+Vision, 1x multiplier (code-focused)
- **GPT-5.1**: Context 128K/64K, Tools+Vision, 1x multiplier (improved)
- **GPT-5.1-Codex**: Context 128K/128K, Tools+Vision, 1x multiplier (code)
- **GPT-5.1-Codex-Max**: Context 128K/128K, Tools+Vision, 1x multiplier (max code)
- **GPT-5.1-Codex-Mini (Preview)**: Context 128K/128K, Tools+Vision, 0.33x multiplier (mini code)
- **GPT-5.2**: Context 128K/64K, Tools+Vision, 1x multiplier (next gen)
- **GPT-5.2-Codex**: Context 272K/128K, Tools+Vision, 1x multiplier (huge context code)

## Other
- **Grok Code Fast 1**: Context 109K/64K, Tools, 0x multiplier (free, fast code)
- **Raptor mini (Preview)**: Context 200K/64K, Tools+Vision, 0x multiplier (preview, large context)

## Selection Guidelines
- **Cost**: Lower multiplier = cheaper/faster (0.33x cheapest, 3x most expensive)
- **Context**: Higher numbers better for long tasks
- **Use**: Code tasks -> Codex variants; Vision -> models with Vision; Tools for function calling
- **Free**: 0x multiplier models
- **Paid**: 0.33x to 3x

## Cost Considerations
- Multiplier indicates relative cost per request
- Free models have 0x, no usage costs
- Paid models scale with multiplier

path: scripts/classify_task.py
content: #!/usr/bin/env python3
"""
Dynamic Model Selector Script

Analyzes a user query and recommends the best GitHub Copilot model based on:
- Complexity (length, keywords)
- Task type (code, reasoning, chat)
- Cost considerations
"""

import sys
import re

def classify_query(query):
    """
    Classify the query and return recommended model.
    
    Returns: dict with 'model', 'reason', 'cost_tier'
    """
    query_lower = query.lower()
    length = len(query.split())
    
    # Keywords indicating complexity
    complex_keywords = ['explain', 'analyze', 'design', 'architecture', 'optimize', 'debug', 'troubleshoot', 'research', 'plan', 'strategy']
    code_keywords = ['code', 'function', 'class', 'script', 'api', 'database', 'algorithm', 'debug', 'fix']
    creative_keywords = ['write', 'story', 'poem', 'design', 'create', 'generate']
    
    # Simple heuristics
    is_very_complex = any(kw in query_lower for kw in complex_keywords) and length > 100
    is_complex = any(kw in query_lower for kw in complex_keywords) or length > 50
    is_code = any(kw in query_lower for kw in code_keywords) or '```' in query or re.search(r'\b(def|class|import|function|async|await)\b', query_lower)
    is_creative = any(kw in query_lower for kw in creative_keywords) and not is_code
    
    if is_very_complex:
        return {
            'model': 'github-copilot/claude-3-opus',
            'reason': 'Very complex task requiring top-tier reasoning',
            'cost_tier': 'paid'
        }
    elif is_complex and is_code:
        return {
            'model': 'github-copilot/gpt-4-turbo',
            'reason': 'Complex code task, needs advanced coding capabilities',
            'cost_tier': 'paid'
        }
    elif is_complex:
        return {
            'model': 'github-copilot/gpt-4o',
            'reason': 'Complex reasoning/analysis task, needs advanced capabilities',
            'cost_tier': 'paid'
        }
    elif is_code:
        return {
            'model': 'github-copilot/grok-code-fast-1',
            'reason': 'Code task, fast and free model suitable',
            'cost_tier': 'free'
        }
    elif is_creative:
        return {
            'model': 'github-copilot/claude-3.5-sonnet',
            'reason': 'Creative writing/design task',
            'cost_tier': 'paid'
        }
    elif length > 20:
        return {
            'model': 'github-copilot/grok-beta',
            'reason': 'Medium complexity, use enhanced free model',
            'cost_tier': 'free'
        }
    else:
        return {
            'model': 'github-copilot/grok-code-fast-1',
            'reason': 'Simple task, fast response sufficient',
            'cost_tier': 'free'
        }

def main():
    if len(sys.argv) < 2:
        print("Usage: python3 classify_task.py \"your query here\"")
        sys.exit(1)
    
    query = ' '.join(sys.argv[1:])
    result = classify_query(query)
    
    print(f"Recommended Model: {result['model']}")
    print(f"Reason: {result['reason']}")
    print(f"Cost Tier: {result['cost_tier']}")

if __name__ == '__main__':
    main()

Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)