Skip to content

feat(commands): /team-onboarding を動的生成方式に変更 - #101

Merged
Kensan196948G merged 1 commit into
mainfrom
feat/team-onboarding-dynamic-generation
Apr 14, 2026
Merged

Kensan196948G merged 1 commit into
mainfrom
feat/team-onboarding-dynamic-generation

Conversation

@Kensan196948G

@Kensan196948G Kensan196948G commented Apr 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • /team-onboarding を静的テンプレートから 実行命令列 (Phase A-G) に全面書き換え
  • プロジェクトごとに異なる ONBOARDING.md を実データから動的抽出して生成
  • 禁止事項・Agent 一覧・Command 一覧は CLAUDE.md / ファイルシステムから動的ミラー(ハードコード排除)

背景と狙い

レビュー指摘により、従来の /team-onboarding が以下の 8 点で公式 Claude Code の /team-onboarding と乖離していることが判明:

  1. 静的テンプレートで実行するたびに同じ内容が出る
  2. ClaudeOS フレームワーク説明に終始し対象プロジェクト固有情報が出ない
  3. セッション履歴からの実践知抽出がない
  4. Verify ループとの連動がない
  5. 出力先が未定義
  6. state.json 構造を簡略化しすぎており実体 (10 ブロック) と乖離
  7. Project Switch Engine 非対応
  8. 禁止事項の網羅不足 (5 項目 vs CLAUDE.md §18 の 8 項目)

本 PR はこれら全 8 点を解消。

主な変更

.claude/claudeos/commands/team-onboarding.md

  • Phase A: プロジェクト判定 — CWD / Git remote / Git branch / CLAUDE.md 存在確認 / Project Switch Engine 判定
  • Phase B: 設定データ収集 — CLAUDE.md / state.json / README.md / agents/ / commands/ / hooks.json を並列取得
  • Phase C: 禁止事項の動的抽出 — Grep(pattern="^## .*禁止") で CLAUDE.md §18 をミラー
  • Phase D: state.json からの実践知抽出 — 10 ブロック構造 (project/goal/kpi/execution/automation/priority/learning/github/status/codex) を前提。learning.failure_patterns/success_patterns 上位 5 件を転記
  • Phase E: ONBOARDING.md 生成 — ./ONBOARDING.md 固定出力。11 セクション構成
  • Phase F: Verify 連動フック提案 — hooks.json 登録は提案に留め、実体は feat(hooks): onboarding-refresh-on-stable フック実体スクリプトを実装 #100 で分離
  • Phase G: 完了報告 — 反映した項目数を明示

ONBOARDING.md (新規)

本プロジェクトに対して動作検証を実行した結果の生成物。

  • 禁止事項 8 件(CLAUDE.md §18 から動的抽出)
  • Agent 37 体(.claude/claudeos/agents/ から Glob 取得)
  • Command 34 個(.claude/claudeos/commands/ から Glob 取得)
  • Git 直近 20 コミット
  • state.json 未存在時の退避動作込み(失敗/成功パターンは初回セッション後に蓄積予定の旨を明記)

設計原則

  • 静的記述を ONBOARDING.md に書かない — CLAUDE.md / state.json が唯一の真実
  • 欠損時の退避動作を必ず明示 — 新規プロジェクト (state.json なし) でも動作する
  • 禁止事項は動的ミラー — CLAUDE.md §18 更新で次回自動追従
  • Verify 連動の自動更新 — STABLE 成立を契機に再実行される設計を提示

関連 Issue

Test plan

  • .claude/claudeos/commands/team-onboarding.md の Phase A-G が tool 起動命令として明示されている
  • 禁止事項が CLAUDE.md §18 の 8 項目すべてを反映している(ONBOARDING.md §7 で検証)
  • state.json 未存在時でも退避動作で生成が完了する
  • Agent / Command の列挙が実ファイルシステムと一致する(Glob 結果と照合済み)
  • CI (PowerShell lint / Pester / Dependabot / gitleaks) 通過
  • 将来: feat(hooks): onboarding-refresh-on-stable フック実体スクリプトを実装 #100 実装後に STABLE 成立で自動更新されることを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

リリースノート

  • 新機能

    • プロジェクト固有のオンボーディングドキュメント(ONBOARDING.md)を自動生成
    • リポジトリ設定から動的にプロジェクト適応型ガイダンスを生成
  • ドキュメント

    • 利用可能なエージェントとコマンドをONBOARDING.mdに自動リスト化
    • セッション開始手順とGit履歴情報を集約

静的テンプレートから実行命令列 (Phase A-G) への全面書き換え。
プロジェクトごとに異なる ONBOARDING.md を実データ (CLAUDE.md / state.json /
セッション履歴) から動的抽出して生成する設計に変更。

主な変更:
- CLAUDE.md §18 の禁止事項を Grep で動的ミラー (ハードコード排除)
- state.json の 10 ブロック構造を前提とした learning.failure/success_patterns 抽出
- Project Switch Engine (.loop-project-exclude/override.md) 判定を組み込み
- 出力先を ./ONBOARDING.md に固定 (docs/ は用途別使用中のため回避)
- state.json 未存在時の退避動作を明示 (新規プロジェクト対応)

Verify ループ STABLE 成立時の自動更新フック実体は
権限境界明確化のため Issue #100 に分離。

動作検証として本プロジェクトに対して実行し ONBOARDING.md を生成済み
(禁止事項 8 件 / Agent 37 体 / Command 34 個を反映)。

Refs: #100

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 09:43
@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

team-onboardingコマンドの仕様を、対話的ガイダンスからリポジトリ固有データを解析する自動生成型へ転換し、プロジェクトローカルの./ONBOARDING.mdを出力するマルチフェーズ生成器に統合しました。適格性チェック、条件付きデータ抽出、フック登録ガイダンスを追加しています。

Changes

Cohort / File(s) Summary
Team Onboarding コマンド仕様
.claude/claudeos/commands/team-onboarding.md
対話的ガイダンスからstate.json解析ベースの自動生成に変更。CLAUDE.md/.loop-project-exclude.md/.loop-project-override.mdによる適格性判定、複数ソースからの動的データ抽出(README、エージェント/コマンド情報、hooks.json)、およびPostToolUseフック登録ガイダンスを追加。禁⽌事項の動的抽出とマーク・ダウン出力テンプレート構造化。
自動生成ドキュメント
ONBOARDING.md
初期化時のデフォルトオンボーディングドキュメント(state.json欠落時の出力テンプレート)。ゴール/KPI/学習パターン/エージェント/コマンド/禁⽌事項/Git履歴/セッション開始ステップを含む。再生成フック統合による Verify→STABLE 段階での自動更新対応。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • Issue #100 — 本PRで追加されたPostToolUseフック登録ガイダンスと再生成機能の実装により、STABLE達成時のオンボーディング自動更新要件を直接アドレスしています。

Possibly related PRs

  • PR #88 — 同じ.claude/claudeos/commands/team-onboarding.mdファイルを修正する関連PR(前PR がインタラクティブドキュメント導入、本PR がリポジトリ解析ベースの自動生成への転換)。

Poem

🐰 ウサギが駆ける、新しい道
リポジトリ読む、知恵の宝庫
ONBOARDING.md、自動に生まれて
チームの歩みを照らしぬ ✨

🚥 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 The PR title accurately describes the main change: converting /team-onboarding from a static template to a dynamic generation approach. The title is concise and clearly highlights the primary objective.
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.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/team-onboarding-dynamic-generation

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

@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: 5

🤖 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/claudeos/commands/team-onboarding.md:
- Around line 139-146: 説明文と例が「置換」に誤解されないように、.claude/claudeos/hooks/hooks.json
の既存 PostToolUse 配列に対して新しいエントリ "onboarding-refresh-on-stable" を append
する手順を明記してください:具体的には PostToolUse
配列が存在しない場合は配列を新規作成し、存在する場合は既存配列を上書きせず末尾に追加することを明記し、既存フック(例:
"capture-result")が保持される旨を明記するとともに、ファイル全体の「before」例と「after(追記後)」の完全な JSON
全体例を併記して /team-onboarding と ONBOARDING.md の再実行意図も簡潔に説明してください。
- Around line 39-40: The glob patterns used for Agent/Command collection
(Glob("**/*.md") and Glob("*.md")) are relative and cause missed files; update
the patterns to explicit rooted paths by replacing Glob("**/*.md") with
Glob(".claude/claudeos/agents/**/*.md") and Glob("*.md") with
Glob(".claude/claudeos/commands/*.md"), and also reconcile the Phase E mismatch
where agents/*.md is used so all phases consistently use the
`.claude/claudeos/agents/**/*.md` pattern; ensure the updates are applied
wherever Glob("**/*.md"), Glob("*.md"), or "agents/*.md" appear (notably lines
referenced around 39–40 and 106–110).
- Around line 124-129: Update the session start and/or Verify steps to include
the required automated review commands: add an explicit execution of
"/codex:review --base main --background" and the CodeRabbit complement
"/coderabbit:review ..." (with appropriate target args) into the step list where
"/codex:setup" and "/codex:status" are currently specified (see the session
start block and the Verify procedure referenced at lines ~124-129 and ~144-149);
ensure the text specifies running Codex review for all changes and running
CodeRabbit static analysis as a complementary flow so the required review gate
is always invoked during session start or before Verify completes.
- Around line 53-67: state.json のスキーマ不整合:Phase E が参照する
execution.loop_distribution が Phase D
の抽出契約に定義されていないため、実装側がどのキーを使うか不明瞭です。修正方法は一つに統一してください — ① Phase D の抽出対象一覧に
execution.loop_distribution を明記してスキーマに追加する(抽出ロジック/生成ロジック両方で利用可能にする)、または ② Phase
E 側の参照を既存の既定キー(例: execution.distribution など)に切り替えて参照先を整合させる。対象となる識別子は
execution.loop_distribution、Phase D、Phase E、抽出対象一覧(state.json
スキーマ)および生成ロジック(loop 分配を参照している箇所)です。
- Line 47: The Grep() call mixes CLI-style flags with named parameters causing
parsing ambiguity; update the call (Grep) to use the tool's expected
named-parameter form (e.g., replace the CLI-style "-A=30" with a named argument
such as afterLines=30 or lines_after=30) and ensure this matches the argument
name defined in the tool spec (check the .claude-plugin tool definition or the
CLAUDE.md tool-spec section for the exact parameter name) so all Grep()
invocations use a consistent named-parameter format.
🪄 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: ba888ed9-3f87-443c-9795-8c91fe992854

📥 Commits

Reviewing files that changed from the base of the PR and between 32ce37a and 9bb65cc.

📒 Files selected for processing (2)
  • .claude/claudeos/commands/team-onboarding.md
  • ONBOARDING.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Prepare
  • GitHub Check: test-and-validate
  • GitHub Check: PSScriptAnalyzer
🧰 Additional context used
📓 Path-based instructions (3)
{docs/**,**.md,.claude/**}

📄 CodeRabbit inference engine (AGENTS.md)

Structure sub-agent responses using fixed 4-section format: Summary, Risks, Findings, Next Action (in that order), with Risks listed before Findings

Files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

**/*: Perform Codex review using /codex:review --base main --background for all changes
Perform adversarial Codex review using /codex:adversarial-review --base main --background for authentication/authorization changes, database schema modifications, concurrent processing additions, and pre-release final verification
Use CodeRabbit static analysis as a complementary tool to Codex review (not a replacement): execute /coderabbit:review committed --base main before PR creation, /coderabbit:review all --base main during Verify phase, and /coderabbit:review uncommitted for post-fix re-verification
Enforce CodeRabbit finding resolution: Critical and High severity findings are mandatory fixes blocking merge, Medium severity is mandatory with exception documentation allowed, Low severity is optional based on time/token availability
Limit CodeRabbit feedback loops: maximum 3 rounds per file, maximum 5 rounds for overall review; escalate remaining findings to Issues when limits reached
Prohibit direct push to main branch; all changes must use branches or WorkTree with mandatory PR and CI success before merge
Require Codex review approval before merging any PR
At 5-hour limit, ensure minimal commit unit, push changes, create PR (Draft acceptable), update GitHub Projects status, collect test/lint/build/CI results, document remaining tasks and restart point, update README.md with end-of-session summary, and produce final status report
Do not directly push to main branch, modify main without PR, merge without CI success, execute unlimited repairs, merge without verification, apply fixes without root cause understanding, or deep dive when token budget is depleted

Files:

  • ONBOARDING.md
**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.md: Include in PR body: change description, test results, impact scope, and remaining tasks
Keep all documentation files (README.md, docs/) synchronized with implementation; ensure external-facing documentation is complete and not abandoned

Files:

  • ONBOARDING.md
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:21.915Z
Learning: Applies to Claude/**/README.md : README must be updated when user-facing features, setup procedures, architecture, or quality gates change
📚 Learning: 2026-04-14T02:12:21.915Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:21.915Z
Learning: Applies to Claude/**/README.md : README must be updated when user-facing features, setup procedures, architecture, or quality gates change

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T06:21:13.377Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T06:21:13.377Z
Learning: Applies to Claude/templates/claude/**/README.md : Update README.md whenever the following changes: user-facing features, setup procedures, architecture, or quality gates. Treat README as the external-facing truth. Do not leave README unable to withstand external explanation.

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T02:12:41.360Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claudeos/examples/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:41.360Z
Learning: Applies to Claude/templates/claudeos/examples/**/CLAUDE.md : Define README update policy in CLAUDE.md at project root

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T06:20:36.544Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-14T06:20:36.544Z
Learning: Applies to README.md : Maintain README.md as the authoritative external truth source; update when user-facing features, setup procedures, architecture, or quality gates change; use tables and diagrams extensively for clarity

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T02:12:41.360Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claudeos/examples/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:41.360Z
Learning: Applies to Claude/templates/claudeos/examples/**/CLAUDE.md : Define project language in CLAUDE.md at project root

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T02:12:41.360Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claudeos/examples/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:41.360Z
Learning: Applies to Claude/templates/claudeos/examples/**/CLAUDE.md : Define branch strategy in CLAUDE.md at project root

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T02:12:41.360Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claudeos/examples/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:41.360Z
Learning: Applies to Claude/templates/claudeos/examples/**/CLAUDE.md : Define test procedures in CLAUDE.md at project root

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T02:12:54.820Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T02:12:54.820Z
Learning: Applies to {docs/**,**.md,.claude/**} : Structure sub-agent responses using fixed 4-section format: Summary, Risks, Findings, Next Action (in that order), with Risks listed before Findings

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T06:20:36.544Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-14T06:20:36.544Z
Learning: Configuration directory is .claude/claudeos containing agents, skills, commands, rules, hooks, scripts, contexts, examples, mcp-configs, and kernel documentation

Applied to files:

  • ONBOARDING.md
📚 Learning: 2026-04-14T02:12:21.915Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T02:12:21.915Z
Learning: Applies to Claude/.claude/CLAUDE.md : Project-specific configuration should be placed at `.claude/CLAUDE.md` in the repository root and overrides global Claude settings when necessary

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T06:20:36.544Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-14T06:20:36.544Z
Learning: Execute automatic startup sequence on session start: Register 4 loop commands (/loop 30min ClaudeOS Monitor, /loop 2h ClaudeOS Development, /loop 1h15m ClaudeOS Verify, /loop 1h15m ClaudeOS Improvement) totaling 5 hours with phase distribution: Monitor 10% / Development 40% / Verify 25% / Improvement 25%

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
📚 Learning: 2026-04-14T06:21:13.377Z
Learnt from: CR
Repo: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New PR: 0
File: Claude/templates/claude/CLAUDE.md:0-0
Timestamp: 2026-04-14T06:21:13.377Z
Learning: Execute the following 4 loop commands in order at session start: `/loop 30min ClaudeOS Monitor`, `/loop 2h ClaudeOS Development`, `/loop 1h15m ClaudeOS Verify`, `/loop 1h15m ClaudeOS Improvement`. Do not begin normal development work until all 4 registrations are complete.

Applied to files:

  • ONBOARDING.md
  • .claude/claudeos/commands/team-onboarding.md
🔇 Additional comments (1)
ONBOARDING.md (1)

15-39: フォールバック設計は明確で運用しやすいです。

Summary: state.json 未存在時の退避挙動が具体的に記述されており、初回運用で迷いにくいです。
Risks: 現時点では重大なリスクは見当たりません。
Findings: Goal/KPI/学習履歴の欠損時メッセージと次回反映条件が一貫しています。
Next Action: この方針を維持しつつ、自動再生成フック(Issue #100)実装後に整合性を再確認してください。

Comment on lines +39 to +40
| `.claude/claudeos/agents/` | `Glob("**/*.md")` | Agent Teams 未整備として記録 |
| `.claude/claudeos/commands/` | `Glob("*.md")` | コマンド未整備として記録 |

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

Glob の探索範囲指定が不正確で、列挙漏れを起こします。

Summary: Agent/Command の収集指定がカレント依存で、意図したディレクトリを確実に走査できません。
Risks: ONBOARDING の Agent 数・Command 数が欠落/過少になる可能性があります。
Findings: Glob("**/*.md") と Glob("*.md") がベースパスなし、かつ Phase E では agents/*.md と再び不一致です。
Next Action: 収集パターンを .claude/claudeos/agents/**/*.md と .claude/claudeos/commands/*.md に統一してください。

差分案
-| `.claude/claudeos/agents/` | `Glob("**/*.md")` | Agent Teams 未整備として記録 |
-| `.claude/claudeos/commands/` | `Glob("*.md")` | コマンド未整備として記録 |
+| `.claude/claudeos/agents/` | `Glob(".claude/claudeos/agents/**/*.md")` | Agent Teams 未整備として記録 |
+| `.claude/claudeos/commands/` | `Glob(".claude/claudeos/commands/*.md")` | コマンド未整備として記録 |
@@
-{.claude/claudeos/agents/*.md を Glob し、ファイル名とフロントマターの description を表形式で列挙}
+{.claude/claudeos/agents/**/*.md を Glob し、ファイル名とフロントマターの description を表形式で列挙}

Also applies to: 106-110

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

In @.claude/claudeos/commands/team-onboarding.md around lines 39 - 40, The glob
patterns used for Agent/Command collection (Glob("**/*.md") and Glob("*.md"))
are relative and cause missed files; update the patterns to explicit rooted
paths by replacing Glob("**/*.md") with Glob(".claude/claudeos/agents/**/*.md")
and Glob("*.md") with Glob(".claude/claudeos/commands/*.md"), and also reconcile
the Phase E mismatch where agents/*.md is used so all phases consistently use
the `.claude/claudeos/agents/**/*.md` pattern; ensure the updates are applied
wherever Glob("**/*.md"), Glob("*.md"), or "agents/*.md" appear (notably lines
referenced around 39–40 and 106–110).

| Development | 60m | 設計・実装・WorkTree 管理 |
| Verify | 45m | test / lint / build / CodeRabbit / CI 確認、STABLE 判定 |
| Improvement | 45m | リファクタリング・ドキュメント更新・再開メモ |
1. `Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", -A=30)` — `## 18. 禁止事項` セクションを取得

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
# 目的: リポジトリ内で使われている Grep(...) 記法の実例を収集し、引数形式を検証する
rg -n -C2 'Grep\s*\(' --type=md
rg -n -C2 'output_mode\s*=' --type=md
rg -n -C2 '\-A\s*=?\s*[0-9]+' --type=md

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 86


🏁 Script executed:

# ファイル存在確認と内容確認
ls -la ".claude/claudeos/commands/team-onboarding.md" 2>&1 | head -20
echo "---"
# ファイルサイズを確認
wc -l ".claude/claudeos/commands/team-onboarding.md" 2>&1
echo "---"
# 該当行周辺を確認 (45-50行目)
sed -n '45,50p' ".claude/claudeos/commands/team-onboarding.md" 2>&1

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 508


🏁 Script executed:

# より広範なGrepパターン検索 (大文字小文字区別なし)
rg -i 'grep\s*\(' -A 2 -B 2 --type=md 2>&1 | head -100

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 86


🏁 Script executed:

# markdown形式で "-A" を含む行を検索
rg '\-A' --type=md -n 2>&1 | head -50

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 4216


🏁 Script executed:

# 全ファイルタイプでGrep()を検索(定義と使用例)
rg -i 'grep\s*\(' -A 3 -B 1 2>&1 | head -80

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 86


🏁 Script executed:

# .claude ディレクトリ内を探索
find .claude -type f -name "*.md" -o -name "*.json" -o -name "*.txt" 2>&1 | head -50

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 2101


🏁 Script executed:

# Grep関数の定義やドキュメントを探索
rg -i 'def.*grep|function.*grep|grep.*function' --type=md --type=json 2>&1

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 86


🏁 Script executed:

# team-onboarding.md の全文を確認(仕様を理解するため)
head -100 ".claude/claudeos/commands/team-onboarding.md"

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 3273


🏁 Script executed:

# プラグイン定義を確認
cat ".claude/claudeos/.claude-plugin/plugin.json" 2>&1 | head -150

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 1045


🏁 Script executed:

# marketplace.jsonも確認
cat ".claude/claudeos/.claude-plugin/marketplace.json" 2>&1 | head -150

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 532


🏁 Script executed:

# CLAUDE.md を確認(ツール定義がある可能性)
head -200 ".claude/claudeos/CLAUDE.md" 2>&1

Repository: Kensan196948G/ClaudeCLI-CodexCLI-CopilotCLI-StartUpTools-New

Length of output: 4639


Grep() 関数の引数形式を統一してください。CLI フラグと命名パラメータが混在しています。

-A=30 の記法は grep/rg の CLI オプション形式ですが、前の引数(pattern=, path=, output_mode=)は関数の命名パラメータ形式です。この混在はツール実装の解釈エラーを招きます。

修正例
Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", afterLines=30)

または

Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", lines_after=30)

リポジトリ内に他の Grep() 呼び出し例がないため、.claude-plugin/ の tool 定義または CLAUDE.md のツール仕様セクションで期待される引数形式を確認し、それに統一してください。

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

In @.claude/claudeos/commands/team-onboarding.md at line 47, The Grep() call
mixes CLI-style flags with named parameters causing parsing ambiguity; update
the call (Grep) to use the tool's expected named-parameter form (e.g., replace
the CLI-style "-A=30" with a named argument such as afterLines=30 or
lines_after=30) and ensure this matches the argument name defined in the tool
spec (check the .claude-plugin tool definition or the CLAUDE.md tool-spec
section for the exact parameter name) so all Grep() invocations use a consistent
named-parameter format.

Comment on lines +53 to +67
`state.json` が存在した場合、**10 ブロック構造** を前提に以下を読む:

| ロール | 責務 |
| ブロック | 抽出対象 |
|---|---|
| CTO | 最終判断・優先順位・継続可否 |
| ProductManager | Issue 生成・要件整理 |
| Architect | アーキテクチャ設計 |
| Developer | 実装・修正・修復 |
| Reviewer | Codex + CodeRabbit レビュー・コード品質 |
| Debugger | 原因分析・rescue 実行 |
| QA | テスト・回帰確認・品質評価 |
| Security | secrets・権限・脆弱性確認 |
| DevOps | CI/CD・PR・Deploy Gate |
| Analyst | KPI 分析・メトリクス評価 |
| EvolutionManager | 改善提案・自己進化管理 |
| ReleaseManager | リリース管理・マージ判断 |

### Step 5: state.json の読み方

`state.json` はセッションの単一の真実(Single Source of Truth)です:

```json
{
"goal": { "title": "プロジェクトの目標" },
"kpi": { "success_rate_target": 0.9 },
"execution": {
"phase": "Monitor | Development | Verify | Improvement",
"remaining_minutes": 300
},
"token": { "used": 0, "remaining": 100 }
}
| `project` | プロジェクト識別情報 |
| `goal` | 現在の目標(title / description) |
| `kpi` | 達成目標値と現在値 |
| `execution` | `phase` / `remaining_minutes` — 進行中であれば再開ポイント扱い |
| `automation` | `auto_issue_generation` / `self_evolution` フラグ |
| `priority` | 優先順位リスト |
| `learning` | `failure_patterns` / `success_patterns` — これが最重要。最大 5 件を「このプロジェクトでよくハマる点」として転記 |
| `github` | Projects / Issues / PR の最新状態 |
| `status` | ループ実行状態 |
| `codex` | `last_review_status` / `blocking_issues` — 未解決の重大指摘があれば Onboarding 先頭で警告 |

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

state.json スキーマ定義と参照フィールドが不整合です。

Summary: Phase D の定義にない execution.loop_distribution を Phase E が前提にしています。
Risks: 実装者がどのキーを信頼すべきか判断できず、常時デフォルトフォールバック化する恐れがあります。
Findings: 抽出対象一覧(Line 53-67)と生成ロジック(Line 126-129)の契約が一致していません。
Next Action: loop_distribution を Phase D の抽出契約に明記するか、Phase E 側の参照を既定キーへ合わせてください。

Also applies to: 126-129

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

In @.claude/claudeos/commands/team-onboarding.md around lines 53 - 67,
state.json のスキーマ不整合:Phase E が参照する execution.loop_distribution が Phase D
の抽出契約に定義されていないため、実装側がどのキーを使うか不明瞭です。修正方法は一つに統一してください — ① Phase D の抽出対象一覧に
execution.loop_distribution を明記してスキーマに追加する(抽出ロジック/生成ロジック両方で利用可能にする)、または ② Phase
E 側の参照を既存の既定キー(例: execution.distribution など)に切り替えて参照先を整合させる。対象となる識別子は
execution.loop_distribution、Phase D、Phase E、抽出対象一覧(state.json
スキーマ)および生成ロジック(loop 分配を参照している箇所)です。

Comment on lines +124 to +129
## 10. セッション開始手順

CLAUDE.md §0 の 4 ループ登録コマンドを、**このプロジェクトの state.json から抽出した** 時間配分で生成:

{state.json.execution.loop_distribution があればそれを優先、無ければ CLAUDE.md §0 デフォルト値}

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

セッション開始手順に必須レビューコマンドが不足しています。

Summary: /codex:setup と /codex:status のみで、規約上必須のレビュー実行フローが欠けています。
Risks: Verify での品質ゲート運用漏れが発生し、PR マージ判断が不完全になります。
Findings: /codex:review --base main --background と CodeRabbit 補完フロー(/coderabbit:review ...)が手順に含まれていません。
Next Action: セッション開始または Verify 手順に、規約で定める Codex/CodeRabbit 実行コマンドを明示してください。

As per coding guidelines, "Perform Codex review using /codex:review --base main --background for all changes" and "Use CodeRabbit static analysis as a complementary tool to Codex review ...".

Also applies to: 144-149

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

In @.claude/claudeos/commands/team-onboarding.md around lines 124 - 129, Update
the session start and/or Verify steps to include the required automated review
commands: add an explicit execution of "/codex:review --base main --background"
and the CodeRabbit complement "/coderabbit:review ..." (with appropriate target
args) into the step list where "/codex:setup" and "/codex:status" are currently
specified (see the session start block and the Verify procedure referenced at
lines ~124-129 and ~144-149); ensure the text specifies running Codex review for
all changes and running CodeRabbit static analysis as a complementary flow so
the required review gate is always invoked during session start or before Verify
completes.

Comment on lines +139 to +146
1. `.claude/claudeos/hooks/hooks.json` に以下のエントリが存在しない場合、追記を **提案する**(勝手に編集しない。ユーザー確認後に Edit):
```json
{
"PostToolUse": [
{ "name": "onboarding-refresh-on-stable", "description": "STABLE 判定成立時に /team-onboarding を再実行し ONBOARDING.md を更新" }
]
}
```

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 | 🟡 Minor

Hook 追記の JSON 例は「置換」に誤解されやすいです。

Summary: PostToolUse 配列のみの断片提示だと既存要素消失の誤編集を誘発します。
Risks: 既存フック(例: capture-result)が欠落し、運用フローが壊れる可能性があります。
Findings: 「追記提案」意図に対して、提示 JSON がマージ方法を示していません。
Next Action: 「既存配列へ append」手順を明示し、全体例を併記してください。

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

In @.claude/claudeos/commands/team-onboarding.md around lines 139 - 146,
説明文と例が「置換」に誤解されないように、.claude/claudeos/hooks/hooks.json の既存 PostToolUse
配列に対して新しいエントリ "onboarding-refresh-on-stable" を append する手順を明記してください:具体的には
PostToolUse 配列が存在しない場合は配列を新規作成し、存在する場合は既存配列を上書きせず末尾に追加することを明記し、既存フック(例:
"capture-result")が保持される旨を明記するとともに、ファイル全体の「before」例と「after(追記後)」の完全な JSON
全体例を併記して /team-onboarding と ONBOARDING.md の再実行意図も簡潔に説明してください。

Copilot AI 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.

Pull request overview

/team-onboarding コマンドを静的テンプレート方式から、リポジトリの実データ(CLAUDE.md / state.json / .claude/claudeos / Git 履歴など)を収集して ONBOARDING.md を動的生成する方式へ移行するPRです。

Changes:

  • .claude/claudeos/commands/team-onboarding.md を Phase A〜G の実行命令列として全面刷新
  • 生成物サンプルとして ONBOARDING.md を新規追加(動的抽出結果の例)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
ONBOARDING.md /team-onboarding により生成されるオンボーディング成果物のサンプルを追加
.claude/claudeos/commands/team-onboarding.md プロジェクト判定→データ収集→禁止事項/学習履歴抽出→ONBOARDING生成→Verify連動提案までの手順を定義

Comment on lines +47 to +48
1. `Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", -A=30)` — `## 18. 禁止事項` セクションを取得
2. リスト項目(`- ` で始まる行)を **すべて** 抽出し、件数を明示して ONBOARDING.md に転記

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

Phase C の Grep(..., -A=30) だと ## 18. 禁止事項 の直後にある ## 19. 自動停止条件 の箇条書き(- STABLE 達成 など)まで一緒に取得され、手順 2 の「- で始まる行をすべて抽出」に従うと禁止事項が混入します。## 18 から次の ## 見出し直前までを切り出すなど、セクション境界で抽出範囲を限定してください。

Suggested change
1. `Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", -A=30)` — `## 18. 禁止事項` セクションを取得
2. リスト項目(`- ` で始まる行)を **すべて** 抽出し、件数を明示して ONBOARDING.md に転記
1. `## 18. 禁止事項` 見出しを起点に取得し、**次の `## ` 見出し直前まで** を禁止事項セクションとして切り出す(固定行数の `-A` では取得しない)
2. 手順 1 で切り出した **禁止事項セクション内のみ** から、リスト項目(`- ` で始まる行)を抽出し、件数を明示して ONBOARDING.md に転記

Copilot uses AI. Check for mistakes.
| Development | 60m | 設計・実装・WorkTree 管理 |
| Verify | 45m | test / lint / build / CodeRabbit / CI 確認、STABLE 判定 |
| Improvement | 45m | リファクタリング・ドキュメント更新・再開メモ |
1. `Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", -A=30)` — `## 18. 禁止事項` セクションを取得

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

Phase C の抽出範囲を固定長(-A=30)にしているため、禁止事項セクションが今後拡張された場合に末尾が欠けて「全項目を動的ミラー」の契約を満たせなくなります。行数ではなく「次の見出しまで」など構造に基づいて範囲決定する方式にしてください。

Suggested change
1. `Grep(pattern="^## .*禁止", path="./CLAUDE.md", output_mode="content", -A=30)` — `## 18. 禁止事項` セクションを取得
1. `Bash("awk '/^## .*禁止/{flag=1} flag{print} flag && /^## / && !/^## .*禁止/{exit}' ./CLAUDE.md | sed '${/^## /d;}'")` — `## 18. 禁止事項` セクションを、見出し開始から**次の `##` 見出し直前まで**構造ベースで取得

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +40
| `.claude/claudeos/agents/` | `Glob("**/*.md")` | Agent Teams 未整備として記録 |
| `.claude/claudeos/commands/` | `Glob("*.md")` | コマンド未整備として記録 |

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

Phase B の Glob パターンが取得対象ディレクトリを含んでいないため、実行ディレクトリ次第で repo 全体の Markdown を拾ってしまい、Agent 一覧が誤生成になります。Glob(".claude/claudeos/agents/**/*.md") のようにベースパス込みで指定するか、対象ディレクトリに対して明示的に絞り込む形に修正してください。

Suggested change
| `.claude/claudeos/agents/` | `Glob("**/*.md")` | Agent Teams 未整備として記録 |
| `.claude/claudeos/commands/` | `Glob("*.md")` | コマンド未整備として記録 |
| `.claude/claudeos/agents/` | `Glob(".claude/claudeos/agents/**/*.md")` | Agent Teams 未整備として記録 |
| `.claude/claudeos/commands/` | `Glob(".claude/claudeos/commands/*.md")` | コマンド未整備として記録 |

Copilot uses AI. Check for mistakes.
@Kensan196948G
Kensan196948G merged commit f2be133 into main Apr 14, 2026
8 checks passed
@Kensan196948G
Kensan196948G deleted the feat/team-onboarding-dynamic-generation branch April 14, 2026 09:49
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.

2 participants