# 规格撰写 (spec)

> 分五个阶段逐轮追问，把模糊意图变成可直接执行的规格，并提交为 GitHub issue。

- 分类: [需求分析](https://www.myskills.tools/zh/categories/requirements/)
- 来源: 社区 · Garry Tan
- 代码仓库: https://github.com/garrytan/gstack/tree/main/spec (commit 3e4240a · v0.1.0)
- SKILL.md: https://github.com/garrytan/gstack/blob/main/spec/SKILL.md
- 安装命令: `npx skills add garrytan/gstack --skill spec`
- 许可证: MIT
- 兼容工具: Claude Code, Codex, Cursor, Copilot
- 权限: read-repo ✓, write-files ✗, shell ✓, network ✓
- 状态: 扫描通过
- 规则扫描无法覆盖所有风险，安装前请阅读此技能的 SKILL.md，确认权限后再使用。
- ⚠ 会在 GitHub 创建 issue，可能把规格发给 Codex 评分，使用 --execute 时会在新 git worktree 中启动 claude -p。

## 核心规则

绝不在第一条消息后就产出 issue：始终从第一阶段开始，且不提出实现方案。

## 执行阶段

1. **弄清原因** — 问清谁受影响、现状、期望行为、为何是现在、如何判定完成；默认用 gh issue list 查重。
2. **锁定范围** — 明确不做什么、涉及哪些系统、顺序约束、最小可交付版本以及失败与回滚方式。
3. **先读代码再追问** — 提问前先用 Grep、Glob 或 Read 查看代码并引用 path:line，再就数据模型、API、后台任务、UI、基础设施和测试提问。
4. **审阅草稿** — 展示完整 issue 草稿并询问哪里写错了，反复修改直到用户确认。
5. **质检并提交** — 依次做内容审查、强制脱敏扫描和 Codex 质量评分，然后提交 issue、本地存档，可选用 --execute 启动代理执行。

## 权限说明（据 SKILL.md 整理）

| 能力 | 是否需要 | 说明 |
|---|---|---|
| 文件写入 | 不需要 | allowed-tools 不含 Write/Edit，不修改项目代码；规格存档由其 shell 脚本写入本地状态目录。 |
| 命令执行 | 需要 | 运行 gh、gstack 辅助脚本、git worktree，以及在 --execute 时运行 claude -p。 |
| 网络外发 | 部分需要 | 通过 gh 访问 GitHub 查重和建 issue，并可调用 Codex 做质量评分。 |

## SKILL.md 头部信息（YAML）

```yaml
---
name: spec
preamble-tier: 3
version: 0.1.0
description: Turn vague intent into a precise, executable spec in five phases. (gstack)
allowed-tools:
  - Bash
  - Read
  - Grep
  - Glob
  - AskUserQuestion
triggers:
  - spec this out
  - file an issue
  - write up a ticket
  - turn this into an issue
  - make this a github issue
  - turn this into a backlog item
---
```

首页: https://www.myskills.tools/zh/ · URL: https://www.myskills.tools/zh/skills/spec/
