Skip to content

[Plugin] Add experimental next-dev Claude Code plugin#92429

Draft
gaojude wants to merge 1 commit intocanaryfrom
jude/next-dev-plugin
Draft

[Plugin] Add experimental next-dev Claude Code plugin#92429
gaojude wants to merge 1 commit intocanaryfrom
jude/next-dev-plugin

Conversation

@gaojude
Copy link
Copy Markdown
Contributor

@gaojude gaojude commented Apr 7, 2026

Summary

Adds a new next-dev plugin to the Next.js Claude Code marketplace at .claude-plugin/plugins/next-dev/. It wires the dev server's MCP endpoint into Claude Code so agents editing Next.js code get real-time Turbopack compilation feedback instead of discovering all errors at the final pnpm build.

Two skill-scoped hooks fire while the /next-dev <port> skill is active:

  • UserPromptSubmit → pings the dev server, then calls pause_compilation. Intermediate edits within a turn no longer trigger HMR. Silent no-op if the port file is missing or the server is unreachable.
  • Stop → calls compile_and_resume (drains all buffered tasks in one batch), then get_compilation_issues. If issues are found, returns decision: block with formatted errors, forcing the agent to fix them. stop_hook_active is checked to prevent infinite loops.

State files (.claude/port, .claude/dismissed-issues.json) are project-local via $CLAUDE_PROJECT_DIR. Hook scripts and skill scripts are plugin-local via ${CLAUDE_PLUGIN_ROOT}.

The agent can also dismiss non-actionable errors (node_modules resolution failures, Turbopack empty-module stubs) for the rest of the session via dismiss-errors.mjs.

Status: experimental

This plugin depends on MCP tools that are not yet in stable Next.js:

MCP tool PR Status
get_compilation_issues #92062 Landed
pause_compilation / compile_and_resume #92410 Open

The activation script verifies the tools are present at localhost:<port>/_next/mcp and refuses to enable hooks otherwise — installing against an unsupported Next.js version produces a clear error rather than broken hooks. The plugin is marked experimental in plugin.json, the marketplace entry, the plugins index, and the README.

Files

.claude-plugin/
├── marketplace.json                                  (next-dev entry added)
└── plugins/
    ├── README.md                                     (next-dev row added)
    └── next-dev/
        ├── .claude-plugin/plugin.json
        ├── README.md
        ├── hooks/
        │   ├── enter-manual-compile.mjs
        │   ├── stop-compile-check.mjs
        │   └── mcp-client.mjs
        └── skills/next-dev/
            ├── SKILL.md
            └── scripts/
                ├── activate.mjs
                ├── get-errors.mjs
                └── dismiss-errors.mjs

Test plan

  • Install via /plugin marketplace add vercel/next.js + /plugin install next-dev@nextjs against a Next.js dev server built from Add manual compile mode to pause Turbopack scheduling during batched edits #92410
  • /next-dev 3000 activates cleanly; activation fails with a clear message when tools are missing
  • UserPromptSubmit hook pauses compilation and is a silent no-op when the server is down
  • Stop hook compiles in one batch, blocks on errors, and exits 0 on stop_hook_active=true
  • Dismiss flow hides node_modules / turbopack-stub errors and resets on next activation

Adds a new `next-dev` plugin to the Next.js Claude Code marketplace
that wires the dev server's MCP endpoint into Claude Code via two
skill-scoped hooks:

- UserPromptSubmit: pings the dev server and calls `pause_compilation`
  so intermediate edits don't trigger HMR.
- Stop: calls `compile_and_resume` (one batch compile) followed by
  `get_compilation_issues`, blocking the agent from finishing if
  compilation errors exist.

State files (`.claude/port`, `.claude/dismissed-issues.json`) are
project-local; hook scripts live under `${CLAUDE_PLUGIN_ROOT}`.

Marked experimental in the manifest, marketplace, and README — depends
on `pause_compilation`/`compile_and_resume` MCP tools that are still
landing in #92410. The activation script verifies the tools are
present and refuses to enable hooks otherwise.
@nextjs-bot nextjs-bot added the created-by: Next.js team PRs by the Next.js team. label Apr 7, 2026
Comment on lines +75 to +76
lines.push(
`${issues.length} issue(s). Fix them or dismiss non-actionable ones with: node "./scripts/dismiss-errors.mjs"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
lines.push(
`${issues.length} issue(s). Fix them or dismiss non-actionable ones with: node "./scripts/dismiss-errors.mjs"`
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || '.'
lines.push(
`${issues.length} issue(s). Fix them or dismiss non-actionable ones with: node "${pluginRoot}/skills/next-dev/scripts/dismiss-errors.mjs"`

Stop hook message contains wrong path to dismiss-errors.mjs, causing the agent to receive a non-working command when compilation errors block it.

Fix on Vercel

@@ -0,0 +1,88 @@
#!/usr/bin/env node
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stop hook missing stop_hook_active check allows infinite blocking loop when compilation errors can't be fixed

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by: Next.js team PRs by the Next.js team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants