# Validate Configuration Command You are a configuration validation specialist implementing chain prompting for multi-stage validation. ## Command Usage ``` /project:validate-config [config_path] [profile] ``` **Arguments:** - `config_path` (optional) - Path to configuration file to validate (default: .claude/config/defaults.json) - `profile` (optional) - Profile to validate: development|production|research **Examples:** ```bash # Validate defaults /project:validate-config # Validate development profile /project:validate-config .claude/config/profiles/development.json development # Validate custom configuration /project:validate-config examples/custom_config.json # Validate merged configuration for production profile /project:validate-config production ``` ## Chain Prompting Validation Stages ``` STAGE 1: Load Configuration & Schema ↓ STAGE 2: Schema Validation ↓ STAGE 3: Semantic Validation ↓ STAGE 4: Cross-Field Validation ↓ STAGE 5: Generate Validation Report ↓ ``` ## STAGE 1: Load Configuration & Schema **Single-Task Goal:** Load configuration file and validation schema ### Actions 1. Determine which configuration to validate: - If no args: validate defaults.json - If profile name only: load defaults.json + profile.json and merge - If config_path: load specified file 2. Read configuration file using Read tool 3. Read schema.json using Read tool 4. Parse JSON content ### Output State ```xml {path} {...} {...} success|failed ... ``` ## STAGE 2: Schema Validation **Single-Task Goal:** Validate configuration against JSON schema ### Validation Checks 1. **Required Fields** - Check all required properties present - Check nested required fields 2. **Type Checking** - Validate all types match schema (string, integer, boolean, etc.) - Check array item types - Check object property types 3. **Value Constraints** - Check minimum/maximum for integers - Check enum values - Check string patterns (regex) 4. **Structure Validation** - Verify object structure matches schema - Check for unexpected properties - Validate nested objects ### Output State ```xml passed|failed orchestration.max_parallel_agents integer between 1 and 10 15 Value exceeds maximum allowed ... generation.custom_field Property not defined in schema ``` ## STAGE 3: Semantic Validation **Single-Task Goal:** Validate logical consistency and semantic correctness ### Validation Checks 1. **Logical Consistency** - `batch_size` should be <= `max_iterations` - `infinite_mode_wave_size` should be reasonable (1-20) - `context_budget_per_agent` * `max_parallel_agents` should be < total budget - `agent_timeout_ms` should be > `web_fetch_timeout_ms` 2. **Path Validation** - `output_directory` should be valid directory name - No absolute paths where relative expected - No parent directory references (../) in outputs 3. **Value Reasonableness** - `max_parallel_agents` not too high (warn if > 10) - `batch_size` not too large (warn if > 50) - `max_iterations` reasonable for mode - Timeout values sensible 4. **Feature Dependencies** - If `web_enhancement.enabled` is true, check web-related config - If `enable_review_stage` is true, check quality config - If `enable_url_strategy` is true, validate URL-related settings ### Output State ```xml passed|failed|warning batch_size_vs_max_iterations batch_size (100) exceeds max_iterations (50) error parallel_agents_count max_parallel_agents (15) is unusually high, may cause performance issues warning ``` ## STAGE 4: Cross-Field Validation **Single-Task Goal:** Validate relationships between configuration sections ### Validation Checks 1. **Orchestration vs Quality** - If `enable_review_stage` is true, ensure sufficient timeout - Review stage adds 30-50% to execution time 2. **Orchestration vs Limits** - `max_parallel_agents` * `infinite_mode_wave_size` should respect `max_iterations` - Total context budget calculation: verify feasibility 3. **Web Enhancement vs Orchestration** - `initial_priming_urls` should be reasonable for `batch_size` - `urls_per_iteration` should be feasible within `agent_timeout_ms` - Web cache settings compatible with output settings 4. **Logging vs Performance** - Verbose logging with large batch sizes may impact performance - Debug logging with many agents may produce excessive output 5. **Chain Prompting vs Quality** - If many stages configured, ensure timeout sufficient - Self-correction enabled requires retry budget ### Output State ```xml passed|failed|warning passed warning passed warning passed orchestration_limits orchestration.max_parallel_agents orchestration.infinite_mode_wave_size limits.max_iterations Configuration may exceed max_iterations in first wave warning Reduce wave_size or increase max_iterations ``` ## STAGE 5: Generate Validation Report **Single-Task Goal:** Create comprehensive validation report ### Report Contents 1. **Summary** - Overall status: VALID | INVALID | WARNINGS - Configuration file validated - Profile (if applicable) - Validation timestamp 2. **Schema Validation Results** - Total checks performed - Errors found - Warnings found 3. **Semantic Validation Results** - Logical consistency checks - Value reasonableness - Feature dependencies 4. **Cross-Field Validation Results** - Relationship checks - Compatibility issues 5. **Detailed Error List** - All errors with paths and messages - Severity levels - Recommendations for fixes 6. **Warnings List** - All warnings - Impact assessment - Suggestions for optimization 7. **Configuration Summary** - Key settings extracted - Profile characteristics - Estimated resource usage ### Output Format ``` ======================================== CONFIGURATION VALIDATION REPORT ======================================== Configuration: {path} Profile: {profile} Validated: {timestamp} Schema Version: {version} OVERALL STATUS: {VALID|INVALID|WARNINGS} ---------------------------------------- SCHEMA VALIDATION ---------------------------------------- Status: {passed|failed} Errors: {n} Warnings: {n} [If errors exist:] ERRORS: 1. orchestration.max_parallel_agents Expected: integer between 1 and 10 Actual: 15 Message: Value exceeds maximum allowed 2. generation.naming_pattern Expected: string Actual: null Message: Required field is missing [If warnings exist:] WARNINGS: 1. generation.custom_field Message: Property not defined in schema Impact: Will be ignored during execution ---------------------------------------- SEMANTIC VALIDATION ---------------------------------------- Status: {passed|failed|warning} LOGICAL CONSISTENCY: {passed|failed} VALUE REASONABLENESS: {passed|warning} FEATURE DEPENDENCIES: {passed} [If issues exist:] ISSUES: 1. [WARNING] batch_size unusually large Value: 100 Recommendation: Consider reducing to 20-50 for better control 2. [ERROR] timeout too short for web fetches agent_timeout_ms: 10000 web_fetch_timeout_ms: 30000 Fix: Increase agent_timeout_ms to at least 60000 ---------------------------------------- CROSS-FIELD VALIDATION ---------------------------------------- Status: {passed|warning} Checks Performed: 5 ✓ Orchestration vs Quality ⚠ Orchestration vs Limits ✓ Web Enhancement vs Orchestration ⚠ Logging vs Performance ✓ Chain Prompting vs Quality ISSUES: 1. [WARNING] Configuration may exceed max_iterations max_parallel_agents (5) * infinite_mode_wave_size (20) = 100 max_iterations: 50 Recommendation: Reduce wave_size to 10 or increase max_iterations 2. [WARNING] Verbose logging with large batch size Impact: May produce excessive output and slow execution Recommendation: Use 'info' level instead of 'debug' for batch_size > 10 ---------------------------------------- CONFIGURATION SUMMARY ---------------------------------------- Profile: {profile} Parallel Agents: {n} Batch Size: {n} Web Enhancement: {enabled|disabled} Chain Prompting Stages: {n} Estimated Context Budget: {tokens} tokens Estimated Execution Time: {minutes} minutes ---------------------------------------- RECOMMENDATIONS ---------------------------------------- {List of recommended changes based on validation} 1. Reduce max_parallel_agents from 15 to 10 2. Increase agent_timeout_ms to 60000 3. Consider using 'info' logging level instead of 'debug' ======================================== {VALIDATION PASSED|VALIDATION FAILED|VALIDATION PASSED WITH WARNINGS} ======================================== ``` ## Self-Correction Mode If validation fails and you want to suggest fixes: ```bash /project:validate-config --suggest-fixes ``` This will: 1. Run all validation stages 2. Identify all errors 3. Generate corrected configuration 4. Display diff showing proposed changes 5. Optionally write corrected config to new file ## Output Examples ### Example 1: Valid Configuration ``` ======================================== CONFIGURATION VALIDATION REPORT ======================================== Configuration: .claude/config/profiles/development.json Profile: development Validated: 2025-10-10T14:30:00Z Schema Version: 1.0.0 OVERALL STATUS: VALID Schema Validation: PASSED (0 errors, 0 warnings) Semantic Validation: PASSED Cross-Field Validation: PASSED Configuration is valid and ready to use. ======================================== ``` ### Example 2: Configuration with Warnings ``` ======================================== CONFIGURATION VALIDATION REPORT ======================================== Configuration: examples/custom_config.json Profile: custom Validated: 2025-10-10T14:35:00Z Schema Version: 1.0.0 OVERALL STATUS: VALID WITH WARNINGS Schema Validation: PASSED (0 errors, 1 warning) Semantic Validation: WARNING Cross-Field Validation: WARNING WARNINGS: 1. max_parallel_agents set to 8 (high) Impact: May cause performance issues 2. Debug logging with batch_size 20 Impact: Excessive output RECOMMENDATIONS: 1. Consider reducing max_parallel_agents to 5-6 2. Use 'info' logging level for production Configuration is usable but optimizations recommended. ======================================== ``` ### Example 3: Invalid Configuration ``` ======================================== CONFIGURATION VALIDATION REPORT ======================================== Configuration: broken_config.json Validated: 2025-10-10T14:40:00Z OVERALL STATUS: INVALID ERRORS: 1. orchestration.max_parallel_agents: 15 (exceeds maximum of 10) 2. generation.naming_pattern: missing required field 3. agent_timeout_ms (10000) < web_fetch_timeout_ms (30000) Configuration cannot be used until errors are fixed. Run with --suggest-fixes to see recommended corrections. ======================================== ``` ## Exit Codes When used programmatically: - Exit 0: Configuration valid - Exit 1: Configuration invalid (errors) - Exit 2: Configuration valid with warnings