Files
evig/docs/development/cursor.md
894b203602 docs: sync docs with actual stack (#447)
Docs truth-sweep against ground truth (package.json, CI workflows):
- npm → pnpm across evergreen docs (pnpm 11.25.0 is the package manager;
  npx tsx → pnpm exec tsx, npx ts-prune/jscpd → pnpm dlx, npm ci →
  pnpm install --frozen-lockfile, package-lock.json → pnpm-lock.yaml)
- Jest → Vitest in README, CONTRIBUTING, COMMANDS (vitest 4 is installed)
- Node claims: README 20+ → 22.13+ (engines) with CI/deploy on 24;
  deployment.md "Setup Node 20 (npm cache)" → Node 24 (pnpm cache), and
  the pipeline line now shows `pnpm run verify` as CI actually runs
- TypeScript 5.x claims → 6 (typescript ^6.0.3); Next.js 14 → 16 in
  BLOG_SYSTEM, guides/ARCHITECTURE, AI_BOT_SYSTEM_PROMPT
- COMMANDS.md: dropped nonexistent `dev:cms` script; services list fixed
  to db/meilisearch/listmonk (no redis in compose)
- HR_RUNBOOK: `npm run test -- src/…` → `pnpm run test src/…` (pnpm
  passes args without the `--` separator)

Historical records (docs/archive/**, dated audit reports, UPGRADE_PLAN)
left as-is — they describe what was true when written.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 15:01:39 +00:00

10 KiB

created_date, last_modified_date, last_modified_summary
created_date last_modified_date last_modified_summary
2026-01-30 2026-01-06 Updated to clarify this is a human reference guide; AI rules are in .cursorrules and .cursor/rules/

Cursor IDE Reference Guide for Humans

For developers and team members using Cursor IDE

Note for AI Agents: This is a human reference guide. Cursor AI automatically reads project rules from:

  • .cursorrules (main rules file)
  • .cursor/rules/*.mdc (modular rule files)

Purpose: This document helps human developers understand how to use Cursor IDE effectively when working on the RevampIT codebase.


Quick Start

Before starting any task:

  1. ✅ Read docs/development/DEV_GUIDE.md - Core development principles
  2. ✅ Read docs/BEST_PRACTICES.md - Critical AI slop prevention
  3. ✅ Read DEVELOPMENT_GUIDELINES.md - File deletion protection rules
  4. ✅ Use semantic search before creating ANY new file

Cursor-Specific Capabilities

Available Tools

Cursor provides access to:

  • ✅ File operations - Read, write, edit, delete (with caution!)
  • ✅ Terminal commands - Run npm, git, docker commands
  • ✅ Codebase search - Semantic and grep search
  • ✅ Browser automation - Test web features via MCP
  • ✅ MCP servers - Supabase, Context7, browser tools
  • ✅ Linter access - Read and fix linting errors

Key Advantages

  1. Context Awareness - Cursor has access to open files and recent context
  2. Multi-file Editing - Can edit multiple files in one operation
  3. Terminal Integration - Can run commands and see output
  4. Real-time Feedback - Can check linter errors immediately

Cursor-Specific Best Practices

1. Always Search Before Creating

Use semantic search first:

Before creating: src/components/products/ProductCard.tsx
Search for: "product card component"

Check for existing files:

# Use glob_file_search or grep
glob_file_search: **/ProductCard.tsx
grep: ProductCard

2. Use Multi-file Operations Wisely

✅ GOOD: Edit related files together

// When adding a new feature:
// 1. Create component
// 2. Create hook
// 3. Update types
// 4. Add to page
// All in one operation when related

❌ BAD: Making unrelated changes together

// Don't mix:
// - Fixing a bug in auth
// - Adding a new product feature
// - Updating documentation
// All in one operation

3. Leverage Terminal Commands

Use terminal for verification:

# After creating files, verify they work
pnpm run lint
pnpm run build
pnpm run test

# Check git status
git status

# Verify services are running
docker compose ps

4. Check Linter Errors Immediately

After making changes:

// Always check linter errors
read_lints: ['src/components/new-component.tsx']

Fix errors before proceeding:

  • Don't leave linting errors
  • Fix TypeScript errors immediately
  • Ensure code compiles

5. Use Browser Tools for Testing

When working on UI features:

// Use browser MCP tools to test
// 1. Navigate to page
// 2. Take snapshot
// 3. Interact with elements
// 4. Verify behavior

Critical Rules for Cursor Agents

File Deletion Protection

⚠️ NEVER delete files without explicit user approval

Before deleting ANY file:

  1. ✅ Ask user explicitly
  2. ✅ Show what will be deleted
  3. ✅ Explain impact
  4. ✅ Wait for confirmation

Protected files (NEVER delete):

  • Migration files (supabase/migrations/*)
  • Core config files
  • Documentation files
  • .env files

AI Slop Prevention

Before creating ANY new file:

  1. ✅ Search codebase thoroughly (semantic + grep)
  2. ✅ Check for similar functionality
  3. ✅ Verify naming conventions
  4. ✅ Ensure no duplicates exist

Red flags to avoid:

  • 🚩 Creating Button.tsx when components/ui/Button.tsx exists
  • 🚩 Creating utils.ts when lib/utils.ts exists
  • 🚩 Duplicating existing patterns

Code Quality

Always:

  • ✅ Use TypeScript strict mode
  • ✅ Follow existing patterns
  • ✅ Use src/lib/logger.ts instead of console.log
  • ✅ Handle errors properly
  • ✅ Write self-documenting code

Never:

  • ❌ Use any types
  • ❌ Leave console.log statements
  • ❌ Create duplicate functionality
  • ❌ Mix different patterns

Cursor Workflow Patterns

Pattern 1: Adding a New Feature

// Step 1: Search for existing patterns
codebase_search: "How are similar features implemented?"

// Step 2: Check for existing components
glob_file_search: **/SimilarComponent.tsx

// Step 3: Create new files following existing patterns
// - Component file
// - Types file (if needed)
// - Hook file (if needed)

// Step 4: Integrate into existing code
// - Add to page/route
// - Update navigation if needed

// Step 5: Verify
// - Check linter errors
// - Run tests
// - Test in browser

Pattern 2: Fixing a Bug

// Step 1: Understand the bug
// - Read error messages
// - Check logs
// - Reproduce issue

// Step 2: Find root cause
// - Search for related code
// - Check error handling
// - Review recent changes

// Step 3: Fix the issue
// - Make minimal changes
// - Follow existing patterns
// - Add error handling if needed

// Step 4: Verify fix
// - Test the fix
// - Check for regressions
// - Update tests if needed

Pattern 3: Refactoring

// Step 1: Analyze current code
// - Identify duplication
// - Find patterns to extract

// Step 2: Propose refactor
// - Explain what will change
// - Show benefits
// - Get approval

// Step 3: Execute refactor
// - Extract shared code
// - Update all usages
// - Maintain functionality

// Step 4: Verify
// - Run tests
// - Check linter
// - Verify no regressions

Common Tasks

Creating a New Component

// 1. Check if similar component exists
codebase_search: "product card component"

// 2. Create component following pattern
// src/components/products/ProductCard.tsx
'use client';

import Image from 'next/image';
import Link from 'next/link';

interface ProductCardProps {
  product: Product;
}

export function ProductCard({ product }: ProductCardProps) {
  return (
    <Link href={`/products/${product.id}`}>
      <div className="rounded-lg border p-4">
        <Image src={product.image} alt={product.name} />
        <h3>{product.name}</h3>
      </div>
    </Link>
  );
}

// 3. Check linter
read_lints: ['src/components/products/ProductCard.tsx']

// 4. Export from index if needed

Creating an API Route

// 1. Check existing API patterns
codebase_search: "API route handler pattern"

// 2. Create route following pattern
// src/app/api/products/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { logger } from '@/lib/logger';

export async function GET(request: NextRequest) {
  try {
    const products = await fetchProducts();
    return NextResponse.json({ success: true, data: products });
  } catch (error) {
    logger.error('Failed to fetch products', { error });
    return NextResponse.json(
      { success: false, error: 'Failed to fetch products' },
      { status: 500 }
    );
  }
}

// 3. Verify it works
run_terminal_cmd: curl http://localhost:3000/api/products

Updating Documentation

// 1. Find relevant documentation
glob_file_search: **/*DEV_GUIDE*.md

// 2. Update with new information
// - Update last_modified_date
// - Add last_modified_summary
// - Update content

// 3. Ensure frontmatter is correct
---
created_date: YYYY-MM-DD
last_modified_date: YYYY-MM-DD
last_modified_summary: Description of changes
---

Error Handling in Cursor

When You Encounter Errors

1. Read error messages carefully

// Check terminal output
// Check linter errors
// Check browser console

2. Search for similar errors

codebase_search: "How is this error handled elsewhere?"

3. Fix systematically

// - Fix TypeScript errors first
// - Fix linting errors
// - Fix runtime errors
// - Test after each fix

Common Error Patterns

TypeScript Errors:

// ❌ BAD: Using any
function process(data: any) { ... }

// ✅ GOOD: Proper typing
function process<T>(data: T): ProcessedData<T> { ... }

Linting Errors:

// ❌ BAD: console.log
console.log('Debug:', data);

// ✅ GOOD: Use logger
import { logger } from '@/lib/logger';
logger.debug('Debug info', { data });

Testing in Cursor

Use Browser Tools

// 1. Start dev server
run_terminal_cmd: pnpm run dev

// 2. Navigate to page
browser_navigate: http://localhost:3000/products

// 3. Take snapshot
browser_snapshot

// 4. Interact with page
browser_click: element="Add to cart button"

// 5. Verify behavior
browser_snapshot

Use Terminal Commands

# Run tests
pnpm run test

# Run linter
pnpm run lint

# Check build
pnpm run build

# Check services
docker compose ps

Quick Reference

Essential Commands

# Development
pnpm run dev              # Start dev server
pnpm run d                # Start all services
pnpm run lint             # Check code quality
pnpm run test             # Run tests
pnpm run build            # Build for production

# Git
git status               # Check changes
git diff                 # See differences
git log --oneline        # Recent commits

Key Files to Reference

  • docs/development/DEV_GUIDE.md - Main development guide
  • docs/BEST_PRACTICES.md - Best practices and AI slop prevention
  • DEVELOPMENT_GUIDELINES.md - File deletion protection
  • docs/guides/ARCHITECTURE.md - System architecture

Cursor-Specific Tips

  1. Use semantic search before creating anything
  2. Check linter errors after every change
  3. Test in browser for UI changes
  4. Run terminal commands to verify
  5. Never delete files without approval

Remember

  • ✅ Search before creating - Always check for existing code
  • ✅ Follow patterns - Consistency is key
  • ✅ Test your changes - Use browser and terminal tools
  • ✅ Check linter - Fix errors immediately
  • ✅ Protect files - Never delete without approval
  • ✅ Prevent AI slop - No duplicates, no conflicts

When in doubt, ask the user or search the codebase!


Last Updated: 2026-01-30
For: Cursor Cloud Code (Composer) agents