agentleFS
sagullapallisagullapalli/claude-code-setup/.claude/skills/frontend-patterns/SKILL.md

frontend-patterns

Skill4 starsChanged 10 months agoMITView on GitHub

React, TypeScript, Vite patterns for web applications. Use when building UI components, forms, routing, state management, or animations.

46 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use kotlin-testing, configure-ecc and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • tpavanipradeepSkill

    kotlin-testing

    Kotlin testing patterns with Kotest, MockK, coroutine testing, property-based testing, and Kover coverage. Follows TDD methodology with idiomatic Kotlin practices.

    Also in 6 projects that use this

  • saxon-ySkill

    configure-ecc

    Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.

    Also in 12 projects that use this

  • mryeastcodeSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 5 projects that use this

  • InfopibeSkill

    content-hash-cache-pattern

    Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.

    Also in 11 projects that use this

  • InfopibeSkill

    ralphinho-rfc-pipeline

    RFC-driven multi-agent DAG execution pattern with quality gates, merge queues, and work unit orchestration.

    Also in 9 projects that use this

  • WorldFlowAISkill

    project-guidelines-example

    Also in 18 projects that use this

  • +3 more from Infopibe

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. 0 are common, 15 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 15

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always add timeout guards for initial loading states (5-10s)

    line 107
  2. Very specific:

    Use AbortController for fetch requests

    line 108
  3. Very specific:

    Use enabled prop for conditional fetching

    line 119
  4. Distinctive:

    Don't retry mutations (could duplicate actions)

    line 120
  5. Distinctive:

    Before implementing a feature, check relevant pattern files:

    line 159
  6. Distinctive:

    If a pattern exists:

    line 166
  7. Distinctive:

    Follow the documented approach

    line 167
  8. Distinctive:

    Don't reinvent the wheel

    line 169
  9. Distinctive:

    If you discover a new pattern:

    line 172
  10. Distinctive:

    Add to appropriate pattern file

    line 174
  11. Distinctive:

    Use STAR format for lessons learned

    line 175
  12. Very specific:

    Update this SKILL.md if it's a new category

    line 176
  13. Distinctive:

    Add to "Quick Navigation by Use Case" section

    line 180
  14. Distinctive:

    Update "Related Skills" in other pattern files

    line 181
  15. Distinctive:

    Add to relevant agent memory files

    line 182
  16. Distinctive:

    Add inline comments for clarity

    line 221
  17. Distinctive:

    Keep examples focused and minimal

    line 222
  18. Distinctive:

    Update "Last Updated" dates

    line 244

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Frontend Patterns

Purpose: Comprehensive React + TypeScript + Vite patterns for building modern, performant web applications

Stack: React 18, TypeScript, Vite, TanStack Query v5, React Router, Tailwind CSS


Pattern Index

Core Patterns (Existing)

#PatternFocus AreaWhen to Use
01TroubleshootingCORS, Loading States, Network DebuggingDebugging frontend connectivity, timeouts, environment issues
02OAuth AuthenticationUser Auth, OAuth Flows, Error HandlingImplementing OAuth login, auth state, callback handling
03React PerformanceBundle Size, Query Optimization, StateOptimizing bundle, state management, component rendering
04TanStack QueryCache, Mutations, Optimistic UpdatesData fetching, caching, invalidation, session-specific state

Extended Patterns (New)

#PatternFocus AreaWhen to Use
05Form HandlingValidation, Submission, Complex FormsBuilding forms with validation, file uploads, multi-step flows
06React Router PatternsNavigation, Guards, LayoutsReact Router patterns, protected routes, nested routing
07State ManagementContext, Zustand, Jotai, Decision TreeChoosing state solutions (useState/Context/Zustand/Jotai), migration patterns
08AnimationsCSS, Framer Motion, View Transitions, GSAPAdding animations, transitions, gestures, scroll effects

Quick Navigation by Use Case

Development & Debugging

  • CORS errors: 01-troubleshooting.md#cors-debugging
  • Loading states hang: 01-troubleshooting.md#loading-state-issues
  • Network debugging: 01-troubleshooting.md#network-debugging
  • Environment setup: 01-troubleshooting.md#environment-setup-verification

Authentication

  • User-scoped auth: 02-oauth-authentication.md#user-scoped-vs-session-scoped-auth
  • OAuth callback: 02-oauth-authentication.md#oauth-callback-handling
  • Auth error handling: 02-oauth-authentication.md#error-handling
  • Protected routes: 02-oauth-authentication.md#pattern-protected-routes-react-router

Performance

  • Bundle optimization: 03-react-performance.md#bundle-optimization
  • Code splitting: 03-react-performance.md#pattern-dynamic-imports-for-route-based-code-splitting
  • State patterns: 03-react-performance.md#state-management-patterns
  • Asset optimization: 03-react-performance.md#asset-optimization

Data Fetching

  • Cache invalidation: 04-tanstack-query.md#cache-invalidation-vs-refetch
  • Mutations: 04-tanstack-query.md#mutation-lifecycle
  • Optimistic updates: 04-tanstack-query.md#optimistic-updates
  • Session-specific state: 04-tanstack-query.md#session-specific-state

Forms

  • Form validation: 05-form-handling.md#3-validation-patterns
  • File uploads: 05-form-handling.md#5-file-upload-patterns
  • Multi-step forms: 05-form-handling.md#6-multi-step-forms
  • Async validation: 05-form-handling.md#8-async-validation
  • Auto-save drafts: 05-form-handling.md#10-auto-save-drafts

Routing

  • React Router setup: 06-react-router-patterns.md#1-react-router-v6-setup
  • Route guards: 06-react-router-patterns.md#2-route-guards--protection
  • Nested routes: 06-react-router-patterns.md#3-nested-routes--layouts
  • Lazy loading: 06-react-router-patterns.md#6-lazy-loading-routes
  • URL state: 06-react-router-patterns.md#10-url-state-management

State Management

  • Decision framework: 07-state-management.md#decision-framework
  • Server vs client state: 07-state-management.md#server-state-vs-client-state
  • Context patterns: 07-state-management.md#react-context-patterns
  • Zustand patterns: 07-state-management.md#zustand-patterns
  • Jotai atoms: 07-state-management.md#jotai-patterns
  • State persistence: 07-state-management.md#state-persistence
  • Migration patterns: 07-state-management.md#migration-patterns

Animations

  • Decision framework: 08-animations.md#decision-framework
  • Library comparison: 08-animations.md#library-comparison
  • CSS transitions: 08-animations.md#css-transitions--animations
  • Framer Motion: 08-animations.md#framer-motion-patterns
  • View Transitions API: 08-animations.md#view-transitions-api
  • React Spring: 08-animations.md#react-spring-patterns
  • GSAP: 08-animations.md#gsap-patterns
  • Common patterns: 08-animations.md#common-animation-patterns
  • Accessibility: 08-animations.md#accessibility
  • Performance: 08-animations.md#performance-optimization

Common Patterns Across Files

State Accumulation vs Replacement

  • Accumulate (lists/history): setState(prev => [...prev, newItem])
  • Replace (single values): setState(newValue)
  • Details: 04-tanstack-query.md#state-accumulation-pattern

Timeout Guards

  • Always add timeout guards for initial loading states (5-10s)
  • Use AbortController for fetch requests
  • Details: 01-troubleshooting.md#loading-state-issues

Error Handling

  • Detect auth errors (401) globally
  • Clear auth state on failures
  • Show user-friendly messages
  • Details: 02-oauth-authentication.md#error-handling

Query Configuration

  • Set staleTime appropriately (5min for chat apps)
  • Use enabled prop for conditional fetching
  • Don't retry mutations (could duplicate actions)
  • Details: 04-tanstack-query.md#query-configuration

Technology Stack Reference

Core Libraries

  • React: 18.x (Concurrent features, Suspense)
  • TypeScript: 5.x (Strict mode recommended)
  • Vite: 5.x (Fast bundler, HMR)
  • TanStack Query: 5.x (Data fetching, caching)
  • React Router: 6.x (Routing, navigation)
  • Tailwind CSS: 3.x (Utility-first styling)

State Management Options

  • useState/useReducer: Local component state
  • TanStack Query: Server state (async data)
  • Zustand: Global client state (lightweight)
  • Jotai: Atomic state management
  • See: 07-state-management.md for decision guide

Form Libraries

  • React Hook Form: Performant, minimal re-renders
  • Zod: Schema validation (TypeScript-first)
  • Formik: Feature-rich (heavier)
  • See: 05-form-handling.md for patterns

Animation Libraries

  • CSS Transitions/Animations: Native, performant
  • Framer Motion: Declarative, gesture support
  • React Spring: Physics-based animations
  • See: 08-animations.md for comparisons

Pattern Development Workflow

1. Check Existing Patterns

Before implementing a feature, check relevant pattern files:

# Search across all patterns
grep -r "pattern-keyword" .claude/skills/frontend-patterns/

2. Use Documented Patterns

If a pattern exists:

  • Follow the documented approach
  • Reference the pattern in code comments
  • Don't reinvent the wheel

3. Document New Patterns

If you discover a new pattern:

  1. Implement and verify it works
  2. Add to appropriate pattern file
  3. Use STAR format for lessons learned
  4. Update this SKILL.md if it's a new category

4. Update Cross-References

When adding patterns:

  • Add to "Quick Navigation by Use Case" section
  • Update "Related Skills" in other pattern files
  • Add to relevant agent memory files

Contributing Guidelines

Pattern File Structure

Each pattern file should follow this structure:

# Pattern Name

**Purpose**: One-sentence description
**When to use**: Use cases
**Last Updated**: YYYY-MM-DD

## Table of Contents
1. [Pattern Category 1](#pattern-category-1)
2. [Pattern Category 2](#pattern-category-2)

## Pattern Category 1

### Pattern: Specific Pattern Name
**Problem**: What problem does this solve?
**Solution**: How to solve it
**Implementation**: Code examples

---

## Summary
- Key patterns list
- Common mistakes
- Quick reference table
- Related skills

Code Examples

  • Show both WRONG and CORRECT examples
  • Include TypeScript types
  • Add inline comments for clarity
  • Keep examples focused and minimal

Pattern Categories

  • Problem: Describe the issue
  • Solution: High-level approach
  • Implementation: Code examples
  • Anti-Pattern: Common mistakes
  • Key Points: Bullet list of gotchas

Maintenance

When to Update

  • New framework version released
  • Discovered better pattern
  • Common bug/issue encountered
  • User feedback suggests improvement

Review Cycle

  • Review patterns quarterly
  • Archive outdated patterns to .claude/skills/archive/
  • Update "Last Updated" dates
  • Maintain backward compatibility references

Related Resources

Internal

  • General Frontend: ../frontend-development.md
  • Testing Patterns: ../testing-strategy/04-frontend-component-testing.md
  • Security: ../security-best-practices.md
  • API Design: ../api-design.md

External (Official Docs)


Last Updated: 2025-12-09

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.