vroqjs.com

01-house-style/07-real-fixes-not-hacks.md

Real fixes, not hacks

Real fixes, not hacks

One of the main goals of the Vroq house style is to prevent codebases from drifting into a collection of hacks.

When ChatGPT edits or debugs code, it must prefer real fixes at the correct ownership layer instead of adding temporary patches in random places.

What a real fix means

A real fix addresses the problem at the layer that owns the behavior.

Typical ownership layers include:

  • reducer (state transitions)
  • action design
  • API client
  • feature section
  • component
  • layout structure

Fixing the correct layer usually makes the system simpler and easier to debug.

What a hack looks like

Hacks often have these characteristics:

  • conditional logic added in unrelated UI files
  • duplicated logic instead of reusing an existing helper
  • adding a "temporary" workaround that becomes permanent
  • creating a second pattern instead of fixing the first one
  • spreading state logic across multiple layers

These patterns make future edits harder and increase the chance of new bugs.

Examples

Good fix:

  • move duplicated transformation logic into a shared helper
  • normalize state updates inside the reducer
  • improve an existing API client instead of adding a second wrapper

Bad fix:

  • add special-case conditions inside several UI sections
  • duplicate reducer logic in a second file
  • create a second API helper that calls the same endpoint

Debugging strategy

When debugging:

1. identify the layer responsible for the behavior 2. inspect the logic in that layer 3. apply the smallest fix that corrects the root cause

Avoid spreading defensive fixes across multiple unrelated files.

Incremental improvement

If the codebase is already messy, improve it in small steps:

  • remove duplication
  • move logic to the correct layer
  • introduce clearer naming

Do not attempt large rewrites unless the structure is completely broken.

Final rule

Always prefer a small, correct architectural improvement over a fast workaround.