12 KiB
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:
# 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
↓ <loaded_config>
STAGE 2: Schema Validation
↓ <schema_validation>
STAGE 3: Semantic Validation
↓ <semantic_validation>
STAGE 4: Cross-Field Validation
↓ <cross_field_validation>
STAGE 5: Generate Validation Report
↓ <validation_report>
STAGE 1: Load Configuration & Schema
Single-Task Goal: Load configuration file and validation schema
Actions
- 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
- Read configuration file using Read tool
- Read schema.json using Read tool
- Parse JSON content
Output State
<loaded_config>
<config_path>{path}</config_path>
<config_content>{...}</config_content>
<schema_content>{...}</schema_content>
<load_status>success|failed</load_status>
<load_errors>...</load_errors>
</loaded_config>
STAGE 2: Schema Validation
Single-Task Goal: Validate configuration against JSON schema
Validation Checks
-
Required Fields
- Check all required properties present
- Check nested required fields
-
Type Checking
- Validate all types match schema (string, integer, boolean, etc.)
- Check array item types
- Check object property types
-
Value Constraints
- Check minimum/maximum for integers
- Check enum values
- Check string patterns (regex)
-
Structure Validation
- Verify object structure matches schema
- Check for unexpected properties
- Validate nested objects
Output State
<schema_validation>
<status>passed|failed</status>
<errors>
<error>
<path>orchestration.max_parallel_agents</path>
<expected>integer between 1 and 10</expected>
<actual>15</actual>
<message>Value exceeds maximum allowed</message>
</error>
...
</errors>
<warnings>
<warning>
<path>generation.custom_field</path>
<message>Property not defined in schema</message>
</warning>
</warnings>
</schema_validation>
STAGE 3: Semantic Validation
Single-Task Goal: Validate logical consistency and semantic correctness
Validation Checks
-
Logical Consistency
batch_sizeshould be <=max_iterationsinfinite_mode_wave_sizeshould be reasonable (1-20)context_budget_per_agent*max_parallel_agentsshould be < total budgetagent_timeout_msshould be >web_fetch_timeout_ms
-
Path Validation
output_directoryshould be valid directory name- No absolute paths where relative expected
- No parent directory references (../) in outputs
-
Value Reasonableness
max_parallel_agentsnot too high (warn if > 10)batch_sizenot too large (warn if > 50)max_iterationsreasonable for mode- Timeout values sensible
-
Feature Dependencies
- If
web_enhancement.enabledis true, check web-related config - If
enable_review_stageis true, check quality config - If
enable_url_strategyis true, validate URL-related settings
- If
Output State
<semantic_validation>
<status>passed|failed|warning</status>
<errors>
<error>
<check>batch_size_vs_max_iterations</check>
<message>batch_size (100) exceeds max_iterations (50)</message>
<severity>error</severity>
</error>
</errors>
<warnings>
<warning>
<check>parallel_agents_count</check>
<message>max_parallel_agents (15) is unusually high, may cause performance issues</message>
<severity>warning</severity>
</warning>
</warnings>
</semantic_validation>
STAGE 4: Cross-Field Validation
Single-Task Goal: Validate relationships between configuration sections
Validation Checks
-
Orchestration vs Quality
- If
enable_review_stageis true, ensure sufficient timeout - Review stage adds 30-50% to execution time
- If
-
Orchestration vs Limits
max_parallel_agents*infinite_mode_wave_sizeshould respectmax_iterations- Total context budget calculation: verify feasibility
-
Web Enhancement vs Orchestration
initial_priming_urlsshould be reasonable forbatch_sizeurls_per_iterationshould be feasible withinagent_timeout_ms- Web cache settings compatible with output settings
-
Logging vs Performance
- Verbose logging with large batch sizes may impact performance
- Debug logging with many agents may produce excessive output
-
Chain Prompting vs Quality
- If many stages configured, ensure timeout sufficient
- Self-correction enabled requires retry budget
Output State
<cross_field_validation>
<status>passed|failed|warning</status>
<checks_performed>
<check name="orchestration_quality">passed</check>
<check name="orchestration_limits">warning</check>
<check name="web_orchestration">passed</check>
<check name="logging_performance">warning</check>
<check name="chain_quality">passed</check>
</checks_performed>
<issues>
<issue>
<check>orchestration_limits</check>
<fields>
<field>orchestration.max_parallel_agents</field>
<field>orchestration.infinite_mode_wave_size</field>
<field>limits.max_iterations</field>
</fields>
<message>Configuration may exceed max_iterations in first wave</message>
<severity>warning</severity>
<recommendation>Reduce wave_size or increase max_iterations</recommendation>
</issue>
</issues>
</cross_field_validation>
STAGE 5: Generate Validation Report
Single-Task Goal: Create comprehensive validation report
Report Contents
-
Summary
- Overall status: VALID | INVALID | WARNINGS
- Configuration file validated
- Profile (if applicable)
- Validation timestamp
-
Schema Validation Results
- Total checks performed
- Errors found
- Warnings found
-
Semantic Validation Results
- Logical consistency checks
- Value reasonableness
- Feature dependencies
-
Cross-Field Validation Results
- Relationship checks
- Compatibility issues
-
Detailed Error List
- All errors with paths and messages
- Severity levels
- Recommendations for fixes
-
Warnings List
- All warnings
- Impact assessment
- Suggestions for optimization
-
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:
/project:validate-config <config_path> --suggest-fixes
This will:
- Run all validation stages
- Identify all errors
- Generate corrected configuration
- Display diff showing proposed changes
- 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