Skip to main content
skill CX Codex

frontend-dev-guidelines · bbeierle12 — Claude Code skill: what it does

frontend-dev-guidelines — a convention set for React and TypeScript work: folder layout, data loading, styling and tests. It loads when the agent touches frontend code.

MIT 105 installs ★ 9 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Bbeierle12/Skill-MCP-Claude --skill frontend-dev-guidelines -a claude-code
Open on GitHub

What frontend-dev-guidelines does

The skill gives an agent a fixed shape for React and TypeScript code. Feature folders under src/features/, shared pieces in components/ui and components/layout, plus hooks, utils, types, api and styles. Components carry a typed props interface.

Samples cover Suspense with useSuspenseQuery, lazy routes through lazy, server state on TanStack Query with useQuery and useMutation, global state on Zustand or Context. There are sections on memoization, code splitting, virtual lists via @tanstack/react-virtual, Tailwind and CSS Modules styling, ErrorBoundary from react-error-boundary, and component tests with @testing-library/react. Four companion files go deeper: component-patterns.md, state-management.md, performance.md, testing.md.

Every fetching example assumes TanStack Query. If your app keeps server state somewhere else, the useSuspenseQuery and useMutation snippets have to be adapted by hand.

What it helps with

  • lay out a fresh React app into feature folders
  • move data fetching to Suspense and useSuspenseQuery
  • lazy-load routes behind a fallback
  • wrap a page in an error boundary with a reset button
  • write a component test with @testing-library/react

Example prompts for the agent

  • Create a dashboard page under src/features/dashboard following the skill structure
  • Rewrite the task list with useSuspenseQuery and a Suspense skeleton
  • Split the heavy chart component into its own lazy chunk

How to install frontend-dev-guidelines

1Skills CLI (Vercel)

npx skills add Bbeierle12/Skill-MCP-Claude --skill frontend-dev-guidelines -a claude-code

2Manually: put the files in place

~/.claude/skills/frontend-dev-guidelines/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/frontend-dev-guidelines/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about frontend-dev-guidelines

How do I install frontend-dev-guidelines in Claude Code?

Run npx skills add Bbeierle12/Skill-MCP-Claude --skill frontend-dev-guidelines -a claude-code. The skill file lands at ~/.claude/skills/frontend-dev-guidelines/SKILL.md.

What does frontend-dev-guidelines do?

It hands the agent a written set of React and TypeScript conventions: project layout, typed components, data fetching, styling, performance and tests. Think of it as a reference with code samples, not a project generator.

Which libraries does the skill assume?

TanStack Query for server state, Zustand or Context for global state, and Tailwind, CSS Modules or styled-components for styling. The error, list and test sections use react-error-boundary, @tanstack/react-virtual and @testing-library/react.

Source text

SKILL.md · MIT
---
name: frontend-dev-guidelines
description: Frontend development guidelines for React/TypeScript applications. Modern patterns including Suspense, lazy loading, useSuspenseQuery, file organization with features directory, styling best practices, routing, performance optimization, and TypeScript best practices. Use when creating components, pages, features, fetching data, styling, routing, or working with frontend code.
---

# Frontend Development Guidelines

## Project Structure

```
src/
├── features/           # Feature-based organization
│   ├── auth/
│   │   ├── components/
│   │   ├── hooks/
│   │   ├── api/
│   │   └── index.ts
│   ├── dashboard/
│   └── settings/
├── components/         # Shared/common components
│   ├── ui/            # Base UI components
│   └── layout/        # Layout components
├── hooks/             # Shared hooks
├── utils/             # Utility functions
├── types/             # TypeScript types
├── api/               # API layer
└── styles/            # Global styles
```

## Component Patterns

### Functional Components with TypeScript

```tsx
interface Props {
  title: string;
  onAction: (id: string) => void;
  isLoading?: boolean;
}

export function MyComponent({ title, onAction, isLoading = false }: Props) {
  // Component logic
  return (
    <div>
      {isLoading ? <Spinner /> : <Content title={title} />}
    </div>
  );
}
```

### Suspense for Data Fetching

```tsx
import { Suspense } from 'react';

function ParentComponent() {
  return (
    <Suspense fallback={<LoadingSkeleton />}>
      <DataComponent />
    </Suspense>
  );
}

function DataComponent() {
  // useSuspenseQuery automatically suspends
  const { data } = useSuspenseQuery({
    queryKey: ['items'],
    queryFn: fetchItems,
  });
  
  return <ItemList items={data} />;
}
```

### Lazy Loading Routes

```tsx
import { lazy, Suspense } from 'react';

const Dashboard = lazy(() => import('./features/dashboard'));
const Settings = lazy(() => import('./features/settings'));

function App() {
  return (
    <Suspense fallback={<PageLoader />}>
      <Routes>
        <Route path="/dashboard" element={<Dashboard />} />
        <Route path="/settings" element={<Settings />} />
      </Routes>
    </Suspense>
  );
}
```

## State Management

### Local State
```tsx
const [value, setValue] = useState<string>('');
const [items, setItems] = useState<Item[]>([]);
```

### Server State (TanStack Query)
```tsx
// Queries
const { data, isLoading, error } = useQuery({
  queryKey: ['users', userId],
  queryFn: () => fetchUser(userId),
});

// Mutations
const mutation = useMutation({
  mutationFn: updateUser,
  onSuccess: () => {
    queryClient.invalidateQueries({ queryKey: ['users'] });
  },
});
```

### Global State (Zustand or Context)
```tsx
// Simple global state with Zustand
const useStore = create<Store>((set) => ({
  theme: 'light',
  setTheme: (theme) => set({ theme }),
}));
```

## Styling Best Practices

### Tailwind CSS
```tsx
<div className="flex items-center gap-4 p-4 bg-white rounded-lg shadow-md">
  <span className="text-lg font-semibold text-gray-900">
    {title}
  </span>
</div>
```

### CSS Modules (when needed)
```tsx
import styles from './Component.module.css';

<div className={styles.container}>
  <span className={styles.title}>{title}</span>
</div>
```

### Styled Components / Emotion (if used)
```tsx
const Container = styled.div`
  display: flex;
  align-items: center;
  padding: ${({ theme }) => theme.spacing.md};
`;
```

## Performance Optimization

### Memoization
```tsx
// Memoize expensive computations
const expensiveValue = useMemo(() => {
  return computeExpensiveValue(data);
}, [data]);

// Memoize callbacks
const handleClick = useCallback((id: string) => {
  onAction(id);
}, [onAction]);

// Memoize components
const MemoizedComponent = memo(function Component({ data }: Props) {
  return <div>{data.value}</div>;
});
```

### Code Splitting
```tsx
// Route-based splitting
const Page = lazy(() => import('./Page'));

// Component-based splitting
const HeavyComponent = lazy(() => import('./HeavyComponent'));
```

### Virtual Lists
```tsx
import { useVirtualizer } from '@tanstack/react-virtual';

function VirtualList({ items }: { items: Item[] }) {
  const parentRef = useRef<HTMLDivElement>(null);
  
  const virtualizer = useVirtualizer({
    count: items.length,
    getScrollElement: () => parentRef.current,
    estimateSize: () => 50,
  });
  
  return (
    <div ref={parentRef} style={{ height: '400px', overflow: 'auto' }}>
      <div style={{ height: virtualizer.getTotalSize() }}>
        {virtualizer.getVirtualItems().map((virtualItem) => (
          <div key={virtualItem.key} style={{
            position: 'absolute',
            top: virtualItem.start,
            height: virtualItem.size,
          }}>
            {items[virtualItem.index].name}
          </div>
        ))}
      </div>
    </div>
  );
}
```

## TypeScript Best Practices

### Type Definitions
```tsx
// Props interfaces
interface ButtonProps {
  variant: 'primary' | 'secondary' | 'danger';
  size?: 'sm' | 'md' | 'lg';
  onClick: () => void;
  children: React.ReactNode;
}

// API response types
interface ApiResponse<T> {
  data: T;
  meta: {
    page: number;
    total: number;
  };
}

// Utility types
type PartialUser = Partial<User>;
type RequiredUser = Required<User>;
type UserKeys = keyof User;
```

### Strict Null Checks
```tsx
// Handle potentially null values
const user = useUser();

if (!user) {
  return <NotFound />;
}

// Now TypeScript knows user is defined
return <UserProfile user={user} />;
```

## Error Handling

### Error Boundaries
```tsx
import { ErrorBoundary } from 'react-error-boundary';

function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
  return (
    <div role="alert">
      <p>Something went wrong:</p>
      <pre>{error.message}</pre>
      <button onClick={resetErrorBoundary}>Try again</button>
    </div>
  );
}

<ErrorBoundary FallbackComponent={ErrorFallback}>
  <MyComponent />
</ErrorBoundary>
```

## Testing

### Component Tests
```tsx
import { render, screen, fireEvent } from '@testing-library/react';

describe('Button', () => {
  it('calls onClick when clicked', () => {
    const onClick = vi.fn();
    render(<Button onClick={onClick}>Click me</Button>);
    
    fireEvent.click(screen.getByRole('button'));
    
    expect(onClick).toHaveBeenCalledOnce();
  });
});
```

### Hook Tests
```tsx
import { renderHook, act } from '@testing-library/react';

describe('useCounter', () => {
  it('increments count', () => {
    const { result } = renderHook(() => useCounter());
    
    act(() => {
      result.current.increment();
    });
    
    expect(result.current.count).toBe(1);
  });
});
```

## Resource Files

For detailed patterns, see:
- [component-patterns.md](resources/component-patterns.md)
- [state-management.md](resources/state-management.md)
- [performance.md](resources/performance.md)
- [testing.md](resources/testing.md)

© Bbeierle12 · MIT · Bbeierle12/Skill-MCP-Claude

Similar skills

All skills for Frontend and UI →

frontend-dev-guidelines by other authors comes first.

From the same set19

The whole set →
gsap-react gsap-react — a skill for Claude Code, Codex, Cursor and other agents covering GSAP integration patterns inside React. Handles the useGSAP hook, ref strategies, animation cleanup on unmount, and context management. CX Codex +1 728installs gsap-scrolltrigger A skill for GSAP ScrollTrigger: tie animations to scroll position, pin sections, build parallax and snap points. Useful when a page has to react to scrolling. CX Codex +1 612installs gsap-fundamentals gsap-fundamentals is a Claude Code skill covering GSAP tweens, timelines, easing, and animation properties. It explains adding motion to UI elements and getting started with GSAP. CX Codex +1 286installs shader-effects This skill provides GLSL patterns for glow, distortion, grain, glitch, and other shader effects. Use it for post-processing or stylized rendering. CX Codex +1 225installs d3js-visualization d3js-visualization teaches the agent to write D3.js charts: bars, lines, pies, tooltips, zoom. Useful when the visual has to be coded rather than pulled from a chart library. CX Codex +1 189installs particles-gpu particles-gpu generates GPU-accelerated particle systems for Three.js and React Three Fiber. Ideal for rendering thousands to millions of points smoothly. CX Codex +1 173installs shader-fundamentals The shader-fundamentals skill covers GLSL basics, from vertex and fragment shaders to coordinates, types, and data flow. Use it when building or debugging shader code. CX Codex +1 173installs gsap-sequencing The gsap-sequencing skill guides complex GSAP timelines with labels, nested sequences, callbacks, and precise placement. Use it for coordinated UI motion. CX Codex +1 163installs

Project sponsors

Companies that keep this analytics open