跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 next-dev-loop

Next Dev Loop

编辑应用程序代码后验证 Next.js 运行时的行为 。 使用这一技能来确认一个更改在运行中的应用中实际上有效——而不仅仅是它编译或打字检查. 将 /_next/mcp(Next.js的视图)与代理浏览器(浏览器的视图)相融合. 需要运行“ next dev” .

13616 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

编辑应用程序代码后验证 Next.js 运行时的行为 。 使用这一技能来确认一个更改在运行中的应用中实际上有效——而不仅仅是它编译或打字检查. 将 /_next/mcp(Next.js的视图)与代理浏览器(浏览器的视图)相融合. 需要运行“ next dev” .

何时用

官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:next-dev-loop、requires、preflight、loop、before the edit — narrow the scope、after the edit — verify。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

Verify Next.js runtime behavior after editing app code. Use this skill to confirm a change actually works in a running app — not just that it compiles or type-checks. Combines /_next/mcp (Next.js's view) with agent-browser (the browser's view). Requires a running `next dev`.

next-dev-looprequirespreflightloopbefore the edit — narrow the scopeafter the edit — verifygotchasreference/_next/mcp notesteardown

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
next-dev-loop
description
Verify Next.js runtime behavior after editing app code. Use this skill to confirm a change actually works in a running app — not just that it compiles or type-checks. Combines /_next/mcp (Next.js's view) with agent-browser (the browser's view). Requires a running `next dev`.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「next-dev-loop」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-9d4162c3a7b85ac8-Next-Dev-Loop.html
请存为 .cursor/skills/next-dev-loop/SKILL.md 或 .claude/skills/next-dev-loop/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/vercel/next.js' --list

npx skills add 'https://github.com/vercel/next.js' --skill 'next-dev-loop'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: next-dev-loop description: > Verify Next.js runtime behavior after editing app code. Use this skill to confirm a change actually works in a running app — not just that it compiles or type-checks. Combines /_next/mcp (Next.js's view) with agent-browser (the browser's view). Requires a running `next dev`. --- # next-dev-loop The edit/verify rhythm during `next dev` — make a change, then confirm it actually works at runtime, not only that the types or the build are happy. You verify through two views of the same running app: - **`/_next/mcp`** — an HTTP endpoint Next.js exposes about itself. Knows framework-specific things: routes, segments, RSC, server actions, server logs, and errors as Next.js saw them. Call `tools/list` for the current surface. - **`agent-browser`** — a CLI that drives a real Chrome. Knows framework-agnostic browser things: DOM, console, network, React fiber, vitals. Before driving it, run `agent-browser skills get core` once for the version-matched usage guide — don't guess subcommands from memory. The two views cross-check each other. ## requires - Next.js **16.3+** with **Turbopack** — `/_next/mcp` plus the proactive compile check via `get_compilation_issues`. - `agent-browser` **>= 0.31.1** — React introspection, worktree-scoped `session id`, idempotent `--restore`, and launch flag reconciliation. These are hard floors, not soft preferences. If anything is missing, tell the user how to upgrade and stop. Don't fall back to grepping source or to a weaker probe — this skill assumes both views are live at the versions above. - Upgrade Next.js: `pnpm next upgrade` (or `npx next upgrade`). Docs: https://nextjs.org/docs/app/getting-started/upgrading (version-16 guide: https://nextjs.org/docs/app/guides/upgrading/version-16) - Install or upgrade `agent-browser`: `npm i -g agent-browser@latest`. If the CLI isn't on `PATH`, install it before continuing — preflight expects to invoke it directly. ## preflight Once per session, confirm both views are live. 1. **Open `agent-browser` at the target URL, restoring saved login state when present.** First derive one stable session id for this checkout and use it for every `agent-browser` command: ```bash SESSION="$(agent-browser session id --scope worktree --prefix next-dev-loop)" export AGENT_BROWSER_SESSION="$SESSION" export AGENT_BROWSER_RESTORE="$SESSION" ``` Then open the target URL: ```bash agent-browser --session "$SESSION" --restore --headed --enable react-devtools open ``` `--scope worktree` keeps parallel worktrees and copied checkouts from colliding. Bare `--restore` uses the session id as the persistence key, loads saved cookies/localStorage before navigation when present, and auto-saves state on close. Always pass the desired launch flags on `open`; agent-browser will reuse, relaunch, or restart its scoped background state as needed. The browser is the user's. If state was not restored (first run, expired session) and the page is gated, the user drives the login — pause until they confirm. After login, continue using the same session and restore context; `agent-browser close` saves the cookie state so the next `open` restores it. 2. Probe `/_next/mcp` (`tools/list`) — confirm it's reachable and lists `get_compilation_issues`. First read the port off the `next dev` banner; if it isn't 3000, set `NEXT_MCP_URL=http://localhost:/_next/mcp` before probing: - Unreachable → either `next dev` isn't running, or Next.js is below 16.3. Check `package.json` to disambiguate, then refuse. - `get_compilation_issues` not in the list → Next.js below 16.3. Refuse and tell the user to upgrade. 3. `get_compilation_issues` doubles as a Turbopack probe. An error response of `"Turbopack project is not available..."` means the user is on webpack. Refuse — Turbopack is required. 4. `get_routes` → your route map for the rest of the session. ## loop ### before the edit — narrow the scope Ask the running app, not the codebase. `/_next/mcp` knows which files rendered the current route; use those as your search scope. Runtime introspection stays cheap as the codebase grows; agentic search doesn't. ### after the edit — verify Four failure modes. Check each: - **Compiles** — `get_compilation_issues`. - **Runs without errors** — `/_next/mcp` (server and bubbled-up browser errors both surface here). - **Behaves as intended** — `agent-browser` drives the page; assert what the user actually sees. - **React-level behavior** — `agent-browser` with react-devtools enabled exposes the component tree, props, state, and render counts. Anchor framework-level checks here (extra renders, server/client boundary shifts, suspense fallbacks) — DOM asserts alone miss them. Pick the specific tool from `tools/list` or the agent-browser manual rather than from memory. ## gotchas - **Preserve `.next` while the development server is running.** Moving or deleting it disconnects the server from its generated state and discards incremental caches. Moving it to a backup is still a reset. If a production build needs isolated output, configure a separate `distDir`. - **Every `agent-browser` command must know your session and restore key, or it may use an empty default browser or fail to save login state.** Easiest: export both `AGENT_BROWSER_SESSION="$SESSION"` and `AGENT_BROWSER_RESTORE="$SESSION"` at the top of each shell you run agent-browser in. If you do not export them, pass `--session "$SESSION" --restore` on every command. - **When the two views disagree, suspect the tooling first.** If `agent-browser` says a route is broken but `/_next/mcp` and the server say it rendered cleanly, a stale or misdirected browser session is the likelier cause than a real bug — reconcile the views before debugging the app. - Confirming a click or navigation: the page settles a beat later, so wait with `wait --load networkidle` (no path to get wrong), then snapshot/read to confirm the page. Avoid `wait --url` unless you pass the link's exact href — a guessed or placeholder path won't match the real URL and times out after 25s. - A blank read, empty snapshot, `about:blank`, or a "no browser session" error — right after `open` or after a click (even if `open` reported the page) — is the browser dropping the page (a stale session), not a broken route. Reopen your session at the URL with `--session "$SESSION" --restore` and re-snapshot; if still blank, run `agent-browser --session "$SESSION" --restore close`, then open again. Don't fall back to `curl`; it bypasses the browser you're testing. - React introspection output is stale after navigation. Re-run. - `/_next/mcp` replies are SSE — read the JSON off the `data:` line with `sed -n 's/^data: //p'` (a plain `sed 's/^data: //'` leaves the `event:` line and the parse fails). - `get_errors` and `get_page_metadata` need at least one navigation to populate. ## reference All tools below are present once preflight passes. If `tools/list` is missing any of them, preflight should have refused — re-check. ``` # /_next/mcp notes get_project_metadata projectPath, devServerUrl, bundler get_routes fs-scan; no browser session needed get_errors runtime + build; needs a browser session; includes browser-side errors caught by the dev server get_page_metadata segment trie + routerType; needs a browser session; use as a discovery shortcut for which files power a route get_logs returns logFilePath get_server_action_by_id hashed id → file + functionName get_compilation_issues Turbopack only; errors on webpack ("Turbopack project is not available") ``` ## teardown Close the session with the same session and restore context: `agent-browser --session "$SESSION" --restore close`. `close` saves that session's cookies and storage so the next loop's `--restore` open keeps the user logged in. Leave `next dev` up for the next loop.

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…