CLI workflow

Deploy Next.js with the Best CLI for AI Agents

Build locally, create a preview deployment, verify the result, and keep production promotion behind an explicit approval.

Deployment and cloudRemote write

Prepare tools, authentication, and evidence first

Install the recommended tools, confirm minimum permissions, and keep compatibility separate from real execution records.

verceldocs-verified
Create, inspect, and promote Vercel deployments without relying on the dashboard.

Recommended install

$ shell
npm install --global vercel
Authentication
browser login, access token
Tested agents
No agent-specific execution record
Evidence status
docs-verified · Documentation checked 2026-07-10
Independent CLI execution
No independently executed version recorded
wranglerverified
Develop, deploy, and inspect Cloudflare Workers and related resources.

Recommended install

$ shell
npm install --save-dev wrangler
Authentication
OAuth, API token
Tested agents
No agent-specific execution record
Evidence status
verified · Documentation checked 2026-07-10
Independent CLI execution
4.87.0 · 2 checks
ghverified
Review pull requests, triage issues, inspect Actions, and manage releases with GitHub's official CLI.

Recommended install

$ shell
brew install gh
Authentication
OAuth, personal access token, GitHub Actions token
Tested agents
No agent-specific execution record
Evidence status
verified · Documentation checked 2026-07-10
Independent CLI execution
2.86.0 · 2 checks
jqverified
Parse, filter, validate, and transform JSON locally with deterministic output.

Recommended install

$ shell
brew install jq
Authentication
No authentication for the base operation
Tested agents
No agent-specific execution record
Evidence status
verified · Documentation checked 2026-07-10
Independent CLI execution
jq-1.7.1-apple · 4 checks

Copy or download this workflow Skill

The Skill includes input and output contracts, recommended tools, approval points, rollback, and evidence boundaries. Review it against the active environment before saving.

deploy-nextjs-SKILL.md
---
name: deploy-nextjs-workflow
description: "Build locally, create a preview deployment, verify the result, and keep production promotion behind an explicit approval."
---

# Deploy a Next.js application

## Intended outcome

Produce a working preview and a release-ready report without silently changing production.

## Evidence boundary

- Tool status distinguishes `docs-verified` material from independent execution; the two are not interchangeable.
- The current registry does not attribute a tool execution to a particular agent, so compatible agents cannot be called tested agents.
- Reconfirm the target account, environment, version, and official documentation before execution.
- Never auto-execute an R2, R3, or confirmation-marked step; obtain explicit approval immediately before it runs.

## Recommended tools, installation, and authentication

- **Vercel CLI** (evidence: `docs-verified`, docs checked: `2026-07-10`, no independently executed version recorded)
  - Install: `npm install --global vercel`
  - Authentication: browser login, access token
  - Minimum permissions: Use a token scoped to the target team and project; keep production promotion separate.
- **Cloudflare Wrangler** (evidence: `verified`, docs checked: `2026-07-10`, independently tested version 4.87.0 recorded)
  - Install: `npm install --save-dev wrangler`
  - Authentication: OAuth, API token
  - Minimum permissions: Use an API token limited to the required account, zone, and Worker resources.
- **GitHub CLI** (evidence: `verified`, docs checked: `2026-07-10`, independently tested version 2.86.0 recorded)
  - Install: `brew install gh`
  - Authentication: OAuth, personal access token, GitHub Actions token
  - Minimum permissions: Use a read-only or fine-grained token limited to the required repositories.
- **jq** (evidence: `verified`, docs checked: `2026-07-10`, independently tested version jq-1.7.1-apple recorded)
  - Install: `brew install jq`
  - Authentication: not required for the base operation
  - Minimum permissions: No service credential is required; restrict filesystem and network access to the task.

## Input contract

- Repository path
- package scripts
- deployment target
- scoped deployment credentials

## Output contract

- Build result
- preview URL
- verification notes
- production command awaiting approval

## Safe workflow

1. **Inspect the project** — Read package scripts, framework configuration, and current Git state before choosing a deployment target.
   - Input: Repository files and Git metadata
   - Output: Build command and deployment plan
   - Risk: `read-only`
   - Command: `jq '.scripts' package.json && git status --short`
2. **Build and create a preview** — Run the project build, then use the provider CLI to create a non-production preview.
   - Input: Build command and preview credentials
   - Output: Preview deployment URL and CLI logs
   - Risk: `remote-write`
   - Command: `pnpm build && vercel deploy`
3. **Verify before promotion** — Open the preview, exercise critical routes, and report any warnings before proposing production promotion.
   - Input: Preview URL and acceptance checks
   - Output: Pass/fail report and proposed production command
   - Risk: `read-only`

## Ask before proceeding

- Creating a preview in a shared account
- Running a production deployment
- Changing domains, secrets, or environment variables

## Rollback

- Keep the previous production deployment available
- Promote the last known-good deployment through the provider
- Revert the release commit if the application itself is faulty

## Official sources

- [Vercel CLI documentation](https://vercel.com/docs/cli) — Official CLI documentation for project linking, builds, deployments, and logs.
- [Cloudflare Wrangler documentation](https://developers.cloudflare.com/workers/wrangler/) — Official Wrangler command and configuration documentation for Workers.
- [GitHub CLI manual](https://cli.github.com/manual/) — Official command, authentication, JSON field, and workflow documentation.

Outcome, inputs, and outputs

Define the result and evidence before the agent selects a command.

Goal

Produce a working preview and a release-ready report without silently changing production.

Required inputs

  • Repository path
  • package scripts
  • deployment target
  • scoped deployment credentials

Expected outputs

  • Build result
  • preview URL
  • verification notes
  • production command awaiting approval

Deploy Next.js with the Best CLI for AI Agents: safe workflow

Run each step inside its stated boundary and verify the output before continuing.

Step 1Read only

Inspect the project

Read package scripts, framework configuration, and current Git state before choosing a deployment target.
Input
Repository files and Git metadata
Output
Build command and deployment plan
$ Inspect the project
jq '.scripts' package.json && git status --short
Step 2Remote write

Build and create a preview

Run the project build, then use the provider CLI to create a non-production preview.
Input
Build command and preview credentials
Output
Preview deployment URL and CLI logs
$ Build and create a preview
pnpm build && vercel deploy
Step 3Read only

Verify before promotion

Open the preview, exercise critical routes, and report any warnings before proposing production promotion.
Input
Preview URL and acceptance checks
Output
Pass/fail report and proposed production command

Approval points and rollback

Pause at the listed decision points and keep recovery instructions beside the action.

Ask before these actions

  • Creating a preview in a shared account
  • Running a production deployment
  • Changing domains, secrets, or environment variables

Recovery plan

  • Keep the previous production deployment available
  • Promote the last known-good deployment through the provider
  • Revert the release commit if the application itself is faulty

CLI, MCP, or API?

Choose the interface by execution location, identity, output contract, and permission boundary.

CLI

Best for local builds, CI, preview creation, and reproducible deployment logs.

MCP

Useful when a managed integration exposes deployments with narrowly scoped, typed actions.

API

Use for a custom release service that must create and monitor deployments programmatically.

Recommended approach

Use the provider CLI for preview work and require a human decision before production promotion.

Official evidence and references

Use these primary or upstream sources to verify current command behavior before acting.

Vercel CLI documentation

Official CLI documentation for project linking, builds, deployments, and logs.

Cloudflare Wrangler documentation

Official Wrangler command and configuration documentation for Workers.

GitHub CLI manual

Official command, authentication, JSON field, and workflow documentation.

Questions before you run it

Can an agent deploy directly to production?

Only after it shows the exact command, target, preview evidence, and rollback option and receives explicit approval.

Should the agent use Vercel CLI or Wrangler?

Use the CLI for the platform that actually hosts the application; confirm framework compatibility from that platform’s current documentation.

Related tools and guides

Browse sibling guides and choose the next page that best matches the active task.

Continue with tool evidence, a workflow, or a decision guide related to this task.

Continue with tool evidence, a workflow, or a decision guide related to this task.

Continue with tool evidence, a workflow, or a decision guide related to this task.

Inspect installation, authentication, structured output, command risk, and official evidence.

Inspect installation, authentication, structured output, command risk, and official evidence.