ts-build

A command for building TypeScript projects, including checking the code's types before running the configured build tool. TypeScript is JavaScript with optional checks that catch many mistakes before the program runs.

In plain words
What is it for?
Use it to validate the project configuration and dependencies, run a type check, build with tools such as Vite or webpack when configured, and optionally watch for changes.
Why use it?
It catches type errors early and reports them in groups such as file, error code, and severity, making build failures easier to investigate.

Command

Part of the typescript-pro plugin — 5 skills, 10 commands, 8 agents shipped together

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/andronics/claude-plugin-typescript-pro/ts-build
Clone the repo
git clone --depth 1 https://github.com/andronics/claude-plugin-typescript-pro

Or install typescript-pro, the plugin that ships this one along with the rest of its 5 skills, 10 commands, 8 agents.

Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,174 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00012 $0.01174
Opus 5 $0.00006 $0.00587
Sonnet 5 $0.00002 $0.00235
Haiku 4.5 $0.00001 $0.00117

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

Security

Grade A, and why

ts-build scanned grade A with 0 findings 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 2d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/ts-build.md · 170 lines

How it starts

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

Build TypeScript project with intelligent error handling and analysis:

  1. Detect Build Configuration

    • Check for build tool:
      • tsconfig.json → tsc
      • vite.config.ts → Vite
      • webpack.config.ts → webpack
      • tsup.config.ts → tsup
      • rollup.config.ts → Rollup
    • Determine build mode: development or production
    • Check for watch mode flag: $ARGUMENTS includes "--watch"
  2. Pre-Build Validation

    • Verify TypeScript is installed
    • Check tsconfig.json is valid
    • Ensure dependencies are installed (node_modules exists)
    • Clean previous build artifacts if needed
  3. Type-Check First

    • Run tsc --noEmit to check types without emitting
    • This is fast and catches type errors early
    • If type errors found, categorize them by:
      • File (group errors by file)
      • Error code (TS2322, TS2339, etc.)
      • Severity (error vs warning)
  4. Build Project

    Execute appropriate build command:

    • tsc: npx tsc -p tsconfig.json
    • Vite: npx vite build
    • webpack: npx webpack --mode production
    • tsup: npx tsup
    • Custom: Use npm script from package.json

    Monitor build progress and capture output.

  5. Handle Build Errors

    Type Errors:

    • Parse TypeScript error messages
    • Group similar errors together
    • For each unique error:
      • Show file and line number
      • Display code snippet with context
      • Explain error in plain English
      • Suggest specific fixes with code examples
      • Offer to apply automated fixes where possible

    Build Tool Errors:

    • Module resolution failures
    • Missing dependencies
    • Configuration issues
    • Asset loading problems

    Runtime Errors:

    • Import/export mismatches
    • Circular dependencies
    • Missing type declarations
  6. Error Analysis & Suggestions

    Common Error Patterns:

    TS2322: Type Assignment Error

    // Error: Type 'string | undefined' is not assignable to type 'string'
    const name: string = user.name; // user.name is string | undefined
    
    // Fixes:
    // 1. Handle undefined:
    const name: string = user.name ?? 'Unknown';
    
    // 2. Use optional type:
    const name: string | undefined = user.name;
    
    // 3. Type guard:
    if (user.name) {
      const name: string = user.name;
    }
    

    TS2339: Property Does Not Exist

    // Error: Property 'foo' does not exist on type 'User'
    
    // Fixes:
    // 1. Add property to interface
    // 2. Use optional chaining: user.foo?.bar
    // 3. Type assertion with explanation (last resort)
    

    TS7006: Implicit Any Parameter

    // Error: Parameter 'x' implicitly has an 'any' type
    function add(x, y) { return x + y; }
    
    // Fix: Add explicit types
    function add(x: number, y: number): number { return x + y; }
    
  7. Build Success Analysis

    If build succeeds:

    • Show build time
    • Display output file sizes
    • Check for large bundles (warn if > 500KB)
    • Show tree-shaking effectiveness (if applicable)
    • List generated files and their locations
    • Verify source maps were generated
  8. Performance Metrics

    Track and report:

    • Type-checking time
    • Build/bundling time
    • Total time
    • Output bundle sizes
    • Number of modules processed

    Compare with previous builds if possible.

  9. Post-Build Actions

    • Run automated tests if build successful
    • Generate type declaration files (.d.ts)
    • Update documentation if needed
    • Suggest next steps (deploy, test, etc.)
  10. Watch Mode

    If --watch flag provided:

    • Start incremental build in watch mode
    • Monitor file changes
    • Rebuild only changed files
    • Show real-time type errors
    • Track build performance over time
  11. Build Optimization Suggestions

    If build is slow or bundle is large:

    • Suggest enabling skipLibCheck
    • Recommend project references for monorepos
    • Suggest code splitting strategies
    • Identify large dependencies
    • Recommend tree-shaking improvements
    • Suggest moving to faster build tool (esbuild, swc)

Read the full file on GitHub · 170 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. 2d ago First seen · 170 lines · 12 tokens per session scan A 33f733734c72

Subscribe to this mod's changes

ts-build is a command published in the GitHub repository andronics/claude-plugin-typescript-pro (4 stars, last pushed 10mo ago), licensed MIT. It adds 12 tokens to every session and 1,174 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.