Next.js Code One Task
| This documentation was generated with the assistance of AI. Please report any inaccuracies. |
Implement a single task from a Next.js implementation_plan.md — the implementation, its tests, and its checkbox
update — for the exact Next.js profile the project actually has. It is the narrowest execution unit for a
nextjs-tagged task in the iru-code pipeline and the Next.js counterpart to iru-typescript-code-one-task.
Purpose
The same Next.js code means different things across versions and caching models: fetch is cached by default in 14
and not in 15+, params is a plain object in 14 and a Promise from 15, and export const revalidate = 60 is ISR in
the previous model but a build error under Cache Components. iru-nextjs-code-one-task therefore starts by detecting
the project’s profile — Next major (14, 15, 16), router (App, Pages or hybrid), cacheComponents (giving the profile
14, 15, 16-prev or 16-cc), src/ layout, proxy.ts vs middleware.ts, output mode, test runners (Vitest
or Jest via next/jest, Playwright), styling, linter, package manager, and any project AGENTS.md/CLAUDE.md
guidance including the version-matched docs under node_modules/next/dist/docs/ — and only then loads the matching
slice of its bundled reference/ directory.
It treats the route’s rendering mode as part of the contract: it never changes a route’s mode the task did not ask to
change, and it states the expected next build classification (static, SSG, dynamic, partial) of every route it
touched so the group skill can check it against the real build. It never runs tests, coverage, quality checks,
license headers or next build — those happen once per group in iru-nextjs-code-one-task-group. It runs on a
medium model on purpose: the plan carries the hard reasoning and the Next.js rules live in reference/.
For a task that adds or changes a page, component or list, it also applies the catalog’s UI contract mapped onto
Next.js (see Building user interfaces): it first writes a
Screen › Region › Component decomposition marking each component as Server or Client, feeds interactive Client
Components serializable props from Server Components, paginates or virtualizes collections, and writes Playwright
component (gallery), screen and flow specs that capture .ui-screenshots/ across left-to-right/right-to-left ×
light/dark with axe checks, without running them.
Plugin
Shipped by the iru-nextjs plugin of the ai-catalog marketplace (install with /plugin install iru-nextjs@ai-catalog; see Plugins).
Inputs
| Argument | Required | Description | Default |
|---|---|---|---|
|
Yes |
The task’s full text from |
None — the skill has nothing to do without it. |
|
No |
The skill’s own bundled reference directory: |
Bundled with the skill |
code-style.md is always read, server-and-client-components.md always for the App Router, testing.md nearly
always, and the others only when the task touches that area (data reads/caching, Server Actions, route handlers and
the proxy, new routes or segment config, metadata, Pages Router files, security-sensitive code). Within
data-fetching-and-caching.md only the detected profile’s section is applied.
Outputs
-
Source and test files created/modified per the task, following the detected profile: profile-correct APIs (
awaiton request APIs andparamson 15+,'use cache'only under16-cc, segment config never under16-cc,proxy.tsormiddleware.tsas detected),'use client'on the smallest interactive leaf, noany,readonlydefaults, named exports except where Next requires a default, full TSDoc on exported symbols, and no new runtime dependency ornext.configchange unless the task calls for it. -
Server Actions and Route Handlers that authenticate, validate and authorize inside themselves, data modules that import
server-only, and no secrets or whole rows crossing to the client. -
Tests added/updated — React Testing Library for components, direct calls for leaf async Server Components, Server Actions and Route Handlers (always including anonymous, wrong-owner and invalid-input cases), and a Playwright spec only for a new user-visible flow in a project that already has Playwright. Not run by this skill.
-
For UI work: Playwright stories for each visual state of every added/changed Client Component, a screen spec and, for a new flow, a flow spec, all capturing the
.ui-quality.ymlmatrix via the project’ssupport/ui-screenshots.tshelper (copied from the bundledreference/ui-screenshots.tsif missing;@axe-core/playwrightis the one permitted new dev dependency). Not run by this skill. -
implementation_plan.mdwith this task’s own checkbox (and completed sub-tasks) checked and a "group validation pending" note, written before reporting. Untouched if the task stopped on a blocker. -
A report to the caller: the detected profile and which reference files were read, files touched, tests written, the expected
next buildclassification of every touched route (and whether any changed mode), for UI work the decomposition tree and the stories/specs added, blocker status, and any deliberate deviation fromreference/.
Execution flow
A conflict between reference/ and the surrounding code is deliberately not a stop condition: the skill follows the
surrounding code and reports the divergence.
Dependencies
Invokes
None — iru-nextjs-code-one-task is a leaf skill; it does not call any other skill in this catalog. It reads its own
reference/ directory and edits the code and test files the task names.
Invoked by
-
Next.js Code One Task Group — Step 2, implements each task and its tests, via the
iru-isolated-skill-executoragent.
Source
SKILL.md on GitHub — the file this page was generated from. The bundled Next.js agreements live alongside it under reference/.