Plan-Do-Check-Act Skill
This skill implements the PDCA (Plan-Do-Check-Act) workflow to ensure tasks are systematically planned and executed.
Requirements
- - Python 3.6+ - Required for all scripts
- Git - Optional - Only used for progress tracking. PDCA works perfectly without Git - it will use file modification times instead.
Setup Guide (First Time)
After installing, run the setup wizard:
CODEBLOCK0
The wizard will:
- 1. Check Python and Git dependencies
- Create workspace directory (default:
~/pdca-workspace) - Create a test plan
- Optionally initialize Git for progress tracking
- Show next steps
Manual Setup
If you prefer manual setup:
CODEBLOCK1
Security Notes
- - Workspace Scope: Only operates on
plan*.md files in the configured workspace directory - Destructive Operations:
cleanup command deletes archived files older than specified days (default 7) - User Confirmation: Archive operation prompts for confirmation if plan is not completed
- Dry Run: Use
cleanup --dry-run to preview before deleting - Autonomous Invocation: Should require user confirmation before cleanup/archive operations
Core Process
1. Plan
When receiving a user task, create
plan.md:
- - Break down the task into executable subtasks
- Record the session ID
- Mark priorities and dependencies
2. Do
Execute tasks according to plan.md:
- - Check off each completed task INLINECODE5
- Mark in-progress tasks as INLINECODE6
- Record issues during execution
3. Check
After all tasks are completed:
- - Check for any missed items
- Verify output meets expectations
- Identify areas for improvement
4. Act
Based on check results:
- - Fix identified issues
- Update plan.md with learnings
- Archive or iterate
plan.md Template
CODEBLOCK2
Trigger Scenarios
Core Logic: Step Analysis
After receiving a task, quickly analyze how many steps are needed:
1-2 steps → Execute directly, no plan
- - "Rename a file"
- "Delete that test file"
3-5 steps → Optional plan (ask user)
- - "Help me build a login feature"
5+ steps → Auto trigger PDCA
- - "Build a complete user system with registration and login"
- "Refactor this project from React to Vue"
Step Analysis Dimensions
| Dimension | 1 step | 2-3 steps | 5+ steps |
|---|
| File Changes | Single file | 2-3 files | Multiple modules/dirs |
| Dependencies |
None | Simple | Multi-layer/sequential |
|
Tech Stack | Single tech | 2 techs | Full-stack/multi-service |
|
Testing | No testing | Simple validation | Full test suite |
|
Deploy/Config | No deploy | Local run | Deploy + config + docs |
Keyword Triggers
Trigger regardless of step count when user explicitly requests:
- - "break down", "decompose", "plan", "checklist"
- "plan", "checklist", "todo", "track"
Session Binding
plan.md Records Session ID
CODEBLOCK3
Categorized Display After Wake
CODEBLOCK4
Interruption Recovery
Two Interruption Scenarios
| Scenario | Handling |
|---|
| Unexpected (network down, crash) | Check file modifications within 10 minutes |
| Manual Pause ("pause for now") |
Use
PAUSED status explicitly |
Progress Inference (Active Check)
- 1. Check git status - Uncommitted changes
- Check file modification time - Files within 10 minutes
- Compare task description - Keyword matching
- Identify task type - Code/Test/Deploy/Docs/General
- Ask user confirmation - Final confirmation
Recovery Flow
CODEBLOCK5
Consumption Mechanism
Status Flow
CODEBLOCK6
Execution Rules
- - Consume one task at a time
- Check off immediately upon completion INLINECODE8
- Skip and record if blocked
Concurrency Control
- - Only one active plan at a time
- When new task arrives: if incomplete plan exists → ask "Finish previous or create new?"
Destruction Mechanism
Archive Strategy
| Status | Retention | Action |
|---|
| COMPLETED | 7 days | Move to INLINECODE9 |
| PAUSED |
30 days | Ask user to continue or delete |
|
STALE (no update >14 days) | Immediate | Mark as
ABANDONED, wait for confirmation |
Cleanup Commands
CODEBLOCK7
Usage
Agent Workflow
Trigger Conditions
Automatically trigger PDCA when user:
- - Asks about incomplete tasks: "What's not done?", "What's pending?", "Any unfinished tasks?"
- Asks about progress: "How's it going?", "Progress check", "What's the status?"
- Asks about the plan: "What's the plan?", "Show me the plan"
- Submits a complex task (5+ steps)
- Explicitly requests: "break down", "create a plan", "make a checklist"
Plan Phase
- 1. Analyze steps with INLINECODE11
- If 5+ steps → create plan.md
- Output plan content to user
Do Phase
- 1. Execute tasks one by one
- After each task → update plan.md
- Report progress to user
Example:
CODEBLOCK8
Check Phase
- 1. When user asks "What's not done?" → run INLINECODE12
- Output incomplete plans with progress
- Example response:
CODEBLOCK9
Act Phase
- 1. Fix identified issues
- Archive completed plans
Create Plan
CODEBLOCK10
Update Status
CODEBLOCK11
Pause/Resume
CODEBLOCK12
Session Start Check
CODEBLOCK13
Progress Check
CODEBLOCK14
Scripts
| Script | Function |
|---|
| INLINECODE13 | Main management script (create/update/pause/resume/archive) |
| INLINECODE14 |
Progress check (git + file modification + keyword matching) |
|
analyze_steps.py | Step analysis (decide whether to plan) |
|
check_deps.py | Dependency check |
Configuration
Default workspace: ~/.openclaw/workspace/
Plan files: plan.md or plan-*.md
Archive directory: INLINECODE20
Security:
- - Only operates on
plan*.md files in the workspace - Does not modify non-plan files
- Archive/cleanup only affects
archive/ directory - Use
--dry-run to preview cleanup before deleting
计划-执行-检查-行动技能
该技能实现了PDCA(计划-执行-检查-行动)工作流程,确保任务被系统地规划和执行。
要求
- - Python 3.6+ - 所有脚本必需
- Git - 可选 - 仅用于进度追踪。PDCA无需Git也能完美运行——它将使用文件修改时间代替。
设置指南(首次使用)
安装后,运行设置向导:
bash
运行交互式设置
python3 scripts/setup.py
向导将:
- 1. 检查Python和Git依赖
- 创建工作区目录(默认:~/pdca-workspace)
- 创建测试计划
- 可选地初始化Git用于进度追踪
- 显示后续步骤
手动设置
如果你更喜欢手动设置:
bash
1. 创建工作区目录
mkdir -p ~/pdca-workspace
2. 创建测试计划
cd ~/pdca-workspace
manage_plan.py create 我的第一个计划 任务1 任务2 任务3
3. 验证是否正常工作
manage_plan.py check plan.md
4. (可选)设置Git用于进度追踪
git init
安全说明
- - 工作区范围: 仅操作配置的工作区目录中的plan*.md文件
- 破坏性操作: cleanup命令删除超过指定天数(默认7天)的归档文件
- 用户确认: 如果计划未完成,归档操作会提示确认
- 预演模式: 使用cleanup --dry-run在删除前预览
- 自主调用: 在清理/归档操作前应要求用户确认
核心流程
1. 计划
收到用户任务时,创建plan.md:
- - 将任务分解为可执行的子任务
- 记录会话ID
- 标记优先级和依赖关系
2. 执行
根据plan.md执行任务:
- - 勾选已完成的任务 [x]
- 标记进行中的任务为 [>]
- 记录执行过程中的问题
3. 检查
所有任务完成后:
- - 检查是否有遗漏项
- 验证输出是否符合预期
- 识别改进领域
4. 行动
基于检查结果:
- - 修复已识别的问题
- 用经验教训更新plan.md
- 归档或迭代
plan.md模板
markdown
任务计划:[任务名称]
会话: discord:1488795270769676318
创建时间: YYYY-MM-DD HH:MM
状态: 进行中 | 已完成 | 已暂停
当前任务
任务3 - 实现登录API(进行中)
检查清单
- - [x] 任务1 - 数据库设计
- [x] 任务2 - 用户模型创建
- [>] 任务3 - 实现登录API(进行中)
- [ ] 任务4 - 实现注册API
- [ ] 任务5 - 单元测试
备注
执行过程中的记录...
检查结果
完成后填写...
触发场景
核心逻辑:步骤分析
收到任务后,快速分析需要多少步骤:
1-2步 → 直接执行,无需计划
3-5步 → 可选计划(询问用户)
5步以上 → 自动触发PDCA
- - 构建一个包含注册和登录的完整用户系统
- 将这个项目从React重构到Vue
步骤分析维度
| 维度 | 1步 | 2-3步 | 5步以上 |
|---|
| 文件变更 | 单个文件 | 2-3个文件 | 多个模块/目录 |
| 依赖关系 |
无 | 简单 | 多层/顺序依赖 |
|
技术栈 | 单一技术 | 2种技术 | 全栈/多服务 |
|
测试 | 无需测试 | 简单验证 | 完整测试套件 |
|
部署/配置 | 无需部署 | 本地运行 | 部署+配置+文档 |
关键词触发
当用户明确要求时,无论步骤数量都触发:
- - 分解、拆分、计划、清单
- 计划、检查清单、待办、追踪
会话绑定
plan.md记录会话ID
markdown
会话: discord:1488795270769676318
唤醒后分类显示
当前会话未完成的计划:
- 1. plan.md - 用户系统开发(2/5)
其他会话未完成的计划:
- 2. plan-blog.md - 博客搭建(1/3)← telegram:123456
中断恢复
两种中断场景
| 场景 | 处理方式 |
|---|
| 意外中断(网络断开、崩溃) | 检查10分钟内的文件修改 |
| 手动暂停(先暂停) |
明确使用PAUSED状态 |
进度推断(主动检查)
- 1. 检查git状态 - 未提交的变更
- 检查文件修改时间 - 10分钟内的文件
- 比较任务描述 - 关键词匹配
- 识别任务类型 - 代码/测试/部署/文档/通用
- 询问用户确认 - 最终确认
恢复流程
唤醒 → 启动时 → 读取plan.md → 检查10分钟内的文件
↓
login_api.py 3分钟前修改过,继续?
消费机制
状态流转
已创建 → 进行中 → 已暂停 ↔ 已恢复 → 已完成 → 已归档
执行规则
- - 一次消费一个任务
- 完成后立即勾选 [x]
- 如果受阻则跳过并记录
并发控制
- - 一次只能有一个活跃计划
- 新任务到达时:如果存在未完成的计划 → 询问完成之前的还是创建新的?
销毁机制
归档策略
| 状态 | 保留时间 | 操作 |
|---|
| 已完成 | 7天 | 移动到 archive/plan-YYYY-MM-DD-任务名.md |
| 已暂停 |
30天 | 询问用户继续或删除 |
|
过期(超过14天无更新) | 立即 | 标记为已放弃,等待确认 |
清理命令
bash
归档已完成
manage_plan.py archive
清理过期文件(>7天)
manage_plan.py cleanup --days 7
列出所有计划
manage_plan.py list
使用说明
智能体工作流程
触发条件
当用户以下情况时自动触发PDCA:
- - 询问未完成任务:还有什么没做?、有什么待办?、有未完成的任务吗?
- 询问进度:进展如何?、进度检查、状态如何?
- 询问计划:计划是什么?、给我看看计划
- 提交复杂任务(5步以上)
- 明确要求:分解、创建计划、制作检查清单
计划阶段
- 1. 使用analyze_steps.py分析步骤
- 如果5步以上 → 创建plan.md
- 向用户输出计划内容
执行阶段
- 1. 逐一执行任务
- 每个任务完成后 → 更新plan.md
- 向用户报告进度
示例:
「✓ 任务1完成(数据库设计)
→ 开始任务2(用户模型创建)」
检查阶段
- 1. 当用户问还有什么没做? → 运行manage_plan.py on-start
- 输出未完成的计划及进度
- 示例回复:
「您有1个未完成的计划:
用户系统开发(2/5完成)
✓ 数据库设计
✓ 用户模型创建
○ 实现登录API(进行中)
○ 实现注册API
○ 单元测试
下一个任务:实现登录API」
行动阶段
- 1. 修复已识别的问题
- 归档已完成的计划
创建计划
bash
简单创建
manage_plan.py create 用户系统 数据库设计 用户模型 登录API
带会话
manage_plan.py create 用户系统 任务1 任务2 \
--session discord:1488795270769676318
指定输出文件
manage_plan.py create 博客搭建 购买域名 部署 \
--output plan-blog.md
更新状态
bash
完成任务1和2
manage_plan.py update