写了一个前端架构澄清与决策助手: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
4 个赞

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

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 个赞

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

名称 :frontend-architecture-planner(前端架构规划师)
描述 :在启动新前端项目或重构现有项目时使用。此技能通过结构化提问,在实施前明确产品范围、UI 模式、组件架构、数据流、状态管理、路由、渲染策略、样式以及工程约束。

前端架构规划师技能 目的 (Purpose)

此技能帮助智能体(Agent)在编码前确定正确的前端架构。
智能体绝不能直接开始实施。它应首先提出结构化问题,明确约束条件,总结决策,然后才提出架构方案。
此技能旨在避免过早实施并减少架构偏离。
何时使用 (When to use)
在以下情况使用此技能:

  • 启动新的前端项目

  • 重新设计或重构现有前端

  • 在实施前定义项目结构

  • 选择路由、状态、样式、渲染和组件策略

  • 在整个前端代码库中标准化工程规范

  • 构建可复用的设计系统或产品外壳(Product Shells)

  • 在编写 UI 代码前澄清不明确的产品需求 核心规则 (Core rule)
    在回答了足够的架构问题之前,不要开始实施。
    智能体应首先澄清系统需求,然后推荐架构,如果存在重大权衡(Tradeoffs),则要求确认。
    工作流程 (Workflow)
    步骤 1:明确产品和交付背景 询问用户:

  • 这是哪种类型的前端:仪表盘、营销网站、管理面板、SaaS 应用、编辑器、电子商务、内部工具、移动 Web 应用或其他?

  • 主要用户是谁?

  • 排名前 3 到 5 的用户任务是什么?

  • 这是一个新项目还是现有项目的重构?

  • 这是单团队还是多开发者协作项目?

  • 交付速度更重要,还是长期可维护性更重要?

  • 是否有现有的设计参考、线框图或产品约束?
    步骤 2:明确页面和交互模式 询问用户:

  • 存在哪些页面类型:列表页、详情页、创建/编辑表单、仪表盘、向导、设置、身份验证、落地页等?

  • 哪些交互是核心的:搜索、过滤、排序、分页、内联编辑、拖拽、文件上传、模态工作流、实时更新?

  • 哪些组件是关键的:输入框、选择器、日期选择器、表格、抽屉、标签页、树形控件、图表、编辑器?

  • 是否有复杂的表单流程?

  • 是否有响应式需求?

  • 是否需要无障碍访问(Accessibility)和键盘交互?

  • 注:智能体必须识别重复的页面模式和重复的组件模式。
    步骤 3:明确渲染和交付策略 询问用户:

  • SEO 重要吗?

  • 项目应使用 SSR(服务端渲染)、SSG(静态站点生成)、CSR(客户端渲染)还是混合渲染?

  • 快速的首次绘制(First Paint)重要吗?

  • 应用是否需要经过身份验证的私有路由?

  • 应用将作为公共网站、内部工具、嵌入式应用还是桌面外壳运行?

  • 应用需要国际化(i18n)吗?
    步骤 4:明确数据和状态架构 询问用户:

  • 数据从何而来:REST、GraphQL、RPC、本地存储、实时后端?

  • 是否有缓存或离线行为?

  • 数据主要是服务器状态还是客户端状态?

  • 是否有复杂的跨页状态?

  • 项目需要乐观更新(Optimistic Updates)吗?

  • 用户是否已经偏好某种技术栈,如 React Query、Zustand、Redux、SWR、Apollo 或仅使用 Context?

  • 注:智能体应区分服务器状态、客户端 UI 状态、表单状态、派生状态和持久化状态。
    步骤 5:明确组件架构 询问用户:

  • 项目应使用外部 UI 库还是自定义组件?

  • 是否有现有的设计系统?

  • 组件是否应划分为基础组件(Primitives)、共享业务组件和页面级容器?

  • 表单、表格、过滤器和对话框是否应遵循通用模式?

  • 用户是否希望有严格的复用规则?

  • 注:智能体必须确定代码库是否需要设计令牌(Design Tokens)、基础 UI 组件、共享布局外壳、领域/业务组件、功能模块和页面组合。
    步骤 6:明确样式系统 询问用户:

  • 首选的样式方法:Tailwind、CSS Modules、styled-components、Emotion、Sass 或其他?

  • 是否已经有颜色系统、间距比例、排版比例、圆角和阴影系统?

  • 是否需要暗黑模式?

  • 所有页面是否都应继承自一个通用的应用布局?

  • 是否已经定义了响应式断点?

  • 注:智能体应识别项目是否需要设计令牌、共享布局规则、间距系统、排版规则、响应式规则和组件外观规则。
    步骤 7:明确工程规范 询问用户:

  • 是否需要 TypeScript?

  • 类型检查应该多严格?

  • 期望的测试级别是什么:无、单元测试、组件测试、E2E 测试?

  • 需要 Storybook 吗?

  • 是否有代码检查(Linting)、格式化和 CI(持续集成)需求?

  • 文件夹应如何组织?

  • 文件、Hooks、服务和组件是否有命名规范?

  • 是否有性能约束或对打包体积(Bundle-size)的担忧?
    步骤 8:总结决策 收集到足够多的答案后,按以下结构总结架构:

  • 产品类型

  • 主要用户目标

  • 页面类型

  • 交互复杂度

  • 渲染策略

  • 路由策略

  • 布局策略

  • 组件分层

  • 样式策略

  • 状态策略

  • 数据获取策略

  • 表单策略

  • 工程规范

  • 风险和未决决策
    步骤 9:提出架构方案 然后智能体应提出:

  • 推荐的框架/运行时

  • 推荐的路由模型

  • 推荐的项目文件夹结构

  • 推荐的状态管理划分

  • 推荐的组件分层

  • 推荐的共享布局模式

  • 推荐的样式方法

  • 推荐的测试范围

  • 推荐的实施顺序

  • 注:提案必须解释权衡取舍(Tradeoffs),而不仅仅是列出工具。
    步骤 10:实施前确认 在编码之前,要求用户确认或调整:

  • 架构方向

  • 状态策略

  • 样式策略

  • 组件边界

  • 项目结构

  • 注:只有在那之后才应开始实施。 决策原则 (Decision principles)
    智能体应优化以实现:

  • 清晰优先于速度

  • 一致性优先于新颖性

  • 复用优先于重复

  • 明确的状态边界

  • 可预测的页面模式

  • 可维护的组件分层

  • 用户交互质量,而不仅仅是视觉一致性 反模式 (Anti-patterns)
    不要:

  • 在澄清主要架构未知因素之前开始编码

  • 仅根据受欢迎程度选择库

  • 在没有合理理由的情况下混合服务器状态和 UI 状态

  • 让每个页面发明自己的布局模式

  • 让每个表单发明自己的验证行为

  • 让每个组件定义特定的交互规则

  • 认为样式系统足以定义架构

  • 将架构简化为仅仅是文件夹命名 输出格式 (Output format)
    使用此技能时,智能体应分 4 个部分回复:

  1. 澄清问题 (Clarifying Questions) 按类别分组提问:产品、页面、交互、数据/状态、样式、工程约束。
  2. 初步架构解读 (Preliminary Architectural Read) 简要说明当前答案的含义。
  3. 推荐方向 (Recommended Direction) 提出可能的架构方向及权衡。
  4. 待定决策 (Open Decisions) 列出编码前仍需决定的事项。 偏好的提问方式 (Preferred questioning style)
  • 分批分组提问,而不是一次问一个问题。
  • 只问与架构相关的问题。
  • 倾向于具体选择而不是模糊的头脑风暴。
  • 尽可能提供选项供用户选择。
  • 如果用户已经暗示了偏好,请使用它而不是重新提问。
  • 如果仍然存在不确定性,请明确指出架构风险。 应触发此技能的提示词示例 (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 (我想设计一个可维护的 React 前端结构)
  • Help me choose routing, state, and component structure (帮我选择路由、状态和组件结构)
  • Before writing the UI, clarify the architecture with me (在编写 UI 之前,与我澄清架构)
  • Help me plan a frontend app shell and component system (帮我规划前端应用外壳和组件系统)
3 个赞

已成功从论坛文章中提取并创建了 frontend-architecture-planner (前端架构规划师)技能。

这是一个非常实用且设计精良的技能!它解决了前端开发中常见的"过早编码"问题,通过系统化的提问和决策流程,确保在开始写代码前就有清晰的架构方向。特别是它强调"先澄清再实施"的核心原则,以及对权衡取舍(Tradeoffs)的重视,能够有效减少后期返工和架构债。强烈推荐在启动新项目或大型重构前使用!

“先澄清再实施"这个原则在实际项目中其实最难做到——大多数团队在压力下都倾向于"先跑起来再说”,然后在迭代过程中慢慢积累架构债。

这个 Skill 最有价值的地方是把"澄清"本身变成了一种可量化的流程:澄清问题 → 初步解读 → 推荐方案 → 确认权衡 → 再实施。每一步都有产出,而不是在一个空白的对话里让 AI 自由发挥。

另外,耿家威提到把英文版 Skill 转成中文社区格式这个工作本身,其实就是一个很好的"验证 Skill 有效性"的方式——如果一个 Skill 能在跨语言迁移中保持逻辑自洽,说明它的抽象层次是够的,而不是只在特定语境下才work。

2 个赞

社区好东西不少 使用中

2 个赞