Compare commits

..

1 Commits

Author SHA1 Message Date
paoloricciuti
af8d994fa3 chore: use @include in docs 2026-01-30 15:55:56 +01:00
31 changed files with 62 additions and 611 deletions

View File

@@ -1,5 +0,0 @@
---
'@sveltejs/opencode': patch
---
fix: better subagent instructions to use MCP or skill

View File

@@ -0,0 +1,5 @@
---
'@sveltejs/mcp': patch
---
fix: turn off no-inspect in eslint for mcp

View File

@@ -0,0 +1,5 @@
---
'@sveltejs/opencode': minor
---
feat: distribute skills through opencode plugin

View File

@@ -10,7 +10,7 @@
"description": "A plugin for all things Svelte development, MCP, skills, and more.",
"lspServers": {
"svelte": {
"command": "svelteserver",
"command": "svelte-language-server",
"args": ["--stdio"],
"extensionToLanguage": {
".svelte": "svelte"

View File

@@ -17,7 +17,7 @@ jobs:
name: Release
runs-on: ${{ matrix.os }}
outputs:
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
published: ${{ steps.changesets.outputs.published }}
strategy:
matrix:
# pseudo-matrix for convenience, NEVER use more than a single combination
@@ -64,7 +64,7 @@ jobs:
publish-mcp:
needs: release
if: contains(needs.release.outputs.publishedPackages, '"@sveltejs/mcp"')
if: needs.release.outputs.published == 'true'
uses: ./.github/workflows/publish-mcp.yml
secrets:
MCP_KEY: ${{ secrets.MCP_KEY }}

View File

@@ -1,71 +0,0 @@
name: Sync Agents Documentation
on:
push:
branches:
- main
paths:
- 'instructions/AGENTS.md'
permissions:
contents: write
pull-requests: write
jobs:
sync-agents:
# prevents this action from running on forks
if: github.repository == 'sveltejs/mcp'
name: Sync AGENTS.md to OpenCode Package and Docs
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
echo installing pnpm version $PNPM_VER
npm i -g pnpm@$PNPM_VER
- name: Sync AGENTS.md
run: pnpm sync-agents-md
- name: Check for changes
id: git-check
run: |
git diff --exit-code packages/opencode/instructions/opencode-agents.md documentation/docs/10-introduction/.generated/agents.md || echo "changed=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: sync AGENTS.md to opencode package and documentation'
branch: chore/sync-agents-md
delete-branch: true
title: 'chore: sync AGENTS.md to opencode package and documentation'
body: |
## Summary
Automatically synced AGENTS.md to the opencode package and documentation.
This PR was triggered by changes to `instructions/AGENTS.md`.
## Changes
- Synced `packages/opencode/instructions/opencode-agents.md` with latest AGENTS.md
- Updated `documentation/docs/10-introduction/.generated/agents.md` with latest content
## Generated by
GitHub Action: Sync Agents Documentation
labels: |
chore
documentation
automated

View File

@@ -1,86 +0,0 @@
name: Sync Cursor Plugin
on:
push:
branches:
- main
paths:
- 'plugins/svelte/skills/**'
- 'plugins/svelte/agents/**'
- 'instructions/AGENTS.md'
permissions:
contents: write
pull-requests: write
jobs:
sync-cursor:
# prevents this action from running on forks
if: github.repository == 'sveltejs/mcp'
name: Sync Cursor Plugin from Sources of Truth
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: false # pnpm is not installed yet
- name: Install pnpm
shell: bash
run: |
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
echo installing pnpm version $PNPM_VER
npm i -g pnpm@$PNPM_VER
- name: Setup Node.js with pnpm cache
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: 24
package-manager-cache: true # caches pnpm via packageManager field in package.json
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
- name: Sync Cursor plugin
run: pnpm sync-cursor-plugin
- name: Check for changes
id: git-check
run: |
git diff --exit-code svelte-cursor/ || echo "changed=true" >> $GITHUB_OUTPUT
- name: Create Pull Request
if: steps.git-check.outputs.changed == 'true'
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: sync Cursor plugin from sources of truth'
branch: chore/sync-cursor-plugin
delete-branch: true
title: 'chore: sync Cursor plugin from sources of truth'
body: |
## Summary
Automatically synced the Cursor plugin from sources of truth.
This PR was triggered by changes to one or more of:
- `plugins/svelte/skills/**` (skills)
- `plugins/svelte/agents/**` (agent definitions)
- `instructions/AGENTS.md` (agent instructions/rules)
## Changes
- Synced `svelte-cursor/skills/` with latest skill definitions
- Synced `svelte-cursor/agents/` with latest agent definitions (stripped Claude-specific fields)
- Synced `svelte-cursor/rules/` with latest instructions from AGENTS.md
## Generated by
GitHub Action: Sync Cursor Plugin
labels: |
chore
automated

View File

@@ -1,23 +0,0 @@
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available Svelte MCP Tools:
### 1. list-sections
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
### 2. get-documentation
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
### 3. svelte-autofixer
Analyzes Svelte code and returns issues and suggestions.
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
### 4. playground-link
Generates a Svelte Playground link with the provided code.
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.

View File

@@ -17,6 +17,30 @@ To get the most out of the MCP server we recommend including the following promp
> [!NOTE] This is already setup for you when using `npx sv add mcp`
@include .generated/agents.md
```md
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available MCP Tools:
### 1. list-sections
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
### 2. get-documentation
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
### 3. svelte-autofixer
Analyzes Svelte code and returns issues and suggestions.
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
### 4. playground-link
Generates a Svelte Playground link with the provided code.
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.
```
If your MCP client supports it, we also recommend using the [svelte-task](prompts#svelte-task) prompt to instruct the LLM on the best way to use the MCP server.

View File

@@ -33,13 +33,10 @@ The default configuration for the Svelte OpenCode plugin looks like this...
},
"skills": {
"enabled": true
},
"instructions": {
"enabled": true
}
}
```
...but if you prefer, you can enable only the subagent, only the MCP, only the skills, or configure the kind of MCP server you want to use (`local` or `remote`).
You can place this file in `./.opencode/svelte.json` (in your project), in `~/.config/opencode/svelte.json` or, if you have an `OPENCODE_CONFIG_DIR` environment variable specified, at `$OPENCODE_CONFIG_DIR/svelte.json`.
You can place this file in `~/.config/opencode/svelte.json` or, if you have an `OPENCODE_CONFIG_DIR` environment variable specified, at `$OPENCODE_CONFIG_DIR/svelte.json`.

View File

@@ -1,6 +1,6 @@
## `svelte-code-writer`
CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating or editing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
<a href="https://github.com/sveltejs/mcp/releases?q=svelte-code-writer" target="_blank" rel="noopener noreferrer">Open Releases page</a>

View File

@@ -1,23 +0,0 @@
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available Svelte MCP Tools:
### 1. list-sections
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
### 2. get-documentation
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
### 3. svelte-autofixer
Analyzes Svelte code and returns issues and suggestions.
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
### 4. playground-link
Generates a Svelte Playground link with the provided code.
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.

View File

@@ -25,9 +25,7 @@
"debug:generate-summaries": "pnpm --filter @sveltejs/mcp-server run debug:generate-summaries",
"release": "pnpm --filter @sveltejs/mcp run build && changeset publish",
"changeset:version": "changeset version && pnpm --filter @sveltejs/mcp run update:version && git add --all",
"sync-opencode-skills": "rm -rf packages/opencode/skills && cp -r plugins/svelte/skills packages/opencode/skills",
"sync-agents-md": "rm -f packages/opencode/instructions/opencode-agents.md && rm -f documentation/docs/10-introduction/.generated/agents.md && mkdir -p packages/opencode/instructions && mkdir -p documentation/docs/10-introduction/.generated && cp instructions/AGENTS.md packages/opencode/instructions/opencode-agents.md && cp instructions/AGENTS.md documentation/docs/10-introduction/.generated/agents.md",
"sync-cursor-plugin": "node scripts/sync-cursor-plugin.ts"
"sync-opencode-skills": "rm -rf packages/opencode/skills && cp -r plugins/svelte/skills packages/opencode/skills"
},
"keywords": [
"svelte",

View File

@@ -1,11 +1,5 @@
# @sveltejs/mcp
## 0.1.20
### Patch Changes
- fix: turn off no-inspect in eslint for mcp ([`2245cb2`](https://github.com/sveltejs/mcp/commit/2245cb2dc9e2d217869b6a800795ce59ffb40c51))
## 0.1.19
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@sveltejs/mcp",
"version": "0.1.20",
"version": "0.1.19",
"type": "module",
"license": "MIT",
"mcpName": "dev.svelte/mcp",

View File

@@ -9,7 +9,7 @@
"subfolder": "packages/mcp-stdio",
"source": "github"
},
"version": "0.1.20",
"version": "0.1.19",
"websiteUrl": "https://svelte.dev/docs/mcp/overview",
"icons": [
{
@@ -25,7 +25,7 @@
{
"registryType": "npm",
"identifier": "@sveltejs/mcp",
"version": "0.1.20",
"version": "0.1.19",
"runtimeHint": "npx",
"transport": {
"type": "stdio"

View File

@@ -1,23 +1,5 @@
# @sveltejs/opencode
## 0.1.2
### Patch Changes
- feat: allow for local opencode config ([#156](https://github.com/sveltejs/mcp/pull/156))
## 0.1.1
### Patch Changes
- fix: actually push skills to right config path ([`c2c1b3e`](https://github.com/sveltejs/mcp/commit/c2c1b3e5e788b14eea17cd37a83ca55433cc4072))
## 0.1.0
### Minor Changes
- feat: distribute skills through opencode plugin ([#151](https://github.com/sveltejs/mcp/pull/151))
## 0.0.3
### Patch Changes

View File

@@ -71,15 +71,8 @@ function get_config_paths() {
}
}
// Project-local: ./.opencode/svelte.json (cwd)
let project_path: string | null = null;
const project_config = join(process.cwd(), '.opencode', 'svelte.json');
if (existsSync(project_config)) {
project_path = project_config;
}
// Lowest priority first, highest priority last (project overrides global)
return [global_path, config_dir_path, project_path];
// returning config_dir first so it has higher priority
return [config_dir_path, global_path];
}
function load_config_file(config_path: string): ConfigLoadResult {
@@ -128,9 +121,6 @@ function merge_with_defaults(user_config: Partial<McpConfig>): McpConfig {
export function get_mcp_config(ctx: PluginInput) {
const config_paths = get_config_paths();
let merged: Partial<McpConfig> = {};
// Iterate from lowest to highest priority, merging as we go
for (const path of config_paths) {
if (path && existsSync(path)) {
const result = load_config_file(path);
@@ -139,28 +129,23 @@ export function get_mcp_config(ctx: PluginInput) {
ctx.client.tui.showToast({
body: {
title: 'Svelte: Invalid opencode plugin config',
message: `${result.parse_error} (${path})\nSkipping this config file`,
message: `${result.parse_error}\nUsing default values`,
variant: 'warning',
duration: 7000,
},
});
}, 7000);
continue;
return default_config;
}
const parsed = v.safeParse(config_schema, result.data);
if (parsed.success) {
merged = {
mcp: { ...merged.mcp, ...parsed.output.mcp },
subagent: { ...merged.subagent, ...parsed.output.subagent },
instructions: { ...merged.instructions, ...parsed.output.instructions },
skills: { ...merged.skills, ...parsed.output.skills },
};
return merge_with_defaults(parsed.output);
} else {
setTimeout(() => {
ctx.client.tui.showToast({
body: {
title: 'Svelte: Invalid opencode plugin config',
message: `Invalid config schema (${path})\nSkipping this config file`,
message: `${result.parse_error}\nUsing default values`,
variant: 'warning',
duration: 7000,
},
@@ -170,5 +155,5 @@ export function get_mcp_config(ctx: PluginInput) {
}
}
return merge_with_defaults(merged);
return default_config;
}

View File

@@ -13,9 +13,7 @@ export const svelte_plugin: Plugin = async (ctx) => {
input.mcp ??= {};
input.instructions ??= [];
// @ts-expect-error -- types are wrong in the opencode package...will fix there and remove this
input.skills ??= {};
// @ts-expect-error -- types are wrong in the opencode package...will fix there and remove this
input.skills.paths ??= [];
input.skills ??= [];
// by default we use svelte as the name for the svelte MCP server
let svelte_mcp_name = 'svelte';
// we loop over every mcp server to see if any of them is already the svelte MCP server
@@ -42,7 +40,7 @@ export const svelte_plugin: Plugin = async (ctx) => {
if (mcp_config.skills?.enabled !== false) {
const skills_dir = join(current_dir, 'skills');
// @ts-expect-error -- skills is a new opencode feature
input.skills.paths.push(skills_dir);
input.skills.push(skills_dir);
}
// if the user doesn't have the MCP server already we add one based on config
@@ -64,71 +62,9 @@ export const svelte_plugin: Plugin = async (ctx) => {
input.agent['svelte-file-editor'] = {
color: '#ff3e00',
mode: 'subagent',
prompt: `You are a Svelte 5 expert responsible for writing, editing, and validating Svelte components and modules. You have access to the Svelte MCP server which provides documentation and code analysis tools. Always use the tools from the svelte MCP server to fetch documentation with \`get_documentation\` and validating the code with \`svelte_autofixer\`. If the autofixer returns any issue or suggestions try to solve them.
If the MCP tools are not available you can use the \`svelte-code-editor\` skill to learn how to use the \`@sveltejs/mcp\` cli to access the same tools.
If the skill is not available you can run \`npx @sveltejs/mcp@latest -y --help\` to learn how to use it.
## Available MCP Tools
### 1. list-sections
Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths. Use this first to discover what documentation is available.
### 2. get-documentation
Retrieves full documentation for specified sections. Accepts a single section name or an array of section names. Use after \`list-sections\` to fetch relevant docs for the task at hand.
**Example sections:** \`$state\`, \`$derived\`, \`$effect\`, \`$props\`, \`$bindable\`, \`snippets\`, \`routing\`, \`load functions\`
### 3. svelte-autofixer
Analyzes Svelte code and returns suggestions to fix issues. Pass the component code directly to this tool. It will detect common mistakes like:
- Using \`$effect\` instead of \`$derived\` for computations
- Missing cleanup in effects
- Svelte 4 syntax (\`on:click\`, \`export let\`, \`<slot>\`)
- Missing keys in \`{#each}\` blocks
- And more
## Workflow
When invoked to work on a Svelte file:
### 1. Gather Context (if needed)
If you're uncertain about Svelte 5 syntax or patterns, use the MCP tools:
1. Call \`list-sections\` to see available documentation
2. Call \`get-documentation\` with relevant section names
### 2. Read the Target File
Read the file to understand the current implementation.
### 3. Make Changes
Apply edits following Svelte 5 best practices:
### 4. Validate Changes
After editing, ALWAYS call \`svelte-autofixer\` with the updated code to check for issues.
### 5. Fix Any Issues
If the autofixer reports problems, fix them and re-validate until no issues remain.
## Output Format
After completing your work, provide:
1. Summary of changes made
2. Any issues found and fixed by the autofixer
3. Recommendations for further improvements (if any)
`,
prompt: `You are a specialized Svelte coder. Always use the tools from the svelte MCP server to fetch documentation with \`get_documentation\` and validating the code with \`svelte_autofixer\`. If the autofixer returns any issue or suggestions solve them before summarizing the changes for the main agent.`,
description:
'Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server or the `svelte-code-writer` skill if they are available. Fetches relevant documentation and validates code using the Svelte MCP server tools.',
'Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server. Fetches relevant documentation and validates code using the Svelte MCP server tools.',
permission: {
bash: 'ask',
edit: 'allow',

View File

@@ -1,6 +1,6 @@
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available Svelte MCP Tools:
## Available MCP Tools:
### 1. list-sections

View File

@@ -1,6 +1,6 @@
{
"name": "@sveltejs/opencode",
"version": "0.1.2",
"version": "0.0.3",
"type": "module",
"license": "MIT",
"homepage": "https://github.com/sveltejs/mcp#readme",

View File

@@ -1,6 +1,6 @@
---
name: svelte-code-writer
description: CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
description: CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating or editing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
---
# Svelte 5 Code Writer

View File

@@ -1,13 +1,13 @@
{
"name": "svelte",
"description": "A plugin for all things related to Svelte development, MCP, skills, and more.",
"version": "1.0.1",
"version": "1.0.0",
"author": {
"name": "Svelte"
},
"lspServers": {
"svelte": {
"command": "svelteserver",
"command": "svelte-language-server",
"args": ["--stdio"],
"extensionToLanguage": {
".svelte": "svelte"

View File

@@ -1,15 +1,11 @@
---
name: svelte-file-editor
description: Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server or the `svelte-file-editor` skill if they are available. Fetches relevant documentation and validates code using the Svelte MCP server tools.
description: Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server. Fetches relevant documentation and validates code using the Svelte MCP server tools.
permissionMode: acceptEdits
---
You are a Svelte 5 expert responsible for writing, editing, and validating Svelte components and modules. You have access to the Svelte MCP server which provides documentation and code analysis tools. Always use the tools from the svelte MCP server to fetch documentation with `get_documentation` and validating the code with `svelte_autofixer`. If the autofixer returns any issue or suggestions try to solve them.
If the MCP tools are not available you can use the `svelte-code-editor` skill to learn how to use the `@sveltejs/mcp` cli to access the same tools.
If the skill is not available you can run `npx @sveltejs/mcp@latest -y --help` to learn how to use it.
## Available MCP Tools
### 1. list-sections

View File

@@ -1,6 +1,6 @@
---
name: svelte-code-writer
description: CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
description: CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating or editing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
---
# Svelte 5 Code Writer

View File

@@ -1,85 +0,0 @@
import fs from 'node:fs/promises';
import path from 'node:path';
const CURSOR_PLUGIN_DIR = './svelte-cursor';
const CLAUDE_PLUGIN_DIR = './plugins/svelte';
const AGENTS_MD_PATH = './instructions/AGENTS.md';
/**
* Sync skills from Claude plugin to Cursor plugin (direct copy)
*/
async function sync_skills() {
const source = path.join(CLAUDE_PLUGIN_DIR, 'skills');
const dest = path.join(CURSOR_PLUGIN_DIR, 'skills');
await fs.rm(dest, { recursive: true, force: true });
await fs.cp(source, dest, { recursive: true });
console.log('Synced skills to Cursor plugin');
}
/**
* Sync agent definition from Claude plugin to Cursor plugin,
* stripping Claude-specific frontmatter fields (permissionMode)
*/
async function sync_agents() {
const source = path.join(CLAUDE_PLUGIN_DIR, 'agents');
const dest = path.join(CURSOR_PLUGIN_DIR, 'agents');
await fs.rm(dest, { recursive: true, force: true });
await fs.mkdir(dest, { recursive: true });
const files = await fs.readdir(source);
for (const file of files) {
if (!file.endsWith('.md')) continue;
const content = await fs.readFile(path.join(source, file), 'utf-8');
// Strip Claude-specific frontmatter fields
const transformed = content.replace(
/^(---\n)([\s\S]*?)(---\n)/m,
(_match, open, frontmatter, close) => {
const filtered_lines = (frontmatter as string)
.split('\n')
.filter((line: string) => !line.startsWith('permissionMode:'))
.join('\n');
return `${open}${filtered_lines}${close}`;
},
);
await fs.writeFile(path.join(dest, file), transformed);
}
console.log('Synced agents to Cursor plugin');
}
/**
* Sync AGENTS.md instructions as a Cursor rule (.mdc file with frontmatter)
*/
async function sync_rules() {
const dest = path.join(CURSOR_PLUGIN_DIR, 'rules');
await fs.rm(dest, { recursive: true, force: true });
await fs.mkdir(dest, { recursive: true });
const agents_content = await fs.readFile(AGENTS_MD_PATH, 'utf-8');
const rule_content = `---
description: Instructions for using the Svelte MCP server tools for documentation lookup, code analysis, and validation
alwaysApply: true
---
${agents_content.trim()}
`;
await fs.writeFile(path.join(dest, 'svelte-mcp-tools.mdc'), rule_content);
console.log('Synced rules to Cursor plugin');
}
await sync_skills();
await sync_agents();
await sync_rules();
console.log('Cursor plugin sync complete');

View File

@@ -1,9 +0,0 @@
{
"name": "svelte",
"description": "A plugin for all things related to Svelte development, MCP, skills, and more.",
"version": "1.0.0",
"author": {
"name": "Svelte"
},
"keywords": ["svelte", "sveltekit", "mcp", "autofixer"]
}

View File

@@ -1,8 +0,0 @@
{
"mcpServers": {
"svelte": {
"type": "http",
"url": "https://mcp.svelte.dev/mcp"
}
}
}

View File

@@ -1,67 +0,0 @@
---
name: svelte-file-editor
description: Specialized Svelte 5 code editor. MUST BE USED PROACTIVELY when creating, editing, or reviewing any .svelte file or .svelte.ts/.svelte.js module and MUST use the tools from the MCP server or the `svelte-file-editor` skill if they are available. Fetches relevant documentation and validates code using the Svelte MCP server tools.
---
You are a Svelte 5 expert responsible for writing, editing, and validating Svelte components and modules. You have access to the Svelte MCP server which provides documentation and code analysis tools. Always use the tools from the svelte MCP server to fetch documentation with `get_documentation` and validating the code with `svelte_autofixer`. If the autofixer returns any issue or suggestions try to solve them.
If the MCP tools are not available you can use the `svelte-code-editor` skill to learn how to use the `@sveltejs/mcp` cli to access the same tools.
If the skill is not available you can run `npx @sveltejs/mcp@latest -y --help` to learn how to use it.
## Available MCP Tools
### 1. list-sections
Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths. Use this first to discover what documentation is available.
### 2. get-documentation
Retrieves full documentation for specified sections. Accepts a single section name or an array of section names. Use after `list-sections` to fetch relevant docs for the task at hand.
**Example sections:** `$state`, `$derived`, `$effect`, `$props`, `$bindable`, `snippets`, `routing`, `load functions`
### 3. svelte-autofixer
Analyzes Svelte code and returns suggestions to fix issues. Pass the component code directly to this tool. It will detect common mistakes like:
- Using `$effect` instead of `$derived` for computations
- Missing cleanup in effects
- Svelte 4 syntax (`on:click`, `export let`, `<slot>`)
- Missing keys in `{#each}` blocks
- And more
## Workflow
When invoked to work on a Svelte file:
### 1. Gather Context (if needed)
If you're uncertain about Svelte 5 syntax or patterns, use the MCP tools:
1. Call `list-sections` to see available documentation
2. Call `get-documentation` with relevant section names
### 2. Read the Target File
Read the file to understand the current implementation.
### 3. Make Changes
Apply edits following Svelte 5 best practices:
### 4. Validate Changes
After editing, ALWAYS call `svelte-autofixer` with the updated code to check for issues.
### 5. Fix Any Issues
If the autofixer reports problems, fix them and re-validate until no issues remain.
## Output Format
After completing your work, provide:
1. Summary of changes made
2. Any issues found and fixed by the autofixer
3. Recommendations for further improvements (if any)

View File

@@ -1,28 +0,0 @@
---
description: Instructions for using the Svelte MCP server tools for documentation lookup, code analysis, and validation
alwaysApply: true
---
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
## Available Svelte MCP Tools:
### 1. list-sections
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
### 2. get-documentation
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
### 3. svelte-autofixer
Analyzes Svelte code and returns issues and suggestions.
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
### 4. playground-link
Generates a Svelte Playground link with the provided code.
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.

View File

@@ -1,66 +0,0 @@
---
name: svelte-code-writer
description: CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.
---
# Svelte 5 Code Writer
## CLI Tools
You have access to `@sveltejs/mcp` CLI for Svelte-specific assistance. Use these commands via `npx`:
### List Documentation Sections
```bash
npx @sveltejs/mcp list-sections
```
Lists all available Svelte 5 and SvelteKit documentation sections with titles and paths.
### Get Documentation
```bash
npx @sveltejs/mcp get-documentation "<section1>,<section2>,..."
```
Retrieves full documentation for specified sections. Use after `list-sections` to fetch relevant docs.
**Example:**
```bash
npx @sveltejs/mcp get-documentation "$state,$derived,$effect"
```
### Svelte Autofixer
```bash
npx @sveltejs/mcp svelte-autofixer "<code_or_path>" [options]
```
Analyzes Svelte code and suggests fixes for common issues.
**Options:**
- `--async` - Enable async Svelte mode (default: false)
- `--svelte-version` - Target version: 4 or 5 (default: 5)
**Examples:**
```bash
# Analyze inline code (escape $ as \$)
npx @sveltejs/mcp svelte-autofixer '<script>let count = \$state(0);</script>'
# Analyze a file
npx @sveltejs/mcp svelte-autofixer ./src/lib/Component.svelte
# Target Svelte 4
npx @sveltejs/mcp svelte-autofixer ./Component.svelte --svelte-version 4
```
**Important:** When passing code with runes (`$state`, `$derived`, etc.) via the terminal, escape the `$` character as `\$` to prevent shell variable substitution.
## Workflow
1. **Uncertain about syntax?** Run `list-sections` then `get-documentation` for relevant topics
2. **Reviewing/debugging?** Run `svelte-autofixer` on the code to detect issues
3. **Always validate** - Run `svelte-autofixer` before finalizing any Svelte component