关于 prd-close
prd-close 是用于关闭已实现或不再需要的 PRD 的工作流技能,指导用户更新并归档文档、关闭关联议题,以及提交文档变更。
主要功能
- 01确定 PRD 和关闭原因
- 02与用户确认关闭条件
- 03更新并归档 PRD
- 04更新并关闭代码托管议题
- 05跳过 CI 提交变更
适用场景
- 01关闭已在其他项目实现的 PRD
- 02归档重复或已被取代的 PRD
- 03关闭需求已变更的 PRD
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ vtmocanu/ skills --skill prd-close安装后在 Claude Code 中输入/prd-close确认已加载。
详细介绍
从 vfarcic/dot-ai
shared-prompts/prd-close.md移植而来(MIT,版权所有 (c) 2025 Viktor Farcic)。原作者:Viktor Farcic。
关闭 PRD
关闭已实现(在之前的工作或外部项目中)的 PRD,或不再需要的 PRD。此工作流会更新 PRD 状态、将其归档、更新 GitHub issue,并直接提交到 main,且不会触发 CI。
何时使用此命令
在以下情况使用 /prd-close:
- ✅ PRD 功能已在单独的项目或之前的工作中实现
- ✅ PRD 已不再相关(已被取代、需求变更或超出范围)
- ✅ 现有功能已满足 PRD 的要求
- ✅ 此仓库不需要实现新代码
以下情况不要使用 /prd-close:
- ❌ 你刚完成 PRD 的实现(请改用
/prd-done) - ❌ PRD 仍有正在进行的实现工作
- ❌ 存在尚未提交、且需要纳入 PR 的代码变更
用法
# Interactive mode - will prompt for PRD number and closure reason
/prd-close
# With PRD number
/prd-close 20
# With PRD number and reason
/prd-close 20 "Already implemented by dot-ai-controller"
与代码托管平台无关:下面的 gh 命令仅为 GitHub 示例。根据 git remote get-url origin 检测代码托管平台,并使用对应的 CLI,将每个动词映射到相应的命令:GitHub → gh;GitLab → glab(PR 称为 merge request,使用 glab mr …);Forgejo/Gitea → tea。如果缺少所需的 CLI,请告知用户并提供其安装页面链接。
工作流步骤
步骤 1:确定 PRD 和原因
如果未提供 PRD 编号:
- 检查对话上下文中近期有关 PRD 的讨论
- 检查 git 分支是否包含 PRD 标识(例如,
feature/prd-X) - 如果无法确定,请询问用户 PRD 编号
关闭原因类别:
- 已实现:功能已存在于外部项目或之前的工作中
- 不再需要:需求已变更、超出范围或已被取代
- 重复:另一个 PRD 涵盖了相同功能
- 已延期:已移至未来版本或其他项目
所需信息:
- PRD 编号
- 关闭原因(简要说明)
- 实现参考(如果已实现):仓库、PR 或文档的链接
步骤 2:读取并验证 PRD
从 prds/[number]-*.md 读取当前 PRD 文件:
验证检查:
- PRD 文件存在且可读取
- 向用户确认是否应关闭此 PRD
- 根据 PRD 内容核实关闭原因是否合理
- 询问用户是否有实现证据(如果是“已实现”)
向用户展示 PRD 摘要:
## PRD #X: [Title]
**Status**: [Current Status]
**Created**: [Date]
**Summary**: [Brief description of what PRD requested]
**Proposed Action**: Close as [reason]
**Implementation Reference**: [If applicable]
Proceed with closure? (yes/no)
步骤 3:更新 PRD 文件
更新 PRD 元数据:
元数据更新:
**Status**: Complete [or] No Longer Needed [or] Duplicate
**Last Updated**: [Current Date]
**Completed**: [Current Date] [or] **Closed**: [Current Date]
步骤 4:将 PRD 移至归档目录
将 PRD 文件移至 done 目录并更新路线图:
git mv prds/[number]-[name].md prds/done/
注意:如果移动失败,因为 prds/done/ 不存在,请使用 mkdir -p prds/done 创建该目录,然后重试。
更新 ROADMAP.md(如果存在):
- 检查
docs/ROADMAP.md是否存在 - 从路线图中移除已关闭的 PRD(搜索“PRD #[number]”)
- 移除引用此 PRD 的整行
- 已关闭的 PRD 不应出现在未来的路线图中,因为它们已不再处于开发中
步骤 5:更新 GitHub Issue
暂时重新打开 issue 以进行更新:
gh issue reopen [number]
使用新的 PRD 路径和状态更新 issue 描述:
gh issue edit [number] --body "$(cat <<'EOF'
## PRD: [Title]
**Problem**: [Original problem statement]
**Solution**: [Original solution statement]
**Detailed PRD**: See [prds/done/[number]-[name].md](./prds/done/[number]-[name].md)
**Priority**: [Original Priority]
**Status**: ✅ **[COMPLETE/CLOSED]** - [Brief reason]
EOF
)"
步骤 6:关闭 GitHub Issue
添加完整的关闭评论,然后关闭 issue:
gh issue close [number] --comment "$(cat <<'EOF'
## ✅ PRD #[number] Closed - [Reason Category]
[Detailed explanation of why PRD is being closed]
### [If "Already Implemented"]
**Implementation Details**
This PRD requested [functionality]. **All core requirements are satisfied** by [implementation reference].
| Requirement | Implementation | Status |
|-------------|----------------|--------|
| [Requirement 1] | [Where implemented] | ✅ Complete |
| [Requirement 2] | [Where implemented] | ✅ Complete |
**Implementation Reference**: [Link to project/repo/PR]
[If there are gaps]
**Not Implemented** (deferred or out of scope):
- [Feature X] - [Why not needed or deferred]
### [If "No Longer Needed"]
**Reason for Closure**
[Explain why requirements changed, what superseded this, or why it's out of scope]
**Alternative Approach**: [If applicable]
[What replaced this PRD or how needs are met differently]
### Files
**PRD Location**: `prds/done/[number]-[name].md`
**Status**: [Complete/Closed]
**Closed**: [Date]
EOF
)"
步骤 7:提交并推送
将变更直接提交到 main,并跳过 CI:
# Stage all changes
git add .
# Verify what will be committed
git status
# Commit with skip CI flag
git commit -m "docs(prd-[number]): close PRD #[number] - [brief reason] [skip ci]
- Moved PRD to prds/done/ directory
- Updated PRD status to [Complete/Closed]
- Updated GitHub issue description with new path
- [Implementation details or reason]
Closes #[number]"
# Pull latest and push to remote
git pull --rebase origin main && git push origin main
重要事项:
- 始终使用
[skip ci]标记,避免文档变更触发不必要的 CI 运行 - 添加 issue 引用(
Closes #[number]),将提交关联到 issue
示例场景
示例 1:已在外部项目中实现
/prd-close 20 "Implemented by dot-ai-controller"
关闭评论:
## ✅ PRD #20 Closed - Already Implemented
This PRD requested proactive Kubernetes cluster monitoring with AI-powered remediation.
**Core functionality (60-80%) is already implemented** by the separate
[dot-ai-controller](https://github.com/vfarcic/dot-ai-controller) project.
| Requirement | Implementation | Status |
|-------------|----------------|--------|
| Continuous health checks | Event-based monitoring via K8s events | ✅ Complete |
| Intelligent alerting | Slack notifications with AI analysis | ✅ Complete |
| Automated remediation | Automatic/manual modes with confidence thresholds | ✅ Complete |
| Anomaly detection | AI-powered event analysis | ✅ Complete |
**Not Implemented** (advanced features, may be future PRD):
- Continuous metrics monitoring (Prometheus-style)
- Predictive analytics with baseline learning
- Multi-channel alerting (email, PagerDuty)
示例 2:重复的 PRD
/prd-close 45 "Duplicate of PRD #44"
关闭评论:
## 🔄 PRD #45 Closed - Duplicate
This PRD covers the same functionality as PRD #44. Consolidating all work
under PRD #44 to avoid fragmentation.
**Action**: Continue work on PRD #44 instead.
示例 3:不再需要
/prd-close 12 "Requirements changed, out of scope"
关闭评论:
## ⏸️ PRD #12 Closed - No Longer Needed
After discussion, this approach no longer aligns with project direction.
Requirements have evolved and this PRD is out of scope.
**Alternative Approach**: Using [different solution/approach] instead.
成功标准
✅ PRD 文件已更新,包含完成/关闭元数据
✅ PRD 已归档至 prds/done/ 目录
✅ GitHub issue 已更新,包含新的 PRD 路径
✅ GitHub issue 已关闭,并附上全面的关闭评论
✅ 更改已提交至 main,并带有跳过 CI 标记
✅ 更改已推送至远程仓库
备注
- 无需 PR:此工作流会将仅涉及文档的更改直接提交至 main
- 跳过 CI:始终包含
[skip ci],以避免不必要的 CI 运行 - 全面记录:确保 issue 评论清楚说明关闭原因
- 实现参考:链接到已实现相关功能的外部项目、代码仓库或 PR
- 承认差距:如实说明已实现的内容与缺失的内容