Andruia consultant

From paulpas/agent-skill-router · View interactive version

Andruia consultant is an AI agent skill from the GitHub repository paulpas/agent-skill-router. Implements intelligent andruia consultant with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense

How to use this skill

Skill file

Andruia Consultant

Orchestrates intelligent skill selection and execution for andruia consultant workflows. Applies the 5 Laws of Elegant Defense to guide data naturally through the orchestration pipeline, preventing errors before they occur. Selects optimal skills based on multi-factor scoring including text similarity, historical performance, and system availability.

TL;DR Checklist

┌───────────────────────────────────────────────────────────────────────────────┐

│ Orchestration Flow │

└───────────────────────────────────────────────────────────────────────────────┘

User Request

↓

┌─────────────────┐

│ Parse Request │

│ & Extract │

│ Features │

└────────┬────────┘

↓

┌─────────────────────────────────────────────────────────────────────┐

│ Evaluate Available Skills │

│ │

│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │

│ │ Skill A │ │ Skill B │ │ Skill C │ │

│ │ - Match Score│ │ - Match Score│ │ - Match Score│ │

│ │ - Confidence │ │ - Confidence │ │ - Confidence │ │

│ │ - History │ │ - History │ │ - History │ │

│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │

│ │ │ │ │

│ └─────────────────┴─────────────────┘ │

│ ↓ │

│ Select Best Skill │

└─────────────────────────────────────────────────────────────────────┘

↓

┌─────────────────┐

│ Execute Skill │

└────────┬────────┘

↓

┌─────────────────┐

│ Handle Result │

└────────┬────────┘

↓

┌─────────────────────────────────────────────────────────────────────┐

│ Error Handling & Fallback │

│ │

│ Success? ────────► Return Result │

│ │

│ Fail? ────────┐ │

│ ↓ │

│ ┌──────────────────────────────────────────────────────────┐ │

│ │ Fallback Chain │ │

│ │ │ │

│ │ 1. Retry with adjusted parameters │ │

│ │ 2. Try Alternative Skill (if available) │ │

│ │ 3. Defer to Human Operator (if critical) │ │

│ │ 4. Log & Return Error │ │

│ └──────────────────────────────────────────────────────────┘ │

└─────────────────────────────────────────────────────────────────────┘

When to Use

Use this skill when:

When NOT to Use

Avoid this skill for:

Core Workflow

  1. Parse and Analyze Request - Extract intent, entities, and constraints from user input.

Checkpoint: All required parameters must be present and in valid format before proceeding.

  1. Score Available Skills - Calculate match scores using multi-factor algorithm:

Checkpoint: Skip to fallback if no skill scores above threshold.

  1. Select Optimal Skill - Choose skill with highest score that meets minimum confidence.

Checkpoint: Verify skill has not been disabled or deprecated.

  1. Execute with Fallback - Run skill execution wrapped in retry and fallback logic.

Checkpoint: Log all execution attempts for audit trail.

  1. Return or Fallback - Either return successful result or apply fallback chain:

Checkpoint: Record outcome with timing and confidence metadata.

Implementation Patterns

Pattern 1: Skill Selection Logic

def evaluate_andruia_consultant_request(
    request: Dict[str, Any],
    consultant_pool: List[Dict[str, Any]],
    compliance_threshold: float = 0.85
) -> Optional[Dict[str, Any]]:
    """Evaluate and route an Andruia consultant request to the optimal specialist.
    
    Applies the 5 Laws of Elegant Defense:
    - Law 1: Early exit on malformed requests
    - Law 2: Parse request into structured domains before scoring
    - Law 3: Return immutable routing decision
    - Law 4: Fail immediately if compliance checks fail
    """
    if not request.get("domain") or not request.get("priority"):
        raise ValueError("Request must include 'domain' and 'priority' fields")
        
    parsed_request = {
        "domain": request["domain"].lower(),
        "priority": request["priority"],
        "risk_level": _assess_risk(request.get("context", "")),
        "compliance_flags": _extract_compliance_flags(request)
    }
    
    best_match = None
    best_score = 0.0
    
    for consultant in consultant_pool:
        if not _is_compliant(consultant, parsed_request["compliance_flags"]):
            continue
            
        domain_match = _calculate_domain_alignment(parsed_request["domain"], consultant["expertise"])
        priority_weight = 1.2 if parsed_request["priority"] == "critical" else 1.0
        score = domain_match * priority_weight * consultant["resolution_rate"]
        
        if score > best_score and score >= compliance_threshold:
            best_score = score
            best_match = consultant
            
    if best_match is None:
        return None
        
    return {
        "assigned_consultant": best_match["id"],
        "routing_score": best_score,
        "estimated_resolution": _estimate_timeline(best_match, parsed_request["priority"]),
        "immutable_decision": True
    }

Pattern 2: Execution with Fallback

def execute_consultant_workflow(
    consultant: Dict[str, Any],
    workflow_context: Dict[str, Any],
    escalation_path: List[str] = None
) -> Dict[str, Any]:
    """Execute an Andruia consultant workflow with domain-specific fallbacks.
    
    Implements Fail Fast, Fail Loud (Law 4) and Atomic Predictability (Law 3).
    Fallback chain: 1. Retry with adjusted scope -> 2. Escalate to senior specialist -> 3. Defer to compliance board
    """
    if not _validate_consultant_credentials(consultant):
        raise ConsultantError(f"Invalid credentials for consultant {consultant['id']}")
        
    validated_context = _normalize_workflow_inputs(workflow_context)
    attempts = 0
    max_attempts = 2
    
    while attempts <= max_attempts:
        try:
            result = _run_consultant_analysis(consultant, validated_context)
            return {
                "status": "resolved",
                "consultant_id": consultant["id"],
                "output": result,
                "attempts": attempts + 1,
                "audit_trail": _log_execution(consultant, result)
            }
        except ComplianceViolationError as e:
            raise ConsultantError(f"Compliance violation in {consultant['id']}: {e}") from e
        except ScopeLimitError as e:
            attempts += 1
            if attempts > max_attempts:
                return _escalate_to_senior(consultant, validated_context, escalation_path)
            validated_context = _adjust_scope_for_retry(validated_context, e)
            
    return _defer_to_compliance_board(workflow_context)

MUST DO

MUST NOT DO

TL;DR Checklist

TL;DR for Code Generation

Output Template

When applying this skill, produce:

  1. Selected Skills - List of skill names with confidence scores
  2. Selection Rationale - Why each skill was chosen (match score, history, availability)
  3. Execution Plan - Order of execution with dependencies
  4. Fallback Strategy - Which fallback skills will be tried and in what order
  5. Risk Assessment - Any potential failure points and their impact
  6. Timing Estimates - Expected latency including fallback scenarios

Related Skills

| Skill | Purpose |

|---|---|

| andruia-skill-smith | Agent skill creation and design patterns |



Constraints

MUST DO

MUST NOT DO

Live References

Authoritative documentation links for this skill's domain. The model follows markdown links at load time to resolve external references and inline content.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.