Agent SkillsDanielPodolsky/ownyourcode › frontend-fundamentals

frontend-fundamentals

GitHub

用于审查前端组件架构、状态管理和性能。检查单一职责、Props数量及状态就近原则,识别上帝组件和Prop Drilling等反模式,并通过苏格拉底式提问引导初级开发者优化代码结构与可维护性。

.claude/skills/fundamentals/frontend/SKILL.md DanielPodolsky/ownyourcode

Trigger Scenarios

审查React/Vue/Svelte组件 评估UI渲染逻辑与状态管理 检查CSS样式决策 审查客户端路由 评估组件性能与可访问性

Install

npx skills add DanielPodolsky/ownyourcode --skill frontend-fundamentals -g -y
More Options

Non-standard path

npx skills add https://github.com/DanielPodolsky/ownyourcode/tree/main/.claude/skills/fundamentals/frontend -g -y

Use without installing

npx skills use DanielPodolsky/ownyourcode@frontend-fundamentals

指定 Agent (Claude Code)

npx skills add DanielPodolsky/ownyourcode --skill frontend-fundamentals -a claude-code -g -y

安装 repo 全部 skill

npx skills add DanielPodolsky/ownyourcode --all -g -y

预览 repo 内 skill

npx skills add DanielPodolsky/ownyourcode --list

SKILL.md

Frontmatter
{
    "name": "frontend-fundamentals",
    "description": "Reviews React\/Vue component architecture, state, and hooks. Use when junior builds components, forms, modals, uses useState, useEffect, adds state, or asks \"is this good React\"."
}

Frontend Fundamentals Review

"A component should do ONE thing well. If you're describing it with 'and', split it."

When to Apply

Activate this skill when reviewing:

  • React/Vue/Svelte components
  • UI rendering logic
  • State management code
  • CSS/styling decisions
  • Client-side routing

Review Checklist

Component Architecture

  • Single Responsibility: Does each component do ONE job?
  • Size Check: Is the component under 200 lines?
  • Props Count: Are there fewer than 7 props?
  • Naming: Can you describe the component without saying "and"?

State Management

  • Colocation: Is state as close as possible to where it's used?
  • Lifting: Is state shared properly between siblings via parent?
  • Context vs Props: Is prop drilling avoided (max 3 levels)?
  • Server State: Is server data managed separately (React Query/SWR)?

Performance

  • Memoization: Are expensive computations wrapped in useMemo?
  • Callbacks: Are event handlers wrapped in useCallback where needed?
  • Re-renders: Will this cause unnecessary re-renders?
  • Lazy Loading: Are heavy components code-split?

Accessibility

  • Semantic HTML: Are proper elements used (button vs div)?
  • ARIA: Are interactive elements accessible?
  • Keyboard: Can users navigate without a mouse?

Common Mistakes (Anti-Patterns)

1. God Components

❌ UserDashboard.tsx (1000 lines)
   - fetches data, manages state, renders UI, handles routing

✅ Split into:
   - UserDashboardPage.tsx (container)
   - UserStats.tsx (presentation)
   - UserActivity.tsx (presentation)
   - useUserData.ts (hook)

2. Logic in Render

❌ 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. Prop Drilling

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

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

4. Boolean Prop Soup

❌ <Button primary secondary large small disabled loading />

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

Socratic Questions

Ask the junior these questions instead of giving answers:

  1. Architecture: "What is the ONE job of this component?"
  2. Splitting: "If I asked you to use just the header part elsewhere, could you?"
  3. State: "Who needs this data? Should it live here or higher up?"
  4. Performance: "What happens when the parent re-renders?"
  5. Complexity: "Could a new developer understand this in 5 minutes?"

Standards Reference

See detailed patterns in:

  • /standards/frontend/component-architecture.md

Red Flags to Call Out

Flag Question to Ask
File > 200 lines "Can we split this into smaller pieces?"
> 5 useState calls "Should some of this state be lifted or combined?"
useEffect with [] deps but uses external values "Are we missing dependencies?"
Direct DOM manipulation "Is there a React way to do this?"
Inline styles everywhere "Should we use a consistent styling approach?"

Version History

  • bd1f17c Current 2026-07-11 17:35

Same Skill Collection

.claude/skills/career/resume-bullets/SKILL.md
.claude/skills/career/star-stories/SKILL.md
.claude/skills/fundamentals/accessibility/SKILL.md
.claude/skills/fundamentals/backend/SKILL.md
.claude/skills/fundamentals/database/SKILL.md
.claude/skills/fundamentals/debugging/SKILL.md
.claude/skills/fundamentals/documentation/SKILL.md
.claude/skills/fundamentals/engineering/SKILL.md
.claude/skills/fundamentals/error-handling/SKILL.md
.claude/skills/fundamentals/performance/SKILL.md
.claude/skills/fundamentals/resistance/SKILL.md
.claude/skills/fundamentals/security/SKILL.md
.claude/skills/fundamentals/seo/SKILL.md
.claude/skills/fundamentals/testing/SKILL.md
.claude/skills/gates/error/SKILL.md
.claude/skills/gates/fundamentals/SKILL.md
.claude/skills/gates/ownership/SKILL.md
.claude/skills/gates/performance/SKILL.md
.claude/skills/gates/security/SKILL.md
.claude/skills/gates/testing/SKILL.md

Metadata

Files
0
Version
bd1f17c
Hash
1628f72c
Indexed
2026-07-11 17:35

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-14 09:26
浙ICP备14020137号-1 $Map of visitor$