defense-in-depth
About
This skill implements a multi-layer validation strategy for the CFN Loop workflow to prevent low-quality deliverables and "consensus on vapor." It enforces rigorous checks at every coordination stage, validating deliverables, confidence, and context throughout the process. Use it to ensure robust, high-quality outputs by maintaining strict quality control across all workflow layers.
Documentation
name: defense-in-depth description: Multi-layer validation strategy for CFN Loop to prevent "consensus on vapor" and ensure robust, high-quality deliverables
Defense-in-Depth Validation for CFN Loop
Overview
In the Claude Flow Novice system, defense-in-depth validation prevents low-quality or incomplete work by enforcing rigorous checks at multiple coordination layers.
Core Principle: Validate deliverables, confidence, and context at EVERY stage of the CFN Loop workflow.
Validation Layers in CFN Loop
Layer 1: Coordinator Context Extraction
Purpose: Validate task description and initial context
# Mandatory fields in context extraction
REQUIRED_FIELDS=(
"epicGoal" # 1-2 sentence description
"inScope" # Specific, achievable objectives
"outOfScope" # Clear boundaries
"deliverables" # Exact file paths/names
"directory" # Target creation path
"acceptanceCriteria" # Measurable requirements
)
validate_coordinator_context() {
for field in "${REQUIRED_FIELDS[@]}"; do
if [[ -z "${CONTEXT[$field]}" ]]; then
echo "❌ INVALID: Missing required context field: $field"
return 1
fi
done
}
Layer 2: Orchestrator Agent Spawning Validation
Purpose: Ensure agents receive complete, actionable context
validate_agent_context() {
# Reference STRAT-025: Explicit Deliverable Tracking
DELIVERABLES_CHECKLIST=$(
for file in "${CONTEXT[deliverables]}"; do
if [[ -f "$file" ]]; then
echo "✅ $file"
else
echo "❌ $file MISSING"
fi
done
)
# Confidence calculation based on deliverable completion
COMPLETION_RATE=$(calculate_completion_rate "$DELIVERABLES_CHECKLIST")
# Enforce low confidence if any deliverables missing
if (( $(echo "$COMPLETION_RATE < 0.50" | bc -l) )); then
AGENT_CONFIDENCE=0.25
fi
}
Layer 3: Loop 2 Validator Quality Gate
Purpose: Enforce strict consensus validation
validate_loop2_consensus() {
# Reference STRAT-020: Mandatory Deliverable Verification
if [[ "$DELIVERABLES_CREATED" -eq 0 ]]; then
echo "❌ NO DELIVERABLES CREATED"
OVERRIDE_CONSENSUS="ITERATE"
FEEDBACK="Iteration required: No deliverables produced"
fi
# Consensus threshold enforcement
if (( $(echo "$CONSENSUS_SCORE < 0.90" | bc -l) )); then
echo "❌ CONSENSUS TOO LOW"
OVERRIDE_CONSENSUS="ITERATE"
fi
}
Layer 4: Product Owner Decision Validation
Purpose: Final quality and strategic alignment check
validate_product_owner_decision() {
# Verify deliverables match epic goals
STRATEGIC_ALIGNMENT=$(assess_strategic_match)
if [[ "$STRATEGIC_ALIGNMENT" -lt 0.75 ]]; then
echo "❌ LOW STRATEGIC ALIGNMENT"
DECISION="ABORT"
REASON="Deliverables do not match epic objectives"
fi
}
Redis-based Quality Coordination
Implement quality gates using Redis pub/sub for zero-token coordination:
# Quality gate blocking mechanism
redis-cli BLPOP "cfn_loop:quality_gate:$TASK_ID" 0
# Signal quality validation result
redis-cli LPUSH "cfn_loop:quality_result:$TASK_ID" "$VALIDATION_STATUS"
Confidence and Consensus Mapping
Confidence Thresholds:
- Gate Threshold: ≥0.75
- Consensus Threshold: ≥0.90
- Product Owner Strategic Alignment: ≥0.85
Key Insights
- Multi-Layer Validation: Each layer adds a unique validation perspective
- Prevent "Consensus on Vapor": Strict deliverable tracking
- Dynamic Iteration: Automatic re-execution when quality gates fail
- Zero-Token Coordination: Redis pub/sub enables efficient quality management
Implementation References
- STRAT-020: Mandatory Deliverable Verification
- STRAT-025: Explicit Deliverable Tracking
- PATTERN-022: Agent Lifecycle Management
Success is not consensus, but verifiable, high-quality deliverables.
Quick Install
/plugin add https://github.com/masharratt/claude-flow-novice/tree/main/cfn-defense-in-depthCopy and paste this command in Claude Code to install this skill
GitHub 仓库
Related Skills
subagent-driven-development
DevelopmentThis skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.
algorithmic-art
MetaThis Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.
executing-plans
DesignUse the executing-plans skill when you have a complete implementation plan to execute in controlled batches with review checkpoints. It loads and critically reviews the plan, then executes tasks in small batches (default 3 tasks) while reporting progress between each batch for architect review. This ensures systematic implementation with built-in quality control checkpoints.
cost-optimization
OtherThis Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.
