# Validation Patterns ## Pre-Execution Checks ```yaml Always Validate: - Risky ops (delete, overwrite, deploy) - Prod changes - Permission escalations - External API calls Check Sequence: 1. Ambiguity: shared/ambiguity-check.yml 2. Security: Path validation, secrets scan 3. Deps: Required tools/libs exist 4. Permissions: User has required access 5. State: Clean working tree, no conflicts ``` ## Risk Assessment ```yaml Risk Score (1-10): Factors: Data loss potential: +3 Irreversibility: +2 Scope of impact: +2 Security impact: +3 Mitigations: Backup available: -2 Test coverage: -1 Sandbox mode: -2 Actions by Score: 1-3: Proceed with note 4-6: Warn and confirm 7-9: Require explicit approval 10: Block execution ``` ## Integration ```yaml Commands: Include: shared/validation.yml Call: validate_pre_execution() Auto-Trigger: - Git push/force operations - File deletions - Database migrations - Production deployments ```