Build fix

From JeremyDev87/codingbuddy · View interactive version

Build fix is an AI agent skill from the GitHub repository JeremyDev87/codingbuddy. Use when build fails, TypeScript errors appear, or compilation breaks. Minimal diff fixes only — no refactoring, no architecture changes.

How to use this skill

Skill file

Build Fix

Overview

Build errors block everything. Fix them fast, fix them small, fix nothing else.

Core principle: Fix ONLY what is broken. A build fix is not an opportunity to refactor, add features, or improve architecture. Touch the minimum lines required to restore a passing build.

Violating the letter of this process is violating the spirit of build fixing.

The Iron Law

MINIMAL DIFF, NO ARCHITECTURE CHANGES — FIX WHAT'S BROKEN, NOTHING MORE

If your diff touches lines unrelated to the error, you are not build-fixing. You are refactoring. Stop.

No exceptions:

When to Use

Use for ANY build/compilation failure:

Use this ESPECIALLY when:

Do NOT use when:

Error Classification

First, classify the build error:

| Class | Symptoms | Typical Minimal Fix |

|-------|----------|-------------------|

| TypeScript Error | TS2345, TS2339, TS7006, TS2532 | Add type annotation, null check, or correct type |

| Import Error | Cannot find module, has no exported member | Fix path, add missing export, correct import name |

| Dependency Error | Version mismatch, missing peer dep, lockfile conflict | Align version, install missing package |

| Config Error | tsconfig.json invalid, env var missing, wrong target | Fix config value, add missing variable |

| Syntax Error | Unexpected token, missing bracket | Fix syntax at reported location |

The Four Phases

You MUST complete each phase before proceeding to the next.

Phase 1: Read the Error

BEFORE attempting ANY fix:

  1. Read the FULL error output
  1. Classify the error (see table above)
  1. Count the errors

Phase 2: Identify Root Cause

Find the MINIMUM change needed:

  1. Check recent changes

```bash

git diff HEAD~1 # What changed?

git log --oneline -5 # Recent commits

```

  1. Trace the error to its source
  1. Identify the scope

Phase 3: Minimal Fix

Apply the SMALLEST possible change:

  1. One fix at a time
  1. Common minimal fixes

```typescript

// TypeScript: TS2345 - Type mismatch

// BAD: Rewrite the function with new types

// GOOD: Add the correct type annotation or assertion

const value = data as ExpectedType;

// TypeScript: TS2532 - Possibly undefined

// BAD: Refactor to eliminate the possibility

// GOOD: Add null check or optional chaining

const name = user?.name ?? 'default';

// Import: Cannot find module

// BAD: Restructure the module system

// GOOD: Fix the import path

import { Thing } from './correct/path';

// Dependency: Missing peer dependency

// BAD: Upgrade the entire dependency tree

// GOOD: Install the specific missing package

// $ yarn add missing-package@^required.version

```

  1. What NOT to do

Phase 4: Verify

Confirm the build passes:

  1. Run the build command

```bash

# Run the same command that failed

yarn build # or npm run build

tsc --noEmit # TypeScript check

```

  1. Run tests to ensure no regressions

```bash

yarn test # or npm test

```

  1. Check the diff

```bash

git diff

```

  1. If build still fails

Red Flags — STOP and Return to Phase 1

If you catch yourself thinking:

| Thought | Reality |

|---------|---------|

| "While I'm fixing this, I'll also..." | Build fix. Nothing else. |

| "This function should really be..." | File an issue. Fix the build. |

| "The types are all wrong, let me redesign..." | Fix the ONE type error. Not all types. |

| "I need to add a new abstraction..." | No new abstractions in a build fix. |

| "Let me upgrade this dependency to latest..." | Only change the version if it fixes the error. |

| "This code is messy, let me clean up..." | Messy code that compiles > clean code in a broken build. |

| "The architecture caused this, so I should..." | Architecture changes are not build fixes. |

ALL of these mean: STOP. You are no longer build-fixing.

Common Rationalizations

| Excuse | Reality |

|--------|---------|

| "The refactor prevents future build errors" | Future prevention is a separate task. Fix now. |

| "It's just a small improvement" | Small improvements compound into large diffs. |

| "The code is already open in my editor" | Being convenient doesn't make it a build fix. |

| "No one will review a 1-line PR" | 1-line PRs are the BEST PRs. Ship it. |

| "I need to understand the whole module" | You need to understand the error. Not the module. |

| "The dependency is outdated anyway" | Outdated but compiling > updated and broken. |

Scope Guard

Before committing, verify your changes pass the scope guard:

For EACH changed line, ask:
  "Would the build fail without this specific change?"

  YES → Keep it
  NO  → Revert it

If any changed line fails the scope guard, you have scope creep. Remove it.

Quick Reference

| Phase | Key Activity | Success Criteria |

|-------|-------------|------------------|

| 1. Read | Read full error, classify, count | Know WHAT is broken |

| 2. Identify | Check changes, trace source | Know WHERE and WHY |

| 3. Fix | Smallest possible change | Minimal diff applied |

| 4. Verify | Build passes, tests pass, diff is clean | Build green, no extras |

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.