Cursor Commands
Community-curated commands for the Cursor AI editor stored in .cursor/commands/. Invoke with /command-name in chat to automate workflows.
3 commands
refactor-to-server-actions.md
23
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Refactor to Server Actions
## Command Prompt
Refactor the selected client component to use Next.js Server Actions instead of API route handlers.
**Current Pattern** (to be refactored):
```typescript
"use client";
export function MyForm() {
const handleSubmit = async (data) => {
const response = await fetch("/api/endpoint", {
method: "POST",
body: JSON.stringify(data),
});
// ...
};
}
/refactor-to-server-actionsMarkdown
create-supabase-migration.md
18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Create Supabase Migration
## Command Prompt
Generate a Supabase migration file based on the following schema requirements:
**Instructions**:
1. Create a new migration file in `supabase/migrations/`
2. Use timestamp naming: `YYYYMMDDHHMMSS_description.sql`
3. Include table creation with all columns and types
4. Add proper constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, CHECK)
5. Create indexes for performance
6. Enable Row Level Security (RLS)
7. Create RLS policies (SELECT, INSERT, UPDATE, DELETE)
8. Add triggers for updated_at timestamps
9. Create helper functions if needed
10. Include comments explaining complex logic
11. Add rollback section at the bottom (commented out)
/create-supabase-migrationMarkdown
generate-api-route-with-tests.md
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Generate API Route with Tests
## Command Prompt
Generate a new Next.js API route handler with the following specifications:
**Route**: `/api/[resource]/route.ts`
**Requirements**:
1. Create the route handler with GET, POST, PUT, and DELETE methods
2. Use TypeScript with strict types
3. Include Zod schema validation for request bodies
4. Add proper error handling with try-catch blocks
5. Return appropriate HTTP status codes
6. Include JSDoc comments for each method
7. Create corresponding test file using Vitest
8. Mock Supabase client for tests
9. Test all CRUD operations with success and error cases
/generate-api-route-with-testsMarkdown