backend-code-review
Conducts comprehensive backend code reviews including API design (REST/GraphQL/gRPC), database patterns, authentication/authorization, caching strategies, message queues, microservices architecture, security vulnerabilities, and performance optimization for Node.js, Python, Java, Go, and C#. Produces detailed review reports with specific issues, severity ratings, and actionable recommendations. Use when reviewing server-side code, analyzing API implementations, checking database queries, validating authentication flows, assessing microservices architecture, or when users mention "review backend code", "check API design", "analyze server code", "validate database patterns", "security audit", "performance review", or "backend code quality".
What this skill does
# Backend Code Review
Conduct systematic backend code reviews to identify security vulnerabilities, performance bottlenecks, code quality issues, and architectural concerns. Produces actionable reports with specific locations and fix recommendations.
## Review Process
Follow this structured approach for comprehensive backend code analysis:
## 1. Assess Technology Stack and Scope
Identify technologies and critical areas before starting:
**Technology Inventory:**
```
Backend Language: Node.js/Python/Java/Go/C#
Framework: Express/FastAPI/Spring Boot/Gin/ASP.NET
Database: PostgreSQL/MySQL/MongoDB/Redis
Architecture: Monolith/Microservices/Serverless
Deployment: AWS/GCP/Azure/Docker/Kubernetes
```
**Critical Review Areas (prioritize these):**
- Authentication and authorization logic
- Payment processing and financial transactions
- Data access layers (ORM queries, raw SQL)
- External API integrations and webhooks
- Background jobs and async processing
- File upload and download handlers
**Example Scope Definition:**
```
Review: User authentication service
Files: src/auth/*.ts (15 files, ~2000 lines)
Priority: High (handles user credentials and sessions)
Focus: Security vulnerabilities, JWT implementation, session management
```
### 2. Review Code Quality and Structure
Evaluate code organization, design patterns, and maintainability:
**Code Organization Checklist:**
```
☐ Proper layering (controllers → services → repositories → database)
☐ Consistent file and folder naming (kebab-case, camelCase, etc.)
☐ One class/function per file (or logically grouped)
☐ No circular dependencies between modules
☐ Clear separation of business logic and infrastructure code
```
**SOLID Principles Validation:**
**Single Responsibility:** Each class/module has one reason to change
```javascript
// ❌ Bad: UserService does too much
class UserService {
createUser() { }
sendEmail() { } // Should be EmailService
processPayment() { } // Should be PaymentService
}
// ✅ Good: Separated responsibilities
class UserService {
createUser() { }
}
class EmailService {
sendEmail() { }
}
class PaymentService {
processPayment() { }
}
```
**Dependency Injection:** Dependencies injected, not hardcoded
```python
# ❌ Bad: Hardcoded dependency
class UserService:
def __init__(self):
self.db = PostgresDB() # Hardcoded, hard to test
# ✅ Good: Dependency injection
class UserService:
def __init__(self, db: Database):
self.db = db # Injected, easy to mock
```
**Error Handling Pattern:**
```typescript
// ❌ Bad: Silent failures
async function getUser(id: string) {
try {
return await db.users.findOne(id);
} catch (err) {
return null; // Swallows error
}
}
// ✅ Good: Proper error handling
async function getUser(id: string): Promise<User> {
try {
const user = await db.users.findOne(id);
if (!user) {
throw new NotFoundError(`User ${id} not found`);
}
return user;
} catch (err) {
logger.error('Failed to fetch user', { id, error: err });
throw new DatabaseError('User fetch failed', { cause: err });
}
}
```
**Code Quality Issues to Flag:**
- Functions > 50 lines (should be split)
- Classes > 300 lines (too many responsibilities)
- Cyclomatic complexity > 10 (simplify logic)
- Code duplication > 5 lines (extract to function)
- Missing type definitions (TypeScript, type hints)
- Magic numbers (use named constants)
**Load detailed checklist:** [code-quality-checklist.md](references/code-quality-checklist.md)
### 3. Validate API Design
Review API endpoints for REST, GraphQL, or gRPC implementations:
**REST API Review:**
**Endpoint Structure:**
```
✅ Good REST Design:
GET /api/v1/users - List users (paginated)
GET /api/v1/users/:id - Get single user
POST /api/v1/users - Create user
PUT /api/v1/users/:id - Replace user
PATCH /api/v1/users/:id - Update user
DELETE /api/v1/users/:id - Delete user
❌ Poor REST Design:
GET /api/v1/getAllUsers - Use plural nouns, not verbs
POST /api/v1/user/create - POST implies creation
GET /api/v1/user/get/123 - Use path params, not verbs
```
**HTTP Status Codes:**
```
✅ Correct Usage:
200 OK - Successful GET, PUT, PATCH
201 Created - Successful POST (with Location header)
204 No Content - Successful DELETE
400 Bad Request - Invalid input
401 Unauthorized - Missing/invalid authentication
403 Forbidden - Authenticated but not authorized
404 Not Found - Resource doesn't exist
409 Conflict - Duplicate resource
422 Unprocessable Entity - Validation failed
500 Internal Server Error - Server error
❌ Common Mistakes:
200 for errors - Should use 4xx or 5xx
500 for validation errors - Should use 400 or 422
404 for unauthorized - Should use 403
```
**Pagination Implementation:**
```javascript
// ✅ Good: Cursor-based pagination for large datasets
GET /api/v1/orders?cursor=eyJpZCI6MTIzfQ&limit=20
Response: {
data: [...],
pagination: {
nextCursor: "eyJpZCI6MTQzfQ",
hasMore: true
}
}
// ✅ Good: Offset pagination for small/medium datasets
GET /api/v1/users?page=2&pageSize=20
Response: {
data: [...],
pagination: {
page: 2,
pageSize: 20,
totalPages: 15,
totalItems: 300
}
}
```
**GraphQL Review:**
**N+1 Query Detection:**
```graphql
# ❌ Bad: Causes N+1 queries
query {
posts {
id
title
author { # Separate query for each post
name
}
}
}
# ✅ Good: Use DataLoader to batch
const authorLoader = new DataLoader(async (authorIds) => {
// Batch fetch all authors in one query
return await db.authors.findByIds(authorIds);
});
```
**gRPC Review:**
Check protocol buffer definitions and error handling:
```protobuf
// ✅ Good proto definition
message GetUserRequest {
string user_id = 1 [(validate.rules).string.uuid = true];
}
message GetUserResponse {
User user = 1;
}
service UserService {
rpc GetUser(GetUserRequest) returns (GetUserResponse);
}
```
**Load detailed checklist:** [api-design-checklist.md](references/api-design-checklist.md)
### 4. Analyze Database Queries and Schema
Review database patterns, query optimization, and data integrity:
**SQL Injection Prevention:**
```python
# ❌ Critical: SQL injection vulnerability
def get_user(username):
query = f"SELECT * FROM users WHERE username = '{username}'"
return db.execute(query)
# ✅ Good: Parameterized queries
def get_user(username):
query = "SELECT * FROM users WHERE username = ?"
return db.execute(query, (username,))
```
**N+1 Query Problem:**
```javascript
// ❌ Bad: N+1 queries (1 query + N queries for authors)
const posts = await Post.findAll();
for (const post of posts) {
post.author = await User.findById(post.authorId); // N queries!
}
// ✅ Good: Join or eager load
const posts = await Post.findAll({
include: [{ model: User, as: 'author' }] // 1 query with join
});
```
**Missing Indexes:**
```sql
-- ❌ Bad: Queries without indexes
SELECT * FROM orders WHERE user_id = 123; -- No index on user_id
SELECT * FROM products WHERE status = 'active' AND category = 'electronics';
-- ✅ Good: Add indexes for common queries
CREATE INDEX idx_orders_user_id ON orders(user_id);
CREATE INDEX idx_products_status_category ON products(status, category);
```
**Transaction Handling:**
```java
// ❌ Bad: No transaction for multi-step operation
public void transferFunds(Long fromId, Long toId, BigDecimal amount) {
Account from = accountRepo.findById(fromId);
Account to = accountRepo.findById(toId);
from.setBalance(from.getBalance().subtract(amount));
to.setBalance(to.getBalance().add(amount));
accountRepo.save(from); // What if this fails?
accountRepo.save(to); // Money lost!
}
// ✅ Good: Atomic transaction
@Transactional
public void transferFunds(Long fromId, Long toId, BigDecimal amount) {
Account from = accountRepo.findById(fromId);
Account to = accountRepo.findById(toId);
from.setBalance(from.getBalance().subtract(amouRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.