agentleFS
code-geekcode-geek/ai-project-template/frontend/CLAUDE.md

ai-project-template / frontend

CLAUDE.md9 starsChanged 16 months agoMITView on GitHub

  • Reads credentials

The file

We split this CLAUDE.md into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    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:

    Use Server Components by default

    line 144
  2. Distinctive:

    Add 'use client' only when needed

    line 145
  3. Distinctive:

    Keep components small and focused

    line 146
  4. Distinctive:

    Follow Tailwind CSS conventions

    line 148
  5. Distinctive:

    Test critical user flows with Playwright

    line 149

≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “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
CLAUDE.md

Frontend AI Instructions

🏗️ Frontend Architecture

  • Framework: Next.js 15 with App Router
  • Language: TypeScript (strict mode)
  • Styling: Tailwind CSS + shadcn/ui
  • State: Zustand for global state
  • API Client: Native fetch with typed wrappers

📁 Project Structure

src/
├── app/              # Next.js App Router
│   ├── layout.tsx   # Root layout
│   ├── page.tsx     # Home page
│   └── (auth)/      # Auth group
├── components/
│   ├── ui/          # shadcn/ui components
│   └── features/    # Feature components
├── lib/
│   ├── api.ts       # API client
│   └── utils.ts     # Utilities
└── types/           # TypeScript types

📝 Component Patterns

Server Components (default)

// app/products/page.tsx
export default async function ProductsPage() {
  const products = await getProducts()

  return (
    <div>
      {products.map(product => (
        <ProductCard key={product.id} product={product} />
      ))}
    </div>
  )
}

Client Components

'use client'

import { useState } from 'react'

export function Counter() {
  const [count, setCount] = useState(0)

  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  )
}

🎨 UI Components

Adding shadcn/ui components

npx shadcn@latest add button
npx shadcn@latest add form
npx shadcn@latest add dialog

Component usage

import { Button } from '@/components/ui/button'
import { Dialog } from '@/components/ui/dialog'

export function MyComponent() {
  return (
    <Button variant="outline" size="sm">
      Click me
    </Button>
  )
}

🔧 Common Tasks

Create new page

# Create directory and page
mkdir -p src/app/products
touch src/app/products/page.tsx

API Integration

// lib/api.ts
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000/api'

export async function getProducts() {
  const res = await fetch(`${API_BASE}/products/`)
  if (!res.ok) throw new Error('Failed to fetch')
  return res.json()
}

State Management

// stores/auth.ts
import { create } from 'zustand'

interface AuthState {
  user: User | null
  login: (user: User) => void
  logout: () => void
}

export const useAuthStore = create<AuthState>((set) => ({
  user: null,
  login: (user) => set({ user }),
  logout: () => set({ user: null }),
}))

🧪 Testing

# Run E2E tests
npm run test:e2e

# Run with UI
npm run test:e2e:ui

🛡️ Best Practices

  • Use Server Components by default
  • Add 'use client' only when needed
  • Keep components small and focused
  • Use TypeScript strictly
  • Follow Tailwind CSS conventions
  • Test critical user flows with Playwright

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.