金色时刻 · 15:48
让好资源,触手可及
AGENT SKILL

frontend-code-review

frontend-code-review 是面向测试与安全的 Agent Skill,来自 first-fluke/fullstack-starter。查看技能说明、操作步骤与使用约定,并通过原项目了解详细用法。

Standardized checklist and process for reviewing frontend code (.tsx, .ts, .js).

SKILL.md

下载 MD ↓
namefrontend-code-review
descriptionStandardized checklist and process for reviewing frontend code (.tsx, .ts, .js).

Frontend Code Review Skill

Intent: Use whenever requested to review frontend code (React, Next.js, TypeScript).

Supports: - Pending-change review: Reviewing git diff or staged files. - File-targeted review: Reviewing specific existing files.

Review Process

  1. Scan: Read the code to identify architectural patterns, hooks usage, and component structure.
  2. Check: Apply the Review Checklist.
  3. Report: Output findings in the Required Output Format.

Review Checklist

1. Code Quality & Style

  • [ ] Naming: Are variables/functions named descriptively? (e.g., isLoading vs flag)
  • [ ] Type Safety: Is any avoided? are interfaces defined clearly?
  • [ ] Constants: Are magic numbers/strings extracted to constants?
  • [ ] Destructuring: Is consistent destructuring used for props?

2. React & Next.js Best Practices

  • [ ] Hooks: Are hooks used correctly (dependency arrays, rules of hooks)?
  • [ ] Server/Client: Is 'use client' used only when necessary?
  • [ ] Memoization: Are useMemo/useCallback used appropriately (not prematurely)?
  • [ ] Keys: Do lists have stable, unique keys?

3. Performance

  • [ ] Bundle Size: Are large libraries imported entirely when tree-shaking is possible?
  • [ ] Images: Is next/image used with proper sizing?
  • [ ] Renders: Are there obvious unnecessary re-renders?

4. Accessibility (a11y)

  • [ ] Semantic HTML: Are divs used where button, section, etc., are needed?
  • [ ] Attributes: Do images have alt text? Do inputs have labels?

Required Output Format

# Code Review

Found <N> urgent issues:
## 1. <Issue Title>
**File**: `<path>` line `<line>`

```typescript
<snippet of problematic code>

Reason: Suggested Fix:

<snippet of fixed code>

Found suggestions: - : - : ```

来源:first-fluke/fullstack-starter · MIT 许可 · 许可原文 · MD 为来源页保存的历史版本