build

build is a command for Claude Code from Matt-Dionis/claude-code-configs. It costs 0 tokens per session (2,407 once invoked), scanned A, original, MIT.

A command for building and preparing an MCP server for production deployment. It can target Node.js, Docker, or npm, which is the package registry and toolchain for JavaScript projects.

In plain words
What is it for?
Use `/build` when packaging an MCP server for Node.js, creating a Docker image, or preparing it for npm publication, with optional minification, source maps, or bundle analysis.
Why use it?
It runs pre-build checks, creates the selected output, and validates the result so deployment problems are found before release.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/matt-dionis/claude-code-configs/build
Clone the repo
git clone --depth 1 https://github.com/Matt-Dionis/claude-code-configs

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for build

README.md
[![agentmods](https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/build.svg)](https://agentmods.dev/commands/matt-dionis/claude-code-configs/build)
Your own site
<a href="https://agentmods.dev/commands/matt-dionis/claude-code-configs/build"><img src="https://agentmods.dev/badge/commands/matt-dionis/claude-code-configs/build.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,407 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02407
Opus 5 $0.00000 $0.01203
Sonnet 5 $0.00000 $0.00481
Haiku 4.5 $0.00000 $0.00241

Measured 4d ago against content hash 41fd9c6646d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

build scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

import { exec } from 'child_process';
configurations/mcp-servers/simple-mcp-server/.claude/commands/build.md · 377 lines

How it starts

The opening of the file, as written. The whole thing — 377 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Build MCP Server for Production

Builds and prepares your MCP server for production deployment.

Usage

/build [target] [options]

Targets

  • node - Build for Node.js (default)
  • docker - Build Docker image
  • npm - Prepare for npm publishing

Options

  • --minify - Minify output
  • --sourcemap - Include source maps
  • --analyze - Analyze bundle size

Implementation

import { exec } from 'child_process';
import { promisify } from 'util';
import * as fs from 'fs/promises';
import * as path from 'path';

const execAsync = promisify(exec);

async function buildServer(
  target: 'node' | 'docker' | 'npm' = 'node',
  options: {
    minify?: boolean;
    sourcemap?: boolean;
    analyze?: boolean;
  } = {}
) {
  console.log('🔨 Building MCP Server for Production');
  console.log('='.repeat(50));
  
  // Pre-build checks
  await runPreBuildChecks();
  
  // Build based on target
  switch (target) {
    case 'node':
      await buildForNode(options);
      break;
    case 'docker':
      await buildForDocker(options);
      break;
    case 'npm':
      await buildForNpm(options);
      break;
  }
  
  // Post-build validation
  await validateBuild(target);
  
  console.log('\n✅ Build completed successfully!');
}

async function runPreBuildChecks() {
  console.log('\n🔍 Running pre-build checks...');
  
  // Check for uncommitted changes
  try {
    const { stdout: gitStatus } = await execAsync('git status --porcelain');
    if (gitStatus.trim()) {
      console.warn('⚠️  Warning: You have uncommitted changes');
    }
  } catch {
    // Git not available or not a git repo
  }
  
  // Run tests
  console.log('  Running tests...');
  try {
    await execAsync('npm test');
    console.log('  ✅ Tests passed');
  } catch (error) {
    console.error('  ❌ Tests failed');
    throw new Error('Build aborted: tests must pass');
  }
  
  // Check dependencies
  console.log('  Checking dependencies...');
  try {
    await execAsync('npm audit --production');
    console.log('  ✅ No vulnerabilities found');
  } catch (error) {
    console.warn('  ⚠️  Security vulnerabilities detected');
    console.log('  Run "npm audit fix" to resolve');
  }
}

async function buildForNode(options: any) {
  console.log('\n📦 Building for Node.js...');
  
  // Clean previous build
  await fs.rm('dist', { recursive: true, force: true });
  
  // Update tsconfig for production
  const tsConfig = JSON.parse(await fs.readFile('tsconfig.json', 'utf-8'));
  const prodConfig = {
    ...tsConfig,
    compilerOptions: {
      ...tsConfig.compilerOptions,
      sourceMap: options.sourcemap || false,
      inlineSources: false,
      removeComments: true,
    },
  };
  
  await fs.writeFile('tsconfig.prod.json', JSON.stringify(prodConfig, null, 2));
  
  // Build with TypeScript
  console.log('  Compiling TypeScript...');
  await execAsync('npx tsc -p tsconfig.prod.json');
  
  // Minify if requested
  if (options.minify) {
    console.log('  Minifying code...');
    await minifyCode();
  }
  
  // Copy package files
  console.log('  Copying package files...');
  await fs.copyFile('package.json', 'dist/package.json');
  await fs.copyFile('README.md', 'dist/README.md').catch(() => {});
  await fs.copyFile('LICENSE', 'dist/LICENSE').catch(() => {});
  
  // Create production package.json
  const pkg = JSON.parse(await fs.readFile('package.json', 'utf-8'));
  const prodPkg = {
    ...pkg,
    scripts: {
      start: 'node index.js',
    },
    devDependencies: undefined,
  };
  await fs.writeFile('dist/package.json', JSON.stringify(prodPkg, null, 2));
  
  // Analyze bundle if requested
  if (options.analyze) {
    await analyzeBundleSize();
  }
  
  console.log('  ✅ Node.js build complete');
  console.log('  Output: ./dist');
}

async function buildForDocker(options: any) {
  console.log('\n🐋 Building Docker image...');
  
  // Build Node.js first
  await buildForNode(options);
  
  // Create Dockerfile if it doesn't exist
  const dockerfilePath = 'Dockerfile';

Read the full file on GitHub · 377 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 377 lines · 0 tokens per session scan A 41fd9c6646d7

Subscribe to this mod's changes

build is a command published in the GitHub repository Matt-Dionis/claude-code-configs (625 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,407 tokens. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.