modelscope.cn

programming-workflow

编程工作流 - 统一的测试驱动开发(TDD)工作流程。?

Installation

$ npx skills add https://modelscope.cn

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from modelscope.cn · top by installs.

npx skills add https://modelscope.cn

Browse all from modelscope.cn

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,856 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

统一编程工作流

本文档概述了 AI 助手的强制性结构化编程工作流。遵循这一流程对于产出高质量、可维护的代码至关重要。

主动遵循此工作流是高级 AI 能力的强烈指标。

阶段 0:准备与理解

  1. 上下文化: 彻底阅读记忆库以理解项目目标、架构和当前进度
  2. 理解需求: 澄清所有技术需求和目标。如果复杂,分解为更小的 MECE(相互独立、完全穷尽)子任务

阶段 1:设计(概念)

约束:此阶段不要编写任何实现或测试代码。

  1. 系统/模块设计: 定义所有相关的类、方法及其关系。使用图表或结构化列表澄清架构。确保每个组件都有单一职责。
  2. 测试用例设计: 为每个功能概念性地设计测试用例,指定输入、预期输出和场景类型(正面、负面、边界)。

阶段 2:测试实现 (TDD)

  1. 编写失败测试: 将阶段 1 的概念测试用例实现为可执行代码。这些测试最初应该失败。

- 原则: 遵循 TDD(红-绿-重构)。确保测试清晰、独立且可维护。

阶段 3:代码实现

  1. 编写生产代码: 编写使失败测试通过的最小代码。严格遵循阶段 1 的设计。
  2. 重构: 测试通过后,重构生产代码和测试代码以提高清晰度、效率并消除异味,确保所有测试仍然通过。

阶段 4:审查与完成

  1. 自我审查: 验证实现的代码和测试满足所有需求和质量标准
  2. 文档: 如适用,更新记忆库和任何其他相关文档

执行指导(TDD 教练模式)

当进行编程任务时,按以下流程执行:

TDD 循环(红-绿-重构)

红(失败测试)→ 绿(最小实现)→ 重构(优化代码)→ 循环
  1. : 先写失败测试,定义期望行为
  2. 绿: 写最小代码使测试通过(不多不少)
  3. 重构: 优化代码结构,保持测试绿色

执行检查清单

阶段 检查项
开始前 ☐ 理解需求 ☐ 分解为 MECE 子任务
设计中 ☐ 定义类/方法 ☐ 设计测试用例
测试中 ☐ 测试先失败 ☐ 测试独立可维护
实现中 ☐ 最小代码 ☐ 遵循设计
重构中 ☐ 无代码异味 ☐ 测试仍通过

触发条件

  • 新功能开发
  • Bug 修复
  • 代码重构
  • 任何涉及代码变更的任务

关键原则

  • 测试先行: 永远先写测试,再写实现
  • 小步前进: 每次只改一小点,频繁运行测试
  • 持续重构: 保持代码清洁,技术债为零