Review code for correctness, security, performance, and style
Installation
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Style inconsistencies, naming improvements, minor cleanup
Positive
Acknowledge
Good patterns, clean code, thoughtful design
Procedure
1. Understand the Context
# What is this change supposed to do?
bash /home/shared/scripts/task.sh get "$TASK_ID" | jq -r '.description' 2>/dev/null
# What files changed?cd ~/workspace
git diff --stat HEAD~1 2>/dev/null || echo"No git history — reviewing all files"
git log --oneline -5 2>/dev/null
# Read the full diff
git diff HEAD~1 2>/dev/null | head -500
2. Correctness Review
Does the code actually work?
TARGET="${1:-~/workspace/src}"# Check: does it handle the stated requirements?# (Read the code and trace the logic manually)# Check: edge casesecho"=== Potential edge cases ==="# Null/undefined checks
rg '=== null|== null|=== undefined|== undefined|is None'"$TARGET" --type-add 'code:*.{js,py,ts}' --type code -n | head -10
echo"(Verify every nullable value is checked before use)"# Array bounds
rg '\[0\]|\[-1\]|\.length\b|len\('"$TARGET" --type-add 'code:*.{js,py,ts}' --type code -n | head -10
echo"(Verify array access is bounds-checked)"# Check: error handling
rg 'catch|except|\.catch|on\(.error'"$TARGET" --type-add 'code:*.{js,py,ts}' --type code -n | head -10
echo"(Verify errors are handled, not swallowed)"# Check: does it return/exit correctly in all paths?
rg 'return |process\.exit|sys\.exit'"$TARGET" --type-add 'code:*.{js,py,ts}' --type code -n | head -10
3. Security Review
echo"=== Security checks ==="# No hardcoded secrets
rg -n -i '(password|secret|token|api.?key)\s*[:=]\s*["\x27][a-zA-Z0-9]'"$TARGET" \
--type-add 'code:*.{js,py,ts,sh}' --type code | head -5
# No user input in dangerous functions
rg -n '(eval|exec|system|popen)\s*\('"$TARGET" --type-add 'code:*.{js,py,ts}' --type code | head -5
# Input validation present
rg -n '(validate|sanitize|escape|parseInt|Number\(|\.trim\(\))'"$TARGET" \
--type-add 'code:*.{js,py,ts}' --type code | head -10
echo"(Verify user input is validated before use)"# No path traversal
rg -n '(req\.(params|query|body).*\.(join|resolve|readFile))'"$TARGET" --type js | head -5
4. Performance Review
echo"=== Performance checks ==="# Nested loops (potential O(n^2))
rg -n 'for.*\{'"$TARGET" --type-add 'code:*.{js,ts}' --type code -A 5 \
| grep -B 1 'for.*\{' | head -10
echo"(Check if nested loops are necessary)"# Unbounded growth
rg -n '\.push\(|\.append\(|\.concat\('"$TARGET" --type-add 'code:*.{js,py,ts}' --type code -B 2 \
| grep -v 'splice\|pop\|shift\|slice\|limit' | head -10
echo"(Verify arrays/lists have size limits)"# Resource cleanup
rg -n '(open\(|createReadStream|createConnection|connect\()'"$TARGET" \
--type-add 'code:*.{js,py,ts}' --type code | head -10
echo"(Verify opened resources are closed — look for .close(), finally, using, with)"# Synchronous I/O in async code
rg -n '(readFileSync|writeFileSync|execSync)'"$TARGET" --type js | head -5
echo"(Sync I/O blocks the event loop)"
5. Style Review
echo"=== Style checks ==="# Dead code
rg -n '^\s*(//|#)\s*(function|def |class |const |let |var |import )'"$TARGET" \
--type-add 'code:*.{js,py,ts,sh}' --type code | head -5
echo"(Commented-out code should be deleted)"# Console.log left in
rg -n 'console\.(log|debug)\('"$TARGET" --type-add 'code:*.{js,ts}' --type code \
| grep -v 'test\|spec' | head -5
echo"(Debug logging should be removed or use proper logger)"# Naming conventions
rg -n '\b(data|info|temp|tmp|foo|bar|baz|x|y|z)\b\s*='"$TARGET" \
--type-add 'code:*.{js,py,ts}' --type code | grep -v 'for\s*(' | head -10
echo"(Vague variable names — consider more descriptive names)"# Consistent formattinghead -3 $(find "$TARGET" -name '*.js' -o -name '*.py' | head -5) 2>/dev/null
echo"(Check: consistent indentation, semicolons, quote style)"