Skip to main content

Why Templates Matter

Bad prompts → hallucinated code → wasted debugging time. Good prompts → validated code → fast shipping.

The Template

Every delegate:cursor ticket should include:
**Task**: One-sentence description

**Files to create/modify**:
- `path/to/file.ts`
- `path/to/other-file.ts`

**Requirements**:
- Bullet list of specs
- Be specific about behavior
- Include edge cases

**Validation**:
- Check SCHEMA.md for [specific table]
- Follow existing patterns in [specific file]

**Parallel safe**: ✅/❌ (can this run alongside other tasks?)

**Depends on**: [ticket IDs] or None

Examples

Bad Prompt (Vague)

Build the dashboard
❌ No files specified
❌ No requirements
❌ No validation reference
❌ No dependency info

Good Prompt (Cursor-Ready)

**Task**: Create dashboard layout component

**Files to create**:
- `app/(dashboard)/layout.tsx`
- `app/(dashboard)/page.tsx`

**Requirements**:
- Sidebar with navigation (Clients, Projects, Analytics)
- Header with user menu dropdown
- Protected route (redirect if no session)
- Use Supabase server client from @trendingsociety/db

**Validation**:
- Check SCHEMA.md for user table structure
- Follow existing auth patterns in app/(auth)/

**Parallel safe**: ✅ (no conflicts with other tasks)

**Depends on**: None
✅ Exact file paths
✅ Specific component requirements
✅ References existing patterns
✅ Dependency info included

Template by Task Type

New Component

**Task**: Create [ComponentName] component

**Files to create**:
- `app/[path]/[component].tsx`
- `app/[path]/[component].test.tsx` (if complex)

**Requirements**:
- Props: [list props and types]
- Behavior: [describe what it does]
- Styling: Use Tailwind, follow existing patterns in packages/ui

**Validation**:
- Import from @trendingsociety/ui where possible
- Check similar components in packages/ui/src

**Parallel safe**: ✅
**Depends on**: None

Database Migration

**Task**: Add [table_name] table

**Files to create**:
- `supabase/migrations/[timestamp]_add_[table_name].sql`

**Requirements**:
- Columns: [list columns with types]
- Foreign keys: [list relationships]
- RLS: [describe access rules]
- Indexes: [list indexes needed]

**Validation**:
- Check SCHEMA.md for existing patterns
- Verify FK targets exist
- Test RLS policies

**Parallel safe**: ❌ (database changes)
**Depends on**: None

API Route

**Task**: Create [resource] API route

**Files to create**:
- `app/api/[resource]/route.ts`

**Requirements**:
- GET: [describe response]
- POST: [describe payload and response]
- Auth: [auth requirements]
- Error handling: Return proper status codes

**Validation**:
- Check SCHEMA.md for [table] structure
- Follow patterns in existing API routes

**Parallel safe**: ✅
**Depends on**: [migration ticket if new table]

Bug Fix

**Task**: Fix [description of bug]

**Files to modify**:
- `path/to/buggy/file.ts`

**Problem**:
- Current behavior: [what happens]
- Expected behavior: [what should happen]

**Solution approach**:
- [Suggested fix]

**Validation**:
- Test case: [how to verify fix]

**Parallel safe**: ✅
**Depends on**: None

Prompt Engineering Tips

Be Specific About Files

# ❌ Bad
Create a new component

# ✅ Good
Create `app/(dashboard)/clients/page.tsx`

Reference Existing Patterns

# ❌ Bad
Use our database

# ✅ Good
Import { supabase } from '@trendingsociety/db'
Follow the pattern in app/(dashboard)/projects/page.tsx

Include Edge Cases

# ❌ Bad
Handle errors

# ✅ Good
If query fails, show error toast and log to console
If no data, show empty state with "No clients yet" message
If unauthorized, redirect to /login

Specify Response Format

# ❌ Bad
Return the data

# ✅ Good
Return: { data: Client[], error: null } on success
Return: { data: null, error: string } on failure

Prompt Library

Common prompts are stored in ts-prompt-library repo:
CategoryDescription
editorial/Content generation prompts
verticals/Industry-specific prompts
automation/Workflow prompts

Validation Workflow

How to prevent hallucinations