Repo-local Codex workflow installer for existing Next.js repositories.
New here: start with USER_JOURNEY.md for the end-to-end flow.
v0.1 is implemented from
nextjs-codex-workflow-kit-implementation-spec-v0.1.md.
0.1.0Initial repo-local Codex workflow installer for existing Next.js repositories.0.1.1Stabilized the generated multi-agent workflow, bundled execution/testing quality skills, and hardened the verification/update path.0.1.2Added theexplorerplanning step,single-agentvsmulti-agentworkflow selection, the interactive installer, optional stage-prefixed auto-commit behavior, explicit subagent cleanup instructions, and stricter automated test policy generation.0.1.3(in preparation) Preparing the next release line in README first so release-facing changes are tracked in one place before the package version is bumped and published.
next-codex-workflow prepares an existing Next.js repository so Codex can use
a structured implementation workflow inside that repository.
During init, it:
- validates that the target repository is a supported Next.js project
- detects router style, package manager, scripts, and TypeScript usage
- generates a short
AGENTS.mdwith repo-specific workflow rules - generates project-scoped Codex config and custom agents for planning, execution/refactors, testing, verification, and review
- generates repo-local skills for clarification, exploration, planning, decision logging, verification, and review
- generates short
$skill-nameworkflow shortcuts so users do not need to keep retyping long Codex prompts - supports both
multi-agentandsingle-agentworkflow modes - can optionally create stage-prefixed git commits after completed workflow steps
- vendors approved external skills into the repository from bundled snapshots shipped with this package
- creates workflow artifact files as starter templates immediately during init
- writes an install-state manifest so future updates can refresh the workflow without re-entering the original setup flags
- creates a deterministic verification script
- optionally adds Lighthouse-based performance audit support
init currently expects:
- an existing
package.json nextdeclared in dependencies or devDependencies- at least one of
app/,src/app/,pages/, orsrc/pages/
npx next-codex-workflow initWhen run in a normal terminal without --yes, init now guides the user
through workflow mode, skill preset, optional performance setup, and optional
automatic workflow commits.
After upgrading the package in a repo that already uses this workflow:
npx next-codex-workflow updateExample:
npx next-codex-workflow init --performance --external-skill-set fullExample with explicit workflow mode:
npx next-codex-workflow init --workflow-mode single-agentCodex supports explicit skill invocation by mentioning a skill with $.
If the user prefers a picker UI, they can also open /skills and choose one of
the generated workflow skills there.
This package generates a few command-like shortcut skills so users can trigger
the workflow with short prompts instead of rewriting the same instructions.
Examples after init in the target repository:
$plan-feature add saved search filters to the dashboard
$build-feature implement the approved dashboard filters plan
$verify-feature
$review-feature
These are thin workflow entrypoints built on top of the generated planning, execution, testing, verification, and review agents plus the installed repo-local skills.
One of the main strengths of this package is that it prepares the repository for orchestrated multi-agent work.
In practice, the main Codex session acts as the orchestrator:
- it keeps the feature request and repo-level goal in view
- it reads the workflow artifacts
- it delegates focused jobs to subagents when helpful
- it collects their results and returns one coherent outcome
The generated custom agents support that workflow:
explorerfor read-only repository inspection before planningplannerfor planning artifactsexecutorfor implementation and refactor worktesterfor required automated coverage, test updates, and test-focused checksverifierfor deterministic checksreviewerfor final review
All six agents are expected to consult the relevant vendored quality skills in
.agents/skills/. Planning and execution especially use those skills to shape
architecture, file boundaries, implementation details, UI quality, and test
impact. The tester and verifier agents also inspect the generated
repo-test-policy skill so routing and browser behavior changes trigger
Playwright coverage, while pure logic and service changes trigger Vitest-style
coverage. The tester agent uses bundled vitest,
playwright-best-practices, and playwright-cli guidance where relevant.
This is especially useful for larger changes where exploration, implementation, verification, and review benefit from being split into focused jobs. It is a quality and parallelism benefit, not a token-saving mode by itself.
-
--yesAccept defaults automatically and skip the interactive installer prompts. This is the non-interactive path for scripts, CI, or quick setup. The default path usesmulti-agentworkflow mode and therecommendedexternal skill preset. -
--performanceEnables performance-mode generation. This adds the performance audit skill,agent-workflow/artifacts/PERF.md,scripts/run-lighthouse.mjs,agent-workflow/config/lighthouserc.cjs, andagent-workflow/config/budgets.json. -
--auto-commitEnables stage-prefixed workflow commits after completed shortcut steps. Generated prompts only attempt this when the git tree is scoped to the current workflow step.Prefixes:
plan:build:verify:review:
If unrelated pre-existing changes are present, the generated workflow should skip the commit and report why instead of creating a mixed commit.
-
--routes <comma-separated-routes>Sets the routes used by the generated Lighthouse performance workflow. This is only meaningful together with--performance.Example:
npx next-codex-workflow init --performance --routes /,/dashboard,/settings
-
--external-skill-set <minimal|recommended|full>Controls how many bundled external skills are copied into the target repository.minimalCore external skills only. This includes the default testing quality skills.recommendedCore skills plus the supported design/component/composition skills.fullEverything fromrecommended, plus optional eligible skills such asnext-cache-componentsfor qualifying repositories. -
--workflow-mode <single-agent|multi-agent>Chooses whether the generated workflow shortcuts keep work in one session or route it through specialist spawned agents.multi-agentUsesexplorer,planner,executor,tester,verifier, andreviewerthrough the generated shortcut skills, and the generated prompts tell Codex to close each spawned agent after its result is integrated.single-agentKeeps the same workflow artifacts and quality-skill guidance, but performs planning, implementation, testing, verification, and review in the current session instead of spawning specialist agents. -
--overwrite-managedAllowsinitto replace files that were previously generated by this tool. It still stops on user-owned files that already exist at those paths. -
--dry-runPrints the planned changes and validation results without writing any files.
Use update after upgrading the package to refresh files that were previously
generated by this tool:
npx next-codex-workflow updateIf the package is installed as a dev dependency, the same flow is:
pnpm up next-codex-workflow@latest
pnpm next-codex-workflow updateupdate:
- reuses the saved install-state manifest from the previous install
- preserves the saved workflow auto-commit setting from the previous install
- refreshes files previously managed by this tool
- still stops on user-owned unmanaged files
- can fall back to inferring the prior install shape for older repositories that do not yet have the install-state manifest
- supports
--dry-runfor previewing the refresh
Current bundled presets:
minimalnext-best-practices,vercel-react-best-practices,vitest,playwright-best-practicesrecommendedeverything inminimal, plusbuilding-components,web-design-guidelines,vercel-composition-patterns, andplaywright-clifulleverything inrecommended, plus eligible optional skills such asnext-cache-components
The files below are generated into the target Next.js repository when you run
npx next-codex-workflow init. They do not exist in this package repository by
default because this repository is the installer itself.
AGENTS.md.codex/config.toml.codex/agents/explorer.toml.codex/agents/planner.toml.codex/agents/executor.toml.codex/agents/tester.toml.codex/agents/verifier.toml.codex/agents/reviewer.toml.agents/skills/*agent-workflow/artifacts/PLAN.mdagent-workflow/artifacts/FILE_SPECS.mdagent-workflow/artifacts/DECISION.mdagent-workflow/artifacts/VERIFY.mdagent-workflow/artifacts/REVIEW.mdagent-workflow/artifacts/PERF.mdwhen--performanceis enabledagent-workflow/manifest/install-state.jsonscripts/verify-agent-workflow.mjsscripts/run-lighthouse.mjswhen--performanceis enabled
These artifact files are created during init as starter templates, then
updated later as Codex works through a feature:
PLAN.mdImplementation plan for non-trivial work.FILE_SPECS.mdFile-by-file responsibilities, boundaries, and expectations.DECISION.mdAppend-only log of explicit user choices between viable options.VERIFY.mdHuman-readable verification record after deterministic checks run.REVIEW.mdStructured post-implementation review output.PERF.mdPerformance audit notes when performance mode is enabled.
- It does not implement application features for you during installation.
- It does not fetch skills from the network during init. Bundled external skills are copied from vendored snapshots included in this package.
- It does not wait for a later user request to create the workflow artifact files; the artifact files are created immediately as templates during init.
npm install
npm run typecheck
npm run build
npm run test