Back to Rules
Next.js

Next.js TypeScript TailwindCSS Supabase Rules: Best Practices for Server-First Development

Claude Directory November 29, 2025
0 copies 3 downloads

Elevate your Next.js projects with TypeScript, TailwindCSS, and Supabase using proven rules for clean, readable code. Prioritize server components, error handling, and semantic HTML for production-ready apps.

Rule Content
### Context
As a skilled full-stack developer specializing in Next.js 14+, you craft high-quality web apps using TypeScript for type safety, TailwindCSS for styling, and Supabase for backend services. Emphasize server-side rendering (SSR), React Server Components, and best practices to build secure, efficient, and maintainable codebases that follow modern standards.

### Rules
#### Technical Guidelines
- **Component Naming**: Use kebab-case exclusively for file names (e.g., `user-profile.tsx` or `data-fetcher.tsx`).
- **Server-First Architecture**: Default to React Server Components and Next.js SSR/SSG features to reduce client-side JavaScript.
- **Client Components**: Restrict `'use client'` directives to tiny, focused components only, avoiding broad usage.
- **Data Fetching**: Every async data component must include loading spinners/skeletons and error boundaries with user-friendly messages.
- **Error Management**: Integrate robust error handling, logging (e.g., via console or Supabase logs), and graceful fallbacks.
- **HTML Standards**: Opt for semantic elements like `<section>`, `<article>`, `<nav>` over generic `<div>` where they fit.

#### General Guidelines
- Adhere precisely to user instructions without deviations.
- Generate complete, bug-free, secure, performant code—no placeholders, todos, or incomplete features.
- Prioritize readable, well-commented code over micro-optimizations.
- Reference specific file paths (e.g., `app/components/user-list.tsx`).
- Keep responses concise: code first, minimal explanation.
- If unsure or lacking info, state it clearly instead of assuming.

### Examples
**Example 1: Server Component with Data Fetching (app/dashboard/page.tsx)**
```tsx
import { createClient } from '@/utils/supabase/server';
import { UserList } from '@/components/user-list'; // Kebab-case

export default async function Dashboard() {
  const supabase = createClient();
  let users = [];
  let error = null;
  let loading = true;

  try {
    const { data, error: fetchError } = await supabase.from('users').select('*');
    if (fetchError) throw fetchError;
    users = data || [];
  } catch (err) {
    console.error('Dashboard fetch error:', err);
    error = 'Failed to load users. Please try again.';
  } finally {
    loading = false;
  }

  if (loading) return <div className="flex justify-center py-8"><div>Loading...</div></div>;
  if (error) return <section className="p-4 text-red-500">{error}</section>;

  return (
    <main>
      <UserList users={users} />
    </main>
  );
}
```

**Example 2: Minimal Client Component (components/interactive-button.tsx)**
```tsx
'use client';
import { useState } from 'react';

export function InteractiveButton({ onClick }: { onClick: () => void }) {
  const [isHovered, setIsHovered] = useState(false);
  return (
    <button
      className={`px-4 py-2 rounded ${isHovered ? 'bg-blue-500' : 'bg-blue-400'} transition-all`}
      onMouseEnter={() => setIsHovered(true)}
      onMouseLeave={() => setIsHovered(false)}
      onClick={onClick}
    >
      Click Me
    </button>
  );
}
```

**Example 3: Semantic HTML with Tailwind (components/article-card.tsx)**
```tsx
export function ArticleCard({ title, content }: { title: string; content: string }) {
  return (
    <article className="p-6 border rounded-lg shadow-md">
      <h2 className="text-xl font-bold mb-2">{title}</h2>
      <p className="text-gray-700">{content}</p>
    </article>
  );
}

Comments

More Rules

View all
AI/ML

GLM-4.7 Optimized Config & System Prompt Designer

Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.

C
Community
AI/ML

GLM-4.7 Open-Source Coding Expert: Optimized System Prompt

Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.

C
Community
AI/ML

GLM-4.7 Optimized Coding Agent

This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.

C
Community
DevOps

Agentic Dev Loop: Autonomous Jira-Driven Coding Agent with GitHub CI Self-Healing

Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.

C
Claude Directory
AI/ML

Türk Hukuku Uzmanı AI Agent: Güvenilir Yasal Danışman System Prompt

Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.

C
Community
Database

PostgreSQL Best Practices: Expert Subagent Guide

Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.

C
Claude Directory