一键导入
sync
Inject managed sections into existing CLAUDE.md and AGENTS.md after a plugin update without re-bootstrapping. Preserves all project-specific content.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Inject managed sections into existing CLAUDE.md and AGENTS.md after a plugin update without re-bootstrapping. Preserves all project-specific content.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | sync |
| description | Inject managed sections into existing CLAUDE.md and AGENTS.md after a plugin update without re-bootstrapping. Preserves all project-specific content. |
After updating the North Starr plugin, inject any new or updated managed sections into your existing CLAUDE.md and AGENTS.md without re-running /bootstrap. This preserves all your project-specific content (architecture, module map, vocabulary, etc.) while adding new North Starr sections.
This skill is for Claude Code plugin users only. If you installed via Homebrew, run north-starr update from the terminal instead — it does the same thing without using AI tokens.
/bootstrap when only managed sections need updatingManaged sections are wrapped in marker comments:
<!-- [NORTH-STARR:section-name v1.2] -->
## Section Content
...
<!-- [/NORTH-STARR:section-name] -->
The open marker includes an optional version tag (e.g., v1.2). When syncing, the version in the canonical section is compared to the version in the file. If versions match, the content is assumed current and skipped. If versions differ (or no version exists), content comparison is used as fallback.
The sync process:
Before syncing, check whether the installed plugin is stale. This prevents syncing against outdated templates that silently serve old content.
Locate the marketplace cache: Check if ~/.claude/plugins/marketplaces/north-starr/ exists (this is where Claude Code caches the plugin repo).
Fetch and compare: Run these commands via Bash:
cd ~/.claude/plugins/marketplaces/north-starr && git fetch origin 2>/dev/null && git rev-parse HEAD && git rev-parse origin/main
Evaluate freshness:
HEAD equals origin/main → plugin is current, proceed to Step 1HEAD is behind origin/main → the plugin cache is staleIf stale, auto-update the cache and continue:
cd ~/.claude/plugins/marketplaces/north-starr && git reset --hard origin/main && cd -
rm -rf ~/.claude/plugins/cache/north-starr
Then present a brief notice (not a blocker):
⚠ Plugin cache was stale (HEAD: <old> → <new>). Auto-updated. Continuing sync with latest templates.
Proceed to Step 1 — do NOT stop or ask the user to restart. The sync will now read from the updated marketplace directory, which has the latest templates. A full Claude Code restart is not required for /sync to work correctly since it reads templates directly from the filesystem.
Version cross-check (optional): If .claude-plugin/marketplace.json is readable, compare its metadata.version with the version in the marketplace cache's marketplace.json. Log the versions in the sync preview for transparency:
Plugin version: 4.4.0 (installed) vs 4.5.0 (latest) — STALE
Plugin version: 4.5.0 (installed) vs 4.5.0 (latest) — current
Read the root context files in the project:
CLAUDE.md — always (if it exists)AGENTS.md — always (if it exists)If a file doesn't exist, skip it.
For each managed section defined in the Canonical Sections below, apply the sync logic to all context files found in Step 1:
Decision logic for each section:
| Current state of target file | Action |
|---|---|
| Section exists with markers AND content is identical to canonical | Skip — already up to date, no write needed |
| Section exists with markers AND content differs from canonical | Replace everything between the open and close markers (inclusive) with the canonical version below |
Section heading (e.g. ## How to Approach Tasks) exists but WITHOUT markers | Skip — tell the user: "Section exists without markers. Run /bootstrap to get marker support, or manually wrap the section with markers." |
| Section is completely absent | Append the canonical version at the end of the file |
Comparison: Compare the existing content (between markers) with the canonical version. Normalize whitespace before comparing — trailing newlines and minor formatting differences should not trigger an unnecessary rewrite.
Dry-run preview: Before writing any changes, collect all planned actions (replace, append, skip) and present them as a summary:
Sync preview:
CLAUDE.md:
how-to-approach-tasks — UPDATE (content differs)
auto-learn — SKIP (already current)
AGENTS.md:
how-to-approach-tasks — APPEND (section missing)
auto-learn — APPEND (section missing)
Agents:
chief-ai-po.md — ADD (new)
layoutplan.md — SKIP (identical)
Apply changes? (y/n)
Wait for user confirmation before writing. If the user runs /sync with --force or says "just do it", skip the preview.
After syncing content, check if managed sections appear AFTER project context headings (## Tech Stack, ## Architecture, ## Grain, ## Module Map, ## Conventions). If so, move them:
# Project Name) and its description line, BEFORE any project context headingsCorrect order:
# Project Name
[description]
<!-- [NORTH-STARR:how-to-approach-tasks] -->
## How to Approach Tasks
...
<!-- [/NORTH-STARR:how-to-approach-tasks] -->
<!-- [NORTH-STARR:auto-learn] -->
## When to Learn Automatically
...
<!-- [/NORTH-STARR:auto-learn] -->
## Tech Stack
## Architecture
## Grain
## Module Map
If sections are already in the correct order, skip this step.
Sync agent definitions for each enabled tool:
Claude Code — from templates/claude/agents/ into .claude/agents/:
.md files in templates/claude/agents/.claude/agents/ — create if missing, update if content differs, skip if identical.claude/agents/ if it doesn't existVS Code Copilot — from templates/github/agents/ into .github/agents/ (only if .github/agents/ exists or AGENTS.md references Copilot):
.agent.md files in templates/github/agents/.github/agents/ — create if missing, update if content differs, skip if identical.github/agents/ if it doesn't existDo not hardcode the agent list. Dynamically list all files in the template directories. This ensures new agents added in future plugin versions are automatically synced. Current agents as of v4.3.0: layoutplan, storymap, chief-ai-po.
After syncing, verify the files weren't corrupted:
<!-- [NORTH-STARR:name] --> open marker must have a matching <!-- [/NORTH-STARR:name] --> close marker. If any are orphaned, warn the user.## heading appears more than once in the file. Duplicates indicate a botched append.If any check fails, present the issue before the summary so the user can fix it.
## Sync Complete
**Files updated:**
- CLAUDE.md — [added: section-name, section-name] [updated: section-name] [skipped: section-name (no markers)]
- AGENTS.md — [added: section-name, section-name] [updated: section-name] [skipped: section-name (no markers)]
**Agents:**
- .claude/agents/<name>.md — [added / updated / already current]
[...repeat for each agent found in templates/claude/agents/]
**No changes needed:**
- [file] — all managed sections are up to date
These are the managed sections that /sync injects. CLAUDE.md and AGENTS.md get different variants of the how-to-approach-tasks section — CLAUDE.md uses plain text prompts while AGENTS.md uses vscode_askQuestions.
how-to-approach-tasks (CLAUDE.md variant)Use this version when syncing CLAUDE.md:
<!-- [NORTH-STARR:how-to-approach-tasks] -->
## How to Approach Tasks
Before ANY code change, print this assessment:
| # | Question | Answer |
|---|----------|--------|
| 0 | Is current behavior covered by tests? | Yes / No |
| 1 | How many files will this change? | 1-2 / 3+ |
| 2 | Am I creating new types or protocols? | No / Yes |
| 3 | Does this require cross-module integration? | No / Yes |
**Rules:**
- **Fast-path**: 1 file, no new types, no cross-module impact, existing test coverage → state the file and proceed. No table needed.
- Q0 = No → Write tests for current behavior FIRST
- Q1 = 3+ OR Q2/Q3 = Yes → Run `/invert` automatically. Once the inversion analysis is ready, ask "Proceed with layout plan?" before spawning the `layoutplan` agent. Do not proceed without approval.
- All Low → State files and wait for confirmation
**Workflow:** RED (failing tests) → GREEN (implementation) → Completion summary listing files modified → Ask the user: "What would you like to do next?" with options: Generate commit message, Generate PR description, Run /learn (capture learnings), or Done. Do not run any of these automatically — wait for the user's choice.
**Todo discipline:** Never create a todo item for verification steps like "run tests", "build project", or "verify changes". Testing and building are implicit parts of the implementation workflow, not standalone tasks.
Skip test-first for: config, docs, CI, trivial one-line fixes.
If more files are affected than estimated mid-implementation, STOP and run `/invert`.
Always check `.plans/` for active plans before starting new work.
<!-- [/NORTH-STARR:how-to-approach-tasks] -->
how-to-approach-tasks (AGENTS.md variant)Use this version when syncing AGENTS.md:
<!-- [NORTH-STARR:how-to-approach-tasks] -->
## How to Approach Tasks
Before ANY code change, print this assessment:
| # | Question | Answer |
|---|----------|--------|
| 0 | Is current behavior covered by tests? | Yes / No |
| 1 | How many files will this change? | 1-2 / 3+ |
| 2 | Am I creating new types or protocols? | No / Yes |
| 3 | Does this require cross-module integration? | No / Yes |
**Rules:**
- **Fast-path**: 1 file, no new types, no cross-module impact, existing test coverage → state the file and proceed. No table needed.
- Q0 = No → Write tests for current behavior FIRST
- Q1 = 3+ OR Q2/Q3 = Yes → Run `/invert` automatically. Once the inversion analysis is ready, use `vscode_askQuestions` to ask "Proceed with layout plan?" (options: "Yes, run layoutplan", "No, let me review first"). Once the plan is ready, use `vscode_askQuestions` again to ask "Plan is ready. Start implementation?" (options: "Yes, start coding", "No, I want to adjust the plan"). Do not proceed without approval at each gate.
- All Low → State files and wait for confirmation
**Workflow:** RED (failing tests) → GREEN (implementation) → Completion summary listing files modified → Use `vscode_askQuestions` to prompt the developer with options: "Generate commit message", "Generate PR description", "Run /learn (capture learnings)", "Done". Do not run any of these automatically — wait for the developer's choice. If the developer chooses "Generate commit message", generate it, then use `vscode_askQuestions` again to ask "Commit message generated. What next?" with options: "Generate PR description", "Run /learn (capture learnings)", "Done".
**Todo discipline:** Never create a todo item for verification steps like "run tests", "build project", or "verify changes". Testing and building are implicit parts of the implementation workflow, not standalone tasks.
Skip test-first for: config, docs, CI, trivial one-line fixes.
If more files are affected than estimated mid-implementation, STOP and run `/invert`.
Always check `.plans/` for active plans before starting new work.
<!-- [/NORTH-STARR:how-to-approach-tasks] -->
auto-learn (same for both files)<!-- [NORTH-STARR:auto-learn] -->
## When to Learn Automatically
Run `/learn` automatically when: user corrects your approach, same fix requested twice, your change breaks something, user rejects generated code, you discover an undocumented convention, or you hit a trap not in any landmine rule. Finish the immediate fix first, then capture the insight.
<!-- [/NORTH-STARR:auto-learn] -->
tool: claude)north-starr update instead — same result, no AI tokens<!-- [NORTH-STARR:...] --> markers) are touched/sync after a plugin update will pick them up/bootstrap once to regenerate with markersDecompose a PRD into prioritized, dependency-mapped epics and user stories. Accepts pasted text, file path, or PDF.
Generate AI tool configuration for an existing project. Explores the codebase and produces context files, path-scoped pattern rules, landmine rules, and agents for Claude Code and VS Code Copilot. Run once per project.
Autonomously improve any skill prompt using a measure-change-test loop inspired by Karpathy's autoresearch. Runs the skill repeatedly, scores output against a yes/no checklist, makes one small change per round, keeps improvements, reverts regressions. Use when the user asks to "improve a skill", "optimize a skill", "autoimprove", "run autoresearch on a skill", or similar requests about iteratively improving skill quality.
Analyze code modules and files for refactoring opportunities, code smells, and architectural pattern violations in any language or framework. Use this skill when the user asks to "analyze code smells", "find refactoring opportunities", "check for code quality issues", or "review architecture" for a specific module or file.
Generate clear, descriptive git commit messages by analyzing staged changes. Use this skill when the user asks to "generate a commit message", "write a commit message", "create a commit message", or similar requests related to git commits.
Generate a pull request description by analyzing git changes against the target branch and filling in the project's PR template. Use this skill when the user asks to "generate PR description", "write PR description", "create PR body", "fill PR template", "prepare pull request", or similar requests related to pull request documentation.