Ensure `ThreadLocal` Variables Are Properly Cleaned
Ensure that `ThreadLocal` variables are cleaned using `.remove()` to avoid memory leaks.
performance-efficiency
High
Ensure JSX list components have a key property
Check that JSX list components have unique key properties. Missing keys can cause unnecessary re-renders and lead to state inconsistencies.
performance-efficiencystack-react+1
High
Ensure React list keys are stable between renders
Check if React list keys are stable and unique. Using dynamic values like Math.random() or Date.now() can cause rendering issues. Recommend using unique IDs.
performance-efficiencystack-react+1
High
Explicitly Close Resources in `finally` Blocks
Check if resources such as files or database connections are properly closed in a `finally` block. This ensures resources are always released, even if an exception occurs.
error-handlingperformance-efficiency+1
High
Immutable cache and Vary for precompressed files
Serve precompressed .br/.gz variants when the client sends Accept-Encoding, set "Vary: Accept-Encoding", and apply immutable caching for hashed assets; keep HTML revalidatable.
web-static-assetscaching-strategy+1
High
Immutable cache for hashed assets, no-cache for HTML
In Express, use serve-static with setHeaders to apply "Cache-Control: public, max-age=31536000, immutable" for files matching /\.[0-9a-f]{8,}\./ and "Cache-Control: no-cache" for HTML. Also set correct Content-Type.
web-static-assetscaching-strategy+1
High
Keep 'use client' at the leaf: default to Server Components
Prefer Server Components for pages/layouts and move interactivity to small leaf Client Components. Only add 'use client' where browser APIs or event handlers are strictly necessary.
stack-nextjsstack-react+2
High
Make fetch caching explicit in Server Components
For dynamic data use { cache: 'no-store' } or file-level dynamic = 'force-dynamic'. For ISR use { next: { revalidate: N, tags: [...] } }.
stack-nextjsstack-react+2
High
Middleware only for light auth/rewrites
Keep middleware fast and side-effect free (no DB writes). Narrow the matcher and skip static assets. Use Route Handlers for heavy logic.
stack-nextjsstack-react+2
High
Optimize database queries with JOINs
Prefer JOINs/eager loading over per-row queries to avoid N+1 patterns.
database-query-performanceperformance-efficiency
High
Optimize LINQ queries for database operations
Ensure LINQ queries translate to SQL efficiently (avoid client evaluation, use projections, defer ToList until needed).
database-query-performanceperformance-efficiency
High
Order validations before database queries
Validate inputs and preconditions up-front and return early before issuing any database queries.
api-conventionsperformance-efficiency
High
Prefer `for` Elements Over `Map.fromIterable`
Use `for` elements inside map literals instead of `Map.fromIterable` to improve readability and allow better compiler optimizations.
performance-efficiencyreadability-refactor+1
High
Prefer `SizedBox` Over `Container` for Spacing
Use `SizedBox` instead of `Container` when adding spacing in layouts to improve performance and avoid unnecessary rendering overhead.
performance-efficiencystack-flutter
High
Preload critical fonts and use font-display: swap
Preload render-blocking WOFF2 fonts using <link rel="preload" as="font" type="font/woff2" crossorigin> and define @font-face with "font-display: swap". Only preload fonts used above the fold.
web-static-assetsperformance-efficiency+1
High
Properly Initialize Hash-Based Collections
Ensure that `HashMap` and `HashSet` are initialized with appropriate capacity settings to optimize performance.
performance-efficiency
High
Purpose limitation for analytics (no direct identifiers)
Do not send direct identifiers (email, CPF) to analytics. Use an HMAC-based pseudonymous ID derived from user ID and a rotating key; never reversible without server secret.
compliance-lgpdprivacy-pii+1
High
React Context values should have stable identities
Identify cases where React Context values are being reassigned dynamically. Unstable context values trigger unnecessary re-renders. Use memoization to stabilize them.
performance-efficiencystack-react+1
High
Serve responsive images with modern formats and lazy-load
Provide AVIF/WebP fallbacks via <img srcset> with width/height attributes, meaningful sizes, and "loading=lazy" plus "decoding=async". Avoid shipping oversized PNG/JPEG when AVIF/WebP is supported.
web-static-assetsperformance-efficiency
High
Set CPU/memory requests and limits for all containers
Every container must specify resources.requests and resources.limits for cpu and memory.
infra-as-codeperformance-efficiency
High
Use `Arrays.stream()` for Primitive Arrays
Ensure that `Arrays.stream(array)` is used instead of `Arrays.asList(T... a).stream()` for primitive arrays.
performance-efficiency
High
Use `const` for Literal Constructor Parameters in `@immutable` Classes
Ensure that all literal values passed to constructors of `@immutable` classes are marked as `const` to prevent unnecessary object creation.
performance-efficiencystack-flutter+1
High
Use `entrySet()` When Iterating Over Maps
Ensure that `entrySet()` is used instead of iterating over `keySet()` and calling `get(key)`, to optimize performance.
performance-efficiency
High
Use `finally` for Resource Cleanup
Detect code where resources (files, sockets, etc.) are not closed in a `finally` block. Using `finally` ensures that resources are released, even if an exception is raised.