update-claude
Diagnose 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.
Use
for repositories where
does not exist.
Usage
update-claude [path-to-target-repository]
If the path is omitted, the current directory is targeted.
Prerequisites
- The directory exists in the target repository
- The CLI is installed and authenticated (check with )
- is available (used for skill supplementation via )
Flow
Step 1: Investigate the target repository and existing .claude/
bash
# Check for existence of .claude/
ls <target-repo>/.claude/ 2>/dev/null || echo ".claude/ does not exist"
# List existing Agents
find <target-repo>/.claude/agents -name "*.md" 2>/dev/null | sort
# List existing Rules
find <target-repo>/.claude/rules -name "*.md" 2>/dev/null | sort
# List existing Skills
ls <target-repo>/.claude/skills/ 2>/dev/null | sort
# Check hooks
cat <target-repo>/.claude/settings.json 2>/dev/null || echo "No settings.json"
# Check CLAUDE.md
cat <target-repo>/CLAUDE.md 2>/dev/null | head -80 || echo "No CLAUDE.md"
# Check skills-lock
cat <target-repo>/skills-lock.json 2>/dev/null | head -30 || echo "No skills-lock.json"
# Check implement-issue-tree workflow
ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null || echo "No workflow js"
If
does not exist, guide the user to use
and interrupt processing.
Step 2: Diagnose differences from the ideal state
Diagnose the current state from the following perspectives and create a gap list.
2-1. Agent Diagnosis
| 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 list kept to the minimum necessary? |
| Delegation Agents | Are there Agents equivalent to skill-author / agent-author / rules-author / docs-writer? |
2-2. Rules Diagnosis
| 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 Diagnosis
List skills available via
npx skills add Fandhe-AI/agent-cli-skills
that are not included in
.
Mandatory Skills (to be supplemented if missing):
- , ,
- ,
- ,
- (skill to add/reinforce comments according to rules)
2-4. hooks Diagnosis
| 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 Diagnosis
| 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 Prerequisite Diagnosis
bash
gh auth status
# sub_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
# (if no issue has been created, only gh auth status will be used for prerequisite confirmation)
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 js
Step 3: Present gap list to user for approval
Present the gap list in the following format.
## .claude/ Diagnosis Results
### Items requiring supplementation/enhancement
#### Agents
- [ ] <category>/<Agent-name>.md: <reason for deficiency>
- ...
#### Rules
- [ ] delegation.md: Does not exist
- [ ] coding-<lang>.md: No standards for main language (<lang>)
- ...
#### Skills (supplementable via npx skills add)
- [ ] <skill-name>: Not included in skills-lock.json
- ...
#### hooks
- [ ] SessionStart: No SessionStart hook in settings.json
- [ ] PostToolUse: No auto-formatting hook for <lang>
- ...
#### CLAUDE.md
- [ ] Delegation Policy Table: No path-based switching table
- ...
#### implement-issue-tree Prerequisites
- [ ] workflow js: .claude/workflows/implement-issue-tree.js does not exist
- ...
### Existing Assets (items requiring overwrite confirmation)
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 overwriting
Step 4: Supplement differences
Only supplement approved items. Only modify existing files that have received overwrite confirmation.
4-1. Add missing Agents
Add to
.claude/agents/<category>/<name>.md
.
If the target repo has a
rule (via
), follow that rule.
If not, you can write directly to
.
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).
4-2. Add missing Rules
Add to
.
Customize
and
according to the target repo's path structure, referencing examples from Fandhe-AI/agent-cli-skills.
If
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.
4-3. Supplement missing Skills
bash
cd <target-repo>
npx skills add Fandhe-AI/agent-cli-skills
4-4. Supplement hooks
Add/update SessionStart hook in
.
json
{
"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
- Do not directly expand user input into
Propose PostToolUse auto-formatting hooks after verifying the existence of language-specific tools, and only add them if the user wishes.
4-5. Update CLAUDE.md
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. Prepare implement-issue-tree prerequisites
Guidance if workflow js does not exist:
If not called as a named workflow (
{name: "implement-issue-tree"}
), placement in
is not necessary at all—you can directly specify
.claude/skills/implement-issue-tree/script/implement-issue-tree.js
in the Workflow tool's
.
If 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.
bash
# Place in .claude/workflows/ (only if using as a named workflow)
mkdir -p <target-repo>/.claude/workflows/
# Leave existing symlinks as-is (do not overwrite actual files)
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
If the sub_issues API cannot be used, guide the user to enable GitHub Apps.
Step 5: Report supplementation results
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
# Check list of files after supplementation
find <target-repo>/.claude -type f | sort
# Check existence of CLAUDE.md
ls <target-repo>/CLAUDE.md
# Check update to skills-lock.json
cat <target-repo>/skills-lock.json 2>/dev/null | head -20
# Check implement-issue-tree prerequisites
ls <target-repo>/.claude/workflows/implement-issue-tree.js 2>/dev/null || echo "workflow js: Not placed"
gh auth status
Notes
- For repositories where does not exist, guide the user to use and interrupt processing
- Only overwrite existing files after individual user approval
- Do not start changes without user approval for diagnosis
- Do not hardcode tokens or secrets in
- Do not include commands with in hooks
- If fails, display the error message and guide the user through manual steps
- Follow the rule if it exists in the target repo (if not, direct writing is allowed)
- Follow the principle of least privilege when listing Agent —only include necessary items
- If security issues (sensitive information inclusion, injection risks) are found, interrupt supplementation and warn the user