plan-component-hierarchy
Skill2 starsChanged 7 months agoMITView on GitHub
根据页面地图和技术栈,规划组件分层约定、必建基础组件清单、状态管理边界
In this repository26 other files it gives its agents.
- advise-tech-stackSkill
- commit-with-affectsSkill
- db-dev-guideSkill
- export-db-indexesSkill
- frontend-dev-guideSkill
- frontend-ux-evaluatorSkill
- generate-pr-descriptionSkill
- generate-test-from-impactSkill
- generate-test-skeletonSkill
- lock-global-conventionsSkill
- plan-page-mapSkill
- proposal-reviewSkill
- propose-workflow-improvementsSkill
- pr-self-reviewSkill
- record-decisionSkill
- review-guardrailsSkill
- run-pending-specsSkill
- run-testsSkill
- scan-bundle-bloatSkill
- scan-code-hygieneSkill
- scan-dead-routesSkill
- scan-frontend-qualitySkill
- scan-orphan-componentsSkill
- scan-unused-exportsSkill
- sync-llm-contextSkill
- verify-specSkill
The file
Files
Plan Component Hierarchy Skill
单独调用:
/plan-component-hierarchy(适用于现有项目重构组件结构,或新功能模块规划) 在工作流中调用:由project-bootstrapPhase 4 自动触发
执行步骤
Step 1:定义分层规则
根据项目规模和技术栈,输出组件分层约定。
Step 2:生成必建基础组件清单
在第一个业务功能开发前必须存在的组件(哪怕是空壳),避免后期补做造成不一致。
Step 3:定义状态管理边界
明确哪类数据用哪种方案管理,防止状态混乱。
输出格式
## 组件层级约定
### 分层规则
- `components/ui/` — 纯展示原子组件(Button、Input、Badge)。无业务逻辑,无 API 调用
- `components/common/` — 跨业务复用功能组件(DataTable、EmptyState、ConfirmModal)
- `components/{{模块名}}/` — 业务专属组件,只在对应模块内使用
- `pages/` / `app/` — 页面级,负责数据获取和布局编排
### 禁止事项
- NEVER 在 ui/ 原子组件中调用 API 或访问全局 store
- NEVER 在 pages/ 中写超过 50 行的 JSX(抽为组件)
- NEVER 跨模块直接 import 业务组件(应提升到 common/)
### 状态管理边界
- 服务端数据:{{React Query / SWR / Pinia}} — 理由:{{说明}}
- 全局 UI 状态:{{Zustand / Pinia / Vuex}} — 理由:{{说明}}
- 表单状态:{{React Hook Form / VeeValidate}}
### 必建基础组件清单(开发第一个功能前完成)
- [ ] `Layout` — 全局布局框架
- [ ] `EmptyState` — 空数据占位
- [ ] `LoadingSpinner` / `Skeleton` — 加载态
- [ ] `ErrorBoundary` — 错误边界
- [ ] `ConfirmModal` — 危险操作确认弹窗
- [ ] `DataTable` — 列表表格(含分页插槽)
- [ ] `PageHeader` — 页面标题区约束
- MUST 必建组件清单必须在
project-bootstrap归档时写入项目README.md或docs/ - NEVER 在分层规则中设计超过 4 层的目录(增加认知负担)
- 根据技术栈调整状态管理方案(Vue 项目推荐 Pinia,React 项目推荐 Zustand / React Query)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

