Skip to main content
skill CX Codex GP ChatGPT official · OpenAI

ncc — Codex skill: what it does, how to install

This skill guides Codex through @vercel/ncc, which bundles Node.js code and dependencies into one file. Use it for serverless handlers, CLIs, or Docker builds.

Install into Codex · Skills CLI (Vercel) All methods and platforms ↓
npx skills add openai/plugins --skill ncc -a codex
Open on GitHub

What ncc does

The skill explains how to compile a JavaScript or TypeScript entry file into dist/ with ncc build, enable watch mode, minify output, and create source maps. It also covers ncc run, external modules, and copying non-JavaScript assets beside the generated file.

Its guidance includes package.json scripts, automatic use of the project’s tsconfig.json, and packaging patterns for serverless functions, CLI tools, and GitHub Actions. TypeScript can be compiled directly without a separate tsc command.

Native binary modules often need to stay outside the bundle, so configure them with -e or --external. Install @vercel/ncc globally or as a development dependency before using the commands.

What it helps with

  • bundle a Node.js app into one file
  • package a serverless handler without node_modules
  • compile TypeScript from the project configuration
  • keep aws-sdk or sharp outside the bundle
  • prepare a GitHub Action with license output

Example prompts for the agent

  • Show me how to build src/index.ts into dist/ with minification.
  • Configure an ncc build for api/handler.ts and keep aws-sdk external.
  • Add ncc build and watch scripts to package.json.

How to install ncc

1Skills CLI (Vercel)

npx skills add openai/plugins --skill ncc -a codex

2Manually: put the files in place

.agents/skills/ncc/SKILL.md

For all projects use ~/.agents/skills/

Step by step, with commands for each platform: Codex skills: how to install, where they live, how to call them

Questions about ncc

How do I install ncc in Codex?

Run npx skills add openai/plugins --skill ncc, then npx skills add openai/plugins --skill ncc -a codex. The skill file is placed at .agents/skills/ncc/SKILL.md.

What does the ncc skill do?

It helps Codex apply @vercel/ncc to bundle Node.js modules and their dependencies into one file, including workflows for serverless code, CLIs, and GitHub Actions.

How should native modules be handled?

Keep them external with -e or --external. Binary .node modules often require that setup.

Source text

SKILL.md · Apache-2.0
---
name: ncc
description: 'Expert guidance for @vercel/ncc — a simple CLI for compiling Node.js modules into a single file with all dependencies included. Use when bundling serverless functions, CLI tools, or any Node.js project into a self-contained file.'
metadata:
  priority: 4
  docs:
    - "https://github.com/vercel/ncc"
  pathPatterns: []
  importPatterns:
    - '@vercel/ncc'
  bashPatterns:
    - '\bnpm\s+(install|i|add)\s+[^\n]*@vercel/ncc\b'
    - '\bpnpm\s+(install|i|add)\s+[^\n]*@vercel/ncc\b'
    - '\bbun\s+(install|i|add)\s+[^\n]*@vercel/ncc\b'
    - '\byarn\s+add\s+[^\n]*@vercel/ncc\b'
    - '\bncc\s+build\b'
---

# @vercel/ncc — Node.js Compiler Collection

You are an expert in `@vercel/ncc`, Vercel's simple CLI for compiling a Node.js module into a single file, together with all its dependencies.

## Overview

ncc bundles a Node.js application and all of its `node_modules` into a single output file. This is ideal for:
- **Serverless functions** — deploy a single file instead of `node_modules`
- **CLI tools** — distribute a self-contained executable
- **Docker images** — reduce image size by eliminating `node_modules`

## Installation

```bash
npm install -g @vercel/ncc

# Or as a dev dependency
npm install --save-dev @vercel/ncc
```

## Basic Usage

```bash
# Compile index.js into dist/index.js
ncc build input.js -o dist/

# Watch mode for development
ncc build input.js -o dist/ -w

# Run directly without writing to disk
ncc run input.js
```

## CLI Options

| Flag | Description |
|---|---|
| `-o, --out [dir]` | Output directory (default: `dist`) |
| `-m, --minify` | Minify the output |
| `-s, --source-map` | Generate source maps |
| `-a, --asset-builds` | Build nested JS assets recursively |
| `-e, --external [mod]` | Keep module as external (don't bundle) |
| `-w, --watch` | Watch mode — rebuild on changes |
| `-t, --transpile-only` | Skip TypeScript type checking |
| `--license [file]` | Output licenses to a file |
| `-q, --quiet` | Suppress non-error output |
| `--no-cache` | Skip the build cache |
| `--no-asset-builds` | Skip nested JS asset builds |

## package.json Integration

```json
{
  "scripts": {
    "build": "ncc build src/index.ts -o dist/ -m",
    "build:watch": "ncc build src/index.ts -o dist/ -w",
    "start": "node dist/index.js"
  },
  "devDependencies": {
    "@vercel/ncc": "^0.38.0"
  }
}
```

## TypeScript Support

ncc natively supports TypeScript — no separate `tsc` step needed:

```bash
# Compiles TypeScript directly
ncc build src/index.ts -o dist/

# Skip type checking for faster builds
ncc build src/index.ts -o dist/ -t
```

ncc uses the project's `tsconfig.json` automatically.

## Externals

Keep specific modules out of the bundle (useful for native modules or optional dependencies):

```bash
# Single external
ncc build input.js -e aws-sdk

# Multiple externals
ncc build input.js -e aws-sdk -e sharp
```

For serverless environments where the runtime provides certain modules (like AWS Lambda's `aws-sdk`), mark them as external.

## Static Assets

ncc handles non-JS assets (`.json`, `.node`, binary files) by copying them to the output directory alongside the compiled JS file. They are referenced correctly at runtime.

## Common Patterns

### Serverless Function Bundling

```bash
# Build a minimal serverless handler
ncc build api/handler.ts -o .output/ -m --no-cache
```

### CLI Tool Distribution

```json
{
  "bin": "dist/index.js",
  "scripts": {
    "prepublishOnly": "ncc build src/index.ts -o dist/ -m"
  }
}
```

### GitHub Actions

```bash
# Bundle a GitHub Action into a single file
ncc build src/index.ts -o dist/ -m --license licenses.txt
```

GitHub Actions require all dependencies bundled — ncc is the recommended bundler for custom JS/TS actions.

## Key Points

1. **Single-file output** — all dependencies inlined, no `node_modules` needed at runtime
2. **TypeScript native** — compiles `.ts` files directly using the project's `tsconfig.json`
3. **No config file** — entirely driven by CLI flags
4. **Asset handling** — non-JS files are automatically copied to the output directory
5. **Use externals for native modules** — binary `.node` modules often need to be external
6. **Source maps for debugging** — use `-s` flag to generate `.js.map` files
7. **Watch mode for dev** — use `-w` for fast iteration during development

## Official Resources

- [ncc GitHub](https://github.com/vercel/ncc)
- [Vercel Blog — ncc Introduction](https://github.com/vercel/ncc)

© Vercel Labs · Apache-2.0 · openai/plugins

Similar skills

All skills for Cloud: AWS, Azure, GCP →

From the same set420

The whole set →
vercel-flags Provides guidance for Vercel Flags and the flags v4 SDK. Useful for implementing staged rollouts, A/B experiments, and the Flags Explorer in Next.js or SvelteKit. CX Codex GP ChatGPT 4installs vercel-agent This skill explains Vercel Agent's PR reviews, incident investigations, and SDK setup. Use it when configuring or evaluating Vercel's development tools. CX Codex GP ChatGPT 4installs sign-in-with-vercel Walks your agent through adding user login with a Vercel account over OAuth 2.0 and OpenID Connect. Useful when you hand passwords and sessions to an identity provider. CX Codex GP ChatGPT 4installs next-cache-components Guides AI agents through Next.js 16 Cache Components, the use cache directive, and Partial Prerendering setup. CX Codex GP ChatGPT 4installs json-render Guides rendering of AI SDK v6 UIMessage parts, tool call results, and streaming states in custom React chat interfaces. CX Codex GP ChatGPT 4installs bootstrap Orchestrates setup for repositories linked to Vercel, provisioning Neon databases, setting secrets, and verifying environment keys before running dev commands. CX Codex GP ChatGPT 4installs sentry This skill queries Sentry in read-only mode to inspect issues, events, and basic health data. Use it when checking recent production errors. CX Codex GP ChatGPT 4installs user-context Manages local user context, preferences, and onboarding state for the Public Equity Investing plugin. Runs strictly on explicit user request. CX Codex GP ChatGPT 4installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor