Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Remove a workaround once its root cause is gone
When the underlying problem that motivated a workaround is fixed, revert the workaround to the canonical form instead of leaving stale, duplicated config behind.
Bad example
| 1 | # Workaround added because pnpm v11 ran extra startup checks on every container start |
| 2 | CMD ["sh", "-c", "node scripts/set-base-url.js && node server.js"] |
| 3 |
|
| 4 | # Later in the same PR, pnpm was downgraded to v10 (root cause removed), |
| 5 | # but the bespoke CMD workaround was left in place anyway, |
| 6 | # duplicating logic that the standard script already covers. |
Explanation (EN)
The custom CMD only existed to dodge pnpm v11 behavior. Once pnpm was downgraded the special case is dead weight: it duplicates what the canonical start script does and diverges from how every other service starts, so the next maintainer has to reverse-engineer why it's different.
Objašnjenje (HR)
Prilagodjeni CMD postojao je samo da zaobidje ponasanje pnpm v11. Cim je pnpm vracen na nizu verziju, taj specijalni slucaj je mrtav teret: duplicira ono sto radi kanonicka start skripta i odstupa od nacina na koji se pokrecu svi ostali servisi, pa sljedeci odrzavatelj mora rekonstruirati zasto je drukcije.
Good example
| 1 | # pnpm downgraded to v10 -> the reason for the workaround is gone, |
| 2 | # so revert to the simple, canonical command everyone else uses: |
| 3 | CMD ["pnpm", "run", "deploy"] |
Explanation (EN)
Once the root cause is removed, the code returns to its standard, shared form. There's a single source of truth for how the app starts, no duplicated boot logic, and nothing for a future reader to puzzle over.
Objašnjenje (HR)
Cim je uklonjen temeljni uzrok, kod se vraca na standardni, zajednicki oblik. Postoji jedan izvor istine o tome kako se aplikacija pokrece, nema dupliranog koda za pokretanje i nicega sto bi buduci citatelj morao odgonetavati.
Notes (EN)
A quick way to catch these: after fixing a root cause, grep the diff/PR for any temporary code or comments that referenced the old problem.
Bilješke (HR)
Brz nacin da ih uhvatite: nakon ispravka temeljnog uzroka, pretrazite diff/PR za privremeni kod ili komentare koji su se odnosili na stari problem.
Exceptions / Tradeoffs (EN)
Keep the workaround only if it independently improves things (clearer, faster, safer) even after the root cause is gone, and document why it now stays.
Iznimke / Tradeoffi (HR)
Zadrzite zaobilazno rjesenje samo ako ono i samo po sebi donosi poboljsanje (jasnije, brze, sigurnije) i nakon sto je uzrok uklonjen, te dokumentirajte zasto sada ostaje.