Skip to content

feat: skill engineering pipeline — auto-split, size enforcement, skeleton generator#300

Open
fraser-svg wants to merge 5 commits intogarrytan:mainfrom
fraser-svg:skill-engineering-overhaul
Open

feat: skill engineering pipeline — auto-split, size enforcement, skeleton generator#300
fraser-svg wants to merge 5 commits intogarrytan:mainfrom
fraser-svg:skill-engineering-overhaul

Conversation

@fraser-svg
Copy link

Summary

  • Auto-split parser<!-- ref:filename.md --> markers in templates extract content to references/ files, replacing with markdown links for progressive disclosure
  • Size enforcement — warns at 500+ lines, errors at 800+ (warning-only until Phase 4 refactors all skills)
  • Skeleton generatorbin/gstack-init-skill <name> scaffolds Anthropic-compliant skill directories
  • Orphan detection — flags stale reference files when ref markers are removed from templates
  • Skill engineering rules — path-scoped rules at .claude/rules/skill-engineering.md for progressive disclosure, size limits, frontmatter, directory structure

Pre-Landing Review

2 informational issues found and auto-fixed:

  • Redundant regex check in code block detection → simplified
  • Shell expansion risk in skeleton generator heredoc → switched to printf

Codex Review

  • [P1] Size error exit broke bun run build for existing oversized skills → fixed (warning-only)
  • [P2] Orphaned reference files not detected → fixed (added orphan detection)

Test Coverage

Tests: 104 → 126 (+22 new)

  • auto-split: 8 tests (extraction, nesting, code blocks, errors)
  • validateSize: 7 tests (boundary conditions at 499/500/799/800)
  • skeleton generator: 4 tests (structure, validation, duplicates)
  • integration: 3 tests (dry-run line counts, stderr warnings)

Test plan

  • All bun tests pass (126 tests, 0 failures)
  • bun run gen:skill-docs --dry-run reports all FRESH with line counts
  • bun run gen:skill-docs succeeds (no exit-1 from size errors)
  • Skeleton generator creates correct directory structure

🤖 Generated with Claude Code

Fraser Wiseman and others added 5 commits March 21, 2026 18:21
Add .claude/rules/skill-engineering.md with comprehensive skill-building
guidelines derived from three Anthropic sources:
- "The Complete Guide to Building Skills for Claude" (official PDF)
- Claude Code documentation (code.claude.com/docs/en/skills)
- Anthropic's skill-creator reference implementation

Rules are path-scoped to **/*.tmpl, **/SKILL.md, **/skills/** so they
load automatically when editing skill files but consume zero tokens
during other gstack work.

Covers: three-level progressive disclosure, 500-line SKILL.md limit,
frontmatter requirements, directory structure, writing patterns,
anti-patterns, and the gen-skill-docs template marker system.
…kill-docs

Auto-split parses <!-- ref:filename.md --> markers in templates, extracts
content to references/ files, and replaces with markdown links. Size
validation warns at 500+ lines and errors at 800+ (warning-only for now
until Phase 4 refactors all oversized skills). Orphan detection flags
reference files that no longer correspond to template markers.

Exports autoSplit() and validateSize() for testing. Adds import.meta.main
guard so the module can be imported without triggering the main loop.
Creates Anthropic-compliant skill directories with SKILL.md.tmpl,
references/, and scripts/. Validates kebab-case names, prevents
overwriting existing directories, uses printf for safe description
handling.
22 tests covering: auto-split extraction (single, multiple, nested error,
orphan error, code block ignoring), validateSize boundaries (ok/warn/error),
skeleton generator (structure, kebab-case validation, duplicate rejection),
and integration (dry-run line counts, stderr warnings).
Co-Authored-By: Claude Opus 4.6 <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.

1 participant