代码任务生成器:自动化 AI 编码工作流 - Openclaw Skills
作者:互联网
2026-04-14
什么是 代码任务生成器?
代码任务生成器是 Openclaw Skills 集合中不可或缺的补充,旨在弥合高层实施计划与细粒度、可执行任务之间的鸿沟。通过分析来自各种来源(包括直接文本、本地文件或产品设计文档 (PDD))的输入,该技能会自动将需求格式化为标准的 .code-task.md 格式。
该工具确保每项任务都包含关键上下文、技术约束以及 Given-When-Then 验收标准。无论您是手动工作还是使用自主智能体,该技能都能为高质量软件开发和跨 Openclaw Skills 工作流的一致输出提供必要的技术结构。
下载入口:https://github.com/openclaw/skills/tree/main/skills/paulpete/code-task-generator
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install code-task-generator
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 code-task-generator。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
代码任务生成器 应用场景
- 将模糊的功能描述转换为具有清晰边界的详细技术规范。
- 将 PDD 实施计划分解为顺序的分步文件夹和任务文件。
- 使用 Openclaw Skills 在开发团队中标准化验收标准,以实现更好的 QA。
- 为 Ralph 等智能体的自主实施准备结构化任务。
- 自动化在任务定义中包含单元测试要求,以确保测试驱动开发。
- 输入检测:该技能识别提供的输入是原始文本描述、本地文件路径还是复杂的 PDD 计划结构。
- 需求分析:解析输入以提取核心功能、技术领域、复杂程度和实施约束。
- 任务规划:智能体建议任务分解顺序和依赖图,在继续之前需要用户明确批准。
- 文件生成:获批后,生成带有 YAML 前置数据的标准 Markdown 格式 .code-task.md 文件。
- 集成:提供生成 PROMPT.md 文件的功能,以便 Ralph 开始自主执行新创建的任务。
代码任务生成器 配置指南
要在您的智能体环境中使用此功能,请确保工作区已初始化且智能体具有文件系统权限。
# 通过 AI 助手触发技能的示例
code-task-generator --input "我需要一个验证 API 密钥的函数" --task_name "api-auth"
对于基于 PDD 的工作流,请将输入指向您的设计文档,以发挥 Openclaw Skills 的全部威力:
code-task-generator --input "specs/auth-system/plan.md"
代码任务生成器 数据架构与分类体系
生成的任务使用带有 YAML 前置数据的标准 Markdown 架构进行生命周期跟踪。
| 组件 | 描述 |
|---|---|
| YAML 前置数据 | 跟踪状态(待处理/已开始/已完成)和创建日期。 |
| 参考文档 | 将任务链接到主要的 design.md 和相关研究。 |
| 技术要求 | 特定工程约束和目标的编号列表。 |
| 验收标准 | 使用 Given-When-Then 格式提供可衡量的成功指标。 |
| 元数据 | 标记复杂度(低/中/高)并识别所需的开发人员技能。 |
name: code-task-generator
description: Generates structured .code-task.md files from descriptions or PDD implementation plans. Auto-detects input type, creates properly formatted tasks with Given-When-Then acceptance criteria.
type: anthropic-skill
version: "1.1"
Code Task Generator
Overview
Generate structured code task files from rough descriptions or PDD implementation plans. Auto-detects input type and creates properly formatted .code-task.md files. For PDD plans, processes one step at a time to allow learning between steps.
Important Notes
These rules apply across ALL steps:
- User approval required: Present the task breakdown plan and get explicit approval before generating any files.
- Tests are integrated: Include unit test requirements in each task's acceptance criteria. Never create separate "add tests" tasks.
- PDD mode references: Always include the design document path as required reading. Only include research docs if directly relevant to the specific task.
Parameters
- input (required): Task description, file path, or PDD plan path
- step_number (optional, PDD only): Specific step to process. Auto-determines next uncompleted step if omitted.
- output_dir (optional, default:
specs/{task_name}/tasks/): Output directory for code task files - task_name (optional, description mode only): Override auto-generated task name
Constraints:
- You MUST ask for all required parameters upfront in a single prompt
- You MUST support input as: direct text, file path, directory path (looks for plan.md), or URL
Steps
1. Detect Input Mode
Check if input is a file with PDD plan structure (checklist + numbered steps). Set mode to "pdd" or "description" and inform the user.
2. Analyze Input
- PDD mode: Parse the plan, extract steps and checklist status, determine target step (from step_number or first uncompleted)
- Description mode: Identify core functionality, technical requirements, complexity level (Low/Medium/High), and technology domain
3. Structure Requirements
- PDD mode: Extract the target step's title, description, demo requirements, constraints, and integration notes with previous steps. Identify relevant research documents.
- Description mode: Identify functional requirements, infer technical constraints and dependencies.
For both modes: create measurable acceptance criteria in Given-When-Then format and prepare a task breakdown plan.
4. Plan Tasks
Present the proposed breakdown to the user:
- One-line summary per task
- Proposed sequence and dependencies
- You MUST NOT generate files until the user explicitly approves
5. Generate Tasks
Create files following the Code Task Format below.
PDD mode specifics:
- Create
step{NN}/folder (zero-padded: step01, step02, step10) - Name files sequentially:
task-01-{title}.code-task.md,task-02-{title}.code-task.md - Break down by functional components, not testing phases
All tasks:
- You MUST use the exact Code Task Format structure below
- You MUST include YAML frontmatter with
status: pending,created: YYYY-MM-DD,started: null,completed: null - You MUST use kebab-case names with
.code-task.mdextension - You MUST include acceptance criteria covering main functionality and unit tests
6. Report Results
List generated files with paths. For PDD mode, include the step's demo requirements. Suggest running code-assist on tasks in sequence, or using Ralph for autonomous implementation.
7. Offer Ralph Integration
Ask: "Would you like me to set up Ralph to implement these tasks autonomously?"
If yes, create a concise PROMPT.md with objective, spec directory reference, execution order, and acceptance criteria. Suggest the appropriate command:
- Full pipeline:
ralph run --config presets/pdd-to-code-assist.yml - Simpler flow:
ralph run --config presets/spec-driven.yml
Code Task Format Specification
Each code task file MUST follow this structure:
---
status: pending
created: YYYY-MM-DD
started: null
completed: null
---
# Task: [Task Name]
## Description
[What needs to be implemented and why]
## Background
[Context needed to understand the task]
## Reference Documentation
**Required:**
- Design: specs/{task_name}/design.md
**Additional References (if relevant to this task):**
- [Specific research document or section]
**Note:** Read the design document before beginning implementation.
## Technical Requirements
1. [First requirement]
2. [Second requirement]
## Dependencies
- [Dependency with details]
## Implementation Approach
1. [Implementation step or approach]
## Acceptance Criteria
1. **[Criterion Name]**
- Given [precondition]
- When [action]
- Then [expected result]
## Metadata
- **Complexity**: [Low/Medium/High]
- **Labels**: [Comma-separated labels]
- **Required Skills**: [Skills needed]
Examples
Description mode input: "I need a function that validates email addresses and returns detailed error messages"
Description mode output: specs/email-validator/tasks/email-validator.code-task.md — task with acceptance criteria for valid/invalid email handling, error messages, and unit tests.
PDD mode input: "specs/data-pipeline/plan.md"
PDD mode output: specs/data-pipeline/tasks/step02/ containing task-01-create-data-models.code-task.md, task-02-implement-validation.code-task.md, task-03-add-serialization.code-task.md — each with design.md reference, acceptance criteria, and demo requirements.
Troubleshooting
Vague description: Ask clarifying questions, suggest common patterns, create a basic task and offer to refine.
Complex description: Suggest breaking into smaller tasks, focus on core functionality first, offer to create related tasks.
Missing technical details: Make reasonable assumptions, include multiple approaches, note areas needing user decisions.
Plan file not found: Check if path is a directory (look for plan.md within), suggest common PDD plan locations.
Invalid plan format: Identify missing sections, suggest running PDD to generate a proper plan, extract what's available.
All steps complete: Inform user, ask if they want a specific step anyway, suggest reviewing for new steps.
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
Minecraft 3D 建造计划生成器:AI 场景架构师 - Openclaw Skills
Scholar Search:自动化文献搜索与研究简报 - Openclaw Skills
issue-to-pr: 自动化 GitHub Issue 修复与 PR 生成 - Openclaw Skills
接班交班总结器:临床 EHR 自动化 - Openclaw Skills
Teacher AI 备课专家:K-12 自动化教案设计 - Openclaw Skills
专利权利要求映射器:生物技术与制药 IP 分析 - Openclaw Skills
生成 Tesla 车身改色膜:用于 3D 显示的 AI 图像生成 - Openclaw Skills
Taiwan MD:面向台湾的 AI 原生开放知识库 - Openclaw Skills
自学习与迭代演进:AI Agent 成长框架 - Openclaw Skills
HIPC Config Manager: 安全的 API 凭据处理器 - Openclaw Skills
AI精选
