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).
Enforce test discipline for critical paths
Identify critical flows and require explicit unit/integration/e2e coverage in CI so regressions are caught quickly.
Bad example
| 1 | // Critical billing logic without tests |
| 2 | export function calculateInvoice(items: Item[]) { |
| 3 | return items.reduce((sum, item) => sum + item.price, 0); |
| 4 | } |
Explanation (EN)
Critical behavior is untested, so regressions can ship silently. Teams learn about failures from production incidents.
Objašnjenje (HR)
Kritično ponašanje nije testirano pa regresije mogu proći neprimijećeno. Tim o greškama sazna iz produkcije.
Good example
| 1 | import { calculateInvoice } from './billing'; |
| 2 |
|
| 3 | test('invoice totals include all line items', () => { |
| 4 | const items = [{ price: 10 }, { price: 15 }]; |
| 5 | expect(calculateInvoice(items)).toBe(25); |
| 6 | }); |
| 7 | } |
Explanation (EN)
Explicit tests for critical paths make regressions visible immediately. CI enforces the discipline automatically.
Objašnjenje (HR)
Eksplicitni testovi za kritične putanje odmah otkrivaju regresije. CI automatski provodi disciplinu.
Notes (EN)
Document which paths are critical (auth, billing, onboarding) and require tests for every change.
Bilješke (HR)
Dokumentiraj koje su putanje kritične (auth, billing, onboarding) i zahtijevaj testove za svaku promjenu.
Exceptions / Tradeoffs (EN)
Pure prototypes or throwaway spikes can skip this, but production systems should not.
Iznimke / Tradeoffi (HR)
Čisti prototipi ili throwaway spikeovi mogu preskočiti, ali produkcijski sustavi ne bi trebali.