$npx -y skills add neuromechanist/research-skills --skill update-rulesThis skill should be used when the user asks to \"update rules\", \"sync rules\", \"update AGENTS.md\", \"update CLAUDE.md\", \"refresh rules\", \"update project config\", \"sync templates\", \"update vibe rules\", \"check for rule updates\", \"update user rules\", \"update globa
| 1 | # Update Rules and Configuration |
| 2 | |
| 3 | Update existing AGENTS.md/CLAUDE.md and .rules/ files from the latest plugin templates. Non-destructive: never overwrite user customizations, always preview changes before applying. |
| 4 | |
| 5 | ## When to Use |
| 6 | |
| 7 | - After plugin templates have been updated with new rules or improvements |
| 8 | - When adding a rule file introduced after initial project setup |
| 9 | - When checking if project rules are current with latest best practices |
| 10 | - When checking existing project rules against newer templates. For installing |
| 11 | or updating user-level instructions across Claude, Codex, Copilot, or Cursor, |
| 12 | use `install-user-instructions` instead. |
| 13 | - When a user wants to know what changed in the templates since they last synced |
| 14 | |
| 15 | ## Two Operating Levels |
| 16 | |
| 17 | ### Project Level (`/update-rules project`) |
| 18 | |
| 19 | Update the current project's configuration: |
| 20 | |
| 21 | 1. **`.rules/` directory sync** -- Compare each template rule file against the project's `.rules/` directory: |
| 22 | - `MISSING` -- new in templates, not in project. Show purpose and offer to add. |
| 23 | - `CHANGED` -- exists but differs from template. Show unified diff, suggest merge. |
| 24 | - `CURRENT` -- matches template. Report as up to date. |
| 25 | - `CUSTOM` -- user-added rule not in templates. Preserve completely, report. |
| 26 | |
| 27 | 2. **`AGENTS.md` section comparison** -- Extract H2 headers from both template and project AGENTS.md. Identify missing sections. For matching sections, compare content and suggest updates. Preserve all project-specific customizations (replaced placeholders, custom guidelines, architecture maps). If the project only has CLAUDE.md, offer to migrate shared content into AGENTS.md and leave CLAUDE.md as the Claude adapter. |
| 28 | |
| 29 | 3. **What gets compared:** |
| 30 | - Template `rules/*.md` vs `.rules/*.md` |
| 31 | - Template `AGENTS.md` sections vs `./AGENTS.md` sections (script emits `PROJECT_SECTION_SOURCE=agents|claude` so a CLAUDE.md fallback is never silently treated as AGENTS.md) |
| 32 | - The CLAUDE.md adapter check is performed as an LLM read step (verify it begins with `@AGENTS.md` and contains only Claude-specific additions), not part of the script output |
| 33 | |
| 34 | ### User Level (`/update-rules user`) |
| 35 | |
| 36 | Delegate to `install-user-instructions`. That skill detects and asks which of |
| 37 | Claude Code, Codex, GitHub Copilot CLI, and Cursor the user wants to configure, |
| 38 | previews non-destructive managed-block changes, and prevents general defaults |
| 39 | from being copied into downstream projects. Do not silently interpret `user` |
| 40 | as Claude-only. |
| 41 | |
| 42 | ## Comparison Workflow |
| 43 | |
| 44 | ### Step 1: Run Comparison Script |
| 45 | |
| 46 | Run `project-diff-rules <level>` to get structured comparison data. The script outputs KEY=VALUE pairs categorizing each rule file and listing section headers from both sources. |
| 47 | |
| 48 | ### Step 2: Read and Analyze |
| 49 | |
| 50 | For project level: |
| 51 | - Read each `RULE_CHANGED` file from both template and project to understand the differences |
| 52 | - Read AGENTS.md from both sources to compare sections |
| 53 | - Read CLAUDE.md to verify it imports AGENTS.md with `@AGENTS.md` and contains only Claude-specific additions |
| 54 | - Run `diff --unified "$(project-templates-path)/claude/rules/<file>" ".rules/<file>"` for each changed rule |
| 55 | |
| 56 | For user level, stop this comparison workflow and use |
| 57 | `install-user-instructions`. Read only the selected systems' targets and |
| 58 | platform reference after the user chooses them. |
| 59 | |
| 60 | ### Step 3: Present Update Plan |
| 61 | |
| 62 | Present a numbered list of proposed changes. Each change marked as: |
| 63 | - `[ADD]` -- New content to add |
| 64 | - `[UPDATE]` -- Existing content to modify |
| 65 | - `[INFO]` -- No change needed, already current |
| 66 | |
| 67 | Show preview of what will change for each item. Ask user to confirm which changes to apply. Never apply changes without confirmation. |
| 68 | |
| 69 | ### Step 4: Apply Approved Changes |
| 70 | |
| 71 | - For existing files: use Edit tool for surgical modifications. Use Write only when the user explicitly approves replacing a file with the template version. |
| 72 | - For new .rules/ files: use Write to create them (safe, creating new file). |
| 73 | - For AGENTS.md sections: use Edit to insert or update specific sections. |
| 74 | - For CLAUDE.md: use Edit to keep the adapter import (`@AGENTS.md`) and preserve Claude-only additions. |
| 75 | |
| 76 | ### Step 5: Verify |
| 77 | |
| 78 | Run `project-diff-rules <level>` again to confirm all approved changes were applied. |
| 79 | |
| 80 | ## Non-Destructive Guarantees |
| 81 | |
| 82 | - NEVER overwrite a file without showing the diff first |
| 83 | - NEVER remove user-added content (custom rules, custom sections, custom guidelines) |
| 84 | - NEVER replace project-specific |