NEW: Claude Code Security — research preview

Examples & Templates

16 real-world prompts for Claude Code, Copilot, and Cursor — copy and adapt.

Project Setup

Scaffold a Next.js 15 project

Claude Code

Full-stack setup with TypeScript, Tailwind, Shadcn UI, and Prisma ORM in one shot.

claude "Create a Next.js 15 app with TypeScript, Tailwind CSS v4, Shadcn components, and Prisma with SQLite. Include: auth middleware stub, folder structure per Next.js App Router best practices, and sample .env.example"
#nextjs#setup#full-stack

Add OAuth2 authentication

Claude Code

Plan and implement NextAuth v5 with GitHub and Google providers against an existing app.

claude -p "Add OAuth2 with NextAuth v5 (github and google providers). Protect all /dashboard routes. Store session in the existing Prisma users table."
#auth#security#nextjs

Migrate to TypeScript strict mode

Claude Code

Enable strict mode and fix all type errors across the codebase automatically.

claude "Enable TypeScript strict mode in tsconfig.json, then fix every type error that results. Run tsc --noEmit to verify after each file. Commit when clean."
#typescript#refactor#migration

Testing

Generate test suite from scratch

Claude Code

Create comprehensive Jest tests for an entire module, including edge cases and error paths.

claude --dangerously-skip-permissions "Generate Jest tests for every exported function in src/lib/auth.ts. Include: happy path, boundary values, error cases, and async rejection handling. Run tests and fix failures."
#testing#jest#tdd

Boost test coverage to 80%

Claude Code

Analyze coverage gaps and generate targeted tests until coverage threshold is met.

claude "Run npm run test:coverage and identify all files below 80% line coverage. Generate tests for those files prioritizing untested branches. Re-run coverage to verify."
#testing#coverage#automation

Write tests for a React component

Copilot

React Testing Library tests covering render, user interactions, and loading/error states.

@workspace Write React Testing Library tests for the UserCard component in src/components/UserCard.tsx. Cover: default render, loading state, error state, and the onClick handler. Use screen queries only.
#testing#react#rtl

Security

Security audit a PR diff

Claude Code

Scan staged changes for OWASP Top 10 vulnerabilities before merging.

git diff main...HEAD | claude -p "Audit for OWASP Top 10: injection, broken auth, exposed data, missing validation. Output: file, line, severity (Critical/High/Medium), description. One issue per line."
#security#review#owasp

Add Zod validation to all API routes

Claude Code

Add input validation schemas to every API endpoint that's missing them.

claude "Audit all files in src/app/api/ for missing input validation. For each route that accepts request body or query params without validation, add a Zod schema and validate at the top of the handler. Run npm run build to verify."
#validation#security#zod

Code Review

Review PR for correctness and performance

Copilot

Thorough multi-angle code review with concrete fix suggestions.

@github Review PR #[number]. Check for: bugs that will cause runtime errors, N+1 query patterns, missing error handling, and security issues. For each finding, suggest a specific fix.
#review#performance#copilot

Code Quality

Find and fix all ESLint errors

Claude Code

Run lint, fix all auto-fixable issues, and manually resolve the rest.

claude "Run npm run lint and fix all ESLint errors. For auto-fixable issues use eslint --fix. For manual fixes, read the rule documentation and apply the correct pattern. Verify with another lint run when done."
#eslint#quality#automation

Refactoring

Extract reusable React hook

Cursor

Identify duplicated stateful logic across components and extract into a custom hook.

Look at @src/components/UserList.tsx and @src/components/ProductList.tsx. Both have similar fetch-on-mount patterns. Extract the shared logic into a useDataFetch custom hook in src/hooks/. Update both components to use it.
#react#hooks#refactor

Migration

Migrate from Pages Router to App Router

Claude Code

Systematically convert a Next.js Pages Router app to App Router conventions.

claude "Read MIGRATION-PLAN.md. Convert each Pages Router page listed to App Router. Preserve all functionality. Run npm run build after each page to catch errors. Commit after each successful conversion."
#nextjs#migration#refactor

Documentation

Generate OpenAPI spec from routes

Claude Code

Introspect all API route handlers and produce an OpenAPI 3.1 spec.

claude -p "Read all files in src/app/api/**/*.ts and generate an OpenAPI 3.1 spec in YAML. Include: path, method, request body schema, response schemas, and examples. Output to docs/openapi.yaml"
#openapi#docs#api

Add JSDoc to all public functions

Copilot

Auto-document every exported function with parameter types, return values, and examples.

@workspace Add JSDoc comments to all exported functions in src/lib/ that currently lack them. Include @param, @returns, and a one-line @example for each. Don't modify existing JSDoc.
#docs#jsdoc#typescript

Database

Design a multi-tenant database schema

Claude Code

Full Prisma schema with row-level tenant isolation and soft deletes.

claude "Design a Prisma schema for a multi-tenant SaaS app. Requirements: row-level tenant isolation (tenantId on every user-data table), soft deletes (deletedAt), audit timestamps (createdAt/updatedAt), and foreign key constraints. Generate the migration SQL too."
#database#prisma#saas

Safe database migration with rollback

Claude Code

Generate a migration with an explicit down migration and validation steps.

claude "Add a 'status' enum column to the orders table (pending/processing/shipped/delivered). Write: the up migration, the down migration, and a data migration script to set existing rows to 'pending'. Test the rollback path."
#database#migration#prisma