update-claude
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseupdate-claude
update-claude
既存の 体系を診断し、理想形(日本語運用・カテゴリ別 Agent・Rules 整備・
委譲ルール・model 配分・SessionStart hooks・implement-issue-tree 前提)との差分を提示して
ユーザー承認後に差分のみ追補する。既存の Agent・Rules・CLAUDE.md は上書き前に確認を取る。
.claude/.claude/init-claudeDiagnose the existing system, present the differences from the ideal state (Japanese operation, category-based Agents, Rules maintenance, delegation rules, model allocation, SessionStart hooks, implement-issue-tree prerequisites), and only supplement the differences after user approval. Confirm before overwriting existing Agents, Rules, and CLAUDE.md.
.claude/Use for repositories where does not exist.
init-claude.claude/使い方
Usage
update-claude [対象リポジトリのパス]パスを省略した場合はカレントディレクトリを対象とする。
update-claude [path-to-target-repository]If the path is omitted, the current directory is targeted.
前提条件
Prerequisites
- 対象リポジトリに ディレクトリが存在すること
.claude/ - CLI がインストールされ、認証済みであること(
ghで確認)gh auth status - が使用できること(
npxによるスキル補完に使用)npx skills add
- The directory exists in the target repository
.claude/ - The CLI is installed and authenticated (check with
gh)gh auth status - is available (used for skill supplementation via
npx)npx skills add
フロー
Flow
Step 1: 対象リポジトリと既存 .claude/ を調査する
Step 1: Investigate the target repository and existing .claude/
bash
undefinedbash
undefined.claude/ の存在確認
Check for existence of .claude/
ls <target-repo>/.claude/ 2>/dev/null || echo ".claude/ が存在しない"
ls <target-repo>/.claude/ 2>/dev/null || echo ".claude/ does not exist"
既存 Agent の一覧
List existing Agents
find <target-repo>/.claude/agents -name "*.md" 2>/dev/null | sort
find <target-repo>/.claude/agents -name "*.md" 2>/dev/null | sort
既存 Rules の一覧
List existing Rules
find <target-repo>/.claude/rules -name "*.md" 2>/dev/null | sort
find <target-repo>/.claude/rules -name "*.md" 2>/dev/null | sort
既存 Skills の一覧
List existing Skills
ls <target-repo>/.claude/skills/ 2>/dev/null | sort
ls <target-repo>/.claude/skills/ 2>/dev/null | sort
hooks 確認
Check hooks
cat <target-repo>/.claude/settings.json 2>/dev/null || echo "settings.json なし"
cat <target-repo>/.claude/settings.json 2>/dev/null || echo "No settings.json"
CLAUDE.md の確認
Check CLAUDE.md
cat <target-repo>/CLAUDE.md 2>/dev/null | head -80 || echo "CLAUDE.md なし"
cat <target-repo>/CLAUDE.md 2>/dev/null | head -80 || echo "No CLAUDE.md"
skills-lock の確認
Check skills-lock
cat <target-repo>/skills-lock.json 2>/dev/null | head -30 || echo "skills-lock.json なし"
cat <target-repo>/skills-lock.json 2>/dev/null | head -30 || echo "No skills-lock.json"
implement-issue-tree workflow の確認
Check implement-issue-tree workflow
ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null || echo "workflow js なし"
`.claude/` が存在しない場合は `init-claude` を案内して処理を中断する。ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null || echo "No workflow js"
If `.claude/` does not exist, guide the user to use `init-claude` and interrupt processing.Step 2: 理想形との差分を診断する
Step 2: Diagnose differences from the ideal state
以下の観点で現状を診断し、ギャップ一覧を作成する。
Diagnose the current state from the following perspectives and create a gap list.
2-1. Agent 診断
2-1. Agent Diagnosis
| 診断項目 | 確認内容 |
|---|---|
| カテゴリ分割 | research / implement / testing / quality / docs のカテゴリ分割があるか |
| 技術レイヤ別 builder | リポの技術レイヤに対応した builder Agent が存在するか |
| model 配分 | 実装・調査=sonnet / 機械的=haiku / 横断判断=opus または fable(fable は Opus 上位の最上位 tier)が守られているか |
| 最小権限 | Agent の |
| 委譲 Agent | skill-author / agent-author / rules-author / docs-writer に相当する Agent があるか |
| Diagnosis Item | Check Content |
|---|---|
| Category Division | Is there category division into research / implement / testing / quality / docs? |
| Tech Layer-specific Builders | Are there builder Agents corresponding to the repo's technical layers? |
| Model Allocation | Is the allocation followed: implementation/research=sonnet / mechanical tasks=haiku / cross-cutting decisions=opus or fable (fable is the top tier above Opus)? |
| Least Privilege | Is the Agent's |
| Delegation Agents | Are there Agents equivalent to skill-author / agent-author / rules-author / docs-writer? |
2-2. Rules 診断
2-2. Rules Diagnosis
| 診断項目 | 確認内容 |
|---|---|
| delegation.md | 調査モードの委譲原則・パスベース切り替え表があるか |
| delegation-impl.md | 作成・編集モードの委譲マッピングがあるか |
| coding 規約 | リポの主要言語に対応したコーディング規約があるか |
| security.md | OWASP Top 10・秘密情報混入防止の記載があるか |
| japanese-style.md | 日本語出力スタイルの記載があるか |
| conventional-commits.md | Conventional Commits 詳細規約があるか |
| code-comment-style.md | コメント規約(役割・呼び出し文脈・責務境界の埋め込み方針)があるか |
| out-of-scope-tracking.md | スコープ外事項の追跡規約(Issue 確認→ユーザー承認→起票フロー)があるか |
| Diagnosis Item | Check Content |
|---|---|
| delegation.md | Does it contain delegation principles for research mode and path-based switching table? |
| delegation-impl.md | Does it contain delegation mappings for creation/edit mode? |
| Coding Standards | Are there coding standards corresponding to the repo's main language? |
| security.md | Does it include OWASP Top 10 and prevention of sensitive information inclusion? |
| japanese-style.md | Does it describe Japanese output style? |
| conventional-commits.md | Does it include detailed Conventional Commits rules? |
| code-comment-style.md | Does it include comment rules (policy for embedding role, invocation context, responsibility boundaries)? |
| out-of-scope-tracking.md | Does it include rules for tracking out-of-scope items (Issue confirmation → user approval → ticketing flow)? |
2-3. Skills 診断
2-3. Skills Diagnosis
npx skills add Fandhe-AI/agent-cli-skillsskills-lock.json必須スキル(不足していれば追補対象):
- ・
create-commit・create-prcreate-issue - ・
implement-issueimplement-issue-tree - ・
implement-reviewimplement-review-pr update-docs- (
comment-code規約に従うコメント追加・補強スキル)code-comment-style.md
List skills available via that are not included in .
npx skills add Fandhe-AI/agent-cli-skillsskills-lock.jsonMandatory Skills (to be supplemented if missing):
- ,
create-commit,create-prcreate-issue - ,
implement-issueimplement-issue-tree - ,
implement-reviewimplement-review-pr update-docs- (skill to add/reinforce comments according to
comment-coderules)code-comment-style.md
2-4. hooks 診断
2-4. hooks Diagnosis
| 診断項目 | 確認内容 |
|---|---|
| SessionStart | 日本語・委譲・Conventional Commits・--no-verify 禁止のリマインダーがあるか |
| PostToolUse | 言語に応じた自動整形フックがあるか |
| Diagnosis Item | Check Content |
|---|---|
| SessionStart | Does it include reminders for Japanese language use, delegation, Conventional Commits compliance, and prohibition of --no-verify? |
| PostToolUse | Is there an auto-formatting hook corresponding to the language? |
2-5. CLAUDE.md 診断
2-5. CLAUDE.md Diagnosis
| 診断項目 | 確認内容 |
|---|---|
| 委譲方針 | パスベース切り替え表・model 配分表があるか |
| Sub-agents 一覧 | カテゴリ別 Agent の表があるか |
| Rules 一覧 | ルールファイルの表があるか |
| Current Skills | 導入済みスキル一覧があるか |
| Diagnosis Item | Check Content |
|---|---|
| Delegation Policy | Does it include a path-based switching table and model allocation table? |
| Sub-agents List | Does it include a table of category-based Agents? |
| Rules List | Does it include a table of rule files? |
| Current Skills | Does it include a list of installed skills? |
2-6. implement-issue-tree 前提診断
2-6. implement-issue-tree Prerequisite Diagnosis
bash
gh auth statusbash
gh auth statussub_issues は issue 番号付き issues/{n}/sub_issues
のみ有効(リポジトリ直下に
issues/{n}/sub_issuessub_issues are only valid with issue numbers in issues/{n}/sub_issues
(there is no sub_issues endpoint directly under the repository). If existing issues exist, specify the number to verify connectivity
issues/{n}/sub_issuessub_issues エンドポイントは存在しない)。既存 issue があれば番号を指定して疎通確認する
(if no issue has been created, only gh auth status will be used for prerequisite confirmation)
(issue が未作成なら gh auth status のみで前提確認とする)
—
gh api "repos/<owner>/<repo>/issues/<既存issue番号>/sub_issues" 2>&1 | head -5
ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null
- gh auth の認証状態
- sub_issues API の応答(既存 issue 番号を指定。404 = GitHub Apps が有効でない可能性。
なお `repos/{owner}/{repo}/sub_issues` というリポジトリ直下のエンドポイントは存在しないため使わない)
- workflow js の存在gh api "repos/<owner>/<repo>/issues/<existing-issue-number>/sub_issues" 2>&1 | head -5
ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null
- gh auth authentication status
- sub_issues API response (specify existing issue number. 404 = possibility that GitHub Apps is not enabled.
Note: Do not use the repository-level endpoint `repos/{owner}/{repo}/sub_issues` as it does not exist)
- Existence of workflow jsStep 3: ギャップ一覧をユーザーに提示して承認を得る
Step 3: Present gap list to user for approval
以下の形式でギャップ一覧を提示する。
undefinedPresent the gap list in the following format.
undefined.claude/ 診断結果
.claude/ Diagnosis Results
不足・追補が必要な項目
Items requiring supplementation/enhancement
Agents
Agents
- <カテゴリ>/<Agent名>.md: <不足理由>
- ...
- <category>/<Agent-name>.md: <reason for deficiency>
- ...
Rules
Rules
- delegation.md: 存在しない
- coding-<lang>.md: 主要言語(<lang>)対応規約が存在しない
- ...
- delegation.md: Does not exist
- coding-<lang>.md: No standards for main language (<lang>)
- ...
Skills(npx skills add で補完可能)
Skills (supplementable via npx skills add)
- <スキル名>: skills-lock.json に含まれていない
- ...
- <skill-name>: Not included in skills-lock.json
- ...
hooks
hooks
- SessionStart: settings.json に SessionStart hook がない
- PostToolUse: <lang> の自動整形フックがない
- ...
- SessionStart: No SessionStart hook in settings.json
- PostToolUse: No auto-formatting hook for <lang>
- ...
CLAUDE.md
CLAUDE.md
- 委譲方針表: パスベース切り替え表がない
- ...
- Delegation Policy Table: No path-based switching table
- ...
implement-issue-tree 前提
implement-issue-tree Prerequisites
- workflow js: .claude/workflows/implement-issue-tree.js が存在しない
- ...
- workflow js: .claude/workflows/implement-issue-tree.js does not exist
- ...
既存資産(上書き確認が必要な項目)
Existing Assets (items requiring overwrite confirmation)
以下は既に存在します。変更する場合は個別に確認します。
- <ファイルパス>: <現在の状態の要約>
**ユーザーの承認なしに追補・変更を開始しない。**
承認の粒度:
- 「全て追補する」→ Step 4 に進む
- 「項目を絞って追補する」→ 対象を確認してから Step 4 に進む
- 「既存ファイルを上書きする場合」→ 上書き前に個別確認を取るThe following already exist. Confirm individually if changes are needed.
- <file-path>: <summary of current state>
**Do not start supplementation/changes without user approval.**
Approval granularity:
- "Supplement all" → Proceed to Step 4
- "Supplement specific items" → Confirm targets then proceed to Step 4
- "Overwrite existing files" → Confirm individually before overwritingStep 4: 差分を追補する
Step 4: Supplement differences
承認された項目のみ追補する。既存ファイルは上書き確認を取った項目のみ変更する。
Only supplement approved items. Only modify existing files that have received overwrite confirmation.
4-1. 不足 Agent を追加する
4-1. Add missing Agents
.claude/agents/<category>/<name>.mddotclaude-via-temp_/dotclaude/.claude/yaml
---
name: <name>
description: "<役割の説明(発火トリガー語を含める)>"
model: <haiku|sonnet|opus|fable>
tools: [必要最小限のツール]
---frontmatter のキーは Claude Code の subagent 定義仕様に従い を使う
( は Agent ツール呼び出し時のパラメータ名であり、定義キーではない)。
namesubagent_typeAdd to .
If the target repo has a rule (via ), follow that rule.
If not, you can write directly to .
.claude/agents/<category>/<name>.mddotclaude-via-temp_/dotclaude/.claude/yaml
---
name: <name>
description: "<description of role (including trigger words)>"
model: <haiku|sonnet|opus|fable>
tools: [minimum necessary tools]
---Follow Claude Code's subagent specification for frontmatter keys, using
( is a parameter name for Agent tool calls, not a definition key).
namesubagent_type4-2. 不足 Rules を追加する
4-2. Add missing Rules
.claude/rules/delegation.mddelegation-impl.mdcode-comment-style.mdout-of-scope-tracking.mdinit-claudeAdd to .
Customize and according to the target repo's path structure, referencing examples from Fandhe-AI/agent-cli-skills.
.claude/rules/delegation.mddelegation-impl.mdIf and are missing, generate them by referring to the template outline described in "3-3. Generate rules/" of the init-claude skill.
Adjust according to the target repo's language and structure (documentation comment format, directory structure, etc.) when generating.
code-comment-style.mdout-of-scope-tracking.md4-3. 不足スキルを補完する
4-3. Supplement missing Skills
bash
cd <target-repo>
npx skills add Fandhe-AI/agent-cli-skillsskills-lock.jsonbash
cd <target-repo>
npx skills add Fandhe-AI/agent-cli-skillsConfirm that is updated.
skills-lock.json4-4. hooks を追補する
4-4. Supplement hooks
settings.jsonjson
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "echo '<リポ名>: 日本語でやりとり / 作業は subagent へ委譲し main 消費を抑える / Conventional Commits 厳守 (--no-verify 禁止) / implement-issue は計画承認後に実装'"
}
]
}
]
}
}セキュリティ注意事項:
- の値に API キー・トークン・パスワードを埋め込まない
command - ユーザー入力をそのまま に展開しない
command
PostToolUse 自動整形フックは言語のツール存在確認後に提案し、ユーザーが希望する場合のみ追加する。
Add/update SessionStart hook in .
settings.jsonjson
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "echo '<repo-name>: Communicate in Japanese / Delegate tasks to subagents to reduce main model consumption / Strictly follow Conventional Commits (--no-verify prohibited) / Implement implement-issue only after plan approval'"
}
]
}
]
}
}Security Notes:
- Do not embed API keys, tokens, or passwords in the value
command - Do not directly expand user input into
command
Propose PostToolUse auto-formatting hooks after verifying the existence of language-specific tools, and only add them if the user wishes.
4-5. CLAUDE.md を更新する
4-5. Update CLAUDE.md
不足セクション(委譲方針表・Sub-agents 一覧・Rules 一覧・model 配分表・Current Skills)を追補する。
既存セクションを上書きする場合は承認済み項目のみ変更する。
Supplement missing sections (delegation policy table, Sub-agents list, Rules list, model allocation table, Current Skills).
Only modify approved items when overwriting existing sections.
4-6. implement-issue-tree の前提を整備する
4-6. Prepare implement-issue-tree prerequisites
workflow js が存在しない場合の案内:
named workflow()として呼ばない場合は への配置自体が不要で、Workflow ツールの に を直接指定すればよい。
{name: "implement-issue-tree"}.claude/workflows/scriptPath.claude/skills/implement-issue-tree/script/implement-issue-tree.jsnamed workflow として配置する場合は ではなく相対 symlink を使用する。 で配置すると symlink が実体ファイルに置き換わり、 による更新が named workflow に届かなくなる。
cpcpnpx skills addbash
undefinedGuidance if workflow js does not exist:
If not called as a named workflow (), placement in is not necessary at all—you can directly specify in the Workflow tool's .
{name: "implement-issue-tree"}.claude/workflows/.claude/skills/implement-issue-tree/script/implement-issue-tree.jsscriptPathIf placing as a named workflow, use a relative symlink instead of . If placed via , the symlink will be replaced with an actual file, and updates via will not reach the named workflow.
cpcpnpx skills addbash
undefined.claude/workflows/ への配置(named workflow として使う場合のみ)
Place in .claude/workflows/ (only if using as a named workflow)
mkdir -p <target-repo>/.claude/workflows/
mkdir -p <target-repo>/.claude/workflows/
既に symlink が存在する場合はそのままにする(実体ファイルを上書きしない)
Leave existing symlinks as-is (do not overwrite actual files)
if [ ! -e "<target-repo>/.claude/workflows/implement-issue-tree.js" ]; then
.claude/workflows/ から見た相対パスで symlink を作成する
ln -s ../skills/implement-issue-tree/script/implement-issue-tree.js
<target-repo>/.claude/workflows/implement-issue-tree.js else echo "既に存在する(symlink か実体かを確認: ls -la <target-repo>/.claude/workflows/implement-issue-tree.js)" fi
<target-repo>/.claude/workflows/implement-issue-tree.js else echo "既に存在する(symlink か実体かを確認: ls -la <target-repo>/.claude/workflows/implement-issue-tree.js)" fi
sub_issues API が使用できない場合は GitHub Apps の有効化をユーザーに案内する。if [ ! -e "<target-repo>/.claude/workflows/implement-issue-tree.js" ]; then
Create symlink with relative path from .claude/workflows/
ln -s ../skills/implement-issue-tree/script/implement-issue-tree.js
<target-repo>/.claude/workflows/implement-issue-tree.js else echo "Already exists (check if symlink or actual file: ls -la <target-repo>/.claude/workflows/implement-issue-tree.js)" fi
<target-repo>/.claude/workflows/implement-issue-tree.js else echo "Already exists (check if symlink or actual file: ls -la <target-repo>/.claude/workflows/implement-issue-tree.js)" fi
If the sub_issues API cannot be used, guide the user to enable GitHub Apps.Step 5: 追補結果を報告する
Step 5: Report supplementation results
報告項目:
- 追補したファイル一覧と変更内容
- スキップした項目と理由
- implement-issue-tree の動作前提の充足状況
- ユーザーへの次のアクション案内(手動設定が必要な項目など)
Report Items:
- List of supplemented files and changes made
- Skipped items and reasons
- Satisfaction status of implement-issue-tree prerequisites
- Guidance on next actions for the user (items requiring manual setup, etc.)
検証
Verification
bash
undefinedbash
undefined追補後のファイル一覧確認
Check list of files after supplementation
find <target-repo>/.claude -type f | sort
find <target-repo>/.claude -type f | sort
CLAUDE.md の存在確認
Check existence of CLAUDE.md
ls <target-repo>/CLAUDE.md
ls <target-repo>/CLAUDE.md
skills-lock.json の更新確認
Check update to skills-lock.json
cat <target-repo>/skills-lock.json 2>/dev/null | head -20
cat <target-repo>/skills-lock.json 2>/dev/null | head -20
implement-issue-tree の前提確認
Check implement-issue-tree prerequisites
ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null || echo "workflow js: 未配置"
gh auth status
undefinedls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null || echo "workflow js: Not placed"
gh auth status
undefined注意事項
Notes
- が存在しないリポジトリには
.claude/を案内して処理を中断するinit-claude - 既存ファイルの上書きはユーザーの個別承認後のみ実施する
- ユーザーの診断承認なしに変更を開始しない
- の
settings.jsonにトークン・シークレットをハードコードしないcommand - を含むコマンドを hooks に仕込まない
--no-verify - が失敗した場合はエラーメッセージを表示してユーザーに手動手順を案内する
npx skills add - 対象リポに ルールがある場合はそのルールに従う(ない場合は直接書き込み可)
dotclaude-via-temp - Agent の リストは最小権限原則に従い必要なもののみ列挙する
tools - セキュリティ問題(秘密情報の混入・インジェクションリスク)を発見した場合は追補を中断してユーザーに警告する
- For repositories where does not exist, guide the user to use
.claude/and interrupt processinginit-claude - Only overwrite existing files after individual user approval
- Do not start changes without user approval for diagnosis
- Do not hardcode tokens or secrets in
settings.jsoncommand - Do not include commands with in hooks
--no-verify - If fails, display the error message and guide the user through manual steps
npx skills add - Follow the rule if it exists in the target repo (if not, direct writing is allowed)
dotclaude-via-temp - Follow the principle of least privilege when listing Agent —only include necessary items
tools - If security issues (sensitive information inclusion, injection risks) are found, interrupt supplementation and warn the user