Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions skills/issue-commit/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ allowed-tools:
读取 `references/commit-templates.md`,按模板格式生成 Conventional Commit + Emoji 消息。

- 消息格式:`<Emoji> <type>(<scope>): <subject>`
- subject 使用英文祈使句,首字母小写,句末不加句号
- subject 使用英文祈使句,首字母小写,句末不加句号;不要改成中文
- header 整行不超过 72 字符
- 当 `.issue-flow/issue.json` 存在时,footer 添加 `Refs #<N>`

Expand Down Expand Up @@ -102,7 +102,7 @@ allowed-tools:

- **时态**: 祈使句(`add feature` 而非 `added feature`)
- **简洁**: 第一行保持在 72 字符以内
- **commit message 使用英文**(遵循 CLAUDE.md 规则)
- **commit message 使用英文**(遵循 CLAUDE.md 规则,不使用中文

## 规则

Expand Down
11 changes: 6 additions & 5 deletions skills/issue-create/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ allowed-tools:

使用 AskUserQuestion 按以下结构逐项展示给用户,等待确认或修正:
- 标题(中文,简洁描述要交付的结果)
- 类型 → 对应 label
- 类型 → 对应默认 label
- 背景
- 验收标准(逐条列出)
- 范围(包含 / 不包含)
- bug 类还需:复现步骤、期望行为 vs 实际行为、环境信息

### 5. 起草 Issue

根据确认后的需求(manual)或收集的需求信息(auto),按类型选择 `references/templates.md` 中对应模板,填充内容后写入临时文件。优先使用 `Write` 写入 `mktemp` 创建的临时文件,避免依赖 shell 重定向。标题使用中文,不加前缀。类型与 label 的映射:
根据确认后的需求(manual)或收集的需求信息(auto),按类型选择 `references/templates.md` 中对应模板,填充内容后写入临时文件。优先使用 `Write` 写入 `mktemp` 创建的临时文件,避免依赖 shell 重定向。标题使用中文,不加前缀。创建时默认将 Issue 指派给当前登录用户(`@me`)。类型与默认 label 的映射:
- 新功能 → `enhancement`
- 缺陷修复 → `bug`
- 代码重构 → `refactor`
Expand All @@ -71,7 +71,7 @@ allowed-tools:
```bash
TMPFILE=$(mktemp /tmp/issue-draft.XXXXXX.md)
# 使用 Write 将起草的 Issue 内容写入 $TMPFILE
gh issue create --web --title "..." --label "..." --body-file "$TMPFILE"
gh issue create --web --title "..." --label "..." --assignee "@me" --body-file "$TMPFILE"
rm -f "$TMPFILE"
```

Expand All @@ -85,7 +85,7 @@ rm -f "$TMPFILE"
```bash
TMPFILE=$(mktemp /tmp/issue-draft.XXXXXX.md)
# 使用 Write 将起草的 Issue 内容写入 $TMPFILE
gh issue create --title "..." --label "..." --body-file "$TMPFILE"
gh issue create --title "..." --label "..." --assignee "@me" --body-file "$TMPFILE"
rm -f "$TMPFILE"
```

Expand All @@ -98,7 +98,8 @@ rm -f "$TMPFILE"

- Issue 标题和正文全部使用中文
- 标题表达结果,不加 `feat:`、`fix:` 等前缀
- 分类通过 `--label` 参数实现,不硬编码到标题
- 默认分类通过 `--label` 参数实现,不硬编码到标题
- 创建 Issue 时默认使用 `--assignee "@me"` 将其分配给自己
- 不要编造内容 — 严格从对话上下文和用户输入中推导
- 对话中的要点列表自动转换为验收标准
- 概述保持简洁(1-3 句)
Expand Down
19 changes: 12 additions & 7 deletions skills/issue-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ allowed-tools:
- Bash(gh pr create *)
- Bash(gh pr list --head *)
- Bash(gh issue view --comments *)
- Bash(gh issue view * --json *)
- Bash(mktemp *)
- Bash(rm *)
---
Expand Down Expand Up @@ -59,7 +60,7 @@ allowed-tools:
3. 当前分支已有的 PR(`gh pr list --head <branch>`)
4. `$ARGUMENTS` 中的 Issue 编号

提取到编号后,运行 `gh issue view <N> --comments` 读取 Issue 内容,用于生成标题和正文
提取到编号后,优先运行 `gh issue view <N> --json title,body,labels` 读取 Issue 标题、正文和 labels;如有必要再运行 `gh issue view <N> --comments` 补充上下文,用于生成 PR 标题、正文和默认 label

如果所有来源都无法提取:
- 提示用户手动提供 Issue 编号
Expand All @@ -73,9 +74,12 @@ allowed-tools:
### 5. 起草 PR 内容

1. 根据 `references/templates.md` 中的 PR 模板起草内容,优先使用 `Write` 写入 `mktemp` 创建的临时文件,避免依赖 shell 重定向
2. PR 标题概括当前分支的最终交付内容
2. PR 标题必须使用中文,概括当前分支的最终交付内容,不使用英文 Conventional Commits 格式
3. 如果已关联 Issue,在正文中加入 `Closes #N`
4. 变更说明必须严格来源于 `git diff`、提交记录和 Issue 内容,不编造
4. PR 正文必须使用中文
5. 如果已关联 Issue,默认继承 Issue 的首个 label 作为 PR label;如果未关联 Issue,则按变更类型推断默认 label:新功能→enhancement、缺陷修复→bug、代码重构→refactor、文档更新→documentation、工具/CI/构建→chore、性能优化→performance、依赖升级→dependencies
6. 创建时默认将 PR 指派给当前登录用户(`@me`)
7. 变更说明必须严格来源于 `git diff`、提交记录和 Issue 内容,不编造

### 6. 创建 PR

Expand All @@ -86,7 +90,7 @@ allowed-tools:
```bash
TMPFILE=$(mktemp /tmp/pr-draft.XXXXXX.md)
# 使用 Write 将 PR body 写入 $TMPFILE
gh pr create --web --title "..." --body-file "$TMPFILE"
gh pr create --web --title "..." --label "..." --assignee "@me" --body-file "$TMPFILE"
rm -f "$TMPFILE"
```
3. 使用 `--web` 让用户在浏览器中审核后手动提交
Expand All @@ -98,7 +102,7 @@ allowed-tools:
```bash
TMPFILE=$(mktemp /tmp/pr-draft.XXXXXX.md)
# 使用 Write 将 PR body 写入 $TMPFILE
gh pr create --title "..." --body-file "$TMPFILE"
gh pr create --title "..." --label "..." --assignee "@me" --body-file "$TMPFILE"
rm -f "$TMPFILE"
```

Expand All @@ -107,8 +111,9 @@ rm -f "$TMPFILE"
## 规则

- `issue-pr` 不负责 commit 规范、测试规范、review 流程和分支清理
- PR 标题和正文以仓库现有协作习惯为准
- PR 正文使用中文
- PR 标题和正文全部使用中文
- PR 创建时默认添加 label,并优先继承关联 Issue 的首个 label
- 创建 PR 时默认使用 `--assignee "@me"` 将其分配给自己
- 找到 Issue 时,正文应关联 Issue(`Closes #N`)
- 不自动 `git push`
- manual 模式下所有 GitHub 写操作使用 `--web` 由人工审核
Expand Down
4 changes: 3 additions & 1 deletion skills/issue-pr/references/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ Closes #<N>

附加规范:

- PR title 使用英文 Conventional Commits
- PR title 使用中文,概括最终交付结果,不使用英文 Conventional Commits
- PR body 使用中文描述变更
- 创建 PR 时默认添加 label;若已关联 Issue,优先继承该 Issue 的首个 label
- 创建 PR 时默认使用 `--assignee "@me"` 将其分配给自己
- 关联 Issue 时使用 `Closes #<N>`
- 本地开发中的 commit 如需关联 Issue,使用 `Refs #<N>`,不要使用 `Closes/Fixes #<N>`

Expand Down
35 changes: 35 additions & 0 deletions tests/skill-loading/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,41 @@ for skill_dir in "$SKILLS_DIR"/issue-*/; do
fi
done

echo ""
echo "=== Content Constraint Tests ==="

echo -n " issue-create: default label + assignee + Chinese ... "
if grep -q -- '--label' "$SKILLS_DIR/issue-create/SKILL.md" \
&& grep -q -- '--assignee "@me"' "$SKILLS_DIR/issue-create/SKILL.md" \
&& grep -q 'Issue 标题和正文全部使用中文' "$SKILLS_DIR/issue-create/SKILL.md"; then
echo "ok"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi

echo -n " issue-pr: default label + assignee + Chinese ... "
if grep -F -q -- '--label "..."' "$SKILLS_DIR/issue-pr/SKILL.md" \
&& grep -q -- '--assignee "@me"' "$SKILLS_DIR/issue-pr/SKILL.md" \
&& grep -q 'PR 标题和正文全部使用中文' "$SKILLS_DIR/issue-pr/SKILL.md"; then
echo "ok"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi

echo -n " issue-commit: commit message stays English ... "
if grep -q 'commit message 使用英文' "$SKILLS_DIR/issue-commit/SKILL.md" \
&& grep -q '不要改成中文' "$SKILLS_DIR/issue-commit/SKILL.md"; then
echo "ok"
PASS=$((PASS + 1))
else
echo "FAIL"
FAIL=$((FAIL + 1))
fi

echo ""
echo "=== Results: $PASS passed, $FAIL failed ==="

Expand Down