搜索

PythonReactSEOPDF
GitHub Skill

frontend-architecture

Frontend Architecture & Performance: patterns and techniques for building scalable, maintainable, and high-performance frontends.

ABIvan-Tech☆ 24 仓库 Stars4 仓库 Forks

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

查看来源 ↗使用指南

技能说明

Frontend Architecture & Performance

Use this skill for UI architecture, component boundaries, state placement, and frontend performance work.

Priorities

  1. Clear ownership
  2. Predictable state flow
  3. Usable performance
  4. Composition over duplication
  5. Maintainable delivery

Core Rules

1. Split by responsibility, not by hype
  • Components should have clear ownership.
  • Keep screen/container concerns separate from presentational concerns when that improves clarity.
  • Do not create a new architectural layer unless it reduces real complexity.
2. Keep state as local as possible
  • Start with local component state.
  • Lift state only when multiple consumers truly need it.
  • Global state should be reserved for cross-cutting or shared application concerns, not convenience.
3. Make data flow obvious
  • Prefer one clear direction of data flow.
  • Keep fetching, normalization, and rendering responsibilities understandable.
  • Avoid passing unstable props or context values through large trees without reason.
4. Reuse patterns intentionally
  • Reuse component, layout, and styling conventions already present in the repo.
  • Prefer composition over giant configurable mega-components.
  • Extract shared primitives only after repetition becomes real.
5. Design for loading, error, and empty states
  • Every meaningful async screen should define:
    • loading state
    • error state
    • empty state
    • success state
  • Do not optimize only the happy path.

Performance Rules

6. Optimize the right thing
  • Prioritize user-visible slowness: route transitions, large lists, blocking renders, image weight, bundle size, and repeated network work.
  • Measure with the platform tools available in the repo before adding memoization or architectural complexity.
7. Keep renders cheap
  • Avoid unnecessary derived work in render paths.
  • Memoization is a tool, not a default.
  • Stabilize props and callbacks only when it measurably helps or prevents correctness issues.
8. Be deliberate about bundles
  • Lazy-load heavy routes or features when it helps real startup cost.
  • Keep dependency additions conservative.
  • Avoid shipping large helpers for tiny benefits.

Styling and Structure Rules

  • Respect the repo's styling system.
  • Keep layout primitives and page-specific styling separate when possible.
  • Avoid one-off CSS or utility explosions that are hard to reason about later.
  • Accessibility is architecture too: semantics, focus flow, labels, and contrast should be built in, not patched in at the end.

Review Heuristics

Look for:

  • oversized components with mixed responsibilities
  • state lifted too high
  • duplicated fetching/normalization logic
  • missing loading/error/empty states
  • performance work added without measurement
  • giant shared components that became bottlenecks
  • unnecessary global state or context churn

Anti-Patterns

Avoid:

  • mega-components that own unrelated concerns
  • storing server state and transient UI state in the same generic bucket without boundaries
  • premature abstraction of every repeated markup fragment
  • memoization everywhere "just in case"
  • component APIs with too many mode flags

Quick Checklist

  • Component ownership is clear
  • State lives at the lowest reasonable level
  • Async states are all accounted for
  • Shared abstractions are justified by real reuse
  • Performance issues are measured, not guessed
  • Accessibility and semantics are part of the structure

使用示例

查看来源仓库中的使用示例与配置说明。

查看来源 ↗

来源历史

收录时间
2026-03-11
索引更新时间
2026-03-11
Branch
main

收录与同步日期属于本站记录。源码修改历史请查看来源仓库。

GitHub ↗

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!