From f60cc71f99afc046675d665087ab08a2ffd1e305 Mon Sep 17 00:00:00 2001 From: okash1n <48118431+okash1n@users.noreply.github.com> Date: Fri, 12 Jun 2026 15:44:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=80=8B=E4=BA=BA=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=AE=20rules/user-*=20=E6=8E=A8=E5=A5=A8=E3=82=AC=E3=82=A4?= =?UTF-8?q?=E3=83=80=E3=83=B3=E3=82=B9=E3=81=A8=20/audit-config=20?= =?UTF-8?q?=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=82=92=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=EF=BC=88v0.72.0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - README ja/en に個人設定の推奨配置(rules/user-*.md)を明記 - update 時、CLAUDE.md ユーザーセクションに実コンテンツがある場合のみ非ブロックの tip を 1 行表示(CRLF 耐性つき検出ヘルパー + テスト) - /audit-config 新設: 4 分類レンズ + 削りすぎ防止 + 提案のみ出力の個人設定監査コマンド --- CHANGELOG.md | 9 +++++ README.en.md | 7 ++-- README.md | 8 +++-- commands/audit-config.md | 55 ++++++++++++++++++++++++++++++ i18n/en/strings.sh | 1 + i18n/ja/strings.sh | 1 + lib/update.sh | 26 ++++++++++++++ tests/unit/test-update-refactor.sh | 36 +++++++++++++++++++ 8 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 commands/audit-config.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 16538b5..b8a5481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). +## [0.72.0] - 2026-06-12 + +個人設定の置き場所ガイダンスと監査コマンドを追加(v0.71.1 の `user-*` 予約規約の活用面)。 + +### Added +- **`/audit-config` コマンドを新設**: ユーザー所有の設定(CLAUDE.md ユーザーセクション・`rules/user-*.md`・プロジェクト CLAUDE.md)を「現行モデルに必要か」の観点で監査する。判定レンズは babysitting / over-prescription / stale-premise / context-tax の 4 分類。削りすぎ防止を組み込み済み: モデルが推測できない個人選好は削除対象にしない、context-tax 判定は settings / harness の実確認を伴う場合のみ、出力は提案のみで適用はユーザー承認後(コマンド数 20 → 21) +- **README に個人設定の推奨配置を明記(ja/en)**: 個人の常時ロード指示は CLAUDE.md ユーザーセクションより `~/.claude/rules/user-*.md` 推奨(kit が配布しない予約名のため update と完全分離、ファイル単位で管理可能。コンテキストコストは同一であることも明記) +- **update 時の非ブロック tip**: CLAUDE.md ユーザーセクションに実コンテンツ(スキャフォールド以外)がある場合のみ、update の CLAUDE.md 処理直後に `rules/user-*.md` への移設案内を info 1 行で表示(プロンプトなし・nag なし)。検出ヘルパー `_claude_md_user_section_has_content` のユニットテスト付き + ## [0.71.1] - 2026-06-12 ### Added diff --git a/README.en.md b/README.en.md index 0b1f065..5add7d0 100644 --- a/README.en.md +++ b/README.en.md @@ -52,7 +52,7 @@ Claude Code Starter Kit bootstraps a consistent, high-quality Claude Code enviro - **3 profiles**: Minimal, Standard (recommended), Full - **9 agents**: planner, architect, tdd-guide, code-reviewer, security-reviewer, build-error-resolver, e2e-runner, refactor-cleaner, doc-updater - **8 rules**: coding-style, git-workflow, performance, security, testing, agents, anti-patterns, permissions-guide -- **20 slash commands**: /plan, /tdd, /build-fix, /e2e, /verify, /research, /web-article, /oss-analyze, /web-source-review, /handover, /update-kit, and more +- **21 slash commands**: /plan, /tdd, /build-fix, /e2e, /verify, /research, /web-article, /oss-analyze, /web-source-review, /handover, /update-kit, and more - **12 skill modules**: backend-patterns, frontend-patterns, security-review, tdd-workflow, prompt-patterns, and more - **11 optional hooks/settings**: safety net (cc-safety-net), auto update, web content update, tmux reminder, doc blocker, Prettier or Biome formatting, PR creation log, pre-compact snapshot (opt-in), statusline, doc size guard, feature recommendation - **14 plugins** from multiple marketplaces: security-guidance, commit-commands, pr-review-toolkit, feature-dev, code-review, claude-md-management, superpowers, code-simplifier, document-skills, example-skills, typescript-lsp, gopls-lsp, pyright-lsp, rust-analyzer-lsp @@ -252,6 +252,7 @@ After restarting your terminal, start `claude` in your project directory. The in /oss-analyze # Analyze an OSS repo/doc URL for tech + adoption decisions /web-source-review # Evaluate a URL's credibility as an information source /handover # Structured session handover document +/audit-config # Audit personal config for outdated model-babysitting instructions /update-kit # Manually update starter kit to latest version ``` @@ -393,7 +394,7 @@ claude-code-starter-kit/ │ └── ja/ # Japanese templates & strings ├── agents/ # Agent definitions (9 files) ├── rules/ # Rule files (8 files) -├── commands/ # Slash commands (20 files) +├── commands/ # Slash commands (21 files) └── skills/ # Skill modules (12 dirs) ``` @@ -402,7 +403,7 @@ claude-code-starter-kit/ After installation, you can extend or modify any component: - **Add an agent**: Create a new `.md` file in `~/.claude/agents/` -- **Add a rule**: Create a new `.md` file in `~/.claude/rules/` +- **Add a rule**: Create a new `.md` file in `~/.claude/rules/` (for personal always-loaded preferences, `user-*.md` is recommended — the kit reserves that namespace and never ships such files, so updates can never collide with yours) - **Add a command**: Create a new `.md` file in `~/.claude/commands/` - **Add a skill**: Create a new directory under `~/.claude/skills/` with a `SKILL.md` - **Modify hooks**: Edit `~/.claude/settings.json` hooks section diff --git a/README.md b/README.md index 72c74b4..5437576 100644 --- a/README.md +++ b/README.md @@ -430,7 +430,7 @@ cd claude-code-starter-kit | **refactor-cleaner** | コード整理 | 不要なコードの削除・整理 | | **doc-updater** | ドキュメント更新 | README やドキュメントの更新 | -### 💬 スラッシュコマンド(20個) +### 💬 スラッシュコマンド(21個) スラッシュコマンドは、Claude に **ワンタッチで指示を出すショートカット** です。 Claude Code のチャットで `/` に続けて入力します。 @@ -451,6 +451,7 @@ Claude Code のチャットで `/` に続けて入力します。 | `/web-source-review` | URL を抽出し情報源としての信頼性を評価 | | `/handover` | セッション引き継ぎドキュメントの生成 | | `/update-kit` | スターターキットを手動で最新版に更新 | +| `/audit-config` | 個人設定(CLAUDE.md ユーザーセクション・user-*.md)に旧モデル向けの不要な指示が残っていないか監査 | ### 🌐 Web 取得スキル(web-content-extraction) @@ -867,6 +868,7 @@ NONINTERACTIVE=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/cloudna > **CLAUDE.md のカスタマイズ**: > - `~/.claude/CLAUDE.md` は kit 管理セクション(`` 〜 ``)とユーザーセクション(`# ユーザー設定`)に分かれています > - ユーザーセクションに自由にカスタム指示を追加できます。update 時も kit セクションのみ更新され、ユーザーセクションは保持されます +> - **おすすめ**: 個人の常時ロード指示は、CLAUDE.md のユーザーセクションよりも `~/.claude/rules/user-<名前>.md` として置くのがおすすめです。kit は `user-*` 名のファイルを配布しないことを保証している(CI で強制)ため、update のマージ対象から完全に外れ、ファイル単位で整理・バージョン管理できます。コンテキストコストはどちらも同じ(常時ロード)です > - 既存の CLAUDE.md にマーカーがない場合、初回 update 時に対話的にマイグレーションが行われます > > **既存ユーザー向け**: @@ -899,7 +901,7 @@ NONINTERACTIVE=1 bash -c "$(curl -fsSL https://raw.githubusercontent.com/cloudna | やりたいこと | 方法 | |---|---| | エージェントを追加 | `~/.claude/agents/` に `.md` ファイルを作成 | -| ルールを追加 | `~/.claude/rules/` に `.md` ファイルを作成 | +| ルールを追加 | `~/.claude/rules/` に `.md` ファイルを作成(個人設定は `user-*.md` 推奨 — kit が配布しない予約名で update と衝突しない) | | コマンドを追加 | `~/.claude/commands/` に `.md` ファイルを作成 | | スキルを追加 | `~/.claude/skills/{name}/` に `SKILL.md` + 必要に応じて `references/`, `scripts/`, `assets/` を作成 | | フックを変更 | `~/.claude/settings.json` の hooks セクションを編集 | @@ -1102,7 +1104,7 @@ claude-code-starter-kit/ │ └── ja/ # 日本語 ├── agents/ # AI エージェント定義(9種) ├── rules/ # コーディングルール(8種) -├── commands/ # スラッシュコマンド(20個) +├── commands/ # スラッシュコマンド(21個) └── skills/ # スキルモジュール(12個) ``` diff --git a/commands/audit-config.md b/commands/audit-config.md new file mode 100644 index 0000000..1c53c9b --- /dev/null +++ b/commands/audit-config.md @@ -0,0 +1,55 @@ +--- +description: Audit your personal Claude Code config for outdated, model-babysitting, or redundant instructions. +argument-hint: [global|project|all] +--- + +# /audit-config — Personal Config Audit + +Audit user-owned configuration for instructions that no longer help (or +actively hurt) current-generation models. Kit-managed files are NOT in +scope — the kit audits its own content upstream. + +## Scope + +- `global` (default): the user section of `~/.claude/CLAUDE.md` (content + outside the STARTER-KIT-MANAGED markers) and user-owned rule files + (`~/.claude/rules/user-*.md` and any rules file not shipped by the kit) +- `project`: the current project's `CLAUDE.md` / `.claude/` config +- `all`: both + +## Audit Lenses + +Classify each instruction (line or section) into: + +1. **babysitting** — countermeasures for old-model failure modes that no + longer occur (e.g. tool-call format reminders, "fix errors immediately", + forced step-by-step rituals) +2. **over-prescription** — rigid procedures that override the model's own + judgment where it is now reliable (blanket TDD/coverage mandates, + fixed command pipelines, arbitrary numeric gates) +3. **stale-premise** — references to old models, retired features, or + superseded mechanics (thinking keywords, old model names, obsolete + context-management lore) +4. **context-tax** — always-loaded lines duplicating what the harness or + settings already enforce (language settings, parallel tool calls, + risk reporting). Verify the duplication against the actual settings + file or documented harness behavior before claiming it — cite what + you checked. + +## Preservation Rules (do not over-delete) + +- **Genuine personal preferences stay.** Anything the model could not + infer on its own — naming/secrecy rules, confirmation gates, response + formats, workflow phrases — is the user's voice, not babysitting. +- When unsure whether something is preference or babysitting, keep it + and say why you were unsure. +- Only mark `context-tax` removals when you actually verified the + duplication (e.g. read `settings.json`, confirmed the harness ships + the behavior). No speculation-based deletions. + +## Output (proposal only — never edit without approval) + +Produce a table: `target | verdict (keep/remove/rewrite/merge) | reason`, +followed by the full proposed replacement text for every rewrite/merge. +End with a summary of what gets shorter and what is preserved. Apply +changes only after the user approves them. diff --git a/i18n/en/strings.sh b/i18n/en/strings.sh index e372f02..d478beb 100644 --- a/i18n/en/strings.sh +++ b/i18n/en/strings.sh @@ -270,6 +270,7 @@ STR_UPDATE_TITLE="Updating Claude Code Starter Kit" STR_UPDATE_SETTINGS="Checking settings.json..." STR_UPDATE_SETTINGS_UPDATED="settings.json updated" STR_UPDATE_SETTINGS_UNCHANGED="settings.json unchanged (kit has no changes)" +STR_UPDATE_USER_RULES_TIP="Tip: personal instructions in the CLAUDE.md user section can also live in ~/.claude/rules/user-*.md (a namespace reserved for you — kit updates never ship or touch user-* files). See README > Customization." STR_UPDATE_SETTINGS_MERGING="Merging settings.json (both you and kit have changes)..." STR_UPDATE_SETTINGS_MERGED="settings.json merged successfully" STR_UPDATE_CLAUDEMD="Checking CLAUDE.md..." diff --git a/i18n/ja/strings.sh b/i18n/ja/strings.sh index 98f4d82..d5daca9 100644 --- a/i18n/ja/strings.sh +++ b/i18n/ja/strings.sh @@ -268,6 +268,7 @@ STR_UPDATE_TITLE="Claude Code Starter Kit を更新中" STR_UPDATE_SETTINGS="settings.json を確認中..." STR_UPDATE_SETTINGS_UPDATED="settings.json を更新しました" STR_UPDATE_SETTINGS_UNCHANGED="settings.json に変更なし(kit 側の変更なし)" +STR_UPDATE_USER_RULES_TIP="ヒント: CLAUDE.md ユーザーセクションの個人設定は ~/.claude/rules/user-*.md にも置けます(user-* は kit が配布しない予約名で、update が干渉しません)。詳細は README のカスタマイズ節へ。" STR_UPDATE_SETTINGS_MERGING="settings.json をマージ中(あなたと kit の両方に変更あり)..." STR_UPDATE_SETTINGS_MERGED="settings.json のマージが完了しました" STR_UPDATE_CLAUDEMD="CLAUDE.md を確認中..." diff --git a/lib/update.sh b/lib/update.sh index ccc2705..d7a82c8 100644 --- a/lib/update.sh +++ b/lib/update.sh @@ -798,6 +798,25 @@ _update_phase_settings() { _strip_retired_hook_entries "$current_settings" } +# _claude_md_user_section_has_content - Returns 0 when the user section of a +# deployed CLAUDE.md (everything after the END marker) contains real content +# beyond the scaffold (section heading, HTML comments, blank lines). +_claude_md_user_section_has_content() { + local file="$1" + [[ -f "$file" ]] || return 1 + _has_kit_markers "$file" || return 1 + awk ' + { gsub(/\r$/, "") } + found && NF { + if ($0 ~ /^[[:space:]]*" { found = 1 } + END { exit has ? 0 : 1 } + ' "$file" +} + # --- Phase 2/5: CLAUDE.md (section-aware) ------------------------------------- _update_phase_claude_md() { local claude_dir="$1" @@ -830,6 +849,13 @@ _update_phase_claude_md() { fi fi + # Non-blocking tip: personal always-loaded instructions live better in + # ~/.claude/rules/user-*.md (reserved namespace the kit never ships) than + # in the CLAUDE.md user section. One info line, no prompt, no nag loop. + if _claude_md_user_section_has_content "$current_claude_md"; then + info "${STR_UPDATE_USER_RULES_TIP:-Tip: personal instructions in the CLAUDE.md user section can live in ~/.claude/rules/user-*.md instead (reserved for you; never touched by updates). See README.}" + fi + # Older releases deployed AGENTS.md into ~/.claude. The starter kit no # longer manages that file, so remove the stale copy during update. local legacy_agents_md="${claude_dir}/AGENTS.md" diff --git a/tests/unit/test-update-refactor.sh b/tests/unit/test-update-refactor.sh index 622f989..e58b8a9 100644 --- a/tests/unit/test-update-refactor.sh +++ b/tests/unit/test-update-refactor.sh @@ -94,3 +94,39 @@ fail "$test_name (helper_uses=$helper_uses inline_has=$inline_has)" fi } + +{ + test_name="update: user-section content detection drives the rules/user-* tip" + _ust_tmp="$(mktemp -d)" + _SETUP_TMP_FILES+=("$_ust_tmp") + # scaffold only (heading + placeholder comment) → no tip + cat > "$_ust_tmp/scaffold.md" <<'MD' + +# Global Settings + + +# User Settings + + +MD + # real user content → tip + cat > "$_ust_tmp/content.md" <<'MD' + +# Global Settings + + +# ユーザー設定 + +- 個人ルールがここにある +MD + # markerless → no tip (migration path handles it) + printf '# my own file\n- stuff\n' > "$_ust_tmp/markerless.md" + _ust_rc_scaffold=0; _claude_md_user_section_has_content "$_ust_tmp/scaffold.md" || _ust_rc_scaffold=$? + _ust_rc_content=0; _claude_md_user_section_has_content "$_ust_tmp/content.md" || _ust_rc_content=$? + _ust_rc_markerless=0; _claude_md_user_section_has_content "$_ust_tmp/markerless.md" || _ust_rc_markerless=$? + if [[ "$_ust_rc_scaffold" -ne 0 ]] && [[ "$_ust_rc_content" -eq 0 ]] && [[ "$_ust_rc_markerless" -ne 0 ]]; then + pass "$test_name" + else + fail "$test_name (scaffold=$_ust_rc_scaffold content=$_ust_rc_content markerless=$_ust_rc_markerless)" + fi +}