test-generator
Test Generator
Before generating any output, read config/defaults.md and adapt all patterns, imports, and code examples to the user's configured stack.
Process
- Read the source file to understand its exports, dependencies, and behavior.
- Identify the source type: API route, utility function, React component, or hook.
- Generate test cases covering: happy path, edge cases, error handling, boundary values.
- Write the test file using Vitest syntax (fall back to Jest if the project uses it).
- Include proper mocking, setup/teardown, and descriptive test names.
File Naming and Placement
- Place test file adjacent to source:
foo.ts→foo.test.ts,Foo.tsx→Foo.test.tsx. - If the project uses a
__tests__/directory convention, follow that instead. - For API route tests:
app/api/users/route.ts→app/api/users/route.test.ts.
Testing API Routes
More from nembie/claude-code-skills
code-reviewer
Automated code review for security, performance, and maintainability. Use when asked for code review, security audit, quality check, PR review, or to find issues in code.
22auth-scaffold
Scaffold authentication with Auth.js (NextAuth v5), including providers, session handling, middleware protection, and role-based access. Use when asked to set up auth, add login, protect routes, or implement authentication.
3nextjs-route-generator
Scaffold Next.js App Router API routes with Zod validation, error handling, and TypeScript types. Use when asked to create API routes, REST endpoints, CRUD operations, or scaffold a Next.js backend.
3typescript-refactorer
Identify TypeScript code smells and suggest type-safe refactoring. Use when asked to refactor, improve types, clean up TypeScript code, tighten types, reduce any usage, or improve type safety.
3prisma-query-optimizer
Analyze Prisma queries for performance issues and suggest optimizations. Use when asked to optimize, analyze, audit, or review Prisma queries, or when investigating slow database operations in a Prisma-based project.
3git-commit-composer
Generate conventional commit messages from staged git changes. Use when asked to compose a commit message, write a commit, generate conventional commits, or describe staged changes.
3