Commit Graph

2 Commits

Author SHA1 Message Date
John Lindquist 3a8a8b2bea feat: fix on-demand skill install pipeline, add 7 new engine rules, sync registries
- Fix skill store cross-root slug lookup: installed skills under registrySlug
  names (e.g., next-best-practices) now resolve when queried by engine name
  (e.g., nextjs). Full-body injection rate went from 5% to 78% in evals.

- Fix on-demand install: remove dead hooks.json registrations (library module
  with no entry point), keep inline calls from pretooluse/user-prompt-submit.
  Non-registry skills now dedup normally instead of wastefully reinjectiing
  summary-only content that can never upgrade.

- Add suppressWhenProjectFacts to engine rules: next-upgrade and turbopack
  suppressed in greenfield mode (was 12 useless injections per session).

- Add deriveRegistryInstallSet to orchestrator-install-plan (was missing
  export that crashed on-demand-skill-install on every invocation).

- Sync all engine rule registries from skills.sh API via build-registry.ts.
  22 skills now have registry backing across 11 official Vercel repos.
  Exclude vercel-labs/vercel-plugin and vercel/vercel-plugin self-references.

- Add build:registry to the build pipeline (hooks → registry → manifest).

- Create 7 new engine rules: electron, vercel-composition-patterns,
  vercel-react-native-skills, web-design-guidelines, deploy-to-vercel,
  vercel-react-view-transitions, workflow-init.

- Add .claude/skills/ to .gitignore (installed skill caches).

- Add Verification Checklist to CLAUDE.md.
2026-04-08 22:54:49 -06:00
John Lindquist 66ea38ab23 refactor: replace bundled skills with engine/ rules + registry resolution
This is a fundamental architectural shift: the plugin no longer ships
skill content. Instead it ships a rules engine (engine/*.md) that
defines WHEN to load skills, and relies on the npx skills registry
(skills.sh/vercel, skills.sh/vercel-labs) to provide WHAT skills say.

## What changed

### New: engine/ directory (40 human-editable rule files)
Each file is a markdown document with YAML frontmatter containing:
- pathPatterns, bashPatterns, importPatterns (file/command matching)
- promptSignals (user prompt scoring: phrases, allOf, anyOf, noneOf)
- validate rules (PostToolUse file validation with severity levels)
- chainTo rules (conditional skill chaining with skipIfFileContains)
- retrieval metadata (aliases, intents, entities for discovery)
- priority, docs URLs, sitemap URLs
- registry source (e.g. "vercel/vercel-skills")

The markdown body serves as a summary fallback when the full skill
content isn't cached locally.

### New: scripts/build-manifest.ts (rewritten)
Now reads engine/*.md instead of skills/*/SKILL.md. Compiles
glob→regex at build time and outputs generated/skill-rules.json.
No dependency on VERCEL_PLUGIN_SKILLS_DIR or local skill sources.

### New: test infrastructure
- tests/helpers/mock-skill-cache.ts — generates a temp
  ~/.vercel-plugin/skills/ directory with stub SKILL.md files
  derived from skill-rules.json for test use
- tests/helpers/preload-mock-cache.ts — bun test preload that
  sets VERCEL_PLUGIN_HOME_DIR before any test runs
- bunfig.toml updated with preload

### Removed: skills/ directory (all 40 bundled skills)
The plugin no longer ships skill bodies. At runtime, hooks resolve
skill content from:
1. ~/.vercel-plugin/projects/<hash>/.skills/ (project cache)
2. ~/.vercel-plugin/skills/ (global cache, populated by npx skills)
3. generated/skill-rules.json (metadata-only fallback)

### Removed: 13 test files
Tests that validated build-time skills/ scanning, SKILL.md
frontmatter parsing, snapshot generation, and other behaviors
tied to bundled skills. The remaining 1383 tests pass.

## Architecture going forward

The decoupling is complete:
- engine/*.md = routing rules (owned by plugin, human-editable)
- npx skills = content delivery (owned by Vercel skills team)
- ~/.vercel-plugin/ = runtime cache (populated on first session)
- generated/skill-rules.json = compiled rules (build artifact)

Skills not yet published to the registry will match via the rules
engine but inject only their summary text and docs/sitemap URL
until the Vercel team publishes them.
2026-04-02 00:23:45 -06:00