agentleFS
Michael-ObeleMichael-Obele/shadcn-svelte-mcp/.github/copilot-instructions.md

shadcn-svelte-mcp

Copilot instructions58 starsChanged 58 days agoMITView on GitHub

This file gives concise, actionable instructions for an AI coding agent to be productive in this codebase. Important: AI-generated/progress documentation and ephemeral notes Shell command preference

  • Sends data out

The file

We split this copilot-instructions.md into the rules it gives an agent

7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All AI-generated progress docs, status logs, design notes, or autogenerated markdown should be created or updated only inside the …

    line 25
  2. Distinctive:

    When moving or manipulating files as part of progress updates, prefer Git-aware operations (for example git mv) so history is preserved.

    line 26
  3. Very specific:

    When suggesting or running commands, prefer POSIX bash commands.

    line 30
  4. Very specific:

    Test file organization: ALWAYS place test files in the test/ directory at the repository root, never in src/.

    line 49
  5. Very specific:

    No database. Cache persistence is optional: in-memory plus disk (./.cache) on Node/Bun.

    line 84
  6. Very specific:

    If a tool returns "not found", check the web scraping services in src/services/ and verify the component exists on shadcn-svelte.com.

    line 88
  7. Very specific:

    Verify protocol behavior with curl: curl -X POST http://localhost:3000/mcp -H "Content-Type: application/json" -H "Accept: …

    line 89

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md
<!-- .github/copilot-instructions.md - guidance for AI coding agents -->

AI assistant quick-start for this repository

This file gives concise, actionable instructions for an AI coding agent to be productive in this codebase.

  1. What this repo is
  • A tmcp-based MCP server (lightweight, schema-agnostic MCP SDK). See src/mcp/server.ts for the McpServer assembly, src/index.ts for the Node/Bun HTTP entry, and src/stdio.ts for local MCP clients.
  • Documentation is fetched in real-time from shadcn-svelte.com using Cheerio + Turndown (HTML → Markdown) and direct .md / llms.txt endpoint fetching under src/services/.
  1. How to run / common developer commands
  • Runtimes: Node >= 20.9.0 or Bun >= 1.1 (see package.json "engines").
  • Development: bun run dev (HTTP server with watch on http://localhost:3000, MCP endpoint /mcp, health /health).
  • Type checking: bun run check (runs tsc --noEmit across the project).
  • Local MCP: bun run mcp (stdio transport).
  • Build: bun run build (bundles src/index.ts + src/stdio.ts → dist/ for Fly.io/Render).
  • Agent sync guard: bun run check:agents (fails if the per-editor agent bodies in agents/ drift apart; agents-md-snippet.md is a declared variant).
  • Version guard: bun run check-versions (package.json must match src/mcp/server.ts).
  • CI: .github/workflows/ci.yml runs check, check:agents, check-versions, bun test, and a report-only link check on every push and pull request. Only bun.lock exists, so CI uses bun install --frozen-lockfile — npm ci cannot work in this repo.

Important: AI-generated/progress documentation and ephemeral notes

  • All AI-generated progress docs, status logs, design notes, or autogenerated markdown should be created or updated only inside the ai-generated-docs/ folder at the repository root. Do not place generated progress docs in other directories.
  • When moving or manipulating files as part of progress updates, prefer Git-aware operations (for example git mv) so history is preserved.

Shell command preference

  • When suggesting or running commands, prefer POSIX bash commands. Provide exact, copyable bash snippets and use git for VCS operations. Wrap examples in bash code blocks and avoid platform-specific shells unless requested.
  1. Big-picture architecture (quick map)
  • MCP Server (src/mcp/server.ts): exports server (tmcp McpServer) and serverVersion. Registers 5 tools + 5 prompts, uses the Valibot adapter (@tmcp/adapter-valibot) — all schemas are valibot.
  • Entry points:
    • src/index.ts — srvx HTTP server (Node/Bun): Streamable HTTP at /mcp, /health endpoint.
    • src/stdio.ts — StdioTransport for local MCP clients.
  • Tools (src/mcp/tools/*): each is created with defineTool(...) from tmcp/tool and follows the pattern: valibot schema, async (input) => tool.text(...) | tool.error(...). Examples: shadcn-svelte-get, shadcn-svelte-list, shadcn-svelte-icons, shadcn-svelte-search, bits-ui-get.
  • Prompts (src/mcp/prompts/*): created with definePrompt(...) from tmcp/prompt, valibot schema, return { messages: [...] }.
  • Web scraping services: src/services/doc-fetcher.ts (real-time doc fetching), src/services/catalog.ts (unified live catalog: llms.txt categories + descriptions merged with the component-discovery.ts registry index and bits-ui-discovery.ts), src/services/catalog-search.ts (pure multi-term search core used by the search tool), src/services/cache-manager.ts (memory + optional KV + optional disk tiers, 3-day TTL).
  1. Project-specific conventions and gotchas (do not invent alternatives)
  • Tools use defineTool from tmcp/tool with valibot schemas (import * as v from "valibot") for input validation. Use v.object({...}), v.string(), v.number(), v.picklist([...]) for string literals, v.optional(schema, default) for optional-with-default, and v.pipe(schema, v.description("...")) for field descriptions. Tool handlers MUST return content via tool.text(...) / tool.error(...) from tmcp/utils — never a bare string.
  • Prompts use definePrompt from tmcp/prompt with the same valibot schema conventions and return { messages: [...] } (role: "user" | "assistant", content: { type: "text", text }).
  • The version anchor: version: "x.y.z" in src/mcp/server.ts MUST stay in sync with package.json (see scripts/check-versions.js / sync-versions*.js; regex is version:\s*"[^"]+",).
  • Web scraping approach: tools fetch documentation in real-time from shadcn-svelte.com (.md endpoints, llms.txt, Cheerio+Turndown HTML fallback). Components are discovered dynamically from the live website.
  • The cache manager loads node:fs dynamically so it stays loadable on runtimes without it, degrading to memory-only. Do not add static node:* imports to shared services.
  • Test file organization: ALWAYS place test files in the test/ directory at the repository root, never in src/. Use git mv when moving files to preserve version history.

Testing rule: run bun test before reporting any change as done. It is fast (well under a second), network-free, and the only objective evidence that a change works. An AI agent that reports "done", "fixed", or "tests pass" without having run it in this session is wrong — and if a test fails, fix the cause rather than the expectation. Where behaviour cannot be pinned by a unit test (live scraping, MCP tool calls), validate through the MCP testing channel #test-mcp instead, which exercises the tools through the real protocol. Do NOT start or run bun run dev from within AI tests — the development server is expected to already be running. If a local manual smoke-test is required by a developer, run bun run dev locally for 10–15s, but AI agents must not start it.

Caching: tools use the shared cache-manager (3-day TTL; memory + .cache/ disk on Node/Bun). Expect stale cached results when iterating; clear .cache/ or restart the process during development if necessary.

  1. Common edit patterns and examples (concrete references)

To add a new tool, mirror src/mcp/tools/shadcn-svelte-get.ts:

import { defineTool } from "tmcp/tool";
import { tool } from "tmcp/utils";
import * as v from "valibot";

export const myTool = defineTool(
  {
    name: "my-tool",
    description: "What it does",
    schema: v.object({
      param: v.pipe(v.string(), v.description("What param is")),
    }),
  },
  async ({ param }) => tool.text(`Received: ${param}`),
);

Then register it in src/mcp/server.ts via server.tools([...]). Prompts follow the same shape with definePrompt + server.prompts([...]).

  • To examine how components are discovered and searched, inspect src/services/catalog.ts (search/list catalog) and src/services/catalog-search.ts (ranking); for doc fetching, inspect src/mcp/tools/shadcn-svelte-get.ts.
  • To test changes quickly: run bun test, then use the #test-mcp MCP channel for anything that needs live tools. Do not start bun run dev from AI-driven runs.
  1. Integration & external deps
  • Key runtime deps (see package.json): tmcp, @tmcp/adapter-valibot, @tmcp/transport-http, @tmcp/transport-stdio, valibot, srvx, cheerio, turndown, @orama/orama. Respect the pinned major versions when adding features unless requested.
  • No database. Cache persistence is optional: in-memory plus disk (./.cache) on Node/Bun.
  1. Debugging tips for AI agents
  • If a tool returns "not found", check the web scraping services in src/services/ and verify the component exists on shadcn-svelte.com.
  • Verify protocol behavior with curl: curl -X POST http://localhost:3000/mcp -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'.
  • For runtime discovery iterate: change code and run bun run dev for 10–15s to surface issues; focus on reproducing the failing scenario in that window.
  1. What not to change without confirmation
  • The McpServer assembly in src/mcp/server.ts (server info, adapter, capabilities) — changes affect all transports.
  • The registry format and field names used by tools (items[].name, items[].files[].path, items[].type).
  • The version-sync tooling (.releaserc.json, .github/workflows/version-and-release.yml, scripts/sync-versions*.js) — they anchor on src/mcp/server.ts.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.