Svelte graph
Skill jamcgrath/svelte-component-graph-mcp/skills/svelte-graph
Explore a Svelte/SvelteKit project's component dependency graph via the svelte-component-graph MCP — what imports what, which components are unused, route→component maps, and a component's Svelte 5 props/slots. Use when asked to map components, do impact analysis before a refactor, find dead components, or look up how a component is used or what props it takes — instead of hand-grepping imports.From its SKILL.md
npx -y skills add jamcgrath/svelte-component-graph-mcp --skill svelte-graphAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.5 KB, as published. Nobody here has run it
Svelte component graph
This skill drives the svelte-component-graph-mcp server, which parses a
Svelte/SvelteKit project into a component dependency graph. Prefer these tools
over manually grepping import statements — the parser already resolves
relative + $lib imports, <svelte:component this={Ident}>, and unused
imports, and it caches per file.
Prerequisite
The svelte-component-graph-mcp server must be configured in MCP settings.
If its tools aren't available, tell the user to add it (see the package README)
rather than falling back to grep.
Resolving root
Every tool needs root — an absolute path to the project being analyzed:
- If
svelte.config.jsexists in the current working directory,rootis the cwd ($PWD). - Otherwise (monorepo, or cwd is a subfolder), use the project's absolute path. If unsure which package, ask.
root must be absolute, exist, and contain at least one .svelte file — the
tools return an error otherwise.
The tools
| Tool | Use it to… |
|---|---|
get_graph(root) | Get the whole map: every node (id, label, type, unused?) + every import link. Start here for "map the app" / broad impact analysis. |
get_component(root, path) | Drill into one file. Returns parents (who imports it), children (what it imports), unused, isRoute, and its Svelte 5 props (name/optional/bindable/rest) + slots. path is workspace-relative (src/lib/Button.svelte). |
get_unused(root) | List imported-but-never-rendered components (dead-code candidates). |
get_routes(root) | Every +page/+layout/+error route with the components it directly pulls in. |
scan(root) | Force a full re-parse (bypass caches) and return node/link counts. Use after large external changes (branch switch, generated files) when you want guaranteed-fresh results. |
Node ids are workspace-relative POSIX paths and are the source of truth for
lookups/links. Labels are display names (Button, (page) /dashboard).
Recipes
- Impact analysis before changing a component →
get_component(root, path), readparentsto see every caller you might break. For a wider blast radius,get_graphand trace links. - "What does this component need?" →
get_component, readprops(noteoptional/bindable/rest) andslots. - Find dead code →
get_unused(root). Confirm before deleting (a component could be used dynamically in ways the static parser can't see). - Understand a route →
get_routes(root), orget_componenton the+page.sveltefor itsdataprop + children. - Stale results after a big change →
scan(root), then re-query.
Limits worth stating to the user
- Resolves relative +
$libimports; other custom Vite aliases become best-effort leaf nodes. <svelte:component this={…}>is traced only whenthisis a plain imported identifier.- Svelte 5 only: props come from
$props(); legacyexport let/createEventDispatcherare not parsed. Events in Svelte 5 are callback props, so they appear underprops.