Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2universalStack: typescript
reuseactionsapi-designdry
Write actions generically so they can be reused across features
Prefer a parameterized, generic action (e.g. filter users) that multiple screens can share over a one-off action tied to a single page.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // only usable by the share modal |
| 2 | export async function getUsersForShareModal() { /* ... */ } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // reusable by share modal AND admin panel |
| 2 | export async function filterUsers(opts: { search?: string; excludeIds?: number[] }) { /* ... */ } |
Explanation (EN)
Objašnjenje (HR)