其他
当建筑、现场服务或贸易项目跟踪客户有估算到收款流程时…
适用于将建筑、现场服务、贸易行业的 DOMAIN.md 转成包含估算、排期、进度、结算/开票和项目摘要的 trades operations 工具原型。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 38/100 ×0.15
适用场景
当建筑、现场服务或贸易项目跟踪客户有估算特定
解决思路
- 读取 `DOMAIN.md` 或 `.tasks/domain.md`,再开始写任何代码;从其中取得业务术语、实体、规则、角色、品牌数据、税率、支付条款和集成点。
- 将工具定位为 trades operations 工具:估算到付款工作流;不要构建通用项目管理工具(Jira/Asana)或 CPQ 工具(无产品配置)。
- 按 Template Contract 工作:`app/layouts/MainLayout.tsx` 已提供 `SidebarProvider`、`Sidebar`、`SidebarContent`、`SidebarInset`、`SidebarTrigger`,不要重新接线。
- 将 `SidebarContent` 作为落地区,填充垂直 stepper 和已保存项目。
- 使用 header 中的品牌槽放入 DOMAIN.md 的 logo 和公司名。
- 在 header 右侧用户菜单前添加角色切换 `DropdownMenu`。
- 通过每个五节对应的 route 组件填充 `<main>` 中的 `<Outlet />`。
- 不添加第二个 `Sidebar` 组件;不把品牌 tile 放入 `SidebarContent`,品牌只放 header。
- 不重写 `SidebarProvider`,不替换 collapsible 行为;使用模板已有实现。
- 不把 stepper 做成主内容区水平 tabs;stepper 必须是 `SidebarContent` 内的垂直列表。
- 如果想重构 `MainLayout.tsx`,停下来,改为填充 `SidebarContent`。
- 使用固定五节:Estimate、Schedule、In Progress、Close Out、Job Summary;这些节来自本技能,不来自 transcript 的业务过程。
- Section 1 Estimate:捕获项目详情并构建基于 scope 的估算。
- Estimate 的项目详情:项目名、客户名、地址使用内联可编辑文本(点击编辑,blur 保存)。
- Estimate 的项目详情:估算编号自动生成且只读。
- Estimate 的项目详情:如果 DOMAIN.md 定义 lead source,则用 `Select` 下拉;否则用自由文本。
- Estimate 的项目详情:estimator notes 使用 `Textarea`,始终可编辑。
- Estimate 的 scope items table:每行表示一个带测量数量的工作范围。
- Scope items table 列 Scope:使用 `Select`,选项来自 DOMAIN.md,如 insulation、drywall、taping、sanding、cleaning、priming 等;可编辑。
- Scope items table 列 Location:文本输入,如 「Main floor living room」、「Basement suite」;可编辑。
- Scope items table 列 Spec/Type:文本输入或 `Select`,如 「Type X」、「Moisture resistant」、「R-20 batt」、「Level 4 finish」;可编辑。
- Scope items table 列 Sq ft:数字输入,可编辑。
- Scope items table 列 Rate:数字输入,按 sqft 的美元/加元费率;可编辑。
- Scope items table 列 Line total:自动计算 Sqft × Rate,不可编辑。
- Scope items table 列 Actions:删除按钮,使用 Trash 图标删除行。
- Scope items table 下方添加 「Add row」 按钮。
- 允许同一 scope 类型有多行,例如不同 location 使用不同 drywall type。
- Scope items table 自动计算 footer:Subtotal、Tax(GST 5%)、Total;每次单元格变化时更新。
- Scope items table 所有单元格可直接编辑:点击、输入、blur 保存;参见 frontend-design skill 的内联编辑模式。
- 从 DOMAIN.md 取 Estimate 数据:Entity Registry → Job Specification 子项作为 Scope 下拉选项。
- 从 DOMAIN.md 取 Estimate 数据:Business Rules → 计量单位(sqft、lft)、税类型和税率、支付条款。
- 从 DOMAIN.md 取 Estimate 数据:Terminology Glossary → 精确 scope 名称,不用通用标签。
- Section 2 Schedule:计划现场工作分配和顺序。
- Schedule 的 Assigned roles/people:使用 `Select` 下拉,来自 DOMAIN.md Stakeholder Map,不用自由文本。
- Schedule 的 Scope sequence:可重排列表,显示哪些 scope items 按什么顺序发生。
- Schedule 的 Start date 和 Target completion date:日期选择器,可编辑。
- Schedule 的 Field crew notes:`Textarea`,可编辑。
- 如果 DOMAIN.md 提到排期工具(如 Bold for scheduling),在节描述中引用:Use Bold to line up the field crew.
- Section 3 In Progress:按 scope item 和 location 跟踪工作完成情况。
- In Progress 显示从 Estimate 的 scope items 填充的表格;相同行,现在跟踪完成。
- In Progress 表列 Scope:文本,不可编辑,来自 Estimate。
- In Progress 表列 Location:不可编辑,来自 Estimate。
- In Progress 表列 Sq ft:数字,不可编辑,来自 Estimate。
- In Progress 表列 Status:`Select` 可编辑,选项 Not Started / In Progress / Completed。
- In Progress 的 Status 更改立即保存到 localStorage。
- In Progress 提供 「Mark all completed」 按钮用于批量更新。
- In Progress 显示进度指示,如 「3 of 5 scope items completed」。
- Section 4 Close Out:处理双向付款流——支付 subtrades 并给客户开票。
- Close Out 并排显示两个发票区。
- Trade Invoice 区:subtrade payment amount 从已完成 scope items 自动计算(sqft × rate)。
- Trade Invoice 区:Status 用 `Select`:Ready to pay / Paid。
- Trade Invoice 区:Payment date 用日期选择器,当 status 为 Paid 时可编辑。
- Trade Invoice 区:如果 DOMAIN.md 提到 Bold,引用它。
- Customer Invoice 区:Invoice amount 为 Estimate 的 subtotal + tax。
- Customer Invoice 区:Status 用 `Select`:Ready to send / Sent / Paid。
- Customer Invoice 区:Invoice date 用日期选择器,可编辑。
- Customer Invoice 区:如果 DOMAIN.md 提到 Arvest,引用它。
- Close Out 提供 「Close out job」 操作按钮,标记项目为 Completed。
- Close Out 的两个 invoice statuses 都必须保存到 localStorage。
- 如果 DOMAIN.md 提到开票工具,在节标题引用:「Trade invoice (Bold)」和「Customer invoice (Arvest)」。
- Section 5 Job Summary:已完成项目的只读摘要,即最终输出视图。
- Job Summary 布局顶部:Company header,使用 domain.md Brand Logos 的 logo URL/path + 公司名 + 占位地址 「123 Main St, City, Province, Postal Code — update in settings」。
- Job Summary 布局:Project metadata,含项目名、客户、地址、估算编号、日期、assigned to;两列 label/value 网格。
- Job Summary 布局:Scope summary table,含所有 scope items 的 scope type、location、spec/type、sqft、rate、line total;使用干净 `Table`,数值列右对齐。
- Job Summary 布局:Totals block,含 subtotal、tax(GST 5%)、total;Total 大且粗体。
- Job Summary 布局:Payment status,trade invoice status badge + customer invoice status badge 并排。
- Job Summary 布局:Terms,含 payment terms(Net 30)、currency(CAD)。
- Job Summary 完全只读:无编辑控件、无输入、无下拉;用户回 Estimate 或 Schedule 修改。
- 使用三面板布局和五节;builder 必须遵循该布局。
- 左侧栏始终可见、可折叠;使用模板已接线的 `SidebarProvider`、`Sidebar`、`SidebarContent`、`SidebarTrigger`。
- Sidebar heading 使用上下文标签如 「Workflow」 或 「Project workflow」,不是公司名;heading 描述导航是什么。
- Sidebar 的 Stepper:在 `SidebarContent` 内垂直列出全部五节:(1) Estimate、(2) Schedule、(3) In Progress、(4) Close Out、(5) Job Summary。
- Stepper 每步显示:step number、label、subtitle(来自 section description)、completion state。
- Stepper 必须是侧栏垂直 stepper,不是主内容区水平 tabs。
- Sidebar 的 Saved projects:列出 localStorage 中的项目;每个显示 name + customer + status badge(Estimated / Scheduled / In Progress / Completed)。
- Saved projects 固定在 sidebar 底部,始终可见无需滚动;双击项目名内联重命名。
- 关键:stepper labels 来自本技能,不来自 DOMAIN.md;DOMAIN.md state model 的 estimated、scheduled、in progress、completed 是项目 status 值,用于 badges。
- Stepper labels 是 Estimate、Schedule、In Progress、Close Out、Job Summary;stepper 有 5 步;domain 有 4 个状态;不要把 domain status list 当 stepper labels,否则丢 Close Out 和 Job Summary。
- 主内容区(center)随节变化:只渲染当前节;不要把所有节堆叠在一个滚动页。
- 不要合并多个节到一个面板(例如把 Schedule / In Progress / Close Out 作为一个节是错的);每个节是独立 panel。
- 不要使用水平 tabs;每个 stepper step 以主内容区全宽显示对应 panel,其他 panel 隐藏。
- 实现主内容区:使用 `currentStep` state 变量(0–4);只渲染匹配 `currentStep` 的 panel。
- 条件渲染所有五个 panel:`{currentStep === 0 && <EstimatePanel />}`、`{currentStep === 1 && <SchedulePanel />}`、`{currentStep === 2 && <InProgressPanel />}`、`{currentStep === 3 && <CloseOutPanel />}`、`{currentStep === 4 && <JobSummaryPanel />}`。
- Estimate panel 渲染:项目详情表单 + scope items table(add/remove rows、quantities、rates、自动计算 totals);提供 「Save estimate」 和 「Continue to Schedule」 按钮。
- Schedule panel 渲染:role/crew assignment dropdowns(来自 DOMAIN.md)、scope sequence、date fields、field notes;提供 「Continue to In Progress」 按钮。
- In Progress panel 渲染:基于 location 的 scope tracking table,每行 status;提供 「Mark completed」 按钮。
- Close Out panel 渲染:trade invoice 区 + customer invoice 区并排;提供 「Close out job」 按钮。
- Job Summary panel 渲染:只读格式化项目摘要,含 company header、scope table、totals、payment status。
- 右侧栏始终可见:Project summary 实时更新 sidebar summary,含 current stage、estimate number、payment terms、subtotal、tax、total;scope items 变化时更新。
- 右侧栏 Workflow notes:将 DOMAIN.md 业务规则作为上下文指导显示;引用 BR-IDs。
- 右侧栏 Actions:Back、Continue、Delete project 按钮;Primary action 使用品牌强调色。
- RBAC:从 DOMAIN.md User Roles 或 Stakeholder Map 种子化 localStorage 角色。
- Role switcher:在 header bar 中使用单个 `DropdownMenu`,不是分开按钮;显示 active role name 和 badge。
- Approval gating:如果 DOMAIN.md 说只有某些角色可以 close out 或 approve,则对其他角色禁用这些按钮。
- Role-specific views:如果角色处理特定阶段(如 estimator 处理 Estimate、project manager 处理 Schedule),当该角色激活时显示相关上下文。
- Price visibility:在 Estimate panel 显示 unit rates、line totals、subtotal、tax、total。
- Price visibility:在右侧栏 Project Summary 显示 running totals。
- Price visibility:使用 DOMAIN.md 的 currency、tax type、tax rate。
- Price visibility:价格格式带 currency code(如 「$3,900.40 CAD」 或 「$3,900.40」 且 summary 显示 「CAD」)。
- shadcn/ui 映射:把 cards 当例外,不是默认布局原语;尽可能将内容内联到页面主体。
- shadcn/ui 映射:仅在真正需要强调、分隔、重复或 dialog/detail 框时用 cards;不要 card-heavy dashboards、cards 内 cards 或通用浮动面板网格。
- 映射 Project details form 到 `Input`、`Label`、`Select`;label 堆叠在 input 上方。
- 映射 Scope items table 到 `Table`、`TableHeader`、`TableRow`、`TableCell`;添加/删除行;数值列右对齐。
- 映射 Scope item status 到 `Badge`:Not Started = outline、In Progress = blue、Completed = green。
- 映射 Project status badges 到 `Badge`:Estimated = amber、Scheduled = blue、In Progress = blue、Completed = green。
- 映射 Role badges 到 `Badge`:Staff = outline、Approver = default。
- 映射 Assignment dropdowns 到 `Select`、`SelectContent`、`SelectItem`;从 DOMAIN.md stakeholder names 填充,不用自由文本输入。
- 映射 Invoice status sections 到内联 sections 加 `Separator`、`Badge`、`Select`、`Input`;trade invoice + customer invoice 并排;仅当需要更强分隔时用 cards。
- 映射 Action buttons 到 `Button`:Primary 品牌强调色 「Continue」;Secondary outline 「Back」;Destructive 「Delete project」。
- 映射 Stepper navigation 到 `SidebarContent` 内自定义垂直列表;step number 放在 circle、label、subtitle、completion checkmark;用 `cn()` 处理状态。
- 映射 Role switcher 到 `DropdownMenu`;header 中单个 dropdown trigger。
- 映射 Project summary sidebar 到内联堆叠 label/value rows;labels muted,values bold;Total row 大而突出。
- 映射 Workflow notes 到紧凑 muted note block;引用材料带 BR-IDs。
- 映射 Date fields 到 `Input` 且 `type="date"`;用于 Start date、target completion。
- 映射 Notes/textarea 到 `Textarea`;用于 Estimator notes、field crew notes。
- 映射 Confirmation dialogs 到 `AlertDialog`;用于 Delete project、close out job。
- 映射 Toast notifications 到 `Sonner` / `toast()`;在 save、mark complete、close out 后。
- Entity → Scope Item Mapping:Project / Job → 顶层 project record → 所有 sections。
- Entity → Scope Item Mapping:Estimate → Estimate data(prices、terms)→ Estimate panel。
- Entity → Scope Item Mapping:Job Specification / Scope → scope items table rows → Estimate + In Progress。
- Entity → Scope Item Mapping:Invoice → customer invoice section → Close Out。
- Entity → Scope Item Mapping:Trade Invoice → trade invoice section → Close Out。
- Entity → Scope Item Mapping:Subtrade Payment → payment status on trade invoice → Close Out。
- Entity → Scope Item Mapping:Field Schedule → Schedule data → Schedule panel。
- Business Rule → Validation Mapping:如果规则是 tracked by square footage,则 scope items table 使用 sqft 作为 quantity column。
- Business Rule → Validation Mapping:如果规则是 paid per square footage,则 trade invoice amount = sum of (sqft × rate) for completed scope items。
- Business Rule → Validation Mapping:如果规则是 different [type] per location,则 scope items table 包含 Location column,同一 scope type 多行。
- Business Rule → Validation Mapping:如果 DOMAIN.md 列出 stages: estimated、scheduled、in progress、completed,将这些值作为项目 status/badge 匹配;stepper 仍按本技能五节标签,不替换为这四个状态。
- Business Rule → Validation Mapping:如果规则是 manually entered,则用 project creation form,无 import flow。
- Business Rule → Validation Mapping:如果规则是 GST/HST at X%,则在 estimate 和 invoice 中加 tax line,tax type 作为 label。
- Business Rule → Validation Mapping:如果规则是 Net 30/45,则在 summary 和 invoice 显示 payment terms。
- Business Rule → Validation Mapping:如果规则是 only [role] can [action],则在相关 button 上加 RBAC gate。
- Integration → Reference Mapping:如果 DOMAIN.md 列出集成点(如 Bold、Arvest、QuickBooks),在 section descriptions 和 workflow notes 中引用,但不要构建 integration UI。
- Integration → Reference Mapping:原型仅 localStorage-only;集成放到 full build。
- Reference Files:预期 `DOMAIN.md` 或 `.tasks/domain.md` 存在;用途是业务术语、entities、rules、roles、brand data。
- 写任何代码前读取 `DOMAIN.md` 或 `.tasks/domain.md`。
适用边界 · 注意事项
- 不用于 CPQ 产品配置与依赖关系,改用 cpq-builder;不用于库存/stock 管理,改用 erp-builder;不用于通用 CRM/联系人管理,改用 crm-builder。
- 不是通用项目管理工具(Jira/Asana),不要把它当通用项目管理构建。
- 没有运行中的 Customware SPA 实例来消费生成的 config 时不适用。