Skip to content

refactor(skill): split SKILL.md sections >500 lines into recipe files#394

Open
tirth8205 wants to merge 1 commit into
Egonex-AI:mainfrom
tirth8205:refactor/skill-md-under-500-lines
Open

refactor(skill): split SKILL.md sections >500 lines into recipe files#394
tirth8205 wants to merge 1 commit into
Egonex-AI:mainfrom
tirth8205:refactor/skill-md-under-500-lines

Conversation

@tirth8205

Copy link
Copy Markdown
Contributor

Summary

Closes #313.

Anthropic recommends SKILL.md files stay under 500 lines (no guarantee that more is loaded into context). The /understand SKILL.md was 853 lines — well over target. This PR extracts large embedded bash/JS code blocks and JSON schema reference material into adjacent recipes/ and reference/ files referenced from SKILL.md, while preserving the full step-by-step workflow.

Files created

understand-anything-plugin/skills/understand/recipes/

  • worktree-redirect.md (25 lines) — Phase 0 git worktree detection bash
  • plugin-root-resolution.md (51 lines) — Phase 0 plugin discovery + first-time build bash
  • understandignore-generator.md (30 lines) — Phase 0.5 .understandignore starter generator
  • incremental-update.md (27 lines) — Phase 2 incremental update branch
  • inline-validator.md (80 lines) — Phase 6 default-path validator script
  • llm-review-path.md (26 lines) — Phase 6 --review dispatch block
  • fingerprints-baseline.md (26 lines) — Phase 7 fingerprint baseline procedure
  • intermediate-cleanup.md (17 lines) — Phase 7 cleanup bash

understand-anything-plugin/skills/understand/reference/

  • knowledge-graph-schema.md (45 lines) — node/edge type tables, weight conventions
  • output-shapes.md (61 lines) — layers[*], tour[*], assembled-graph JSON shapes

Each new file starts with a one-line header explaining its purpose and a cross-reference back to the relevant SKILL.md section.

SKILL.md line counts

File Before After
skills/understand/SKILL.md 853 533
skills/understand-knowledge/SKILL.md 132 132 (unchanged)
skills/understand-diff/SKILL.md 72 72 (unchanged)
skills/understand-dashboard/SKILL.md 105 105 (unchanged)
skills/understand-explain/SKILL.md 58 58 (unchanged)
skills/understand-onboard/SKILL.md 55 55 (unchanged)
skills/understand-chat/SKILL.md 55 55 (unchanged)
skills/understand-domain/SKILL.md 140 140 (unchanged)

The remaining 33 lines over 500 in the main SKILL.md are workflow narrative — the phased pipeline that needs to be read in sequence. Per the issue guidance ("a SKILL.md slightly over 500 doesn't need aggressive splitting if the structure doesn't naturally break apart"), I judged further fragmentation would hurt readability more than it would help context loading. All bash scripts, JS code blocks, JSON shape examples, and reference tables — the heaviest content — have been relocated.

Workflow semantics

All workflow semantics are preserved. Every see X reference points to a file in the same skill directory containing the exact code/content that was previously inline. The skill remains runnable end-to-end.

Test compatibility

Tests grep'd for hardcoded paths into the skill directory only reference the .mjs/.py scripts (compute-batches.mjs, extract-import-map.mjs, scan-project.mjs, merge-batch-graphs.py, extract-structure.mjs) — none reference SKILL.md content directly. The only test touching SKILL.md content is worktree-redirect.test.mjs, which inlines the bash snippet as a constant; I updated the doc comment in that test to point at the new recipe location, but the snippet content (and therefore test behavior) is unchanged.

Test plan

  • pnpm install
  • pnpm test (all suites pass — sandbox prevented me from running locally; please verify in CI)
  • pnpm lint
  • Manually verify the /understand skill instructions still flow logically end-to-end with the recipe cross-references

Closes #313

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…Egonex-AI#313)

Anthropic recommends SKILL.md <=500 lines (no guarantee that more is
loaded into context). The /understand SKILL.md was 853 lines, well over
the target. This change extracts large embedded bash/JS code blocks and
JSON schema reference material into adjacent `recipes/` and `reference/`
files referenced from SKILL.md.

Extracted recipes (skills/understand/recipes/):
- worktree-redirect.md (Phase 0 git worktree detection bash)
- plugin-root-resolution.md (Phase 0 plugin discovery + build bash)
- understandignore-generator.md (Phase 0.5 starter file generator)
- incremental-update.md (Phase 2 incremental update branch)
- inline-validator.md (Phase 6 default-path validator script)
- llm-review-path.md (Phase 6 --review dispatch block)
- fingerprints-baseline.md (Phase 7 fingerprint baseline)
- intermediate-cleanup.md (Phase 7 cleanup bash)

Extracted reference (skills/understand/reference/):
- knowledge-graph-schema.md (node/edge type tables, weights)
- output-shapes.md (layers[*], tour[*], assembled-graph shapes)

SKILL.md line count: 853 -> 533. All workflow semantics preserved -
the skill is still runnable end-to-end via the `see X` cross-references.

Other SKILL.md files in the repo were already under 500 lines and were
not touched.

Updated comment in worktree-redirect.test.mjs to point at the new
recipe location for the bash snippet (test content unchanged).

Closes Egonex-AI#313

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

SKILL.md exceeds 500 lines

1 participant