com um clique
code-review
Structured code review workflow for quality and consistency
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Structured code review workflow for quality and consistency
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Web accessibility audit workflow for WCAG compliance
RESTful and GraphQL API design patterns and best practices
Safe database migration workflow with zero-downtime strategies
Git release workflow with semantic versioning and changelogs
Comprehensive performance audit workflow for web applications
Comprehensive security review workflow for identifying vulnerabilities
| name | code-review |
| description | Structured code review workflow for quality and consistency |
| license | MIT |
Use this skill when reviewing code changes for quality, consistency, and best practices.
Before reviewing code:
Ask these questions:
// ❌ Bad: Unclear naming
const d = new Date();
const x = users.filter(u => u.a > d);
// ✅ Good: Self-documenting
const now = new Date();
const activeUsers = users.filter(user => user.lastActiveAt > now);
// ❌ Bad: Magic numbers
if (retries > 3) { ... }
setTimeout(fn, 86400000);
// ✅ Good: Named constants
const MAX_RETRIES = 3;
const ONE_DAY_MS = 24 * 60 * 60 * 1000;
if (retries > MAX_RETRIES) { ... }
setTimeout(fn, ONE_DAY_MS);
// ❌ Bad: Function does too many things
function processUser(user) {
// Validate (20 lines)
// Transform (15 lines)
// Save (10 lines)
// Send email (15 lines)
// Log (5 lines)
}
// ✅ Good: Single responsibility
function processUser(user) {
validateUser(user);
const transformed = transformUser(user);
await saveUser(transformed);
await notifyUser(transformed);
logUserCreation(transformed);
}
// ❌ Bad: Silent failure
try {
await riskyOperation();
} catch (e) {
// nothing
}
// ✅ Good: Proper error handling
try {
await riskyOperation();
} catch (error) {
logger.error('Operation failed', { error, context });
throw new AppError('Operation failed', { cause: error });
}
// ❌ Bad: Type assertions hiding issues
const user = data as User;
const value = (obj as any).property;
// ✅ Good: Type guards and validation
function isUser(data: unknown): data is User {
return (
typeof data === 'object' &&
data !== null &&
'id' in data &&
'email' in data
);
}
if (isUser(data)) {
// data is safely typed as User
}
// Tests should exist for:
// - Happy path
// - Edge cases
// - Error conditions
describe('calculateDiscount', () => {
it('should apply 10% for orders over $100', () => { ... });
it('should return 0 for orders under $50', () => { ... });
it('should throw for negative amounts', () => { ... });
it('should handle zero amount', () => { ... });
});
// ❌ Bad feedback
"This code is confusing"
// ✅ Good feedback
"The variable `d` on line 45 is unclear. Consider renaming to
`createdDate` to match the domain terminology."
// ❌ Bad feedback
"Don't use `any` here"
// ✅ Good feedback
"Using `any` here disables type checking for `processData`.
Consider using `unknown` with a type guard, or define a
specific interface for the expected data shape."
// ❌ Bad feedback
"This function is too long"
// ✅ Good feedback
"This function is 80 lines and handles validation, transformation,
and persistence. Consider extracting into smaller functions:
```typescript
function processOrder(order: Order) {
validateOrder(order);
const enriched = enrichOrder(order);
return saveOrder(enriched);
}
```"
| Instead of | Use |
|---|---|
| "You should..." | "Consider..." |
| "This is wrong" | "This might cause..." |
| "Why did you..." | "What do you think about..." |
| "You forgot to..." | "We might want to add..." |
Use prefixes for clarity:
| Prefix | Meaning | Action Required |
|---|---|---|
blocking: | Must fix before merge | Yes |
suggestion: | Improvement idea | No |
question: | Need clarification | Answer needed |
nit: | Minor style preference | No |
praise: | Good work! | None |
blocking: This endpoint is missing authentication. Add the
`authenticate` middleware before the handler.
suggestion: Consider extracting this validation logic into a
shared `validateEmail` function since it's used in 3 places.
question: I'm not familiar with this library. What's the benefit
over the standard approach we've been using?
nit: Our style guide prefers `const` over `let` when the variable
isn't reassigned.
praise: Nice use of the builder pattern here! This makes the
configuration much more readable.
## Code Review: PR #123
### Summary
[Brief overview of what was reviewed]
### Blocking Issues 🔴
1. [Issue requiring fix before merge]
### Suggestions 💡
1. [Improvement idea]
2. [Another idea]
### Questions ❓
1. [Clarification needed]
### Positive Notes ✅
- [What was done well]
### Verdict
- [ ] Approved
- [x] Request changes
- [ ] Comment only