ec27228a8e
Em dashes (—) and en dashes (–) had spread across comments, docs, tests, and a few UI strings, reading as AI-generated boilerplate rather than house style. Replaced each with punctuation matching its context: colon for explanatory clauses, comma for asides, plain hyphen for numeric/legal ranges (e.g. "21-23§"), "to"/"till" for date ranges, parentheses for paired-dash asides. messages/en.json and messages/sv.json were fixed by hand together to keep sv/en in sync. Left untouched where the dash is the functional subject rather than decorative punctuation: date-range-parser.ts's separator regex, charset-repair.ts's CP1252 byte-mapping table (and its test), the SIE encoding mojibake docs, generic-csv.ts's minus-sign normalizer, the agent system-prompt files that already instruct against em dashes, and a golden iXBRL test fixture compared byte-for-byte. Also fixes two bugs surfaced along the way: an off-by-one in ApiKeysPanel's scope-label split (a leftover from an earlier partial pass), and a charset-repair test that had lost the literal en-dash it exists to verify. Regenerated the agent atom seed migration (skills:generate) since 27 SKILL.md files changed. Added a CLAUDE.md rule against em/en dashes, with an explicit carve-out for the functional-dash cases above. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
3.1 KiB
3.1 KiB
Performance Prompt
Perspective
You are scanning for performance issues in a Next.js 16 (App Router) + React 19 + Supabase application. Focus on page load speed, rendering efficiency, bundle size, data fetching patterns, and perceived performance. The app targets short, focused sessions (90 seconds): speed is a core feature.
Checklist
Rendering & React
- Components that don't need interactivity are Server Components (no unnecessary
'use client') - Large lists use virtualization or pagination (not rendering 1000+ items)
- Expensive computations wrapped in
useMemowhere re-renders are frequent - Callback functions stable with
useCallbackwhen passed as props to memoized children - No unnecessary re-renders from unstable object/array references in props or context
- Suspense boundaries with appropriate fallbacks for async components
Data Fetching
- Server Components fetch data on the server (not client-side
useEffectfor initial data) - No waterfall fetches (parallel when independent)
- Pagination or cursor-based loading for large datasets
- No fetching data that's already available from a parent component
- API routes return only needed fields (not entire rows with unused columns)
- Appropriate use of
revalidatePath/revalidateTagfor cache invalidation
Bundle Size
- Heavy libraries imported dynamically (
next/dynamic) where not needed on initial load - No duplicate dependencies (same library imported from different paths)
- Tree-shaking friendly imports (
import { X } from 'lib'notimport * as lib) - Images optimized with
next/image(not raw<img>tags) - SVG icons from Lucide imported individually (not the entire icon set)
Database & API
- Queries have appropriate indexes (see database prompt for details)
- No N+1 patterns (fetching related data in loops)
- Batch operations used where possible (bulk insert/update)
- API responses are reasonably sized (not returning megabytes of data)
- Rate limiting in place for expensive operations
Perceived Performance
- Loading skeletons match content layout (not generic spinners)
- Optimistic UI updates for user actions (don't wait for server response to show feedback)
- Transitions between states are smooth (no jarring layout shifts)
- Critical content above the fold loads first
- Non-critical content lazy-loaded or deferred
Caching
- Static pages/routes use appropriate caching headers
- API responses include cache headers where data doesn't change frequently
- Client-side state management avoids redundant fetches
- Supabase real-time subscriptions used only where needed (not as a polling replacement)
Classification
- Bug: Memory leak, infinite re-render loop, blocking the main thread, N+1 causing timeouts.
- Feature: Needs pagination, needs virtualization, needs caching layer, needs optimistic updates.
- Improvement: Unnecessary
'use client', could use Server Component, missinguseMemoon expensive computation, bundle could be split, fetch could be parallelized.