Skip to content

refactor: consolidate agent rules into sanity-best-practices skill - #23

Merged
joneidejohnsen merged 5 commits into
mainfrom
feat/migrate-rules-to-skills
Feb 24, 2026
Merged

refactor: consolidate agent rules into sanity-best-practices skill#23
joneidejohnsen merged 5 commits into
mainfrom
feat/migrate-rules-to-skills

Conversation

@joneidejohnsen

Copy link
Copy Markdown
Contributor

Summary

  • Migrates all 21 .mdc agent rules from rules/ into the sanity-best-practices skill as the single source of truth
  • Renames rules/references/ per the agentskills.io specification
  • Adds compiled AGENTS.md inside the skill (Vercel pattern) with all 26 atomic rules
  • Rewrites SKILL.md with a comprehensive Quick Reference index
  • Updates root AGENTS.md Knowledge Router to point to new locations
  • Deletes all old rules/sanity-*.mdc files (clean break, no stubs)

What changed

Before After
rules/sanity-nextjs.mdc skills/sanity-best-practices/references/nextjs.md
rules/sanity-schema.mdc skills/sanity-best-practices/references/schema.md
skills/.../rules/groq-*.md skills/.../references/groq-*.md
Cursor-specific .mdc frontmatter Standard .md frontmatter with title/tags
Two parallel rule systems Single source of truth in skill

MCP impact

  • The MCP server's list_sanity_rules/get_sanity_rules reads from the skill's references directory — will need to be updated to read from references/ instead of rules/
  • "Get started with Sanity" flow continues to work (loaded via MCP, not hardcoded path)

Test plan

  • All 4 skills pass npm run validate
  • Zero .mdc files remaining
  • Zero stale rules/sanity- references in any .md or .json file
  • 48 files in references/ (21 guides + 26 atomic rules + _sections.md)
  • Verify MCP list_sanity_rules still works after server-side update

🤖 Generated with Claude Code

Migrate all 21 .mdc agent rules from rules/ into the sanity-best-practices
skill as the single source of truth, following the agentskills.io spec.

- Move comprehensive guides to skills/sanity-best-practices/references/
  (e.g., sanity-nextjs.mdc → references/nextjs.md)
- Rename rules/ → references/ per agentskills.io specification
- Convert .mdc frontmatter to standard .md (add title/tags, drop alwaysApply)
- Update all internal cross-references to new paths
- Rewrite SKILL.md with Quick Reference index (Vercel pattern)
- Add compiled AGENTS.md inside skill with all 26 atomic rules
- Update root AGENTS.md Knowledge Router to point to new locations
- Update README.md with new repository structure
- Delete all 21 old rules/sanity-*.mdc files (clean break)
- All 4 skills pass validation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@runeb

runeb commented Feb 23, 2026

Copy link
Copy Markdown
Member

Review from Claude Code


Review: consolidate agent rules into sanity-best-practices skill

Summary

The amended PR addresses the concerns from the initial review. This is a clean consolidation — good to go.

What it does

Merges the 26 atomic rule files and 21 guide/integration files into 22 unified reference files under skills/sanity-best-practices/references/. Deletes the top-level rules/ directory, the rules/ and references/ split inside the skill, the compiled AGENTS.md inside the skill, and _sections.md. Strips globs/tags from frontmatter. Updates the root AGENTS.md Knowledge Router and README to point to the new paths.

What's good

  • Single canonical location for all content — no more duplication across rules/*.mdc, skills/.../rules/, and a compiled AGENTS.md
  • Spec-aligned with agentskills.io (references/ is the standard directory; rules/ was not in the spec)
  • Clean frontmatter — just title and description, no dead metadata
  • README documents the MCP relationship — makes it clear that references/ is the canonical source for list_sanity_rules / get_sanity_rules
  • SKILL.md is focused — clean Quick Reference index at 75 lines
  • Validation passes

Delivery channels all accounted for

  • MCP tools (list_sanity_rules / get_sanity_rules): server-side update in progress to read from references/
  • MCP prompts: SKILL.md still works, now with a cleaner index
  • Cursor plugin: discovers the skill via skills/
  • Claude Code plugin: discovers the skill via skills/
  • npx skills add: installs skill per agentskills.io spec
  • Root AGENTS.md: Knowledge Router updated to point to references/ paths
  • Manual install: copy skills/sanity-best-practices/ to your project

Comment thread skills/sanity-best-practices/references/app-sdk.md Outdated
jwoods02 and others added 4 commits February 24, 2026 11:44
Delete 25 atomic reference files that duplicated content already
covered by the comprehensive topic guides (groq.md, schema.md, etc.).
Unique content from atomics (optimizable filters table, defineMigration
example, compound cursor pattern, icon mapping table, stegaClean
alternatives, etc.) was merged into the corresponding guide before
deletion.

Also makes migration.md an index that points to migration-html-import.md
for the HTML deep-dive, keeping the pattern extensible for future
migration guides.

Updates SKILL.md and AGENTS.md to reflect the consolidated structure
(47 → 22 reference files).
@joneidejohnsen

Copy link
Copy Markdown
Contributor Author

Review from Claude Code

Review: consolidate agent rules into sanity-best-practices skill

The good

The consolidation direction is right — one canonical location instead of parallel directories. The rules/ -> references/ rename aligns with the agentskills.io spec. The .mdc -> .md conversion drops Cursor-specific coupling. SKILL.md is well-structured with a good Quick Reference index. Validation passes.

Main concern: this content has ~8 distribution channels

This repo serves the same content through many paths: MCP tools (list_sanity_rules/get_sanity_rules), MCP resources, MCP prompts, Claude Code plugin, Cursor plugin (with globs-based auto-attachment), npx skills add, the root AGENTS.md, and manual copy to .cursor/rules/. Several of these have hard dependencies on rules/*.mdc existing — the MCP tools, MCP resources, and Cursor plugin all break when that directory is deleted.

The PR acknowledges the MCP impact as a follow-up checkbox, but given how many channels are affected, it would be worth documenting which channels need updating and coordinating those changes. A section in the README mapping "canonical content lives in skills/.../references/, here's how each channel accesses it" would also help prevent future breakage.

Other observations

  • AGENTS.md inside the skill: Not part of the agentskills.io spec (spec only recognizes SKILL.md + references/ + scripts/ + assets/). At 48KB of fully inlined content, it also runs counter to Vercel's eval findings that a compressed ~8KB index outperforms full docs. The SKILL.md Quick Reference is already that index — it just needs to be more accessible.
  • Content duplication: Every atomic rule is duplicated verbatim in AGENTS.md with no build step to keep them in sync.
  • globs in frontmatter: Currently consumed by Cursor plugin for auto-attachment. After this move to references/*.md, it's unclear whether Cursor still discovers these. Worth clarifying.
  • MCP skill prompts: SKILL.md now references references/ files that aren't reachable via MCP. Agents connected only through MCP can't follow those pointers.
  • _sections.md: Duplicates what's in SKILL.md's Quick Reference.

Fixed in #24

@runeb runeb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good — concerns from the initial review have been addressed.

@joneidejohnsen
joneidejohnsen merged commit aeb1e64 into main Feb 24, 2026
3 checks passed
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.

4 participants