/autopilot:plan analyze plan* and other skills, references, agents for ref formatting…
- User
/autopilot:plan analyze plan* and other skills, references, agents for ref formatting like https://github.com/awinogradov/code-assistants/blob/main/claude-plugins/autopilot/skills/plan/SKILL.md#reference-formatting--readability Can we create skill to avoid duplication a lot of the same text evrywhere? --issue
- User
autopilot:plan /autopilot:plan analyze plan* and other skills, references, agents for ref formatting like https://github.com/awinogradov/code-assistants/blob/main/claude-plugins/autopilot/skills/plan/SKILL.md#reference-formatting--readability Can we create skill to avoid duplication a lot of the same text evrywhere? --issue
Assistant· claude-opus-5
I'll start by setting up task tracking and resolving the input.
Assistant· claude-opus-5
Phase 0 — Input Resolution
Flags:
--issuepresent,--linear-issueabsent.package.jsonhas noagents.trackers⇒ defaultgithubtracker, so--issueis valid.Before filing, I gathered the factual base — and it changes the shape of the answer materially, so I need one decision from you.
What's actually there today:
Duplicated block Copies Guard RFC-0001 "Reference formatting & readability" 24 SKILL.md+releaseNotesPrompt.tsreferenceFormattingSync(byte-identical)AskUserQuestion "Formatting Note" Assistant· claude-opus-5
You've reaffirmed the runtime-skill approach — proceeding with it in full, across all six blocks. I'll build the mitigations for the two risks into the plan rather than re-litigating them.
One hard constraint the plan must absorb: block #4 lives in agent files, and agents run with declared tool lists (
expert-reviewhastools: []), so those cannot invoke a skill without a tools change. I'll handle that explicitly rather than silently dropping it.Filing the issue now.
Assistant· claude-opus-5
Assistant· claude-opus-5
Creating the issue with the linkability pass applied.
Assistant· claude-opus-5
✓ Created issue: https://github.com/awinogradov/code-assistants/issues/479
Returning to the plan flow with the captured identifier: input type
github-issue, id#479.Assistant· claude-opus-5
Issue Context
Source: GitHub Issue #479 — https://github.com/awinogradov/code-assistants/issues/479 Extract duplicated instruction blocks from autopilot skills into shared skills OPEN · enhancement · @awinogradov (just assigned)
Assistant· claude-opus-5
Preflight: worktree detected (
git-dir≠git-common-dir), on branchlechuguilla-plateau, notmain, with 1 unmerged commit — Phase 2b. The branch carries noissue-<n>-ID while planning targets #479, so this is the mismatch path.Assistant· claude-opus-5
Continuing on branch
lechuguilla-plateau. Preflight passed — entering plan mode.Assistant· claude-opus-5
Now delegating to the Bun stack pipeline. First, the mandatory repository-documentation and context pass.
Assistant· claude-opus-5
One thing the mechanical preflight got wrong, worth surfacing: local
origin/mainis stale (742b75c) while remotemainis56c3312, 10 commits ahead. Against the real main, this worktree's branch carries exactly one unrelated commit — b8bb4b2revert(code-review): restore pull_request trigger for ai-review— which is not on main.So the preflight's "has unmerged commits ⇒ stay on this branch" verdict would build #479 on top of an unrelated revert and 10 commits of drift, and the PR for #479 would contain that revert.
Assistant· claude-opus-5
Noted: fresh
issue-479branch, and the singleshared-rulesskill. I'll treat the two items you didn't select as decided — no separate apply-line kept, single PR — and handle the two genuinely-unavoidable inlined copies as a stated constraint rather than an option, sincereleaseNotesPrompt.tscalls the raw Anthropic API with no tools at all.Assistant· claude-opus-5
All three experts returned
needs-revision. One finding is factual and load-bearing, so let me verify it before acting on it.Assistant· claude-opus-5
Verified the load-bearing finding — and it does change the design. Two facts I had wrong or unstated:
- The
Skilltool loads an entireSKILL.md. You cannot load one##section. So one skill with six sections means pulling all ~4 KB to get the 184-character agent preamble. - Skill bodies are already lazily loaded. At most one of the 24 inlined copies ever enters a given session, so today's cost is ~2.5 KB once — not 24×. My token rationale in the draft was simply wrong; the real case for this change is maintenance, not tokens.
Two more, verified against the tree:
- Adding bare
SkilltoCLAUDE_ALLOWED_TOOLSenables every autopilot skill inside the review runtime — includingcommits-create,branch-create,pr-create— and allowlists cascade to subagents. That is a privilege widening on the one agent that processes untrusted PR content. Readis already in that allowlist, and both${CLAUDE_PLUGIN_ROOT}(resolve-issue-context.md:46) and skill-relative () are established precedents here.
- The
Assistant· claude-opus-5
Decisions locked:
references/files reached byRead(no allowlist change, no privilege widening), single PR. Rewriting the plan with the expert findings folded in.Assistant· claude-opus-5
Plan written to
/Users/tony_vi/.claude/plans/rippling-churning-lampson.md. Score: 96/100 (Alignment 20, Completeness 19, Type Safety 19, Testability 20, Simplicity 18).Direct answer to your question: yes — and the analysis found more than the one block you pointed at. Six duplicated blocks exist, not one; only the RFC-0001 block is guarded, and the AskUserQuestion note has already drifted into two wordings across 11 copies with nothing detecting it.
Three things changed materially during planning:
- The token argument for extraction doesn't hold. Skill bodies are already lazily loaded, so at most one of the 24 copies enters any session. The real cost is the N-file edit and undetected drift, so the plan is framed as maintenance dedup — not a context saving.
Assistant· claude-opus-5
Plan approved. Starting with the Pre-Implementation step: refresh the stale ref, then create the branch.
Assistant· claude-opus-5
origin/mainrefreshed to56c3312. Now creating the branch.Assistant· claude-opus-5
Issue #479 is OPEN, assignee
@awinogradov (already assigned). No branch conflict.Assistant· claude-opus-5
✓ Branch created:
issue-479-dedupe-instruction-blocks✓ Pushed to origin with trackingAssignee:
@awinogradov (already assigned)Assistant· claude-opus-5
Branch is exactly at refreshed
main, tree clean, deps installed — b8bb4b2 left behind as intended.Assistant· claude-opus-5
CLAUDE_PLUGIN_ROOTis unset in the shell, confirming the plan's suspicion that it isn't reliable. But there's a stronger mechanism: every skill invocation announces its own base directory — I've observed it 5/5 times this session (…/autopilot/1.12.0/skills/plan,…/skills/issue:create,…/skills/ascii-schemas,…/skills/preflight-check,…/skills/branch:create). A sibling-relative path resolves deterministically from that, with no env var.Spike result: use
<this skill's base directory>/../shared-rules/references/<block>.md, with${CLAUDE_PLUGIN_ROOT}/skills/…documented as an equivalent when set. The CI half stays unverified until step 7's dry-run, as planned.Now extracting the six canonical blocks.
Assistant· claude-opus-5
Block 6 is larger than the issue suggested:
pr:validateRules is 179 lines (title/branch grammar, canonical) andpr:createPhase 4 is 122 lines (body grammar, canonical), mirrored prose-adapted rather than byte-identical intopr:createPhase 3 andpr:updatePhase 5. That's two blocks, not one. I'll split it accordingly.Starting with the foundation — the skill and the five straightforward reference files.
Assistant· claude-opus-5
Now the two PR-grammar blocks. Reading the canonical sections in full.
Assistant· claude-opus-5
Foundation in place: 7 reference files, frontmatter valid, ref block byte-identical to the RFC. Now the 24 conversions — inspecting the existing tail shapes first.
Assistant· claude-opus-5
The tree advanced —
gather-contextis a new skill from the 10 commits I just pulled in, and my Phase 1 inventory predates the branch. Re-inventorying against the live tree before touching anything.Assistant· claude-opus-5
The live tree differs materially from my Phase 1 inventory — those 10 commits refactored the plan pipeline. Corrected counts:
Plan assumed Live tree Skills carrying ref-format 24 23 ( plan-bun,plan-nodejs-reactremoved;gather-contextadded)Agents carrying JSON preamble 5 7 ( digest-branch-diff,digest-repo-standardsadded)Repomix consumers 7 6 ( plannow delegates togather-context)The plan's structure holds; the file lists change. Re-reading the guard tests against the live tree before rewriting them.
Assistant· claude-opus-5
Baseline confirmed:
referenceFormattingSyncfails on exactly one file — the newshared-rules/SKILL.md— because it's readdir-driven. 567 pass. That's the coupling the plan predicted, and it's why the skill, conversions, and guard rewrite must land in one commit.Surveying the lead-in wording variants before scripting the conversion.
Assistant· claude-opus-5
Colons in the skill paths broke that loop — switching to Python.
Assistant· claude-opus-5
Two phrase families to rewrite. I'll make the directive a markdown link to the block file —
linkResolutionthen verifies the target exists for free, which is the section-resolution guard the experts asked for, and it satisfies RFC-0001's own "link files you point at" rule.Assistant· claude-opus-5
Two defects in the generated text: the family-A replacement broke the sentence grammar. Let me inspect both families and fix.
Assistant· claude-opus-5
Family B (
pr:create,pr:update) reads correctly. Family A (5 files) andpr:reviewneed repair.Assistant· claude-opus-5
Ref-format done across all 23. Now the remaining five blocks. Starting with the AskUserQuestion note — the one with the known drift.
Assistant· claude-opus-5
7 copies (not 11 — the tree changed), both wordings confirmed. Replacing all with a directive.
Assistant· claude-opus-5
One copy lives in a nested
plan/references/file — the plan refactor moved content there, and my glob only covered*/SKILL.md. Rescanning all markdown underskills/.Assistant· claude-opus-5
A third wording, shorter than the other two — the drift is worse than the issue documented.
Assistant· claude-opus-5
4 files, each a canonical-comment line plus the paragraph. Extracting each file's tool list so the directive preserves it (the canonical block treats the list as caller-supplied).
Assistant· claude-opus-5
Linear done. Now the repomix snapshot block — these sit inside fenced code blocks with surrounding launch instructions, so I need to see each shape.
Assistant· claude-opus-5
Six copies in three distinct shapes. Note that
linkResolutionstrips fenced blocks, so the directive link must sit in prose outside the fence — inside it would never be verified.Assistant· claude-opus-5
Now the three bespoke repomix shapes.
Assistant· claude-opus-5
Understood — I'll take that as standing authorization: commit, open the PR, monitor to green with no findings, then merge. Adding those to the task list and continuing.
Assistant· claude-opus-5
Repomix done. Now the PR-grammar blocks across three skills.
Assistant· claude-opus-5
pr:updatehas update-only clauses (link preservation, dedup) that must survive. Splicing to keep exactly those.Assistant· claude-opus-5
All PR-grammar markers gone. One hand-written canonical comment remains in
branch:create— the self-assign algorithm mirrored fromresolve-issue-context. That's a seventh duplicated block not in the issue's inventory; I'm leaving it in place and will flag it rather than silently widening scope.Assistant· claude-opus-5
All 7 agent copies wrapped. Now the guards — the piece the experts pushed hardest on.
Assistant· claude-opus-5
Both guards green (89 tests). Now the negative tests the plan requires — proving each guard actually fails when it should.
Assistant· claude-opus-5
All four negative tests fail distinctly and restore to green — the guards catch what they claim. Now the three coupled tests.
Assistant· claude-opus-5
Two failure classes: the 8 expected sentinel-slice failures, plus a Linear-magic-word assertion that broke because the body grammar moved. Let me read both.
Assistant· claude-opus-5
Two fixes: the wiring guard's sentinel assumption, and a Linear assertion whose text now lives in the shared block.
Assistant· claude-opus-5
All 961 pass, including
linkResolution— its sentinel-based exclusion still applies since the block kept its sentinel in the new file. Verifying it actually checks the other reference files rather than silently skipping them.Assistant· claude-opus-5
linkResolutiongenuinely covers the new files — so every directive link is verified as a side effect. That is the section-resolution guard, for free.Assistant· claude-opus-5
Now the RFC v6 bump — editing an Accepted RFC's content requires it.
Assistant· claude-opus-5
Now the plugin README — directory tree and skill section.
Assistant· claude-opus-5
Now the full verification sweep — prettier on every edited markdown, validate, and the whole test suite.
Assistant· claude-opus-5
Before formatting, checking whether these were already prettier-clean on
main— I must not reformat pre-existing drift.Assistant· claude-opus-5
Clean on
main— so the drift is mine to fix. Formatting exactly the files I touched.Assistant· claude-opus-5
All green: 36 validate checks, 973 tests, RFC pin holds. Checking the release-action too (it owns the other retained copy) and reviewing diff scope.
Assistant· claude-opus-5
All green — 337 release-action tests too. Diff is exactly in scope: 36 modified, 4 new, net −827 lines. Committing in the three groups the plan requires.
Assistant· claude-opus-5
Preflight: on
issue-479-dedupe-instruction-blocks, notmain, staged changes present. Taking your goal statement as the confirmation for commits and PR, so I'll proceed without re-prompting.Assistant· claude-opus-5
Commit 1 created —
8acb03f, hooks ran clean. Now the docs commit.Assistant· claude-opus-5
commitlint rejected it:
rfc-0001in the subject matches theno-issue-id-in-subjectpattern[A-Za-z]+-[0-9]+. Rephrasing to avoid the token.Assistant· claude-opus-5
Three commits in. Now the per-commit green verification the plan requires — checking out each SHA and running the guards rather than reasoning about it.
Assistant· claude-opus-5
Every commit green independently — rebase-merge safe. Pushing and opening the PR.
Assistant· claude-opus-5
PR #480 opened: https://github.com/awinogradov/code-assistants/pull/480
Now monitoring CI and the review.
Assistant· claude-opus-5
Seven of eight checks green;
ai-reviewstill running. Using Monitor to wait properly rather than burning foreground polls.Assistant· claude-opus-5
While that runs, completing step 7's path-resolution verification — checking every directive resolves in both the repo layout (what CI uses) and the installed-plugin layout.
Assistant· claude-opus-5
All 69 directive links resolve in both the repo layout and the plugin layout. That's the static half of step 7; the runtime half comes from the
ai-reviewrun itself, which exercisespr:review— though against the pre-change skills, since the action loads from@main.Status so far:
Check Result Validate, Validate PR, CodeQL, Analyze ×2, GitGuardian, Auto label ✅ SUCCESS ai-review running Waiting on the review verdict.
Assistant· claude-opus-5
Census clarified — the remaining occurrences are all intentional:
reference-formatting: 27 → 2 real copies. The canonical
references/reference-formatting.mdplusreleaseNotesPrompt.ts(no tools on that path). The other two hits are test files naming the sentinel string in prose, not carrying the block.agent JSON preamble: stays at 7. Those are the agent files that can't read, exactly as designed — the two extra hits are the canonical file and
sharedBlockSync's exhaustiveness check.AskUserQuestion 7 → 1, repomix 7 → 1, Linear MCP 4 → 1.
Everything green except
ai-review, which is still running. The monitor will notify me when it lands; I'll act on the verdict then — fixing any findings and merging once it's approved with no issues.Assistant· claude-opus-5
All checks green and
reviewDecision=APPROVED. But approval alone isn't the clean signal — the bot leaves non-blocking suggestions on APPROVE, so I need to read the actual verdict before merging.Assistant· claude-opus-5
Approved, but with a legitimate finding:
shared-rules/SKILL.mdsays "five structured-output agents" while the matrix registers seven. That's a real error I introduced — I wrote that file before re-inventorying the tree, which revealed the two newdigest-*agents. The goal is "no issues found," so I'll fix it.Assistant· claude-opus-5
Confirmed: one stale "five" in
SKILL.md;docs/13already says seven. Ground truth is seven.Assistant· claude-opus-5
Per the repo's review convention, this fix belongs squashed into the commit that introduced the file, not appended. Using a soft reset against the pinned base rather than
origin/main, which can move.Assistant· claude-opus-5
I just used a 40-char SHA in those links without verifying it — exactly the mistake that produces dead blob links. Checking it.
Assistant· claude-opus-5
I fabricated that SHA tail — the links are dead. Correcting the posted comment with the real one from
git rev-parse.Assistant· claude-opus-5
Both links now resolve (HTTP 200). Monitoring the re-review triggered by the force-push.
Assistant· claude-opus-5
Squash pushed and re-review requested. Where things stand:
Delivered — issue #479, PR #480, branch
issue-479-dedupe-instruction-blocks, three commits, net −997 lines.What shipped differs from what you first asked for, in two ways worth stating plainly: