agentleFS
ihiteshguptaihiteshgupta/ClaudeSkills/skills/frontend/react-expert/SKILL.md

react-expert

Skill0 starsChanged 13 months agoMITView on GitHub

Expert in React development with hooks, TypeScript, state management, and modern patterns. Use for React component development, optimization, and best practices.

11 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use fullstack-guardian, playwright-expert 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.
  • JeffallanSkill

    fullstack-guardian

    Builds security-focused full-stack web applications by implementing integrated frontend and backend components with layered security at every level. Covers the complete stack from database to UI, enforcing auth, input validation, output encoding, and parameterized queries across all layers. Use when implementing features across frontend and backend, building REST APIs with corresponding UI, connecting frontend components to backend endpoints, creating end-to-end data flows from database to UI, or implementing CRUD operations with UI forms. Distinct from frontend-only, backend-only, or API-only skills in that it simultaneously addresses all three perspectives—Frontend, Backend, and Security—within a single implementation workflow. Invoke for full-stack feature work, web app development, authenticated API routes with views, microservices, real-time features, monorepo architecture, or technology selection decisions.

    Also in 6 projects that use this

  • JeffallanSkill

    playwright-expert

    Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects, configure test fixtures, set up reporters, add CI integration, implement API mocking, or perform visual regression testing. Trigger terms: Playwright, E2E test, end-to-end, browser testing, automation, UI testing, visual testing, Page Object Model, test flakiness.

    Also in 5 projects that use this

  • martinholovskySkill

    fastapi-expert

    Expert FastAPI developer specializing in production-ready async REST APIs with Pydantic v2, SQLAlchemy 2.0, OAuth2/JWT authentication, and comprehensive security. Deep expertise in dependency injection, background tasks, async database operations, input validation, and OWASP security best practices. Use when building high-performance Python web APIs, implementing authentication systems, or securing API endpoints.

    Also in 6 projects that use this

  • +9 more from Jeffallan

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 1 is common, 19 are distinctive, and 0 are very specific to this project.

  • 1

    Common

    Most of the 11 edited versions we read keep these.

  • 19

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer functional components over class components

    line 25
  2. Distinctive:

    Use hooks for state and side effects

    line 26
  3. Distinctive:

    Follow component composition patterns

    line 28
  4. Distinctive:

    Use generics for reusable components

    line 32
  5. Distinctive:

    Create discriminated unions for complex state

    line 34
  6. Distinctive:

    Use useState for local component state

    line 37
  7. Distinctive:

    Consider Redux Toolkit or Zustand for global state

    line 40
  8. Distinctive:

    Use React.memo for expensive components

    line 44
  9. Distinctive:

    Use index files for exports

    line 198
  10. Distinctive:

    Use default props sparingly (prefer default parameters)

    line 203
  11. Distinctive:

    Avoid prop drilling (use context or composition)

    line 204
  12. Distinctive:

    Use Error Boundaries for error catching

    line 207
  13. Distinctive:

    Write tests for components

    line 212
  14. Distinctive:

    Use React Testing Library

    line 213
  15. Distinctive:

    Test user interactions, not implementation

    line 214
  16. Distinctive:

    Test with screen readers

    line 221
  17. Distinctive:

    Not cleaning up side effects

    line 231
  18. Common:

    When implementing React features:

    line 245
  19. Distinctive:

    Optimize Performance: - Add memoization only when needed

    line 250
  20. Distinctive:

    Review & Refactor: - Ensure code quality and maintainability

    line 253

“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

React Development Expert

Purpose

Provide expert-level React development assistance focusing on modern React patterns, hooks, TypeScript integration, performance optimization, and best practices.

When to Use This Skill

  • Building React components with functional components and hooks
  • Implementing complex state management (Context API, Redux, Zustand)
  • TypeScript integration with React
  • Performance optimization (memo, useMemo, useCallback)
  • React Router implementation
  • Form handling and validation
  • API integration with React Query or SWR
  • Testing React components

Key Principles

1. Modern React Patterns

  • Prefer functional components over class components
  • Use hooks for state and side effects
  • Implement custom hooks for reusable logic
  • Follow component composition patterns

2. TypeScript Best Practices

  • Define proper prop types with TypeScript interfaces
  • Use generics for reusable components
  • Leverage type inference where appropriate
  • Create discriminated unions for complex state

3. State Management

  • Use useState for local component state
  • useReducer for complex state logic
  • Context API for shared state
  • Consider Redux Toolkit or Zustand for global state
  • Implement proper state normalization

4. Performance Optimization

  • Use React.memo for expensive components
  • Implement useMemo for expensive calculations
  • useCallback for function stability
  • Code splitting with React.lazy and Suspense
  • Virtualization for long lists

5. Side Effects

  • useEffect for side effects with proper dependency arrays
  • Clean up effects properly
  • Avoid infinite loops
  • Separate concerns in different effects

Code Structure

Component Template

import React, { useState, useEffect, useMemo, useCallback } from 'react';

interface ComponentProps {
  data: DataType;
  onAction: (id: string) => void;
  className?: string;
}

export const Component: React.FC<ComponentProps> = ({
  data,
  onAction,
  className
}) => {
  const [state, setState] = useState<StateType>(initialState);

  const memoizedValue = useMemo(() => {
    return expensiveCalculation(data);
  }, [data]);

  const handleAction = useCallback((id: string) => {
    onAction(id);
  }, [onAction]);

  useEffect(() => {
    // Side effect
    return () => {
      // Cleanup
    };
  }, [dependencies]);

  return (
    <div className={className}>
      {/* Component JSX */}
    </div>
  );
};

Custom Hook Template

import { useState, useEffect } from 'react';

export function useCustomHook<T>(initialValue: T) {
  const [value, setValue] = useState<T>(initialValue);
  const [loading, setLoading] = useState(false);
  const [error, setError] = useState<Error | null>(null);

  useEffect(() => {
    // Custom hook logic
  }, []);

  return { value, setValue, loading, error };
}

Common Patterns

1. Data Fetching

const useData = (url: string) => {
  const [data, setData] = useState(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch(url);
        const result = await response.json();
        setData(result);
      } catch (err) {
        setError(err);
      } finally {
        setLoading(false);
      }
    };
    fetchData();
  }, [url]);

  return { data, loading, error };
};

2. Form Handling

const useForm = <T extends Record<string, any>>(initialValues: T) => {
  const [values, setValues] = useState<T>(initialValues);
  const [errors, setErrors] = useState<Partial<Record<keyof T, string>>>({});

  const handleChange = (name: keyof T, value: any) => {
    setValues(prev => ({ ...prev, [name]: value }));
  };

  const validate = () => {
    // Validation logic
    return Object.keys(errors).length === 0;
  };

  return { values, errors, handleChange, validate };
};

3. Context Pattern

interface ContextValue {
  state: State;
  actions: Actions;
}

const Context = createContext<ContextValue | undefined>(undefined);

export const Provider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
  const [state, setState] = useState<State>(initialState);

  const value = useMemo(() => ({
    state,
    actions: {
      update: (data: Data) => setState(prev => ({ ...prev, data }))
    }
  }), [state]);

  return <Context.Provider value={value}>{children}</Context.Provider>;
};

export const useContextValue = () => {
  const context = useContext(Context);
  if (!context) {
    throw new Error('useContextValue must be used within Provider');
  }
  return context;
};

Best Practices

  1. Component Organization
    • One component per file
    • Co-locate related files
    • Use index files for exports
    • Separate containers from presentational components
  2. Props Management
    • Destructure props
    • Use default props sparingly (prefer default parameters)
    • Avoid prop drilling (use context or composition)
  3. Error Handling
    • Use Error Boundaries for error catching
    • Handle async errors properly
    • Provide user-friendly error messages
  4. Testing
    • Write tests for components
    • Use React Testing Library
    • Test user interactions, not implementation
    • Mock external dependencies
  5. Accessibility
    • Use semantic HTML
    • Provide ARIA labels where needed
    • Ensure keyboard navigation
    • Test with screen readers

Anti-Patterns to Avoid

  • Modifying state directly
  • Missing dependencies in useEffect
  • Using indexes as keys in lists
  • Too many useEffect hooks in one component
  • Props drilling through many levels
  • Overusing Context (causes unnecessary re-renders)
  • Not cleaning up side effects

Tools & Libraries

  • State Management: Redux Toolkit, Zustand, Jotai, Recoil
  • Data Fetching: React Query, SWR, Apollo Client
  • Forms: React Hook Form, Formik
  • Routing: React Router, TanStack Router
  • UI Libraries: Material-UI, Chakra UI, shadcn/ui
  • Testing: Jest, React Testing Library, Vitest
  • Build Tools: Vite, Next.js, Create React App

Implementation Approach

When implementing React features:

  1. Analyze Requirements - Understand the component's purpose and data flow
  2. Design Component Structure - Plan component hierarchy and state placement
  3. Implement with TypeScript - Define types first, then implement logic
  4. Optimize Performance - Add memoization only when needed
  5. Add Error Handling - Handle edge cases and errors gracefully
  6. Write Tests - Cover critical functionality
  7. Review & Refactor - Ensure code quality and maintainability

Examples

Complex Form with Validation

import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';

const schema = z.object({
  email: z.string().email(),
  password: z.string().min(8)
});

type FormData = z.infer<typeof schema>;

export const LoginForm: React.FC = () => {
  const { register, handleSubmit, formState: { errors } } = useForm<FormData>({
    resolver: zodResolver(schema)
  });

  const onSubmit = async (data: FormData) => {
    // Handle submission
  };

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input {...register('email')} />
      {errors.email && <span>{errors.email.message}</span>}

      <input type="password" {...register('password')} />
      {errors.password && <span>{errors.password.message}</span>}

      <button type="submit">Login</button>
    </form>
  );
};

This skill ensures production-ready, maintainable, and performant React applications.

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.