skills/tb-02c-frontend-patterns/SKILL.md
Add frontend patterns — lazyWithRetry chunk recovery, react-query with queryKeys factory, routes.ts constants, in-app release notes with localStorage tracking, and contact form.
npx skillsauth add TravisBumgarner/claude-brain tb-02c-frontend-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
lazyWithRetry wrapper — catches stale chunk errors after deploys, uses sessionStorage to auto-reload once, prevents infinite loopsChunkErrorBoundary — error boundary for failed dynamic imports with a manual refresh button. Pairs with lazyWithRetry.queryKeys.ts — factory functions for type-safe cache keys; ships with authUser and currentUser, add more as endpoints are builtsrc/api/ folder — plain async functions for API calls (fetch wrappers), one file per resource
src/hooks/ use these API functions as queryFn — hooks are for hooks, API calls live in api/routes.ts — all routes as a ROUTES object
{ href: () => string, label: string, external?: boolean } — href is always a function, parameterized when needed (e.g., href: (id: string) => /items/${id} ). external marks links that open in a new tab with an icon.<Route path={ROUTES.foo.href()}> and link renderingsrc/components/Router.tsx — dedicated router component
lazy() (or lazyWithRetry from the chunk retry pattern)<Suspense fallback={<Loading />}><Outlet />:
AnonymousRoute — redirects to / if logged inMemberRoute — redirects to /login if not logged inModeratorRoute — checks user.userLevel >= UserLevel.MODERATOR, redirects otherwiseAdminRoute — checks user.userLevel >= UserLevel.ADMIN, redirects otherwise* route navigates to 404releaseNotes.ts — typed array as single source of truth
interface ReleaseNoteEntry {
version: string
date: string
changes: { category: 'Added' | 'Improved' | 'Fixed'; items: string[] }[]
}
LAST_SEEN_RELEASE_DATE in localStoragesrc/pages/ReleaseNotes.tsx — full release notes pagesrc/pages/DeleteMe.tsx and remove its import/usage from App.tsx after manual verificationsrc/sharedComponents/ContactForm.tsx
formSuffix: string (appended to website field as {project-name}-{formSuffix}), optional fieldsToHide?: ('name' | 'email')[]https://contact-form.nfshost.com/contactdevelopment
Use this agent when designing visual interfaces, creating design systems, building component libraries, or refining user-facing aesthetics requiring expert visual design, interaction patterns, and accessibility considerations. Specifically: <example> Context: Product team needs a complete design system for a new fintech application with dark mode, multiple device sizes, and strict accessibility requirements. user: "We need to create a comprehensive design system for our fintech app. Include component library, design tokens, typography scale, color palette, interactive patterns, and dark mode support. Must meet WCAG 2.1 AA." assistant: "I'll create a complete design system starting with understanding your brand guidelines and user base through the context-manager. I'll build a modular component library with documented specs, design tokens in multiple formats (CSS, JSON, Figma), responsive patterns across web and mobile, dark mode variants, and comprehensive accessibility annotations. I'll deliver Figma files, design documentation, and developer handoff specifications." <commentary> Use ui-designer when you need to establish or refine a complete design system, including component libraries, design tokens, and comprehensive visual standards. This agent excels at creating reusable design assets and documentation that scale across teams and platforms. </commentary> </example> <example> Context: A frontend team is building a new feature but needs UI design and interaction patterns before development. user: "Design the booking flow for our travel app. Need 3 screen variations, empty/loading/error states, mobile and desktop layouts, and clear interaction patterns for each step." assistant: "I'll design a complete booking flow with wireframes, visual mockups, and interaction specifications. First, let me check the context-manager for your existing design system and style guide. Then I'll create all screen states, document interaction patterns, provide motion design specifications, and ensure alignment with your design language and accessibility standards." <commentary> Invoke ui-designer when your frontend developers need detailed visual designs, interaction specifications, and asset files before implementation. The agent provides a clear handoff package that developers can build from. </commentary> </example> <example> Context: A redesign initiative is underway and you need UI improvements to an existing product. user: "Our dashboard needs a visual refresh. The functionality is fine but the UX feels dated. Improve the visual hierarchy, modernize colors and typography, add micro-interactions, and ensure it works on mobile." assistant: "I'll analyze your current dashboard using the context-manager, identify visual improvement opportunities, redesign layouts for better hierarchy and scannability, update colors and typography to modern standards, add meaningful micro-interactions, and ensure responsive design. I'll provide before/after comparisons, design rationale, and implementation specifications for your developers." <commentary> Use ui-designer for visual refinements, redesigns, and aesthetic improvements to existing interfaces. This agent modernizes dated UIs while respecting existing functionality and providing clear upgrade paths. </commentary> </example>
development
Expert TypeScript developer specializing in advanced type system usage, full-stack development, and build optimization. Masters type-safe patterns for both frontend and backend with emphasis on developer experience and runtime safety.
development
Scaffold a full CRUD route — prompts for resource name, HTTP methods, and access level, then generates backend routes, shared schemas, frontend API functions, react-query hooks, and query keys.
development
Audit the codebase against all setup skills (00-09). Reports what is done, partial, not started, or N/A for every checklist item with a summary table.