Communitygithub.com

前端基础审查

审查 React、Vue 或前端组件代码时自动启用,强制执行组件架构、状态管理模式和 UI 最佳实践。

前端基础审查 是什么?

该技能名为“前端基础审查”,旨在对前端组件代码进行自动化审查,确保遵循组件架构、状态管理和 UI 最佳实践。它适用于 React、Vue、Svelte 等框架,审查内容包括组件单一职责、状态就近放置、性能优化(如 useMemo、代码分割)、无障碍(语义 HTML、ARIA 标签)等。技能提供了详细的检查清单、常见反模式示例(如 God 组件、内联逻辑等)以及苏格拉底式提问模板,帮助开发者深入反思。此外,它还引用了团队内部的组件架构标准文档,并列出需要预警的标记(如文件超过 200 行、过多 useState 调用等),便于开发者在 AI 辅助下进行高质量代码审查。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/danielpodolsky/frontend-fundamentals

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

前端基础审查 是做什么的?

“一个组件应该只做好一件事。如果你用‘和’来描述它,就把它拆分。”

何时启用

在审查以下内容时激活此技能:

  • React/Vue/Svelte 组件
  • UI 渲染逻辑
  • 状态管理代码
  • CSS/样式决策
  • 客户端路由

审查清单

组件架构

  • 单一职责:每个组件是否只做一件事?
  • 规模检查:组件是否不超过 200 行?
  • 属性数量:属性是否少于 7 个?
  • 命名:能否在不使用“和”字的情况下描述该组件?

状态管理

  • 就近放置:状态是否尽可能靠近使用它的地方?
  • 提升状态:兄弟组件之间是否通过父组件正确共享状态?
  • Context vs Props:是否避免了属性透传(最多不超过 3 层)?
  • 服务端状态:服务端数据是否单独管理(如 React Query/SWR)?

性能

  • 记忆化:昂贵的计算是否包裹在 useMemo 中?
  • 回调:事件处理器是否在需要时包裹了 useCallback?
  • 重渲染:是否会导致不必要的重渲染?
  • 懒加载:重型组件是否进行了代码分割?

无障碍

  • 语义化 HTML:是否使用了正确的元素(如 button vs div)?
  • ARIA:交互元素是否无障碍?
  • 键盘:用户能否不使用鼠标进行导航?

常见错误(反模式)

1. God 组件

❌ UserDashboard.tsx (1000 行)
   - 获取数据、管理状态、渲染 UI、处理路由

✅ 拆分为:
   - UserDashboardPage.tsx(容器)
   - UserStats.tsx(展示)
   - UserActivity.tsx(展示)
   - useUserData.ts(自定义 Hook)

2. 渲染内联逻辑

❌ return <div>{users.filter(u => u.active).map(u => ...)}</div>

✅ const activeUsers = useMemo(() => users.filter(u => u.active), [users]);
   return <div>{activeUsers.map(u => ...)}</div>

3. 属性透传

❌ <App user={user}>
     <Layout user={user}>
       <Main user={user}>
         <Widget user={user} />

✅ const user = useUser(); // 在 Widget.tsx 中

4. 布尔属性混乱

❌ <Button primary secondary large small disabled loading />

✅ <Button variant="primary" size="large" state="loading" />

苏格拉底式提问

向初级开发者提问这些问题,而不是直接给出答案:

  1. 架构:“这个组件的单一职责是什么?”
  2. 拆分:“如果要求你单独使用头部部分,你能做到吗?”
  3. 状态:“谁需要这些数据?它应该放在这里还是更高层?”
  4. 性能:“当父组件重新渲染时会发生什么?”
  5. 复杂度:“一个新开发者能在 5 分钟内理解这个吗?”

标准参考

详细模式见:

  • /standards/frontend/component-architecture.md

需要预警的标记

标记需要提出的问题
文件超过 200 行“我们能把它拆分成更小的部分吗?”
超过 5 个 useState 调用“是否应该提升或合并部分状态?”
useEffect 依赖为空数组但使用了外部值“是否缺少依赖项?”
直接操作 DOM“有 React 的做法吗?”
到处使用内联样式“是否应该使用统一的样式方案?”

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相关技能