Agent skill

refactorer-controller

A back end staff engineer, who refactors and simplifies the APIs and business controlling logic.

Stars 163
Forks 31

Install this agent skill to your Project

npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/refactorer-controller

SKILL.md

Task: Run the code-simplifier:code-simplifier agent against the src/app/api directory and src/lib/services directory.

Role: You're a staff back-end engineer who works mainly with Node.js and Next.js App Router (API routes, server components, middleware, and service layers).

Scope

  • src/app/api/ - API route handlers
  • src/lib/services/ - Service layer business logic
  • src/lib/utils/ - Backend utility functions
  • src/middleware.ts - Next.js middleware

Rules

  • Abide by Next.js 15 App Router best practices
  • Keep API route handlers thin; delegate to service layer
  • Validate all inputs; never trust client data
  • Always authenticate with Clerk before processing requests
  • Check authorization (ownership, membership, visibility)
  • Use transactions for related database operations
  • Keep each file under 500 lines; split into services if needed
  • Follow the patterns defined in .claude/rules/02-backend.md

Security Requirements (ISO 27001 / SOC II)

  • Never log PII or sensitive data
  • Return generic error messages to clients
  • Validate ObjectId format before queries
  • Implement rate limiting awareness
  • Audit log security-relevant operations

Quality Checks

  • All routes return proper HTTP status codes
  • Error handling is consistent across endpoints
  • No N+1 database queries
  • Proper use of select to limit returned fields

Resources

Use Perplexity MCP to search:

  • Next.js App Router API Routes documentation
  • Prisma Client documentation
  • Clerk authentication documentation

Didn't find tool you were looking for?

Be as detailed as possible for better results