All skills
sanyuan0704 avatar

/code-review-expert

@ae75e91
by Shawn Yangsanyuan0704/sanyuan-skills3.9k stars
344

Expert code review of current git changes with a senior engineer lens. Detects SOLID violations, security risks, and proposes actionable improvements.

Use this Skill: https://skilld.dev/gh/sanyuan0704/sanyuan-skills/code-review-expert

This session only. Nothing lands on disk.

referencessecurity-checklist.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Security and Reliability Checklist

Input/Output Safety

  • XSS: Unsafe HTML injection, dangerouslySetInnerHTML, unescaped templates, innerHTML assignments
  • Injection: SQL/NoSQL/command/GraphQL injection via string concatenation or template literals
  • SSRF: User-controlled URLs reaching internal services without allowlist validation
  • Path traversal: User input in file paths without sanitization (../ attacks)
  • Prototype pollution: Unsafe object merging in JavaScript (Object.assign, spread with user input)

AuthN/AuthZ

  • Missing tenant or ownership checks for read/write operations
  • New endpoints without auth guards or RBAC enforcement
  • Trusting client-provided roles/flags/IDs
  • Broken access control (IDOR - Insecure Direct Object Reference)
  • Session fixation or weak session management

JWT & Token Security

  • Algorithm confusion attacks (accepting none or HS256 when expecting RS256)
  • Weak or hardcoded secrets
  • Missing expiration (exp) or not validating it
  • Sensitive data in JWT payload (tokens are base64, not encrypted)
  • Not validating iss (issuer) or aud (audience)

Secrets and PII

  • API keys, tokens, or credentials in code/config/logs
  • Secrets in git history or environment variables exposed to client
  • Excessive logging of PII or sensitive payloads
  • Missing data masking in error messages

Supply Chain & Dependencies

  • Unpinned dependencies allowing malicious updates
  • Dependency confusion (private package name collision)
  • Importing from untrusted sources or CDNs without integrity checks
  • Outdated dependencies with known CVEs

CORS & Headers

  • Overly permissive CORS (Access-Control-Allow-Origin: * with credentials)
  • Missing security headers (CSP, X-Frame-Options, X-Content-Type-Options)
  • Exposed internal headers or stack traces

Runtime Risks

  • Unbounded loops, recursive calls, or large in-memory buffers
  • Missing timeouts, retries, or rate limiting on external calls
  • Blocking operations on request path (sync I/O in async context)
  • Resource exhaustion (file handles, connections, memory)
  • ReDoS (Regular Expression Denial of Service)

Cryptography

  • Weak algorithms (MD5, SHA1 for security purposes)
  • Hardcoded IVs or salts
  • Using encryption without authentication (ECB mode, no HMAC)
  • Insufficient key length

Race Conditions

Race conditions are subtle bugs that cause intermittent failures and security vulnerabilities. Pay special attention to:

Shared State Access

  • Multiple threads/goroutines/async tasks accessing shared variables without synchronization
  • Global state or singletons modified concurrently
  • Lazy initialization without proper locking (double-checked locking issues)
  • Non-thread-safe collections used in concurrent context

Check-Then-Act (TOCTOU)

  • if (exists) then use patterns without atomic operations
  • if (authorized) then perform where authorization can change
  • File existence check followed by file operation
  • Balance check followed by deduction (financial operations)
  • Inventory check followed by order placement

Database Concurrency

  • Missing optimistic locking (version column, updated_at checks)
  • Missing pessimistic locking (SELECT FOR UPDATE)
  • Read-modify-write without transaction isolation
  • Counter increments without atomic operations (UPDATE SET count = count + 1)
  • Unique constraint violations in concurrent inserts

Distributed Systems

  • Missing distributed locks for shared resources
  • Leader election race conditions
  • Cache invalidation races (stale reads after writes)
  • Event ordering dependencies without proper sequencing
  • Split-brain scenarios in cluster operations

Common Patterns to Flag

# Dangerous patterns:
if not exists(key):       # TOCTOU
    create(key)

value = get(key)          # Read-modify-write
value += 1
set(key, value)

if user.balance >= amount:  # Check-then-act
    user.balance -= amount

Questions to Ask

  • "What happens if two requests hit this code simultaneously?"
  • "Is this operation atomic or can it be interrupted?"
  • "What shared state does this code access?"
  • "How does this behave under high concurrency?"

Data Integrity

  • Missing transactions, partial writes, or inconsistent state updates
  • Weak validation before persistence (type coercion issues)
  • Missing idempotency for retryable operations
  • Lost updates due to concurrent modifications

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The 'Code Review Expert' skill provides structured analysis of code changes, focusing on security, performance, and design principles. It operates using local git tools and requires user approval before making any changes to the codebase, maintaining a safe and transparent workflow.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    7 files scanned · No issues

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at ae75e91. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 7 months ago

README badge

README badge for sanyuan0704/sanyuan-skills/code-review-expert