Validate plan file

From maslennikov-ig/claude-code-orchestrator-kit · View interactive version

Validate plan file is an AI agent skill from the GitHub repository maslennikov-ig/claude-code-orchestrator-kit. Validate that orchestrator plan files conform to expected JSON schema. Use before workers read plan files or after orchestrators create them to ensure proper structure and required fields.

How to use this skill

Skill file

Validate Plan File

Validate orchestrator plan files to ensure they conform to the expected schema before workers process them.

When to Use

Instructions

Step 1: Read Plan File

Use Read tool to load the plan file.

Expected Input:

Tools Used: Read

Step 2: Determine Schema

Map file name pattern to appropriate JSON schema.

Schema Mapping:

New Naming Convention (standardized):

Step 3: Load and Parse JSON Schema

Use Read tool to load the appropriate schema file from .claude/schemas/.

Tools Used: Read

Step 4: Validate JSON Against Schema

Validate the plan file content against the loaded JSON schema.

Base Schema Validation (all plan files):

Domain-Specific Validation:

Bug Plans:

Security Plans:

Dead Code Plans:

Dependency Plans:

Step 5: Return Validation Result

Return detailed validation result with errors/warnings.

Expected Output:

{
  "valid": true,
  "file": ".bug-detection-plan.json",
  "errors": [],
  "warnings": [],
  "schema": "bug-plan",
  "schemaPath": ".claude/schemas/bug-plan.schema.json"
}

Error Handling

Examples

Example 1: Valid Bug Detection Plan

Input:

file_path: .bug-detection-plan.json

Content:

{
  "workflow": "bug-management",
  "phase": "detection",
  "phaseNumber": 1,
  "config": {
    "priority": "all",
    "categories": ["type-errors", "runtime-errors"],
    "maxBugsPerRun": 50
  },
  "validation": {
    "required": ["report-exists", "type-check"],
    "optional": ["tests"]
  },
  "nextAgent": "bug-hunter",
  "timestamp": "2025-10-18T14:00:00Z",
  "metadata": {
    "createdBy": "bug-orchestrator",
    "iteration": 1,
    "maxIterations": 3
  }
}

Output:

{
  "valid": true,
  "file": ".bug-detection-plan.json",
  "errors": [],
  "warnings": [],
  "schema": "bug-plan",
  "schemaPath": ".claude/schemas/bug-plan.schema.json"
}

Example 2: Missing Required Field

Input:

file_path: .security-scan-plan.json

Content:

{
  "workflow": "security-audit",
  "phase": "scan",
  "config": {
    "categories": ["sql-injection"]
  },
  "validation": {
    "required": ["report-exists"]
  }
}

Output:

{
  "valid": false,
  "file": ".security-scan-plan.json",
  "errors": [
    "Missing required property: config.severity",
    "Schema validation failed at /config/severity: required property missing"
  ],
  "warnings": [],
  "schema": "security-plan",
  "schemaPath": ".claude/schemas/security-plan.schema.json"
}

Example 3: Invalid Enum Value

Input:

file_path: .dependency-audit-plan.json

Content:

{
  "workflow": "dependency-management",
  "phase": "audit",
  "config": {
    "category": "deprecated",
    "severity": "critical"
  },
  "validation": {
    "required": ["report-exists", "lockfile-valid"]
  },
  "nextAgent": "dependency-auditor"
}

Output:

{
  "valid": false,
  "file": ".dependency-audit-plan.json",
  "errors": [
    "Invalid enum value at /config/category: 'deprecated' not in allowed values ['security', 'unused', 'outdated', 'all']"
  ],
  "warnings": [],
  "schema": "dependency-plan",
  "schemaPath": ".claude/schemas/dependency-plan.schema.json"
}

Example 4: Workflow/Phase Mismatch

Input:

file_path: .bug-fixing-plan.json

Content:

{
  "workflow": "security-audit",
  "phase": "fixing",
  "config": {
    "priority": "critical"
  },
  "validation": {
    "required": ["type-check"]
  }
}

Output:

{
  "valid": false,
  "file": ".bug-fixing-plan.json",
  "errors": [
    "Schema mismatch: file pattern suggests 'bug-plan' schema but workflow field is 'security-audit'",
    "Invalid enum value at /phase: 'fixing' not in allowed values ['detection', 'fixing', 'verification'] for bug-plan"
  ],
  "warnings": [
    "Consider renaming file to match workflow: .security-remediation-plan.json"
  ],
  "schema": "bug-plan",
  "schemaPath": ".claude/schemas/bug-plan.schema.json"
}

Validation

Supporting Files

Located in .claude/schemas/:

Integration with Orchestrators

All orchestrators should use this Skill after creating plan files:

## Step 3: Create Plan File

1. Write plan to `.{domain}-{phase}-plan.json`
2. Use validate-plan-file Skill to verify:
   - Input: file_path = ".{domain}-{phase}-plan.json"
   - Check result.valid === true
   - If errors exist, fix plan file and retry
3. Only signal readiness after validation passes

Notes

JSON Schema Validation: This Skill performs full JSON Schema Draft-07 validation including:

File Naming Convention: Plan files must follow pattern .{domain}-{phase}-plan.json where:

Schema References: Uses JSON Schema $ref for base schema inheritance. All domain schemas extend base-plan.schema.json.

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.