This skill should be used when the user asks to "review code",
"check code quality", "find improvements", "refactor code",
"fix code issues", "perform code review", "check for bugs",
"improve code", "analyze code", "review PR", "review pull request",
"コードレビュー", "コードをチェック", "改善点を探す",
"リファクタリング", "コード品質を確認", "バグを探す",
"コードを改善", "PR をレビュー", "プルリクエストをレビュー",
or needs guidance on code review best practices for Swift and TypeScript.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
This skill should be used when the user asks to "review code",
"check code quality", "find improvements", "refactor code",
"fix code issues", "perform code review", "check for bugs",
"improve code", "analyze code", "review PR", "review pull request",
"コードレビュー", "コードをチェック", "改善点を探す",
"リファクタリング", "コード品質を確認", "バグを探す",
"コードを改善", "PR をレビュー", "プルリクエストをレビュー",
or needs guidance on code review best practices for Swift and TypeScript.
version
1.0.0
Code Review
Comprehensive code review skill using codex-cli for analysis, with Claude Code applying fixes automatically.
/code-review # Review all changes vs master
/code-review path/to/file.swift # Review specific file
/code-review handheld/Sources/ # Review directory
Codex-CLI Integration
Step 1: Prepare Review Prompt
Create a structured prompt for codex-cli:
# Review a single file with codex-cli
codex -q "Review this code for issues. Output in JSON format with fields: file, line, severity (Critical/High/Medium/Low), category, description, current_code, suggested_fix. File: <filename>
$(cat path/to/file.swift)"
Step 2: Run Codex-CLI
Execute codex-cli via Bash tool:
# For Swift files
codex -q "You are a Swift code reviewer. Review for:
- Memory leaks (retain cycles in closures)
- Missing @MainActor for UI updates
- Force unwrap without safety
- Performance issues
- SwiftUI best practices
Output JSON array of issues. Each issue: {file, line, severity, category, description, current_code, suggested_fix}
$(cat handheld/Sources/path/to/File.swift)"# For TypeScript files
codex -q "You are a TypeScript code reviewer. Review for:
- any type usage
- Missing useEffect dependencies
- Unnecessary re-renders
- Type safety issues
- Next.js/React best practices
Output JSON array of issues. Each issue: {file, line, severity, category, description, current_code, suggested_fix}
$(cat web/src/path/to/file.tsx)"
Step 3: Parse and Present Issues
Parse the JSON output from codex-cli and present to user:
After user confirmation ("Fix All" or specific issue numbers):
Use Edit tool to apply each fix from codex-cli's suggestions
Run linter/tests to verify
Step 5: Verify
# Swiftcd handheld && make test# TypeScriptcd web && npm run lint && npm run type-check
Quick Reference
Codex-CLI Commands
# Basic review
codex -q "Review this Swift code: $(cat file.swift)"# With specific focus
codex -q "Check for memory leaks in: $(cat file.swift)"# Multiple files (loop)for f in $(git diff master --name-only | grep '\.swift$'); doecho"=== $f ==="
codex -q "Review: $(cat $f)"done
Expected JSON Output Format
[{"file":"ViewModel.swift","line":42,"severity":"High","category":"Concurrency","description":"Missing @MainActor for class with @Observable","current_code":"@Observable\nclass ViewModel {","suggested_fix":"@Observable\n@MainActor\nclass ViewModel {"}]
Swift Code Review
Critical Checks
Category
Check
Severity
Memory
No retain cycles in closures
Critical
Concurrency
@MainActor for UI updates
Critical
Safety
No force unwrapping without safety
High
Performance
Avoid unnecessary @State changes
Medium
Style
Consistent naming conventions
Low
Common Issues and Fixes
1. Force Unwrap Without Safety
// BAD: Force unwrap can crashlet user = users.first!// GOOD: Safe unwrapping with guardguardlet user = users.first else {
return
}
2. Missing @MainActor for UI Updates
// BAD: UI update from background thread@ObservableclassViewModel {
var items: [Item] = [] // Can be updated from any threadfuncloadItems() async {
items =tryawait api.fetchItems() // May not be on main thread
}
}
// GOOD: MainActor ensures UI safety@Observable@MainActorclassViewModel {
var items: [Item] = []
funcloadItems() async {
items =tryawait api.fetchItems()
}
}
# Run SwiftLint (if configured)cd handheld && swiftlint
# With autocorrect
swiftlint --fix
# Run tests
make test
TypeScript
cd web
# Run ESLint
npm run lint
# Run TypeScript type check
npm run type-check
# Fix auto-fixable issues
npm run lint -- --fix
# Run all checks
npm run lint && npm run type-check && npm run build