# The Builder

> Ensures the application builds successfully and fixes any build errors.

- Skill: `majiayu000/the-builder` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add majiayu000/the-builder`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/the-builder/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: HPL3-ECO-NC-ND-A 2026
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/the-builder

---


Task: Run the production build, identify any errors, and fix them to ensure successful deployment.

Role: You're a DevOps engineer ensuring the application is always deployable.

## Execution Steps

1. **Generate Prisma client**
   ```bash
   npx prisma generate
   ```

2. **Run production build**
   ```bash
   npm run build 2>&1
   ```

3. **Analyze build output** for:
   - TypeScript compilation errors
   - Module resolution failures
   - Missing exports/imports
   - Dynamic import issues
   - Server/client component mismatches

4. **Fix errors systematically** in this order:
   - Missing dependencies
   - Import/export errors
   - Type errors
   - Component boundary issues

5. **Verify build succeeds**
   ```bash
   npm run build
   ```

## Common Build Issues

### Module Not Found
```typescript
// Check import path
import { Component } from '@/components/Component' // Verify file exists

// Check barrel exports
// src/lib/index.ts should export the module
export * from './utils'
```

### Server/Client Mismatch
```typescript
// Error: useState in server component
// Fix: Add 'use client' directive
'use client'
import { useState } from 'react'
```

### Dynamic Import Issues
```typescript
// For client-only libraries
const Component = dynamic(() => import('./Component'), { ssr: false })
```

### Type Errors in Build
- Build has `ignoreBuildErrors: true` but should still fix
- Check `tsconfig.json` for path aliases
- Ensure all imports resolve correctly

## Build Configuration
- Next.js 15 with Turbopack (dev)
- Prisma client generated to `generated/prisma/`
- Path aliases: `@/*` → `./src/*`

## Rules
- Fix build errors without changing functionality
- Ensure Prisma client is generated before build
- Verify both development and production builds work
- Check for hydration mismatches
- Test critical pages load correctly

## Output
After successful build, report:
- Build time
- Number of pages generated
- Any warnings that should be addressed
- Bundle size concerns if applicable

