Skip to content

refactor(skills): extract conditional content to references#804

Merged
tmchow merged 3 commits intomainfrom
tmchow/skill-body-weight
May 8, 2026
Merged

refactor(skills): extract conditional content to references#804
tmchow merged 3 commits intomainfrom
tmchow/skill-body-weight

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented May 8, 2026

Summary

SKILL.md content loads at trigger time and is carried through every subsequent tool call and agent dispatch in that session (per AGENTS.md). Three of the heaviest skills had ~5K words of conditional or single-use content inline that the agent only consults under specific conditions. This PR moves that content to references that load on demand.

What moved

Skill Body before Body after Pattern
ce-plan 9,426 8,116 Plan template (only used in Phase 4) → references/plan-template.md
ce-compound-refresh 7,929 7,108 Per-action flows (only one of five runs per candidate) → references/per-action-flows.md
ce-resolve-pr-feedback 3,383 346 Full Mode and Targeted Mode flows (Mode Detection picks one) → references/{full-mode,targeted-mode}.md

Combined: ~5,170 words removed from always-loaded content across the three skills. The ce-resolve-pr-feedback reduction (-90%) is the largest single win — it had no references at all, with both modes living inline despite mode detection routing one or the other.

Why this shape

These extractions all share the same underlying pattern: blocks that are conditional (run only in certain modes), late-sequence (run only after upstream phases pick them), or single-use (a template scaffolded once at the end). AGENTS.md guidance is to extract such blocks when they represent ~20%+ of the skill, replace with 1-3 line stubs stating the condition and a backtick path reference, and never inline the extracted content via @. This PR follows that pattern across the three highest-leverage targets identified in a survey of skill body weights.

Three commits, one per skill, so each is independently reviewable and revertable:

  • bcc9f2ab — ce-plan template extraction (-14% on the body)
  • 4059226b — ce-compound-refresh per-action flows (-10%)
  • d3e43652 — ce-resolve-pr-feedback per-mode flows (-90%)

What was preserved

The contract test for the YAML-safety pointer in ce-compound-refresh's Replace Flow was updated to read from the new reference where the Replace Flow now lives. The test's intent is unchanged — assert that the Replace Flow content carries the pointer to yaml-schema.md. SKILL.md stubs preserve the routing information needed to find the right reference (each action's one-line meaning in the per-action stub, mode descriptions in the per-mode stub).

Test plan

  • bun test — 1,344 pass, 0 fail.
  • bun run release:validate — clean; skill count unchanged at 39, agent count at 49.

Compound Engineering
Claude Code

tmchow added 3 commits May 8, 2026 09:54
The core plan template and Deep extensions template were embedded
inline in SKILL.md (~1,300 words of template scaffolding). The
template is only consulted in Phase 4 when writing the plan, but
loaded on every skill invocation.

Move both templates to references/plan-template.md. SKILL.md keeps
a 1-paragraph stub describing what's in the reference and pointing
to it, plus the same "Omit inapplicable sections" guidance.

SKILL.md body: 9,426 -> 8,116 words (-14%).
Phase 4 contained 5 maintenance-action flows (Keep, Update,
Consolidate, Replace, Delete) inline in SKILL.md, but only one runs
per candidate. All five loaded on every skill invocation.

Move the per-action flows to references/per-action-flows.md.
SKILL.md keeps a Phase 4 stub describing each action in one line so
the reader knows which flow to consult, then points at the reference.

Update the YAML-safety contract test to read from the reference
(where the Replace Flow now lives), not SKILL.md. The test's intent
is unchanged — assert that the Replace Flow content carries the
YAML-safety pointer to yaml-schema.md.

SKILL.md body: 7,929 -> 7,108 words (-10%).
The skill had no references — both Full Mode (10 steps, ~3,000
words) and Targeted Mode (2 steps, ~250 words) were inline. Mode
Detection picks one mode at the start, but both modes' content
loaded on every invocation.

Move Full Mode to references/full-mode.md and Targeted Mode to
references/targeted-mode.md. SKILL.md keeps the cross-cutting
content (intro, security note, the agent-time/tech-debt callout,
Mode Detection table, scripts list, success criteria) plus a
2-line stub pointing each mode at its reference.

SKILL.md body: 3,383 -> 346 words (-90%).
@tmchow tmchow merged commit 62279b0 into main May 8, 2026
2 checks passed
LLMpsycho pushed a commit to LLMpsycho/compound-engineering-plugin that referenced this pull request May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant