Skip to content

Next.js, ShadCN, and tailwindcss v4 project template with custom claude code and superdesign instructions.

chrisdevelops/claude-code-nextjs-project

Repository files navigation

Claude Custom Commands - Developer Guide

Table of Contents

  1. Overview
  2. File Structure
  3. How Commands Work
  4. Available Commands
  5. Workflow Examples
  6. Understanding Component Decomposition
  7. Context Loading Strategy
  8. Tech Stack Reference
  9. Security & Quality Guardrails
  10. File Organization
  11. Common Issues & Solutions
  12. Tips & Best Practices
  13. Extending Commands
  14. Getting Help
  15. Summary

Overview

This project uses custom Claude commands to streamline the development workflow. Commands are organized into two main categories:

  1. Super Design - For creating UI/UX mockups and designs
  2. Implement - For transforming mockups into production Next.js code

File Structure

.claude/
├── instructions.md                    # Claude Code CLI entry point (redirects to CLAUDE.md)
├── commands/
│   ├── implement/
│   │   ├── command.md                # Implementation workflow
│   │   ├── tech-stack.md             # Tech stack reference
│   │   ├── patterns.md               # Code conventions
│   │   ├── security.md               # Security checklist
│   │   └── component-guide.md        # Component hierarchy guide
│   └── superdesign/
│       ├── command.md                # Super Design slash commands
│       ├── style-taxonomy.json       # 35+ design styles database
│       └── (other Super Design files)
├── context/
│   └── folder-structure.md           # Project structure reference
└── (Claude instructions directory)

CLAUDE.md                              # Main instructions (desktop app + reference)
README-CLAUDE-COMMANDS.md              # This file

How Commands Work

Desktop App (claude.ai)

What gets loaded automatically:

  • CLAUDE.md - Main instructions
  • .claude/instructions.md - CLI instructions (if using Claude Code)

How to use commands:

Since the desktop app doesn't support native slash commands, use natural language triggers:

You: "implement hero_landing_1.html as a landing page"
Claude: [Reads CLAUDE.md → Sees "implement" trigger → Loads command.md → Executes workflow]
You: "create a design mockup for a landing page"
Claude: [Reads CLAUDE.md → Sees design trigger → Loads superdesign commands → Guides through process]

Claude Code CLI

What gets loaded automatically:

  • .claude/instructions.md - Entry point (redirects to CLAUDE.md)
  • All commands in .claude/commands/ are available as slash commands

How to use commands:

# In your terminal
claude-code

# Use slash commands directly
/superdesign-start
/implement hero_landing_1.html --route=/landing --test

Available Commands

Super Design Commands

These commands help you create UI/UX mockups before implementation.

/superdesign-start

Full guided workflow with step-by-step confirmations

/superdesign-start

Process:

  1. Layout (ASCII wireframes) → [User approval]
  2. Theme (CSS with style matching) → [User approval]
  3. Animation (micro-syntax specs) → [User approval]
  4. Build (final HTML) → Complete

Use when: You want a complete, guided design process from scratch

Output:

  • ASCII wireframes
  • CSS theme file (.superdesign/design_iterations/theme_N.css)
  • Animation specifications
  • Final HTML (.superdesign/design_iterations/design_name_N.html)

/superdesign-layout

Generate ASCII wireframe layouts

/superdesign-layout

Use when: You need to visualize layout structure before styling

Output: Text-based ASCII wireframes showing component hierarchy


/superdesign-theme

Generate CSS theme with design system

/superdesign-theme

Process:

  1. Reads style-taxonomy.json (35+ design styles)
  2. Matches your description to 2-3 relevant styles
  3. Generates complete CSS with OKLCH colors, fonts, spacing, shadows
  4. Saves to .superdesign/design_iterations/theme_N.css

Use when: You need a complete design system/theme

Example:

You: "Create a theme that feels modern and tech-forward but also calm"
Claude: [Matches "tech-modern" + "calm-serene" styles → Generates theme]

/superdesign-animate

Design animation specifications

/superdesign-animate

Output: Animation specs in micro-syntax format:

element: duration easing [properties] +delay
hero-title: 0.8s easeOut [opacity, translateY] +0.2s

Use when: You need animation strategy before implementation


/superdesign-build

Generate final production-ready HTML

/superdesign-build

Output:

  • Complete single-file HTML with all scripts, styles, and content
  • References theme CSS from previous step
  • Implements animations
  • Includes Tailwind, Flowbite, Lucide icons
  • Saved to .superdesign/design_iterations/{design_name}_N.html

Use when: Ready to generate the final design file


/superdesign-iterate

Modify existing designs

/superdesign-iterate

Process:

  1. Reads existing design files
  2. Makes targeted changes
  3. Creates new iteration: {original_name}_{iteration}.html

Use when: You want to modify/improve an existing design


/superdesign-analyze-style

Explore and match design styles

/superdesign-analyze-style

Output:

  • Analyzes your description
  • Identifies 3-5 matching styles with reasoning
  • Suggests top 2-3 styles to combine
  • Flags conflicting styles to avoid

Use when: You want to explore style options before committing


Implementation Commands

These commands transform Super Design mockups into production Next.js code.

/implement

Transform mockup into production Next.js code

/implement [design-file] [--route=/path] [--type=page|component] [--test]

Examples:

# Basic implementation
/implement hero_landing_1.html --route=/landing

# With tests
/implement dashboard_analytics.html --route=/dashboard/analytics --test

# Component only (no full page)
/implement button_variants.html --type=component

# Preview decomposition plan without generating
/implement pricing_page.html --preview

Process:

Phase 1: Analysis & Decomposition

  1. Reads Super Design HTML file from .superdesign/design_iterations/
  2. Analyzes structure and identifies all UI patterns
  3. Maps to component hierarchy (primitives → blocks → layouts → containers)
  4. Checks for existing components (reuses, doesn't duplicate)
  5. Presents decomposition plan for approval

Phase 2: Generation

  1. Generates primitives (base UI elements)
  2. Generates blocks (composed patterns)
  3. Generates layouts (structure components)
  4. Generates containers (smart components with data)
  5. Generates page (orchestrates everything)
  6. Generates tests (if --test flag)

Phase 3: Validation

  1. Applies security guardrails
  2. Ensures accessibility (WCAG AAA)
  3. Optimizes performance
  4. Validates TypeScript types

Example Output:

📋 Component Decomposition Plan

Analyzing: hero_landing_1.html

Found Components:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PRIMITIVES (3 new + 2 existing)
  ✓ Button → Use shadcn
  ✓ Input → Use shadcn  
  + VideoPlayer.tsx → NEW
  + GradientBadge.tsx → NEW
  + IconCard.tsx → NEW

BLOCKS (8 new)
  + Navigation.tsx → NEW
  + HeroSection.tsx → NEW
  + FeatureCard.tsx → NEW
  + TestimonialCard.tsx → NEW
  + Carousel.tsx → NEW
  + PricingCard.tsx → NEW
  + FAQItem.tsx → NEW
  + NewsletterForm.tsx → NEW

LAYOUTS (2 new)
  + FeatureGrid.tsx → NEW
  + SectionWrapper.tsx → NEW

CONTAINERS (1 new)
  + LandingPageContainer.tsx → NEW

PAGE (1 new)
  + app/landing/page.tsx → NEW

TOTAL: 15 new files + 2 existing components

Proceed with generation? [y/n]

Flags:

  • --route=/path - Target route in app directory (e.g., /landing, /dashboard/analytics)
  • --type=page|component - Generate full page or reusable component (default: page)
  • --test - Generate test files (Vitest + React Testing Library)
  • --preview - Show decomposition plan without generating files
  • --approve-all - Skip approval step, generate all files immediately

Workflow Examples

Example 1: Creating a Landing Page (Full Flow)

Step 1: Design Phase

# Desktop App:
You: "Create a modern landing page design with hero, features, and pricing"

# Claude Code CLI:
/superdesign-start

Claude guides you through:

  1. Layout wireframes → You approve
  2. Theme generation → You approve
  3. Animation specs → You approve
  4. Final HTML build → Complete

Output: .superdesign/design_iterations/landing_modern_1.html


Step 2: Implementation Phase

# Desktop App:
You: "Implement landing_modern_1.html as a landing page with tests"

# Claude Code CLI:
/implement landing_modern_1.html --route=/landing --test

Claude:

  1. Shows decomposition plan (15+ components)
  2. You approve
  3. Generates all files:
    • src/components/primitives/ (3 files)
    • src/components/blocks/ (8 files)
    • src/components/layouts/ (2 files)
    • src/components/containers/ (1 file)
    • src/app/landing/page.tsx (1 file)
    • Test files (if --test)

Example 2: Iterating on Existing Design

# Desktop App:
You: "Iterate on landing_modern_1.html - make the CTA more prominent and add social proof"

# Claude Code CLI:
/superdesign-iterate

Claude:

  1. Reads existing landing_modern_1.html
  2. Makes targeted changes
  3. Creates landing_modern_1_2.html (new iteration)

Then re-implement:

/implement landing_modern_1_2.html --route=/landing --approve-all

Example 3: Just Need a Component

# Create button variants mockup
/superdesign-build

# Implement as reusable component
/implement button_variants.html --type=component

Output: Just the button component in src/components/primitives/


Example 4: Complex Dashboard

Design Phase:

/superdesign-start
# Create dashboard with charts, tables, filters

Implementation Phase:

/implement dashboard_analytics.html --route=/dashboard/analytics --test --preview

Claude shows:

📋 Component Decomposition Plan

Found Components: 25 files
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

PRIMITIVES (6)
  + MetricDisplay.tsx
  + Badge.tsx (custom variant)
  ...

BLOCKS (12)
  + DashboardHeader.tsx
  + KPICard.tsx
  + LineChart.tsx
  + BarChart.tsx
  + DataTable.tsx
  + FilterPanel.tsx
  ...

LAYOUTS (3)
  + DashboardLayout.tsx
  + ChartGrid.tsx
  ...

CONTAINERS (2)
  + AnalyticsView.tsx
  + ReportsContainer.tsx

SERVER (2)
  + server/services/analytics.service.ts
  + server/actions/analytics.actions.ts

Estimated generation time: 3-5 minutes

You approve → Claude generates all 25 files


Understanding Component Decomposition

When Claude analyzes a Super Design mockup, it categorizes components into layers:

Primitives (src/components/primitives/)

Purpose: Single-responsibility UI atoms

Characteristics:

  • Reusable base elements
  • No business logic
  • No data fetching
  • Fully typed props
  • Variants via class-variance-authority

Examples: Button, Input, Card, Badge, Avatar, Icon, Text, Link

Creation rule:

  1. Check shadcn/ui first
  2. Only create if not available or needs customization

Blocks (src/components/blocks/)

Purpose: Composed UI patterns

Characteristics:

  • Composed from primitives
  • Can have local state (useState)
  • Event handlers
  • Form logic
  • No API calls

Examples: SearchBar, UserCard, NotificationItem, FeatureCard, PricingCard, Carousel, FAQItem


Layouts (src/components/layouts/)

Purpose: Page structure and positioning

Characteristics:

  • CSS Grid / Flexbox structures
  • Responsive breakpoints
  • Slot-based composition
  • No business logic

Examples: Grid, Flex, Stack, Container, Section, Sidebar, Header, Footer, DashboardLayout


Containers (src/components/containers/)

Purpose: Smart components with data/logic

Characteristics:

  • Data fetching (Server Components or hooks)
  • Business logic
  • Orchestrates blocks
  • Error boundaries
  • Loading states

Examples: UserProfileContainer, DashboardView, ShoppingCartContainer, MessageListContainer


Pages (src/app/*/page.tsx)

Purpose: Route endpoints

Characteristics:

  • Server Components by default
  • Metadata for SEO
  • Composes containers
  • Minimal logic

Context Loading Strategy

Commands are designed to load context progressively to avoid bloating the context window.

What's Always Loaded:

  • CLAUDE.md - Core instructions (~500 tokens)
  • .claude/instructions.md - CLI redirect (~100 tokens)

What's Loaded On-Demand:

  • .claude/commands/implement/command.md - When implementing
  • .claude/commands/implement/tech-stack.md - When needed
  • .claude/commands/implement/patterns.md - When needed
  • .claude/commands/implement/security.md - When needed
  • .claude/commands/implement/component-guide.md - When needed
  • .claude/commands/superdesign/* - When designing

Benefits:

  • ✅ Minimal initial context (~600 tokens)
  • ✅ Context loaded only when needed
  • ✅ More room for actual work
  • ✅ Faster responses

Tech Stack Reference

Commands automatically apply these technologies:

  • Framework: Next.js 15+ (App Router)
  • Runtime: React 19+ (Server Components + Client Components)
  • Language: TypeScript 5+ (strict mode)
  • Styling: Tailwind CSS v4
  • Backend: Hono (Node runtime)
  • Database: PostgreSQL
  • Build: Vite
  • Components: shadcn/ui (Radix primitives)
  • Icons: Lucide React
  • Forms: React Hook Form + Zod
  • Testing: Vitest + React Testing Library + Playwright
  • Deployment: Docker via Dokploy

Security & Quality Guardrails

All /implement commands automatically apply:

Security ✅

  • Authentication checks in Server Actions/API routes
  • Input validation with Zod
  • Environment variable protection
  • Secure cookies (HttpOnly, Secure, SameSite)
  • Security headers (CSP, X-Frame-Options, etc.)
  • Rate limiting on sensitive routes
  • SSRF prevention
  • File upload validation

Accessibility ✅

  • Semantic HTML
  • ARIA labels
  • Keyboard navigation
  • Focus management
  • Skip links
  • WCAG AAA compliance where possible

Performance ✅

  • Next.js Image optimization
  • Code splitting (dynamic imports)
  • Font optimization
  • Server Components by default
  • Lean bundle sizes

Code Quality ✅

  • TypeScript strict mode
  • No any without justification
  • Proper error handling
  • Consistent naming conventions
  • ESLint + Prettier compliance

File Organization

Generated files follow this structure:

src/
├── app/
│   ├── (auth)/
│   │   └── signin/page.tsx
│   ├── (marketing)/
│   │   └── landing/page.tsx          ← Generated by /implement
│   └── (dashboard)/
│       └── dashboard/page.tsx
├── components/
│   ├── primitives/                   ← Generated primitives
│   │   ├── Button.tsx
│   │   └── VideoPlayer.tsx
│   ├── blocks/                       ← Generated blocks
│   │   ├── HeroSection.tsx
│   │   └── FeatureCard.tsx
│   ├── layouts/                      ← Generated layouts
│   │   └── FeatureGrid.tsx
│   └── containers/                   ← Generated containers
│       └── LandingPageContainer.tsx
├── server/
│   ├── actions/                      ← Generated server actions
│   │   └── newsletter.actions.ts
│   └── services/
│       └── analytics.service.ts
└── types/
    └── landing.types.ts              ← Generated types

Common Issues & Solutions

Issue: "Command not found"

In Desktop App:

  • Slash commands don't work natively
  • Use natural language: "implement hero_landing_1.html as a landing page"

In Claude Code CLI:

  • Make sure you're in the project directory
  • Verify .claude/commands/ folder exists
  • Check command file names match exactly

Issue: "Too many files generated"

Solution: Use --preview flag first

/implement complex_design.html --preview

Review the decomposition plan, then proceed if acceptable.


Issue: "Component already exists"

Claude automatically checks for existing components and reuses them. If you want to regenerate:

# Desktop App:
You: "Regenerate the HeroSection component from landing_modern_1.html"

# CLI:
/implement landing_modern_1.html --type=component --approve-all

Issue: "Missing dependencies"

After generation, Claude lists required dependencies:

Dependencies Added:
  • embla-carousel-react
  • react-hook-form
  • zod

Install: npm install embla-carousel-react react-hook-form zod

Run the install command before testing.


Tips & Best Practices

1. Always Preview Complex Mockups

/implement complex_design.html --preview

Review the decomposition plan before generating 20+ files.


2. Use Iteration for Refinements

# Instead of regenerating everything:
/superdesign-iterate
# Make small changes, then:
/implement design_v2.html --approve-all

3. Generate Tests from the Start

/implement design.html --route=/landing --test

Easier than adding tests later.


4. Check Existing Components First

Before running /implement, check if similar components already exist in your codebase. Claude will reuse them, but it's good to know what you have.


5. Use Type-Specific Implementation

# For full pages:
/implement design.html --type=page

# For reusable components only:
/implement button_variants.html --type=component

6. Leverage Style Taxonomy

When using Super Design theme generation:

You: "Create a theme that feels luxurious but not overly formal, with a touch of playfulness"

Claude: [Analyzes → Matches "luxury" + "playful" styles → Generates cohesive theme]

The style taxonomy has 35+ styles to mix and match intelligently.


Extending Commands

Want to add more commands? Follow this pattern:

1. Create Command File

.claude/commands/your-command/command.md

2. Add Trigger in CLAUDE.md

### Your Command
**Trigger**: "your-command [args]"

**Process**:
1. Read `.claude/commands/your-command/command.md`
2. Follow the workflow

3. Use in Chat

You: "your-command with arguments"
Claude: [Executes workflow]

Getting Help

In Desktop App

You: "How do I implement a design mockup?"
Claude: [Explains /implement workflow]

In CLI

# Commands are documented in their command.md files
# Just ask Claude to explain:
/implement --help

Summary

Super Design Commands → Create mockups

  • /superdesign-start - Full guided workflow
  • /superdesign-theme - Generate CSS themes
  • /superdesign-build - Build HTML
  • /superdesign-iterate - Modify designs

Implementation Commands → Transform to production code

  • /implement - Full implementation workflow
  • Generates 10-30+ files per mockup
  • Applies security, accessibility, performance guardrails
  • Creates proper component hierarchy

Key Philosophy:

  • Progressive context loading (stay lean)
  • Component decomposition (not monolithic)
  • Security & accessibility by default
  • Production-ready from the start

Ready to build? Start with /superdesign-start to create a mockup, then /implement to bring it to life!

About

Next.js, ShadCN, and tailwindcss v4 project template with custom claude code and superdesign instructions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published