写了一个前端架构澄清与决策助手:frontend-architecture-planner


它的核心目标不是直接替你拍板,而是让 Agent 在开始写前端或者重构前端之前,先系统化地向你提问,把这些关键问题问清楚:

  • 项目类型是什么

  • 用户是谁

  • 页面模式有哪些

  • 数据流怎么走

  • 组件体系怎么分层

  • 状态管理怎么选

  • 路由和布局怎么组织

  • 是否 SSR / CSR / SSG

  • 是否要移动端适配

  • 是否有设计系统

  • 团队约束和交付节奏是什么



name: “frontend-architecture-planner”

description: “Use when starting a new frontend project or refactoring an existing one. This skill asks structured questions to clarify product scope, UI patterns, component architecture, data flow, state management, routing, rendering strategy, styling, and engineering constraints before implementation.”

Frontend Architecture Planner Skill

Purpose

This skill helps the agent determine the correct frontend architecture before coding.

The agent must not jump straight into implementation. It should first ask structured questions, identify constraints, summarize decisions, and only then propose an architecture.

This skill is designed to avoid premature implementation and reduce architectural drift.

When to use

Use this skill when:

  • starting a new frontend project
  • redesigning or refactoring an existing frontend
  • defining project structure before implementation
  • choosing routing, state, styling, rendering, and component strategies
  • standardizing engineering conventions across a frontend codebase
  • building reusable design systems or product shells
  • clarifying unclear product requirements before coding UI

Core rule

Do not begin implementation until enough architectural questions have been answered.

The agent should first clarify the system, then recommend the architecture, then ask for confirmation if major tradeoffs exist.

Workflow

Step 1: Clarify the product and delivery context

Ask the user:

  • What kind of frontend is this: dashboard, marketing site, admin panel, SaaS app, editor, e-commerce, internal tool, mobile web app, or other?
  • Who are the primary users?
  • What are the top 3 to 5 user tasks?
  • Is this a new project or a refactor of an existing one?
  • Is this single-team or multi-developer collaboration?
  • Is speed of delivery more important, or long-term maintainability?
  • Are there existing design references, wireframes, or product constraints?

Step 2: Clarify page and interaction patterns

Ask the user:

  • What page types exist: list page, detail page, create/edit form, dashboard, wizard, settings, auth, landing page, etc.?
  • Which interactions are core: search, filtering, sorting, pagination, inline edit, drag-and-drop, file upload, modal workflows, real-time updates?
  • Which components are critical: input, select, date picker, table, drawer, tabs, tree, chart, editor?
  • Are there complex form flows?
  • Are there responsive requirements?
  • Are accessibility and keyboard interactions required?

The agent must identify repeated page patterns and repeated component patterns.

Step 3: Clarify rendering and delivery strategy

Ask the user:

  • Is SEO important?
  • Should the project use SSR, SSG, CSR, or hybrid rendering?
  • Is fast first paint important?
  • Does the app need authenticated private routes?
  • Will the app run as a public website, internal tool, embedded app, or desktop shell?
  • Does the app need internationalization?

Step 4: Clarify data and state architecture

Ask the user:

  • Where does data come from: REST, GraphQL, RPC, local storage, realtime backend?
  • Is there caching or offline behavior?
  • Is data mostly server state or client state?
  • Are there complex cross-page states?
  • Does the project need optimistic updates?
  • Does the user already prefer a stack such as React Query, Zustand, Redux, SWR, Apollo, or context-only?

The agent should distinguish:

  • server state
  • client UI state
  • form state
  • derived state
  • persistent state

Step 5: Clarify component architecture

Ask the user:

  • Should the project use an external UI library or custom components?
  • Is there an existing design system?
  • Should components be divided into primitives, shared business components, and page-level containers?
  • Should forms, tables, filters, and dialogs follow common patterns?
  • Does the user want strict reuse rules?

The agent must determine whether the codebase needs:

  • design tokens
  • primitive UI components
  • shared layout shell
  • domain components
  • feature modules
  • page compositions

Step 6: Clarify styling system

Ask the user:

  • Preferred styling approach: Tailwind, CSS Modules, styled-components, Emotion, Sass, or other?
  • Is there already a color system, spacing scale, typography scale, radius, and shadow system?
  • Is dark mode required?
  • Should all pages inherit from a common app layout?
  • Are responsive breakpoints already defined?

The agent should identify whether the project needs:

  • design tokens
  • shared layout rules
  • spacing system
  • typography rules
  • responsive rules
  • component appearance rules

Step 7: Clarify engineering conventions

Ask the user:

  • Is TypeScript required?
  • How strict should typing be?
  • What testing level is expected: none, unit, component, E2E?
  • Is Storybook needed?
  • Are there linting, formatting, and CI requirements?
  • How should folders be organized?
  • Are there naming conventions for files, hooks, services, and components?
  • Are there performance constraints or bundle-size concerns?

Step 8: Synthesize decisions

After enough answers are collected, summarize the architecture in this structure:

  • Product type
  • Primary user goals
  • Page types
  • Interaction complexity
  • Rendering strategy
  • Routing strategy
  • Layout strategy
  • Component layering
  • Styling strategy
  • State strategy
  • Data-fetching strategy
  • Form strategy
  • Engineering conventions
  • Risks and unresolved decisions

Step 9: Propose the architecture

The agent should then propose:

  • recommended framework/runtime
  • recommended routing model
  • recommended project folder structure
  • recommended state management split
  • recommended component layering
  • recommended shared layout pattern
  • recommended styling approach
  • recommended testing scope
  • recommended implementation sequence

The proposal must explain tradeoffs, not just list tools.

Step 10: Confirm before implementation

Before coding, ask the user to confirm or adjust:

  • architecture direction
  • state strategy
  • styling strategy
  • component boundaries
  • project structure

Only after that should implementation begin.

Decision principles

The agent should optimize for:

  • clarity before speed
  • consistency before novelty
  • reuse before duplication
  • explicit state boundaries
  • predictable page patterns
  • maintainable component layering
  • user interaction quality, not only visual consistency

Anti-patterns

Do not:

  • start coding before clarifying major architectural unknowns
  • choose libraries only based on popularity
  • mix server state and UI state without rationale
  • let every page invent its own layout pattern
  • let every form invent its own validation behavior
  • let every component define ad hoc interaction rules
  • assume a style system is enough to define architecture
  • reduce architecture to folder naming only

Output format

When using this skill, the agent should respond in 4 sections:

1. Clarifying Questions

Ask grouped questions by category:

  • product
  • pages
  • interactions
  • data/state
  • styling
  • engineering constraints

2. Preliminary Architectural Read

Briefly state what the current answers imply.

3. Recommended Direction

Propose the likely architecture direction, with tradeoffs.

4. Open Decisions

List what still must be decided before coding.

Preferred questioning style

  • Ask in grouped batches, not one question at a time.
  • Ask only architecture-relevant questions.
  • Prefer concrete choices over vague brainstorming.
  • When possible, provide options for the user to choose from.
  • If the user already implied a preference, use it instead of re-asking.
  • If uncertainty remains, identify the architectural risk explicitly.

Example prompts that should trigger this skill

  • Help me define the frontend architecture before coding
  • Ask me questions to determine the right frontend stack
  • I want to design a maintainable React frontend structure
  • Help me choose routing, state, and component structure
  • Before writing the UI, clarify the architecture with me
  • Help me plan a frontend app shell and component system
2 个赞

报告,官方,我需要论坛新增英文翻译功能。

2 个赞

好的,我叫博思加进去

2 个赞

hohohoho,我都不好意思评估这个流程

2 个赞

@大模型善后工程师-K叔 你说怎么改

2 个赞

我没明白这个最后的输出结果是什么?

2 个赞

@大模型善后工程师-K叔 就是帮助我梳理前端架构的,不是帮我设计,是帮助我梳理,我来决策的

2 个赞

梳理也需要有个输出呀。
你这个只是抛出问题,用户回答了之后,可能需要一个结论或者建议

3 个赞

是喔!!!

2 个赞

自问自答:

这个 Skill 最终产出什么?

一共 4 类固定产出

1. 一组结构化、成批的澄清问题

不是零散提问,是按模块一次性问完:

  • 产品 / 用户 / 场景
  • 页面模式 & 交互
  • 渲染 / 路由 / 权限
  • 数据流 & 状态
  • 组件 & 样式
  • 工程规范

产出:清晰的提问清单


2. 一份初步架构解读(Preliminary Architectural Read)

根据你回答的信息,AI 总结:

  • 这是什么类型的项目
  • 复杂度在哪
  • 哪些技术方向基本确定
  • 哪些还不确定

产出:对项目的精准理解


3. 一份正式的前端架构推荐方案(核心产出)

这是最值钱的部分:

  • 推荐框架 / 渲染模式(SSR/CSR/SSG)
  • 路由方案
  • 项目目录结构
  • 状态管理拆分
  • 组件分层(基础组件 / 业务组件 / 页面)
  • 样式方案
  • 数据请求策略
  • 表单规范
  • 工程规范(TS、测试、分包)

每条都带:为什么这么选 + 利弊权衡 产出:可直接落地的前端架构设计


4. 一张未决决策清单(Open Decisions)

列出:

  • 还没确定的关键选择
  • 可能的风险
  • 必须定下来才能写代码的点

产出:避免后期返工的风险清单


一句话终极总结

这个 Skill 不写代码,它产出「一份完整、严谨、可直接开工的前端架构设计方案」。

2 个赞

报告,官方,我需要论坛新增英文翻译功能。