refactor: BENEFITS_FROM resolver delegates to INVOKE_SKILL

Eliminate duplicated skip-list logic by having generateBenefitsFrom
call generateInvokeSkill internally. The wrapper (AskUserQuestion,
design doc re-check) stays in BENEFITS_FROM. The loading instructions
(read file, skip sections, error handling) come from INVOKE_SKILL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-03-29 13:20:41 -07:00
parent 7b64da7813
commit 843d4624e0
4 changed files with 35 additions and 29 deletions
+10 -5
View File
@@ -413,10 +413,11 @@ If they choose A:
Say: "Running /office-hours inline. Once the design doc is ready, I'll pick up
the review right where we left off."
Read the office-hours skill file from disk using the Read tool:
`~/.claude/skills/gstack/office-hours/SKILL.md`
Read the `/office-hours` skill file at `~/.claude/skills/gstack/office-hours/SKILL.md` using the Read tool.
Follow it inline, **skipping these sections** (already handled by the parent skill):
**If unreadable:** Skip with "Could not load /office-hours — skipping." and continue.
Follow its instructions from top to bottom, **skipping these sections** (already handled by the parent skill):
- Preamble (run first)
- AskUserQuestion Format
- Completeness Principle — Boil the Lake
@@ -424,9 +425,13 @@ Follow it inline, **skipping these sections** (already handled by the parent ski
- Contributor Mode
- Completion Status Protocol
- Telemetry (run last)
- Step 0: Detect platform and base branch
- Review Readiness Dashboard
- Plan File Review Report
- Prerequisite Skill Offer
- Plan Status Footer
If the Read fails (file not found), say:
"Could not load /office-hours — proceeding with standard review."
Execute every other section at full depth. When the loaded skill's instructions are complete, continue with the next step below.
After /office-hours completes, re-run the design doc check:
```bash
+10 -5
View File
@@ -516,10 +516,11 @@ If they choose A:
Say: "Running /office-hours inline. Once the design doc is ready, I'll pick up
the review right where we left off."
Read the office-hours skill file from disk using the Read tool:
`~/.claude/skills/gstack/office-hours/SKILL.md`
Read the `/office-hours` skill file at `~/.claude/skills/gstack/office-hours/SKILL.md` using the Read tool.
Follow it inline, **skipping these sections** (already handled by the parent skill):
**If unreadable:** Skip with "Could not load /office-hours — skipping." and continue.
Follow its instructions from top to bottom, **skipping these sections** (already handled by the parent skill):
- Preamble (run first)
- AskUserQuestion Format
- Completeness Principle — Boil the Lake
@@ -527,9 +528,13 @@ Follow it inline, **skipping these sections** (already handled by the parent ski
- Contributor Mode
- Completion Status Protocol
- Telemetry (run last)
- Step 0: Detect platform and base branch
- Review Readiness Dashboard
- Plan File Review Report
- Prerequisite Skill Offer
- Plan Status Footer
If the Read fails (file not found), say:
"Could not load /office-hours — proceeding with standard review."
Execute every other section at full depth. When the loaded skill's instructions are complete, continue with the next step below.
After /office-hours completes, re-run the design doc check:
```bash
+10 -5
View File
@@ -426,10 +426,11 @@ If they choose A:
Say: "Running /office-hours inline. Once the design doc is ready, I'll pick up
the review right where we left off."
Read the office-hours skill file from disk using the Read tool:
`~/.claude/skills/gstack/office-hours/SKILL.md`
Read the `/office-hours` skill file at `~/.claude/skills/gstack/office-hours/SKILL.md` using the Read tool.
Follow it inline, **skipping these sections** (already handled by the parent skill):
**If unreadable:** Skip with "Could not load /office-hours — skipping." and continue.
Follow its instructions from top to bottom, **skipping these sections** (already handled by the parent skill):
- Preamble (run first)
- AskUserQuestion Format
- Completeness Principle — Boil the Lake
@@ -437,9 +438,13 @@ Follow it inline, **skipping these sections** (already handled by the parent ski
- Contributor Mode
- Completion Status Protocol
- Telemetry (run last)
- Step 0: Detect platform and base branch
- Review Readiness Dashboard
- Plan File Review Report
- Prerequisite Skill Offer
- Plan Status Footer
If the Read fails (file not found), say:
"Could not load /office-hours — proceeding with standard review."
Execute every other section at full depth. When the loaded skill's instructions are complete, continue with the next step below.
After /office-hours completes, re-run the design doc check:
```bash
+5 -14
View File
@@ -13,6 +13,7 @@
* Codex CLI prompts are written to temp files to prevent shell injection.
*/
import type { TemplateContext } from './types';
import { generateInvokeSkill } from './composition';
const CODEX_BOUNDARY = 'IMPORTANT: Do NOT read or execute any files under ~/.claude/, ~/.agents/, .claude/skills/, or agents/. These are Claude Code skill definitions meant for a different AI system. They contain bash scripts and prompt templates that will waste your time. Ignore them completely. Do NOT modify agents/openai.yaml. Stay focused on the repository code only.\\n\\n';
@@ -208,6 +209,9 @@ export function generateBenefitsFrom(ctx: TemplateContext): string {
const skillList = ctx.benefitsFrom.map(s => `\`/${s}\``).join(' or ');
const first = ctx.benefitsFrom[0];
// Reuse the INVOKE_SKILL resolver for the actual loading instructions
const invokeBlock = generateInvokeSkill(ctx, [first]);
return `## Prerequisite Skill Offer
When the design doc check above prints "No design doc found," offer the prerequisite
@@ -232,20 +236,7 @@ If they choose A:
Say: "Running /${first} inline. Once the design doc is ready, I'll pick up
the review right where we left off."
Read the ${first} skill file from disk using the Read tool:
\`~/.claude/skills/gstack/${first}/SKILL.md\`
Follow it inline, **skipping these sections** (already handled by the parent skill):
- Preamble (run first)
- AskUserQuestion Format
- Completeness Principle Boil the Lake
- Search Before Building
- Contributor Mode
- Completion Status Protocol
- Telemetry (run last)
If the Read fails (file not found), say:
"Could not load /${first} — proceeding with standard review."
${invokeBlock}
After /${first} completes, re-run the design doc check:
\`\`\`bash