Skip to content

feat: refactor SKILL.md into modular reference files#458

Merged
BYK merged 2 commits intomainfrom
feat/modular-skill-files
Mar 18, 2026
Merged

feat: refactor SKILL.md into modular reference files#458
BYK merged 2 commits intomainfrom
feat/modular-skill-files

Conversation

@BYK
Copy link
Member

@BYK BYK commented Mar 18, 2026

Summary

Closes #319

Split the monolithic 824-line SKILL.md into a compact index (~300 lines) with agent guidance + command summaries, and 12 per-group reference files with full flag/example details.

Changes

New Agent Guidance Document

  • docs/src/content/docs/agent-guidance.md — Operational guidance for AI agents including context window tips, safety rules, workflow patterns, and common mistakes
  • Loaded by the generator and injected into SKILL.md's "Agent Guidance" section

Generator Refactoring (script/generate-skill.ts)

  • Produces 3 types of output:
    • SKILL.md — compact ~297-line index with agent guidance + command summaries (down from 824)
    • references/*.md — 12 per-group reference files with full flag/example details
    • index.json — skill discovery manifest for .well-known
  • Route-to-reference mapping groups related commands (trace+span → traces.md, team+repo → teams.md, cli+init+schema → setup.md)
  • Strips global flags from compact index (mentioned once in Global Options section)
  • Cleans references/ directory before writing to handle stale files
  • Each reference file has YAML frontmatter with name, version, description, requires

Checker Update (script/check-skill.ts)

  • Verifies ALL generated files using Bun.Glob (SKILL.md + references/*.md + index.json)
  • Detects changed, new, AND removed files

Runtime Installer Update (src/lib/agent-skills.ts)

  • New fetchAllSkillFiles() fetches SKILL.md + all 12 reference files in parallel
  • installAgentSkills() creates references/ directory and writes all files
  • Graceful degradation: reference file failures don't block SKILL.md installation
  • AgentSkillLocation type now includes referenceCount

Directory Symlinks

  • .cursor/skills/sentry-cli/references → source references
  • docs/public/.well-known/skills/sentry-cli/references → source references

CI Update

  • check-skill job updated to git add entire skill directory + index.json

Tests

  • New tests for fetchAllSkillFiles, reference file installation, graceful degradation

Metrics

  • SKILL.md: 824 lines → 297 lines (64% reduction)
  • Reference files: 788 total lines across 12 files
  • Tests: 24 tests passing

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Refactor SKILL.md into modular reference files by BYK in #458

Bug Fixes 🐛

  • (test) Use os.tmpdir() for test temp directories by BYK in #457
  • Improve error messages — fix ContextError/ResolutionError misuse by BYK in #456

Internal Changes 🔧

  • (list) Align all list commands to issue list standards by BYK in #453

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/pr-preview/pr-458/

Built to branch gh-pages at 2026-03-18 12:13 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 18, 2026

Codecov Results 📊

116 passed | Total: 116 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 1149 uncovered lines.
✅ Project coverage is 95.2%. Comparing base (base) to head (head).

Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    95.20%    95.20%        —%
==========================================
  Files          176       176         —
  Lines        23871     23930       +59
  Branches         0         0         —
==========================================
+ Hits         22724     22781       +57
- Misses        1147      1149        +2
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review March 18, 2026 11:58
Split the monolithic 824-line SKILL.md into a compact index (~300 lines)
with agent guidance + command summaries, and 12 per-group reference files
with full flag/example details.

Changes:
- Create docs/src/content/docs/agent-guidance.md with operational guidance
  for AI coding agents (context window tips, safety rules, workflow
  patterns, common mistakes)
- Refactor script/generate-skill.ts to produce SKILL.md index +
  references/*.md files + auto-generate index.json
- Update script/check-skill.ts to verify all generated files (not just
  SKILL.md)
- Update src/lib/agent-skills.ts to fetch and install SKILL.md +
  reference files (with graceful degradation)
- Add directory symlinks for .cursor/ and docs/.well-known/
- Update CI workflow to git add entire skill directory
- Update tests for new multi-file API

The SKILL.md remains the primary entry point for Claude Code and other
agents. Reference files provide full command details that agents can
read on-demand when they need specifics about a command group.
@BYK BYK force-pushed the feat/modular-skill-files branch from 40df14a to 710b68b Compare March 18, 2026 12:04
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@BYK BYK merged commit b172db5 into main Mar 18, 2026
23 checks passed
@BYK BYK deleted the feat/modular-skill-files branch March 18, 2026 12:29
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.

Refactor sentry skill file into modular reference files

1 participant