MCP HubMCP Hub
스킬 목록으로 돌아가기

code-review-web

rampstackco
업데이트됨 2 days ago
2 조회
239
27
239
GitHub에서 보기
개발aidesign

정보

이 스킬은 웹 애플리케이션 코드를 검토하여 버그, 보안 취약점, 성능 문제, 그리고 특정 기술 스택에 대한 안티패턴을 식별합니다. PR 리뷰, 프로덕션 문제 디버깅, 빌드 오류 진단, 보안 감사 수행과 같은 사용 사례를 위해 설계되었습니다. 코드 리뷰, 디버깅, 장애 조사와 관련된 문구에 반응하여 실행됩니다.

빠른 설치

Claude Code

추천
기본
npx skills add rampstackco/claude-skills -a claude-code
플러그인 명령대체
/plugin add https://github.com/rampstackco/claude-skills
Git 클론대체
git clone https://github.com/rampstackco/claude-skills.git ~/.claude/skills/code-review-web

Claude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요

문서

Code Review for Web

Review and debug web application code with a focus on the patterns that actually break production. Stack-agnostic principles in SKILL.md. Stack-specific patterns in references.


When to use

  • Reviewing a pull request before merging
  • Debugging a production issue
  • Investigating a build failure
  • Auditing security or performance of existing code
  • Investigating environment variable or configuration issues
  • Triaging a "the site is broken" report

When NOT to use

  • Writing a new feature spec (use pm-spec-writing)
  • Pre-launch QA against the running site (use qa-testing)
  • Performance deep-dive on Core Web Vitals (use performance-optimization)
  • Deep accessibility compliance review (use accessibility-audit)

Required inputs

  • The code, PR, error message, or symptom under review
  • Access to logs (build logs, function logs, server logs) if debugging
  • The stack (framework, hosting, database) - even at high level

If just a symptom is provided ("the site is broken"), the workflow's first step is gathering enough context to investigate.


The framework: 5 review dimensions

Every code review covers five dimensions. Pick the depth based on the situation.

1. Correctness

Does the code do what it claims to do?

  • Logic matches the intent stated in the spec or PR description
  • Edge cases handled (empty states, error states, network failures)
  • Off-by-one errors, null/undefined handling, async race conditions
  • Tests exist for the change, or there's a reason they don't
  • The change does not break existing functionality (regression risk)

2. Security

Does the code expose anything sensitive or open an attack surface?

  • Secrets handling. No secrets, API keys, or service-role credentials in client-side code or version control
  • Auth checks. Every mutation endpoint validates the caller before acting
  • Input validation. User input sanitized before use in queries, file paths, or HTML
  • External requests. Outbound URLs validated; no SSRF on user-controlled inputs
  • CSRF protection. State-changing requests require a token or same-origin policy
  • Rate limiting. Public-facing mutation endpoints have rate limits
  • HTTPS-only. No HTTP in production code paths
  • Cookies. Session cookies have Secure, HttpOnly, SameSite attributes set
  • Environment variables. Server-only secrets are not prefixed with anything that exposes them to the client bundle

3. Performance

Will this code scale and stay fast?

  • Database queries. No N+1 patterns. Joins or batch fetches preferred over loops with queries.
  • Pagination. Large result sets paginated, never loaded entirely.
  • Caching. Appropriate cache strategy for the data freshness needs.
  • Bundle size. Client-side dependencies justified. Tree-shaking working.
  • Image handling. Modern formats, lazy loading, explicit dimensions.
  • Background work. Slow operations moved off the request path.
  • Cold start sensitivity. Cold paths optimized if frequently triggered.

4. Reliability

What happens when this fails?

  • Error handling. Caught and handled, not swallowed. Errors logged with context.
  • Retries. Network calls have retry logic for transient failures.
  • Timeouts. External calls have explicit timeouts (no infinite waits).
  • Graceful degradation. Failure of non-critical paths does not crash the page.
  • Idempotency. Mutations that might be retried are safe to retry.
  • Logging. Enough context in logs to diagnose without reproducing.

5. Maintainability

Will the next person (or future you) understand this in six months?

  • Naming. Functions and variables named for what they do, not how.
  • Comments. Explain why, not what. The code says what.
  • Complexity. Functions do one thing. If a function takes 200 lines, it's doing too much.
  • Duplication. Same logic in multiple places gets extracted.
  • Dependencies. New dependencies justified. Each one is a maintenance burden.
  • Magic values. No literal 60000 in code. Use named constants.

Common bug patterns (stack-agnostic)

Patterns that recur across stacks and are worth checking on every review.

Build and deploy

  • Build-time data fetches that timeout. Routes that query a database during static generation can fail at scale. Mark them as runtime-rendered if the data must be fresh.
  • Environment variables not propagating. A var that works locally but breaks in production usually means it was not added to the production environment.
  • Mismatched env between preview and production. Deploys that work in preview but break on the production domain often have stack-specific URLs hardcoded.

URL and domain issues

  • Canonical pointing at staging or preview URL. Caused by client-exposed environment variables that pick up the wrong domain. Canonical domain should come from a server-only environment variable.
  • API URL pointing at the main domain that loops back. After a DNS cutover, the main domain may now serve a different application. APIs should live on dedicated subdomains.
  • HTTPS upgrade issues. Mixed content (HTTP resources loaded into HTTPS pages) breaks browsers' security model.

Cache invalidation

  • Stale content after deploy. Either the cache was not invalidated, or the invalidation requires a manual trigger that did not run.
  • CDN serving old asset under same filename. Always use a new filename or cache-bust query string when replacing assets.
  • Cache headers too aggressive. Long max-age on resources that change frequently leads to users seeing stale content for hours or days.

Database and data

  • N+1 queries. Loop with a query inside the loop. Replace with batch fetch or join.
  • Missing limits on table scans. Forgetting LIMIT on queries that hit large tables.
  • Connection pool exhaustion. Too many concurrent connections, often from build-time fetches in parallel routes.
  • Schema migration without backfill. Adding a NOT NULL column without populating it for existing rows.

Image handling

  • Image not loading after upload. CDN cached the previous filename. Use new filenames for replacements.
  • Layout shift from images. Missing width/height attributes. Always specify both.
  • Slow LCP from large images. Hero images not optimized for size or format.

External integrations

  • Bot mitigation blocking server-to-server calls. CDN or firewall is challenging legitimate automated traffic. Whitelist server IPs or disable challenges for API endpoints.
  • API rate limit triggered in production. Worked locally where traffic was tiny. Add backoff and rate limiting awareness.

Security

  • Unprotected revalidation or admin endpoints. Always require a secret token.
  • PII in URLs. Visible in server logs, browser history, referrer headers.
  • Secrets exposed in client bundle. Anything that gets sent to the browser is public.

Workflow

  1. Gather context. What stack? What's broken or under review? Logs available?
  2. Pick the depth. Quick scan for a small PR. Full review for a major change. Deep dive for a production incident.
  3. Run through the 5 dimensions. Note issues by severity (blocker, important, minor).
  4. Check stack-specific patterns. Reference the appropriate stack guide.
  5. For incidents: identify the smallest hypothesis-driven fix. Reproduce locally if possible.
  6. Write the review. Use the template in references/review-template.md for formal reviews.

Failure patterns

  • "Looks good to me" on a 500-line PR. If the review takes 5 minutes on a large PR, the review didn't happen.
  • Reviewing without running the code. Some bugs only surface at runtime. Pull the branch and run it.
  • Over-indexing on style. Bikeshedding on formatting while missing logic bugs.
  • Skipping security review on "internal" features. Internal becomes external faster than expected.
  • Treating warnings as decoration. Build warnings often become production errors after a dependency update.
  • Debugging without reading the full error message. First line of the stack trace is often not the actual cause. Read all of it.

Debugging workflow

When a production issue is reported:

  1. Read the full error message. Including the stack trace.
  2. Check hosting build and function logs. The exact failing line is usually here.
  3. Identify the last working version. git log --oneline and check recent commits.
  4. Reproduce locally. Confirms it's a code issue and not an environment issue.
  5. Check environment variables. Especially after deploys or DNS changes.
  6. Check cache state. Force a cache invalidation before concluding it's a code bug.
  7. Make the minimal fix. Big refactors during incidents create more incidents.
  8. Verify in production. Check the actual fix worked, not just that the deploy succeeded.
  9. Document. What was the root cause? What would have prevented it? File the learnings.

Output format

For PR reviews: comments inline on the PR, plus a summary if needed.

For formal code reviews: a markdown document at code-review-[date].md with:

  1. Scope (what was reviewed)
  2. Summary (overall assessment)
  3. Critical issues (blockers)
  4. Important issues
  5. Minor issues
  6. Suggestions for follow-up

For incidents: a postmortem document. See after-action-report for that format.


Reference files

GitHub 저장소

rampstackco/claude-skills
경로: skills/code-review-web
0
agent-skillsai-agentsanthropicclaudeclaude-aiclaude-code

연관 스킬

sparc-methodology

개발

SPARC 방법론은 체계적인 소프트웨어 생성을 위한 17개의 특화된 모드를 갖춘 포괄적인 다중 에이전트 개발 프레임워크를 제공합니다. 이는 개발자를 명세화, 의사코드, 아키텍처, 정제 및 완성 단계로 안내하며, TDD와 오케스트레이션 패턴을 통합합니다. 초기 연구부터 배포까지 구조화된 종단 간 개발 워크플로가 필요할 때 이 스킬을 사용하십시오.

스킬 보기

sparc-methodology

개발

SPARC 방법론 스킬은 포괄적인 소프트웨어 개발을 위한 체계적인 다중 에이전트 프레임워크를 제공합니다. 명세 및 아키텍처부터 정제와 완성에 이르는 모든 단계를 아우르는 17개의 전문 모드를 통해 개발자를 안내합니다. 통합된 테스트, 오케스트레이션, 배포 기능을 갖춘 구조화된 개발 워크플로우가 필요할 때 이 스킬을 사용하세요.

스킬 보기

sparc-methodology

개발

SPARC 방법론 스킬은 포괄적인 소프트웨어 프로젝트를 위한 체계적인 다중 에이전트 개발 프레임워크를 제공합니다. 작업을 5단계(명세, 의사코드, 아키텍처, 정제, 완성)로 구조화하며, 연구부터 배포까지 모든 것을 아우르는 17개의 특화 모드를 포함합니다. 처음부터 끝까지 복잡한 개발 작업을 안내하는 체계적이고 조직적인 접근 방식이 필요할 때 이 스킬을 사용하세요.

스킬 보기

rust-desktop-applications

개발

이 스킬은 개발자들이 Tauri 프레임워크 또는 네이티브 GUI 대안을 주로 활용하여 Rust로 크로스 플랫폼 데스크톱 애플리케이션을 구축하도록 지원합니다. 시스템 통합이 필요하고 작은 번들 크기와 높은 성능을 요구하는 애플리케이션을 제작하는 데 이상적입니다. 가이드는 프로젝트 설정, IPC, 상태 관리, 그리고 크로스 플랫폼 테스트 및 배포를 다룹니다.

스킬 보기