SuperAPI AI 工具集

prd-close

办公与效率

查看项目

更新于 10-16 07:30

技能介绍

用途

prd-close 用于关闭一个已经实现(在之前的工作或外部项目中完成)或不再需要的 PRD(产品需求文档)。该工作流会更新 PRD 状态、将其归档、更新 GitHub issue,并直接提交到 main 分支且不触发 CI。

何时使用

在以下情况使用 /prd-close:

  • PRD 功能已在单独项目或之前的工作中实现
  • PRD 不再相关(被取代、需求变更、超出范围)
  • PRD 需求已由现有功能满足
  • 本仓库无需新的代码实现

在以下情况不要使用 /prd-close:

  • 你刚刚完成 PRD 的实现(应使用 /prd-done)
  • PRD 有正在进行的实现工作
  • 存在需要作为 PR 一部分的未提交代码更改

使用方式

# 交互模式 - 会提示输入 PRD 编号和关闭原因
/prd-close

# 带 PRD 编号
/prd-close 20

# 带 PRD 编号和原因
/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 编号。

关闭原因类别:

  • Already Implemented:功能存在于外部项目或之前的工作中
  • No Longer Needed:需求变更、超出范围或被取代
  • Duplicate:另一个 PRD 覆盖了相同功能
  • Deferred:移至未来版本或不同项目

所需信息: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:提交并推送

使用 skip CI 直接提交更改到 main:

# 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 已用完整的关闭评论关闭
  • 更改已用 skip CI 标志提交到 main
  • 更改已推送到远程仓库

说明

  • 无需 PR:此工作流针对仅文档更改直接提交到 main
  • 跳过 CI:始终包含 [skip ci] 以避免不必要的 CI 运行
  • 完整文档:确保 issue 评论清楚解释关闭原因
  • 实现参考:链接到功能存在的外部项目、仓库或 PR
  • 差距确认:诚实说明已实现与缺失的内容