home / skills / wellapp-ai / well / code-review

code-review skill

/cursor-rules/skills/code-review

This skill reviews code changes for quality, conventions, and potential issues, enabling reliable PR reviews and pre-push validation.

npx playbooks add skill wellapp-ai/well --skill code-review

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.0 KB
---
name: code-review
description: Review code changes against hard rules and conventions
---

# Code Review Skill

Systematically review code for quality, conventions, and potential issues.

## When to Use
- Before committing changes (auto-triggered)
- Reviewing others' PRs
- Self-review before pushing
- Pre-push validation (Phase 0)

---

## Phase 0: Pre-Push Validation

Before reviewing code, ensure build passes:

- [ ] `npm run typecheck` - No type errors
- [ ] `npm run lint` - No lint errors
- [ ] No console.log in changed files
- [ ] Tests pass (if applicable): `npm run test`

If any check fails, fix before proceeding to code review.

**Quick check command:**
```bash
npm run typecheck && npm run lint
```

**Check for console.log:**
```bash
git diff --cached --name-only | xargs grep -l "console.log" 2>/dev/null
```

---

## Review Checklist

### Hard Rules Check
- [ ] No `any` type usage
- [ ] No console.log statements
- [ ] Components under 200 lines
- [ ] No inline styles (Tailwind only)
- [ ] No arbitrary values (`px-[13px]`)
- [ ] API follows 3-layer pattern

### Code Quality Check
- [ ] Clear variable/function names
- [ ] No duplicated code
- [ ] Proper error handling
- [ ] Types are specific (not `unknown` everywhere)

### Conventions Check
- [ ] Follows existing patterns in codebase
- [ ] Imports organized correctly
- [ ] File in correct location (feature folder)

### Security Check
- [ ] No hardcoded secrets/API keys
- [ ] No exposed sensitive data
- [ ] Proper input validation

## Output Format

Present findings as:

---

## Code Review Summary

**Files Changed:** [count]
**Issues Found:** [count by severity]

### Critical (must fix)
- [ ] `file.ts:L42` - [issue description]

### Warnings (should fix)
- [ ] `file.ts:L15` - [issue description]

### Suggestions (nice to have)
- [ ] `file.ts:L88` - [suggestion]

### Approved
- [x] No blocking issues found

---

**Proceed with commit?** (yes / fix issues first)

---

## Auto-Trigger
This skill is automatically invoked before every commit.

Overview

This skill reviews TypeScript code changes against hard rules, conventions, and security checks to catch blocking issues before they reach the repository. It runs as a pre-push validator and produces a concise, actionable summary highlighting critical failures, warnings, and suggestions. The goal is fast, deterministic feedback so maintainers and contributors fix the root cause before merging.

How this skill works

The skill inspects staged or changed files and enforces build, lint, and test gates first (typecheck, lint, tests). It then scans diffs for hard rules (no any, no console.log, component size limits, no inline styles) and evaluates code quality, conventions, and security patterns. Results are categorized by severity and formatted into a short review summary with file/line references and remediation hints.

When to use it

  • Automatically before every commit/push (pre-push hook)
  • When creating or reviewing a pull request
  • During CI to prevent merging broken changes
  • As a self-review step before pushing large refactors
  • When onboarding contributors to enforce project conventions

Best practices

  • Run npm run typecheck && npm run lint locally before committing
  • Fix critical issues listed under Critical before proceeding
  • Keep components concise (prefer <200 lines) and extract helpers
  • Avoid any and prefer precise TypeScript types or narrow unknown
  • Store secrets in environment variables and validate inputs

Example use cases

  • Rejecting a commit that introduces console.log or any in a lib file
  • Catching a component that grew past 200 lines and suggesting refactor
  • Detecting hardcoded API keys and flagging them as critical
  • Ensuring new API code follows the repository's 3-layer pattern
  • Adding lint and type errors to the review summary so CI can block merge

FAQ

What commands does the skill require to run?

It expects npm run typecheck, npm run lint, and npm run test (if tests exist). The quick check is: npm run typecheck && npm run lint.

How are findings categorized?

Findings are grouped as Critical (must fix), Warnings (should fix), and Suggestions (nice to have). Each item includes file and line context where possible.