Cc skill coding standards

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

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

How to use this skill

Skill file

Cc Skill Coding Standards

Orchestrates intelligent skill selection and execution for cc skill coding standards 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 validate_skill_standards(skill_path: str, standards_config: Dict) -> Dict:
    """Validate a skill file against CC coding standards.
    
    Implements Law 2 (Parse at boundary) by strictly parsing YAML frontmatter
    and required ## sections before any logic runs.
    """
    # Law 1: Early exit on missing/invalid file
    if not os.path.exists(skill_path):
        raise FileNotFoundError(f"Skill file not found: {skill_path}")
        
    raw_content = Path(skill_path).read_text()
    frontmatter = _parse_frontmatter(raw_content)
    
    # Law 2: Make illegal states unrepresentable
    required_fields = standards_config.get("required_fields", ["name", "version", "description"])
    missing = [f for f in required_fields if f not in frontmatter]
    if missing:
        raise ValueError(f"Missing required frontmatter fields: {missing}")
        
    # Extract and validate ## sections
    sections = _extract_headings(raw_content)
    required_sections = standards_config.get("required_sections", ["TL;DR Checklist", "Core Workflow"])
    missing_sections = [s for s in required_sections if s not in sections]
    
    # Law 3: Return new structure, never mutate input
    compliance_report = {
        "path": skill_path,
        "valid": len(missing_sections) == 0,
        "missing_sections": missing_sections,
        "frontmatter_fields": frontmatter,
        "timestamp": time.time()
    }
    return compliance_report

Pattern 2: Execution with Fallback

def enforce_standards_with_fallback(
    skill_path: str, 
    standards_config: Dict,
    auto_fix: bool = True
) -> Dict:
    """Run standards enforcement pipeline with fallback chain.
    
    Implements Law 4 (Fail Fast, Fail Loud) by halting on critical violations
    and routing to appropriate fallbacks based on severity.
    """
    # Law 1: Early exit on invalid config
    if not standards_config.get("severity_threshold"):
        raise ValueError("Severity threshold must be defined in standards_config")
        
    report = validate_skill_standards(skill_path, standards_config)
    
    if report["valid"]:
        return {"status": "compliant", "report": report}
        
    # Fallback chain based on violation severity
    violations = report["missing_sections"]
    if auto_fix and len(violations) <= 2:
        # Fallback 1: Auto-generate missing sections
        return _auto_generate_sections(skill_path, violations)
        
    if len(violations) > 2:
        # Fallback 2: Route to human review for critical gaps
        return _route_to_human_review(skill_path, violations)
        
    # Fallback 3: Log and return with warning (Law 4)
    return {
        "status": "non_compliant",
        "report": report,
        "action": "logged_for_review",
        "warning": "Critical standards missing. Manual intervention required."
    }

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.