Ci cd pipeline analyzer

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

Ci cd pipeline analyzer is an AI agent skill from the GitHub repository paulpas/agent-skill-router. Implements intelligent ci cd pipeline analyzer with multi-factor skill selection, fallback chains, and adherence to the 5 Laws of Elegant Defense

How to use this skill

Skill file

Ci Cd Pipeline Analyzer

Orchestrates intelligent skill selection and execution for ci cd pipeline analyzer 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 parse_pipeline_config(yaml_content: str, schema: Dict) -> Dict:
    """Parse and validate CI/CD pipeline configuration against schema.
    Implements Law 1 (Early Exit) and Law 2 (Make illegal states unrepresentable).
    """
    if not yaml_content or not isinstance(yaml_content, str):
        raise ValueError("Pipeline content must be a non-empty string")
        
    try:
        config = yaml.safe_load(yaml_content)
    except yaml.YAMLError as e:
        raise ValueError(f"Invalid YAML syntax: {e}") from e
        
    if not isinstance(config, dict):
        raise ValueError("Pipeline root must be a mapping")
        
    # Validate required stages
    required_stages = schema.get("required_stages", ["build", "test", "deploy"])
    missing = [s for s in required_stages if s not in config.get("stages", [])]
    if missing:
        raise ValueError(f"Missing required stages: {', '.join(missing)}")
        
    # Return immutable copy (Law 3)
    return {
        "parsed_at": time.time(),
        "stages": list(config.get("stages", [])),
        "jobs": config.get("jobs", {}),
        "variables": config.get("variables", {}),
        "validation_status": "valid"
    }

Pattern 2: Execution with Fallback

def analyze_pipeline_risks(config: Dict, rules: List[Dict]) -> Dict:
    """Analyze parsed pipeline configuration against security and performance rules.
    Implements Law 4 (Fail Fast) and Law 3 (Immutable returns).
    """
    if not config or not rules:
        raise ValueError("Configuration and rules must be provided")
        
    findings = []
    for rule in rules:
        if rule["type"] == "secret_detection":
            for var_name, var_value in config.get("variables", {}).items():
                if any(keyword in str(var_value).lower() for keyword in ["password", "token", "secret"]):
                    findings.append({
                        "rule_id": rule["id"],
                        "severity": "high",
                        "message": f"Potential secret detected in variable: {var_name}"
                    })
        elif rule["type"] == "stage_dependency":
            stages = config.get("stages", [])
            if len(stages) < 2:
                findings.append({
                    "rule_id": rule["id"],
                    "severity": "medium",
                    "message": "Pipeline has insufficient stages for proper separation of concerns"
                })
                
    # Atomic return with metadata
    return {
        "analysis_timestamp": time.time(),
        "total_findings": len(findings),
        "critical_count": sum(1 for f in findings if f["severity"] == "high"),
        "findings": findings,
        "recommendation": "review_secrets" if any(f["severity"] == "high" for f in findings) else "pass"
    }

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


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.

Related Skills

| Skill | Purpose |

|

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.