Skip to content

feat(skill): prepare-pr スキル新設 (PR-D、試験運用) - #59

Merged
aloekun merged 1 commit into
masterfrom
feat/prepare-pr-skill
Apr 19, 2026
Merged

feat(skill): prepare-pr スキル新設 (PR-D、試験運用)#59
aloekun merged 1 commit into
masterfrom
feat/prepare-pr-skill

Conversation

@aloekun

@aloekun aloekun commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • .claude/skills/prepare-pr/SKILL.md 新規 (178 行、試験運用ステータス)
  • ADR-028 (外部可視成果物の生成コマンドの実行ゲート) の運用フローを skill として明文化
  • 7 ステップ構成: status 確認 → title/body 初稿 → AskUserQuestion 明示承認 → pnpm prepare-pr-body → pnpm create-pr → cleanup
  • docs/todo.md: 「セッション 247510ea 由来: 整備タスク群」ブロック全体を削除 (PR-A〜PR-D で完了)

Context

セッション 247510ea (2026-04-18) 由来の整備タスクの最終 PR (PR-D)。
PR-A (#56, ADR 集約) / PR-B (#57, permissions.ask + body helper) / PR-C (#58, lib-jj-helpers) と連動し、
ADR-028 の二層防衛 (skill の AskUserQuestion = 一次 + permissions.ask = 二次) を運用に落とし込む。

Design highlights

  • user-supplied text の尊重 (ADR-022): 承認済 draft の二重書き換えを禁止
  • automated actor から独立: takt / cli-* の自律ループからは呼ばない
  • body は必ず一時ファイル経由: .tmp-pr-body.md 経由で切り詰めリスク回避 (PR fix(cli-pr-monitor): --body 複数行引数の再結合 #51 対策)
  • dogfooding: 本 PR 自身が skill の Step 1-6 フローで作成される

Validation

  • pre-push-review APPROVED (1 iter, 3m 35s)
  • skill-sync-check: グローバル skill (~/.claude/skills/) に prepare-* 衝突なし
  • skill frontmatter (name, description) 形式を既存 skill (analyze-pr 等) と揃え済

References

Summary by CodeRabbit

  • ドキュメント
    • 新しい対話型の PR 作成スキル仕様を追加しました(PR 作成手順、検証基準、明示的承認フローなどを規定)。
  • その他
    • 進行中タスク一覧から該当の PR-D セクションを削除し、タスク番号を調整しました。

@coderabbitai

coderabbitai Bot commented Apr 19, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@aloekun has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 45 minutes and 46 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 45 minutes and 46 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 546d76ba-0e4a-489e-b1a7-59a53368113c

📥 Commits

Reviewing files that changed from the base of the PR and between 2c344b6 and d53c63f.

📒 Files selected for processing (2)
  • .claude/skills/prepare-pr/SKILL.md
  • docs/todo.md
📝 Walkthrough

Walkthrough

.claude/skills/prepare-pr/SKILL.md を新規追加し、pnpm push 後の対話式 PR 作成ワークフロー(前提条件、検証手順、タイトル/本文生成、明示的ユーザー承認、pnpm create-pr 実行、クリーンアップ、設計ルール)を仕様化。併せて docs/todo.md の該当タスク節を削除し目次番号を調整した。

Changes

Cohort / File(s) Summary
新規スキルドキュメント
​.claude/skills/prepare-pr/SKILL.md
prepare-pr 対話型ワークフロー仕様を追加。前提条件、順序化された実行フロー(リポジトリ状態確認 → PR タイトル草案 → PR 本文草案 → 明示的ユーザー承認(必須)→ 一時ファイル作成と pnpm create-pr 実行→ 成功時のみ一時ファイル削除)、設計原則とアンチパターンを定義。
タスク進捗更新
docs/todo.md
セッション 247510ea に由来する「PR-D(prepare-pr)」関連の最優先タスクセクション一式を削除。以降セクション番号を繰り上げて調整。

Sequence Diagram(s)

sequenceDiagram
participant User
participant Skill as prepare-pr skill
participant JJ as jj (VCS)
participant PNPM as pnpm helpers
participant Harness as permissions/harness
participant Remote as Remote (PR host)

User->>Skill: 起動 (pnpm push 後)
Skill->>JJ: `jj status` / `jj log` で状態検証
JJ-->>Skill: ブックマーク/diff 情報
Skill->>Skill: PR タイトル草案を作成(最新コミットの1行目)
Skill->>Skill: `master..@` から PR 本文草案を作成
Skill->>User: AskUserQuestion(承認/編集/キャンセル、必須)
alt User approves
    Skill->>PNPM: `pnpm prepare-pr-body` ← 本文を stdin で書込、一時ファイル生成
    PNPM-->>Skill: 一時ファイルパス
    Skill->>Harness: permissions.ask(ハーネスの確認を要請)
    Harness-->>Skill: 承認
    Skill->>PNPM: `pnpm create-pr --body-file=<path>`(フォアグラウンド実行)
    PNPM->>Remote: PR 作成リクエスト
    Remote-->>PNPM: PR 作成成功/失敗
    alt 成功
        Skill->>PNPM: 一時ファイルを削除
    else 失敗
        Skill-->>User: 失敗報告(ファイルは残す)
    end
else User edits or cancels
    Skill-->>User: 編集再提出またはキャンセル処理
end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトル「feat(skill): prepare-pr スキル新設 (PR-D、試験運用)」は、新規スキル .claude/skills/prepare-pr/SKILL.md の追加と試験運用ステータスを明確に示しており、プルリクエストの主要な変更内容を正確に反映しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aloekun

aloekun commented Apr 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 19, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@aloekun

aloekun commented Apr 19, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 19, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/skills/prepare-pr/SKILL.md:
- Line 35: The markdown link target `scripts/prepare-pr-body.ps1` in SKILL.md is
using the wrong relative path and breaks the internal link; update that link
target to the repository-root relative path (e.g. /scripts/prepare-pr-body.ps1)
so the markdown link correctly points to the scripts/prepare-pr-body.ps1 file
from the document location.
- Around line 113-117: Replace the Bash heredoc examples with PowerShell
here-strings: change the block that starts with "cat <<'EOF' | pnpm
prepare-pr-body" to use PowerShell @' ... '@ piped to pnpm prepare-pr-body,
update the "pnpm create-pr --title '<approved title>' --body-file .tmp-pr-body"
example block to be labeled and formatted as PowerShell, and convert the cleanup
example that references "pnpm prepare-pr-body:cleanup" to PowerShell formatting
as well; ensure you replace the three bash code fences (the cat <<'EOF'
invocation, the pnpm create-pr invocation, and the pnpm prepare-pr-body:cleanup
fence) with PowerShell here-string equivalents and matching fenced blocks so
they run when CLAUDE_CODE_USE_POWERSHELL_TOOL is enabled.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0bf5ca5-dee2-4c02-8897-fe24f9c278e9

📥 Commits

Reviewing files that changed from the base of the PR and between 027b8d4 and 9f1c157.

📒 Files selected for processing (2)
  • .claude/skills/prepare-pr/SKILL.md
  • docs/todo.md

Comment thread .claude/skills/prepare-pr/SKILL.md Outdated
Comment on lines +113 to +117
```bash
cat <<'EOF' | pnpm prepare-pr-body
<approved PR body content>
EOF
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify 1) PowerShell tool is enabled 2) skill doc still contains Bash heredoc example
rg -n "CLAUDE_CODE_USE_POWERSHELL_TOOL|permissions" .claude/settings.json -C2
rg -n "cat <<'EOF' \\| pnpm prepare-pr-body" .claude/skills/prepare-pr/SKILL.md -C2

Repository: aloekun/claude-code-hook-test

Length of output: 303


🏁 Script executed:

# Check full context around the problematic section and look for other shell examples
sed -n '100,130p' .claude/skills/prepare-pr/SKILL.md

# Look for other bash/shell code blocks in the file
rg -n "^\`\`\`(bash|sh)" .claude/skills/prepare-pr/SKILL.md

Repository: aloekun/claude-code-hook-test

Length of output: 903


🏁 Script executed:

# Get the content of all bash code blocks in the file
sed -n '113,140p' .claude/skills/prepare-pr/SKILL.md

Repository: aloekun/claude-code-hook-test

Length of output: 619


PowerShell 環境での Bash heredoc は実行不可です。すべてのシェル例を PowerShell 互換に更新してください。

.claude/settings.jsonCLAUDE_CODE_USE_POWERSHELL_TOOL: "1" が有効なため、ドキュメント内の Bash コード例(lines 113–135)はそのままでは実行できません。以下の 3 つのコード ブロックをすべて PowerShell ここ文字列構文に変換する必要があります:

  • Line 113–116: cat <<'EOF' | pnpm prepare-pr-body → PowerShell @' '@ | pnpm prepare-pr-body
  • Line 123–125: pnpm create-pr --title ...
  • Line 133–135: pnpm prepare-pr-body:cleanup
PowerShell への変換例
-```bash
-cat <<'EOF' | pnpm prepare-pr-body
+```powershell
+@'
 <approved PR body content>
-EOF
-```
+'@ | pnpm prepare-pr-body
+```
-```bash
-pnpm create-pr --title '<approved title>' --body-file .tmp-pr-body.md
-```
+```powershell
+pnpm create-pr --title '<approved title>' --body-file .tmp-pr-body.md
+```
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/prepare-pr/SKILL.md around lines 113 - 117, Replace the Bash
heredoc examples with PowerShell here-strings: change the block that starts with
"cat <<'EOF' | pnpm prepare-pr-body" to use PowerShell @' ... '@ piped to pnpm
prepare-pr-body, update the "pnpm create-pr --title '<approved title>'
--body-file .tmp-pr-body" example block to be labeled and formatted as
PowerShell, and convert the cleanup example that references "pnpm
prepare-pr-body:cleanup" to PowerShell formatting as well; ensure you replace
the three bash code fences (the cat <<'EOF' invocation, the pnpm create-pr
invocation, and the pnpm prepare-pr-body:cleanup fence) with PowerShell
here-string equivalents and matching fenced blocks so they run when
CLAUDE_CODE_USE_POWERSHELL_TOOL is enabled.

@aloekun
aloekun force-pushed the feat/prepare-pr-skill branch from 9f1c157 to 2c344b6 Compare April 19, 2026 06:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
.claude/skills/prepare-pr/SKILL.md (1)

113-117: ⚠️ Potential issue | 🟠 Major

PowerShell 前提環境とコード例のシェルが不一致です。

この skill は pnpm prepare-pr-body / pnpm create-pr を実行手順として提示していますが、該当コード例が Bash 前提のため、PowerShell 運用でそのまま実行できません。cat <<'EOF' は PowerShell 互換の here-string に置き換えてください。過去レビューと同種の未解消事項です。
Based on learnings: The cli-pr-monitor tool in aloekun/claude-code-hook-test is Windows-only. Hardcoded .exe suffixes are intentional. Cross-platform support is not required.

#!/bin/bash
# Verify shell examples and tool-mode assumptions in the current branch
rg -n "CLAUDE_CODE_USE_POWERSHELL_TOOL|permissions\\.ask" .claude/settings.json -C2
rg -n "^```bash$|cat <<'EOF'|pnpm create-pr --title|pnpm prepare-pr-body:cleanup" .claude/skills/prepare-pr/SKILL.md -C2
🔧 提案パッチ
-```bash
-cat <<'EOF' | pnpm prepare-pr-body
+```powershell
+@'
 <approved PR body content>
-EOF
-```
+'@ | pnpm prepare-pr-body
+```

-```bash
+```powershell
 pnpm create-pr --title '<approved title>' --body-file .tmp-pr-body.md

-bash +powershell
pnpm prepare-pr-body:cleanup

Also applies to: 123-125, 133-135

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/prepare-pr/SKILL.md around lines 113 - 117, Replace the Bash
here-doc examples with PowerShell-compatible here-strings: change the "cat
<<'EOF' | pnpm prepare-pr-body" example to use a PowerShell here-string format
like @' ... '@ | pnpm prepare-pr-body and update the surrounding code fences
from ```bash to ```powershell; do the same conversion for the other examples
that reference "pnpm create-pr --title" and "pnpm prepare-pr-body:cleanup" so
all three snippets use PowerShell fences and @'... '@ piping to the pnpm
commands instead of the Bash-style cat <<'EOF'.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/skills/prepare-pr/SKILL.md:
- Around line 47-51: The fenced code blocks containing the jj commands (the
block with "jj status" / "jj log -r 'master..@' ..." and the similar block at
lines 62-64) need a language tag to satisfy markdownlint MD040; update those
fenced code blocks by adding a language identifier like "bash" (e.g., replace
``` with ```bash) so the blocks are properly annotated for linting and
readability.

---

Duplicate comments:
In @.claude/skills/prepare-pr/SKILL.md:
- Around line 113-117: Replace the Bash here-doc examples with
PowerShell-compatible here-strings: change the "cat <<'EOF' | pnpm
prepare-pr-body" example to use a PowerShell here-string format like @' ... '@ |
pnpm prepare-pr-body and update the surrounding code fences from ```bash to
```powershell; do the same conversion for the other examples that reference
"pnpm create-pr --title" and "pnpm prepare-pr-body:cleanup" so all three
snippets use PowerShell fences and @'... '@ piping to the pnpm commands instead
of the Bash-style cat <<'EOF'.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c5a69332-65fd-44e6-ad61-39d5f5192b22

📥 Commits

Reviewing files that changed from the base of the PR and between 9f1c157 and 2c344b6.

📒 Files selected for processing (2)
  • .claude/skills/prepare-pr/SKILL.md
  • docs/todo.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/todo.md

Comment thread .claude/skills/prepare-pr/SKILL.md Outdated
ADR-028 (外部可視成果物の生成コマンドの実行ゲート) の運用フローを skill として明文化。

`pnpm push` 完了後の PR 作成で以下の 7 ステップを標準化する:

1. jj status + jj log -r master..@ で差分/bookmark 確認
2. commit description から PR title 初稿生成 (70 文字超は短縮、conventional prefix 維持)
3. diff + commit log から PR body 初稿生成 (Summary/Context/Validation/References)
4. Claude が提示 → AskUserQuestion で明示承認 (auto mode でも必須)
5. `pnpm prepare-pr-body` 経由で `.tmp-pr-body.md` に書き出し
6. `pnpm create-pr --title ... --body-file ...` foreground 実行 (permissions.ask で再確認)
7. `pnpm prepare-pr-body:cleanup` で一時ファイル削除

## 設計ハイライト

- **ADR-028 二層防衛の活用**: skill 内の AskUserQuestion (一次) + permissions.ask (二次)
- **user-supplied text の尊重** (ADR-022): 承認済 draft の二重書き換えを禁止
- **body は必ず一時ファイル経由**: `--body "..."` 引数経由の切り詰めリスク回避 (PR #51 / memory `feedback_pnpm_create_pr_body.md`)
- **automated actor から独立**: takt / cli-* の自律ループはこの skill を呼ばない

## ステータス

試験運用 (2026-04-19〜)。発火頻度・UX を半年観察して正式採用 / 改良 / 廃止を判断する。

## ファイル

- `.claude/skills/prepare-pr/SKILL.md` 新設 (178 行)

## docs/todo.md

- PR-D 完了に伴い「セッション 247510ea 由来: 整備タスク群」ブロック全体を削除
- 雑務 task をリナンバー (#8#7)

refs: ADR-028, ADR-022, PR #57 (PR-B body helper), memory `feedback_bookmark_auto_naming.md`
@aloekun
aloekun force-pushed the feat/prepare-pr-skill branch from 2c344b6 to d53c63f Compare April 19, 2026 06:24
@aloekun
aloekun merged commit 1331611 into master Apr 19, 2026
1 check passed
@aloekun
aloekun deleted the feat/prepare-pr-skill branch April 19, 2026 07:00
aloekun added a commit that referenced this pull request May 29, 2026
…ndle CR-RL 採用 3 件 (#183)

* docs(todo): PR #182 post-merge-feedback Bundle CR-RL 採用 3 件 + 順位 165 補足追記

採用: PR #182 post-merge-feedback (2026-05-29 ユーザー承認):
- 順位 167 (T1-#1): check-ci-coderabbit の RATE_LIMIT_MARKER を新フォーマット対応に更新
- 順位 168 (T2-#1): CR rate-limit detection integration test の新旧 fixture
- 順位 169 (T3-#1): ADR-018 / ADR-034 に CR rate-limit format evolution 同期戦略 codify

3 件は Bundle CR-RL タグで同 PR land 推奨 (機械強制 + test 層 + 永続 ADR 層の 3 層補強)。

順位 165 補足追記:
- PR #182 T2-#2 採用候補 (pnpm-create-pr-body-guard hook test) は本 165 と scope 重複のため独立 entry 化せず本 entry に集約
- supplementary fact: PR #134 で pnpm-create-pr-body-guard hook 採用判定されたが未実装の state (= stale unfulfilled adoption、feedback-reports/134.md Tier 1 #1)
- 165 着手時に hook 実装済なら test 範囲を 2 層 (--body-file workaround verify + guard hook 動作 verify) に拡張

* docs(adr): 8 ADR の ephemeral todo 参照を permanent reference に置換 (A01 fix、Cross-File Reference Lifecycle 違反修正)

PR #182 Phase B dogfood で検出された finding WR-2026-05-29-A01 (Severity High、Category adr-alignment) の修正。
8 永続 ADR が docs/todo*.md の section / 順位 N / Phase A-F 等の ephemeral artifact を直接参照しており、
docs-governance.md § Retirement Workflow で todo entry が削除された際に silent dead pointer 化する
systemic documentation drift の構造修正。

修正方針 (analyzer 推奨 3 strategy):
1. ADR cross-references — 別 ADR に decision がある場合
2. PR # references — git log で origin が trackable な場合
3. Inlined constraints — detail が小さい場合

各 ADR の修正:
- ADR-022 line 197: parenthetical pointer 削除 (operational guideline は self-contained で完結)
- ADR-023 lines 54, 86: "docs/todo.md or PR description" → "PR description" (permanent artifact のみに集約)
- ADR-028 line 186: "docs/todo.md #7" → "PR #59 で land、PR #62 で global skill 移管"
- ADR-029 lines 191, 240, 266: task pointer 削除 + ADR-030 supersede note
  (本 ADR は ADR-030 partial supersede 対象、実装系譜は ADR-030 に集約)
- ADR-030 line 417: Phase B-F section pointer → 各 Phase の land 済 PR # (PR #75/77/80/154) を直接列挙、
  Phase E/F は priority table 参照 (specific 順位 番号は避ける)
- ADR-031 line 270: Phase A-F section pointer → PR #182 + priority table (順位 8 は trackable level の言及)
- ADR-033 line 111: grep procedure hardcoded list (todo.md/2/3) → glob (todo*.md)
  本 ADR land 時から todo4-9 が追加されており hardcode list は既に stale
- ADR-034: "todo-summary.md / todo4.md エントリ" section + "新セッションで最初に確認すべきこと"
  を全面再構成、4 component の land 状況を PR # primary table 化 (旧 順位 42 = PR #113 等)、
  新セッション checklist を ADR-018 + memory + grep ベースに置換

修正外 (operational reference として保持):
- ADR-031 lines 79, 84, 96, 121, 185, 189-191, 205, 207, 240, 242, 251, 302: workflow が
  todo.md に書き込む / セクション作成する behavior 記述 (pointer ではない operational description)
- ADR-033 lines 1, 11, 24, 93, 100, 130, 131: ADR 本体が todo.md 管理がテーマのため intrinsic
- ADR-034 lines 195-198 (Bundle b との関係 table): 順位 N と PR # / Bb-N が pair で書かれているため
  permanent reference (PR #) が常にあり、dead pointer リスクなし
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant