SuperAPI AI 工具集

alignfirst-coaching

编程与开发

查看项目

更新于 10-16 07:49

技能介绍

用途

AlignFirst Coaching 用于以“教练”角色编排编码智能体,围绕 AlignFirst 的 spec-plan-execute 或 AAD 工作流推进开发任务。使用该技能时,不应自行实现任何内容,也不应直接调查或修改代码库,职责是委派并引导智能体完成工作。

主要能力

该技能通过一个 CLI 脚本包装编码智能体 CLI(当前为 claude),以非交互方式调用 AlignFirst 协议,解析 JSON 响应,并将相关部分输出到 stdout。脚本路径相对于技能目录为 scripts/alignfirst-coaching.mjs,运行前需解析为绝对路径。例如,若 SKILL.md 位于 /home/user/.agents/skills/alignfirst-coaching/SKILL.md,则脚本位于 /home/user/.agents/skills/alignfirst-coaching/scripts/alignfirst-coaching.mjs。

支持的协议包括:spec、plan、aad、description、read、review、merge。

使用方式

应在被指导项目所在目录运行脚本,以便编码智能体在正确的仓库中工作。对于 --new 模式,输出以 Session ID: 行开头,需保存该 ID 以便后续恢复会话。

CLI 参考:

node scripts/alignfirst-coaching.mjs --new --protocol <protocol> --ticket <id> [--message "..."] node scripts/alignfirst-coaching.mjs --new --message "..." node scripts/alignfirst-coaching.mjs --resume <sessionId> [--protocol <protocol>] [--message "..."]

标志说明:

  • --new:开始新会话。
  • --resume <id>:继续已有会话。
  • --protocol:可选,取值为 spec、plan、aad、description、read、review、merge 之一。
  • --ticket <id>:工单 ID。在 --new 加 --protocol 时必填。
  • --message "...":要发送的消息。spec、aad 以及未指定 --protocol 时必填;其他协议可选。
  • --model <model>:可选,覆盖模型。

关键模式——无协议:未指定 --protocol 时,消息按原样发送(不调用 AlignFirst 斜杠命令)。用于:在已有会话中继续讨论(例如回答智能体提问);在新会话中执行已有计划文件;在新会话中向智能体提问。

示例:

node scripts/alignfirst-coaching.mjs --resume <sessionId> --message "Your answer" node scripts/alignfirst-coaching.mjs --new --message "Execute the plan: .plans/AB-123/A2-plan.md" node scripts/alignfirst-coaching.mjs --new --message "Explain how ... works in this project. Do not implement anything. We need to talk first."

注意:当使用 --new 且不带协议进行提问或讨论(而非执行计划)时,智能体默认会尝试实现内容,因此消息结尾应加上明确约束,例如:“Do not implement anything. We need to talk first.”

Spec-Plan-Execute 工作流

默认工作流。除非常微不足道的任务外,始终从它开始。

步骤 1——创建 spec:

node scripts/alignfirst-coaching.mjs --new --protocol spec --ticket AB-123 --message "Description of the feature or task"

智能体调查代码库并回复其发现和问题。保存输出中的会话 ID。在智能体满意并写出 spec 文件之前,可能需要进行多轮往返——参见“回答智能体提问”。

步骤 2——请求计划:

spec 写好后,在同一会话中请求计划:

node scripts/alignfirst-coaching.mjs --resume <sessionId> --protocol plan

智能体写出计划文件(例如 .plans/AB-123/A2-plan.md),并在输出中提供其路径。此阶段智能体很少提问。

步骤 3——执行计划:

启动新会话执行计划:

node scripts/alignfirst-coaching.mjs --new --message "Execute the plan: .plans/AB-123/A2-plan.md"

智能体实现计划并写出摘要文件(例如 .plans/AB-123/A2-plan.summary.md),并在输出中提供其路径。

步骤 4——提交:

spec 文件顶部附近包含建议的提交信息,用它进行本地提交。

轻量工作流(AAD)

适用于可一次性完成的简单变更——例如移动按钮或调整颜色——或执行计划后的后续调整。智能体调查、讨论,然后直接实现——全部在一个会话中完成。

步骤 1——启动 AAD 会话:

node scripts/alignfirst-coaching.mjs --new --protocol aad --ticket AB-123 --message "Description of the task"

与 spec 工作流类似,智能体调查代码库并提问。保存会话 ID。以相同方式回答问题——参见“回答智能体提问”。

对齐后,智能体实现变更并写出摘要文件(例如 .plans/AB-123/A1-AAD.summary.md),并在输出中提供其路径。

步骤 2——提交:

摘要文件包含建议的提交信息。与 spec 工作流一样进行本地提交。

Description

为已提交的工作生成 PR/MR 描述。无讨论——智能体读取变更并写出描述文件。

node scripts/alignfirst-coaching.mjs --new --protocol description --ticket AB-123

智能体写出包含描述的 markdown 文件,并在输出中提供其路径。

Read(加载上下文)

将某工单的 spec 和摘要文件加载到智能体上下文中。不带 --message 时,智能体描述该工单已完成的工作。带 --message 时,它在一次调用中先加载上下文再处理消息——适合就先前工作提问。

node scripts/alignfirst-coaching.mjs --new --protocol read --ticket AB-123 node scripts/alignfirst-coaching.mjs --new --protocol read --ticket AB-123 --message "Did we propagate the changes in ...? Do not implement anything. We need to talk first."

Review(代码审查)

将当前分支与基础分支对比审查,并写出审查报告。

node scripts/alignfirst-coaching.mjs --new --protocol review --ticket AB-123

智能体写出审查文件(例如 .plans/AB-123/A3-review.md),并在输出中提供其路径。

Merge

解决合并或变基冲突,并总结棘手的解决方案。给定传入分支时也可启动合并。

冲突已存在时:

node scripts/alignfirst-coaching.mjs --new --protocol merge --ticket AB-123

合并尚未开始时,通过 --message 传入传入分支:

node scripts/alignfirst-coaching.mjs --new --protocol merge --ticket AB-123 --message "Merge main into the current branch."

发生冲突时,智能体写出摘要文件(例如 .plans/AB-123/A4-merge.summary.md)并提供其路径。干净合并时不写摘要。

回答智能体提问

在 spec 和 AAD 会话中,智能体在继续前会提问。不带协议恢复会话以回答:

node scripts/alignfirst-coaching.mjs --resume <sessionId> --message "Your answer here"

在智能体满意之前可能有多轮往返。

智能体常一次提出多个问题。在单条消息中全部回答,并按编号对应:

node scripts/alignfirst-coaching.mjs --resume <sessionId> --message
"1 - Explore the codebase to find out, and give me your opinion. 2 - Is that a good design? We need the cleanest code possible. 3 - We checked with the team: yes, it should be optional."

技术问题与功能问题——这一点至关重要。

技术问题——架构、代码模式、现有行为、实现细节。任何可通过阅读代码回答的问题:“X 是否在别处使用?”“Y 如何工作?”“我们是否应移除 Z?”“……的最佳方法是什么?”

绝不要将这些升级给用户。推动智能体自行调查和思考。示例回复:

“Explore the codebase to find out, and give me your opinion.”

“Do not rush. Take the time to fully understand the situation first.”

“What would be the most elegant and proper way to do it?”

“Is that a good design? We need the cleanest code possible.”

“If it is a better design, then yes. If you're not sure, take the time to investigate more.”

“Check if a similar pattern is already implemented elsewhere in the codebase.”

功能或 UX 问题——产品行为、面向用户的决策、业务规则。这些需要人工判断。升级给你的用户,然后转达其回答。

如有疑问,先让智能体调查。只有当问题确实无法从代码库回答时,才升级给用户。

适用场景

适用于通过编码智能体推进开发任务的场景,包括:编写功能规范、制定实现计划、执行计划、生成 PR/MR 描述、加载工单上下文、代码审查、解决合并冲突,以及简单变更的轻量 AAD 流程。

限制

作为教练使用时,不得自行实现任何内容,也不得直接调查或修改代码库。脚本当前包装的编码智能体 CLI 为 claude。其他模型或平台支持情况暂未提供。收费、价格等信息暂未提供。