public-library Vetted by Rulemart
Public engineering rules from Fabrica for coding agents, with versioned groups projects can adopt and customize.
Go techs/go
Add operation and identifier context to errors at boundaries
MEDIUMfabricahq/public-libraryDefine every domain field, and comment other struct fields whose meaning the type does not show
MEDIUMfabricahq/public-libraryExpose error identity only for contract errors
MEDIUMfabricahq/public-libraryGive exported Go identifiers and non-obvious functions doc comments stating their intent
LOW-MEDIUMfabricahq/public-libraryGive text and its parsed form one owner
MEDIUMfabricahq/public-librarySeparate package documentation from file headers
LOWfabricahq/public-library
Goose techs/goose
JavaScript techs/javascript
Avoid layout thrashing
MEDIUMfabricahq/public-libraryAwait only on paths that need the result
MEDIUMfabricahq/public-libraryDefer non-critical browser work to idle time
MEDIUMfabricahq/public-libraryKeep dynamic import and file paths statically analyzable
MEDIUMfabricahq/public-libraryLoad measurement scripts the way their vendors document
LOW-MEDIUMfabricahq/public-libraryMark scroll-related listeners passive when they never cancel scrolling
MEDIUMfabricahq/public-libraryStart independent asynchronous work concurrently
HIGHfabricahq/public-libraryVersion and minimize data in browser storage
MEDIUMfabricahq/public-library
Playwright techs/playwright
Scope locators by test id, then select controls by role and name
MEDIUMfabricahq/public-librarySynchronize with auto-waiting actions and web-first assertions
MEDIUM-HIGHfabricahq/public-library
React techs/react
Accept ref as a prop in React 19
LOWfabricahq/public-libraryAuthenticate and authorize inside every Server Action
CRITICALfabricahq/public-libraryAvoid copying props to state
HIGHfabricahq/public-libraryAvoid loading large barrel files
MEDIUMfabricahq/public-libraryAvoid unnecessary Effects
HIGHfabricahq/public-libraryBuild complex components from composable parts
MEDIUMfabricahq/public-libraryCompose independent server data fetches as siblings
HIGHfabricahq/public-libraryCreate explicit component variants instead of boolean mode props
MEDIUMfabricahq/public-libraryDeduplicate per-request server work with cache
MEDIUMfabricahq/public-libraryDo not define components inside components
HIGHfabricahq/public-libraryFollow the Rules of Hooks
HIGHfabricahq/public-libraryGive every interactive element a role and an accessible name
HIGHfabricahq/public-libraryGive repeated and persistent surfaces stable test ids
MEDIUMfabricahq/public-libraryHint critical resources with React DOM resource APIs
MEDIUMfabricahq/public-libraryInitialize expensive state lazily
LOW-MEDIUMfabricahq/public-libraryKeep components and Hooks pure
HIGHfabricahq/public-libraryKeep input responsive by marking non-urgent updates
MEDIUMfabricahq/public-libraryKeep non-critical scripts off the critical path
MEDIUM-HIGHfabricahq/public-libraryKeep request data out of shared module state
HIGHfabricahq/public-libraryKeep values that do not affect rendering in refs
MEDIUMfabricahq/public-libraryLift shared component state into a provider behind an interface
MEDIUMfabricahq/public-libraryLoad heavy optional code on demand
HIGHfabricahq/public-libraryMemoize deliberately
MEDIUMfabricahq/public-libraryName Effect and non-trivial Hook callbacks
LOWfabricahq/public-libraryName generic components by capability, not by first caller
MEDIUMfabricahq/public-libraryPass only the data Client Components use
MEDIUMfabricahq/public-libraryRead the latest callbacks in Effects without resubscribing
MEDIUMfabricahq/public-libraryRender client-only preferences without a flash or hydration error
MEDIUMfabricahq/public-libraryReuse request-independent server data across requests
MEDIUMfabricahq/public-libraryRun app-wide initialization once per app load
LOW-MEDIUMfabricahq/public-libraryRun post-response work after the response
MEDIUMfabricahq/public-libraryShare client data requests through a caching data layer
MEDIUM-HIGHfabricahq/public-librarySkip off-screen rendering work in long lists
MEDIUMfabricahq/public-libraryStream slow data behind Suspense boundaries
MEDIUM-HIGHfabricahq/public-librarySubscribe to and depend on only the values you use
MEDIUMfabricahq/public-librarySuppress only expected hydration mismatches
LOW-MEDIUMfabricahq/public-libraryUse a boolean condition for conditional rendering
LOW-MEDIUMfabricahq/public-libraryUse Activity to hide UI that should keep its state
MEDIUMfabricahq/public-libraryUse functional updates when new state depends on old state
MEDIUMfabricahq/public-library
TanStack Query techs/tanstack-query
Define hierarchical query keys and options in factories
MEDIUMfabricahq/public-libraryDerive component views of query data with a stable select
LOW-MEDIUMfabricahq/public-libraryDerive infinite query page params from the server's response
MEDIUMfabricahq/public-libraryFetch a dynamic set of queries with useQueries
MEDIUMfabricahq/public-libraryInvalidate or update every query a mutation changes
HIGHfabricahq/public-libraryKey each query by every input it uses
HIGHfabricahq/public-libraryMake offline behavior explicit
LOW-MEDIUMfabricahq/public-libraryMake optimistic updates reversible, and decide them once
MEDIUM-HIGHfabricahq/public-libraryPass the query's AbortSignal to the request
MEDIUMfabricahq/public-libraryPrefetch likely next data on user intent
MEDIUMfabricahq/public-libraryPrefetch on the server and hydrate the query cache
MEDIUM-HIGHfabricahq/public-libraryRead mutation state from other components with useMutationState
LOW-MEDIUMfabricahq/public-libraryReset query errors when an error boundary retries
HIGHfabricahq/public-librarySet staleTime from how fast data changes
MEDIUMfabricahq/public-libraryUse initialData only for complete data
MEDIUMfabricahq/public-library
TanStack Router techs/tanstack-router
Load route data in loaders, in parallel
HIGHfabricahq/public-libraryMask modal routes with the resource's canonical URL
LOWfabricahq/public-libraryProvide shared dependencies through typed router context
HIGHfabricahq/public-libraryRegister the router and read route data through typed route APIs
MEDIUMfabricahq/public-librarySet app-wide navigation behavior in router defaults
MEDIUMfabricahq/public-librarySplit route components out of the main bundle
MEDIUMfabricahq/public-libraryThrow notFound for missing resources and render it with notFoundComponent
MEDIUM-HIGHfabricahq/public-libraryUse Link for navigation users can open, and redirect in the router
MEDIUMfabricahq/public-libraryValidate search params with defaults at the route
HIGHfabricahq/public-libraryWith TanStack Query, load route data into the Query cache
HIGHfabricahq/public-library
TypeScript techs/typescript
Annotate types at module boundaries and where they narrow
MEDIUMfabricahq/public-libraryAvoid silencing the type checker
HIGHfabricahq/public-library 1 starDeclare constants with as const, and satisfies when a type exists
MEDIUMfabricahq/public-libraryDefine every property of a domain type
MEDIUMfabricahq/public-libraryDistinguish null from undefined
LOWfabricahq/public-libraryFollow consistent naming conventions
LOWfabricahq/public-libraryGenerate service types from their contracts
HIGHfabricahq/public-libraryGive exported TypeScript interfaces and non-obvious functions doc comments stating their intent
MEDIUMfabricahq/public-libraryImport types with import type
MEDIUMfabricahq/public-libraryModel distinct states as discriminated unions
MEDIUMfabricahq/public-libraryNarrow unknown values before use
HIGHfabricahq/public-libraryPrefer literal unions over enums
MEDIUMfabricahq/public-libraryPrefer type aliases over interfaces
LOWfabricahq/public-libraryPreserve caller-owned data
MEDIUMfabricahq/public-libraryRequire caller-owned inputs and document defaults
MEDIUM-HIGHfabricahq/public-libraryUse Boolean() for explicit boolean coercion
LOWfabricahq/public-libraryUse named exports
LOWfabricahq/public-libraryUse one array type syntax
LOWfabricahq/public-libraryUse predictable file names
LOWfabricahq/public-libraryUse template literal types for patterned strings
LOW-MEDIUMfabricahq/public-library
Zustand techs/zustand
Create stores once, outside render
HIGHfabricahq/public-libraryDefine typed state and named actions
MEDIUM-HIGHfabricahq/public-libraryKeep each store focused on one domain
MEDIUMfabricahq/public-libraryKeep store state serializable
MEDIUMfabricahq/public-libraryPersist only safe, versioned state
HIGHfabricahq/public-libraryRehydrate persisted stores after React hydration
HIGHfabricahq/public-libraryReset stores between tests and test actions directly
MEDIUMfabricahq/public-librarySubscribe with narrow, stable selectors
HIGHfabricahq/public-libraryUpdate store state functionally and immutably
HIGHfabricahq/public-libraryUse Zustand only for shared client state
HIGHfabricahq/public-library
practices/agents-mdnot canonical
End AGENTS.md with a section on maintaining it
MEDIUMfabricahq/public-libraryHold a size budget for always-loaded agent instructions
MEDIUMfabricahq/public-libraryKeep AGENTS.md to what almost every session needs and can't see
MEDIUMfabricahq/public-library
Code design practices/code-design
Express operations as meaningful steps
MEDIUMfabricahq/public-libraryHide implementation decisions behind meaningful interfaces
HIGHfabricahq/public-libraryOrganize code by feature
MEDIUMfabricahq/public-libraryRecord facts when they happen
HIGHfabricahq/public-libraryRemove unnecessary error cases through contract design
MEDIUM-HIGHfabricahq/public-librarySeparate pure computation from effects
MEDIUMfabricahq/public-library
Concurrency practices/concurrency
Apply asynchronous results only while they remain valid
HIGHfabricahq/public-libraryHonor cancellation and deadlines across every blocking stage
HIGHfabricahq/public-libraryKeep shared resources alive until their users finish
HIGHfabricahq/public-library
Documentation practices/documentation
Comment intent, and point at the owner instead of describing it
MEDIUMfabricahq/public-libraryGive every lint or type-checker suppression a reason
MEDIUMfabricahq/public-libraryHead a file with its purpose only when its name can't say it
LOWfabricahq/public-libraryLink every TODO and workaround to where it will be resolved
LOW-MEDIUMfabricahq/public-libraryState the current model and its reasons, not how it got there
MEDIUMfabricahq/public-libraryWrite comments in plain, direct language
MEDIUMfabricahq/public-library
Performance practices/performance
READMEs practices/readmes
Give a quick start that runs as written
MEDIUM-HIGHfabricahq/public-libraryKeep the README an entry point, and link to the full documentation
MEDIUMfabricahq/public-libraryMatch the README's presentation to the product's tier
MEDIUMfabricahq/public-libraryOpen with what the product does for the reader
MEDIUMfabricahq/public-libraryState what the product does not do
MEDIUMfabricahq/public-library
Testing practices/testing
Choose tests by risk and cost
HIGHfabricahq/public-libraryCover empty inputs and boundaries
MEDIUMfabricahq/public-libraryKeep tests independent
MEDIUM-HIGHfabricahq/public-libraryName tests for the behavior and the condition
LOWfabricahq/public-libraryReproduce bugs with regression tests
HIGHfabricahq/public-libraryRun focused tests while iterating, and the full suite before finishing
LOW-MEDIUMfabricahq/public-libraryTest at the lowest layer that proves the behavior
MEDIUM-HIGHfabricahq/public-libraryTest observable behavior
HIGHfabricahq/public-library
practices/writingnot canonical
Build the explanation in steps
MEDIUMfabricahq/public-libraryGive the reader a map, then follow it
MEDIUMfabricahq/public-libraryMake important abstractions concrete
MEDIUMfabricahq/public-libraryMake the actor and action clear
MEDIUMfabricahq/public-libraryTake a side and earn it
MEDIUMfabricahq/public-libraryWrite to one reader as if they're across the table
LOW-MEDIUMfabricahq/public-library