Prerequisite Protocol
Environment Check
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "unknown")
BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
echo "PROJECT: $PROJECT_ROOT"
echo "BRANCH: $BRANCH"
echo "COMMIT: $COMMIT"
Prerequisite Skill Check
# 检查前置工件
GOAL_ARTIFACT="memory/artifacts/goal-oriented/latest.json"
MVP_ARTIFACT="memory/artifacts/mvp-first/latest.json"
if [ -f "$GOAL_ARTIFACT" ]; then
echo "FOUND: goal-oriented artifact"
fi
if [ -f "$MVP_ARTIFACT" ]; then
echo "FOUND: mvp-first artifact"
fi
mkdir -p memory/artifacts/pdca-cycle
PDCA Cycle
Overview
The PDCA cycle (Plan-Do-Check-Act) is a continuous improvement methodology that continuously optimizes processes and results through a cycle of four stages: Plan, Do, Check, and Act.
Core Value:
- Data-driven decision-making
- Small steps, fast iteration
- Continuous improvement, spiraling upward
- Reduce trial-and-error costs
Origin: Deming Cycle, popularized by W. Edwards Deming
When to Use
Applicable Scenarios:
- Iterative tasks that require continuous improvement
- Quality assurance and process optimization
- Pilot validation of new solutions
- Data-driven decision-making
- Performance optimization and cost reduction
- Improving user satisfaction
Inapplicable Scenarios:
- One-time tasks that do not require improvement
- Emergencies that require immediate action
The Process
digraph pdca {
rankdir=TB;
Plan [label="Plan\n计划", shape=box, style=filled, fillcolor="#c8e6c9"];
Do [label="Do\n执行", shape=box, style=filled, fillcolor="#bbdefb"];
Check [label="Check\n检查", shape=box, style=filled, fillcolor="#fff9c4"];
Act [label="Act\n处理", shape=box, style=filled, fillcolor="#f8bbd0"];
Plan -> Do [label="制定计划"];
Do -> Check [label="收集数据"];
Check -> Act [label="分析结果"];
Act -> Plan [label="下一轮循环", style=dashed];
}
Detailed Explanation of the Four Stages
Plan
- Clarify goals and metrics
- Analyze the current situation and gaps
- Develop a specific action plan
- Estimate risks and response plans
Do
- Pilot on a small scale
- Execute strictly according to the plan
- Collect data during execution
- Record problems and observations
Check
- Compare expected and actual results
- Analyze the causes of deviations
- Extract lessons learned
- Present data visually
Act
- Standardize successful practices
- Improve shortcomings
- Plan the next cycle
- Expand the scope of application
Cycle Checklist
Use the following checklist to ensure each stage is fully executed:
Plan Stage
- Clarify goals and measurement metrics
- Collect current-state data
- Analyze root causes (fishbone diagram, 5 Whys can be used)
- Develop a specific action plan
- Determine responsible persons and time nodes
- Estimate risks and response measures
Do Stage
- Select a small-scale pilot area
- Prepare the required resources
- Execute strictly according to the plan
- Collect process data (time, cost, quality)
- Record problems and anomalies encountered
- Keep the pilot environment controllable
Check Stage
- Compare actual results with expected goals
- Analyze the causes of differences
- Verify the effectiveness of the solution
- Extract successful experiences and failure lessons
- Data visualization (charts, reports)
- Team discussion and consensus building
Act Stage
- Standardize successful practices
- Document best practices
- Improve shortcomings
- Plan the goals of the next cycle
- Expand the scope of application (if applicable)
- Share experience with relevant teams
Examples
Case 1: PDCA Application for Code Quality Improvement
Plan:
- Goal: Reduce bug density by 50% (from 15 per thousand lines → 7.5 per thousand lines)
- Current situation analysis: The main problems are insufficient boundary checking and missing exception handling
- Action plan:
- Introduce static code analysis tools
- Enforce Code Review
- Write unit test templates
Do:
- Pilot in Project A (1 month)
- Introduce SonarQube
- Weekly Code Review meetings
- Collect data: number of bugs, discovery stage
Check:
- Bug density reduced to 8 per thousand lines (close to target)
- Static analysis found 120 issues, no new bugs after fixes
- Code Review found 35 potential issues
- But development time increased by 15%
Act:
- Standardization: Integrate SonarQube into CI/CD
- Improvement: Optimize the Code Review process to reduce time
- Next round goal: Maintain bug density and shorten development time
Case 2: Iterative optimization to improve user satisfaction
Plan:
- Goal: Increase user satisfaction from 3.2 to 4.0
- Current situation: Slow response and incomplete features
- Plan:
- Shorten response time (< 2 hours)
- Add high-frequency demand features
Do:
- Pilot for 2 weeks
- Add customer service staff
- Develop the Top 3 demanded features
- Collect feedback data
Check:
- Satisfaction increased to 3.8 (did not reach 4.0)
- Response time met the target
- High usage rate of new features
- But some features lack usability
Act:
- Standardization: Write response time requirements into the SLA
- Improvement: Optimize the UI/UX of new features
- Next round goal: Satisfaction > 4.0
Common Pitfalls
Pitfall 1: Skipping the Check stage and directly entering the next round
- Manifestation: Entering the next round immediately after execution, without checking the results
- Correct approach: Effects must be verified with data, avoiding judgment based on feelings
Pitfall 2: Only Plan and Do, without continuous improvement
- Manifestation: Ending after planning and execution, without performing Check and Act
- Correct approach: PDCA is a cycle, not a linear process
Pitfall 3: Ignoring data collection and judging based on feelings
- Manifestation: No quantitative data in the Check stage, subjectively judging "the effect is good"
- Correct approach: Clarify the data collection plan in the Plan stage
Pitfall 4: Pilot scope too large, risks out of control
- Manifestation: Full-scale rollout on the first attempt
- Correct approach: Pilot on a small scale in the Do stage, then expand after successful verification
Pitfall 5: No standardization in the Act stage, loss of experience
- Manifestation: Ending after improvement, without documentation
- Correct approach: Write successful practices into standard processes
References
- "The Essential Deming: Leadership Principles from the Father of Quality" - W. Edwards Deming
- Lean Six Sigma - Continuous improvement methodology
- Toyota Production System - Lean production
- PDCA Cycle Practical Guide
Post-protocol
Artifact output
Save the PDCA cycle results to the artifact file:
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
ARTIFACT_FILE="memory/artifacts/pdca-cycle/result-$TIMESTAMP.json"
cat > "$ARTIFACT_FILE" <<EOFJSON
{
"skill": "pdca-cycle",
"version": "2.0.0",
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"project": "$PROJECT_ROOT",
"branch": "$BRANCH",
"commit": "$COMMIT",
"input": {
"user_request": "用户的原始请求"
},
"output": {
"cycle_number": 1,
"plan": {
"objective": "",
"actions": []
},
"do": {
"completed_actions": [],
"issues": []
},
"check": {
"metrics": {},
"findings": []
},
"act": {
"decisions": [],
"next_cycle": ""
}
},
"next_skills": []
}
EOFJSON
echo "ARTIFACT SAVED: $ARTIFACT_FILE"
ln -sf "$ARTIFACT_FILE" memory/artifacts/pdca-cycle/latest.json
Target file update
If the target file exists, record the completion of the PDCA cycle.
Suggested follow-up skills
Based on the PDCA cycle results, it may be necessary to continue with the next cycle or complete the goal.