workflow-specify.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <workflow id="wds-4-specify" name="WDS Phase 4 — Specify Page" version="1.0">
  3. <description>
  4. Create a complete, implementation-ready page specification: layout, components with Object IDs,
  5. multilingual content, interactions, states, validation, spacing, and typography.
  6. All 9 steps must be completed in sequence before the specification is considered done.
  7. Validation runs at step 9 before the spec is written to disk.
  8. </description>
  9. <prerequisites>
  10. <require file="{output_folder}/C-UX-Scenarios/{scenario-slug}/{scenario-slug}.md" label="Scenario outline"/>
  11. <require file="{output_folder}/C-UX-Scenarios/{scenario-slug}/pages/{NN}.{step}-{page-slug}/" label="Page folder from Phase 3 or design activity"/>
  12. <require file="{output_folder}/_progress/00-design-log.md" label="Design log"/>
  13. </prerequisites>
  14. <!-- ═══════════════════════════════════════════════════════════════════ -->
  15. <!-- INITIALIZATION — runs before step 1 -->
  16. <!-- ═══════════════════════════════════════════════════════════════════ -->
  17. <initialization>
  18. <instruction>
  19. Read the design log at {output_folder}/_progress/00-design-log.md before starting.
  20. Check Current table for any in-progress work from a previous session.
  21. </instruction>
  22. <instruction>
  23. Load page context from the existing page folder:
  24. {output_folder}/C-UX-Scenarios/[NN-slug]/pages/[NN].[step]-[page-slug]/
  25. The page boilerplate created in Phase 3 contains scenario, page number, platform,
  26. page purpose, entry context, exit action, and on-page interactions.
  27. </instruction>
  28. <instruction>
  29. Update the design log Current table: add this page with status "specifying".
  30. </instruction>
  31. <gate type="file-exists" path="{output_folder}/C-UX-Scenarios/{scenario-slug}/{scenario-slug}.md"
  32. failure-message="Scenario outline must exist. Select a scenario from the design log before running Specify."/>
  33. <gate type="folder-exists" path="{output_folder}/C-UX-Scenarios/{scenario-slug}/pages/{NN}.{step}-{page-slug}/"
  34. failure-message="Page folder must exist. Run Phase 3 or a design activity (Suggest/Dream) to create the page structure before specifying."/>
  35. </initialization>
  36. <!-- ═══════════════════════════════════════════════════════════════════ -->
  37. <!-- STEP 1 — Page Basics -->
  38. <!-- ═══════════════════════════════════════════════════════════════════ -->
  39. <step id="1-page-basics" name="Capture page metadata and entry/exit points" step-file="steps-p/step-01-page-basics.md">
  40. <instruction>
  41. Present the page basics form to the user and collect all required fields:
  42. - Page name/title
  43. - URL/route (if applicable)
  44. - Main user goal (one sentence)
  45. - Entry points (where users come from)
  46. - Exit points (where users go next)
  47. For public pages, also collect SEO data — check the project brief's SEO Strategy for target keywords:
  48. - Primary keyword
  49. - Secondary keywords
  50. - URL slug (from keyword map)
  51. </instruction>
  52. <instruction>
  53. Store all captured values as page_basics:
  54. page_title, url_route, user_goal, entry_points, exit_points,
  55. primary_keyword (public pages), secondary_keywords (public pages), url_slug (public pages).
  56. </instruction>
  57. <gate type="data-captured" required="page_title url_route user_goal entry_points exit_points"
  58. failure-message="All basic page fields must be captured before proceeding. Do not skip any field."/>
  59. <gate type="seo-data-captured" condition="page-is-public"
  60. required="primary_keyword secondary_keywords url_slug"
  61. failure-message="SEO data is mandatory for public pages. Check the project brief's SEO Strategy section."/>
  62. <gate type="user-confirms" prompt="All page basics captured and confirmed by user?"/>
  63. <output>page_basics stored — title, route, goal, entry/exit points, and SEO data (if public page).</output>
  64. </step>
  65. <!-- ═══════════════════════════════════════════════════════════════════ -->
  66. <!-- STEP 2 — Layout Sections -->
  67. <!-- ═══════════════════════════════════════════════════════════════════ -->
  68. <step id="2-layout-sections" name="Define major page sections" step-file="steps-p/step-02-layout-sections.md">
  69. <instruction>
  70. Ask the user to describe the major areas of the page (header, hero, main content, sidebar,
  71. footer, etc.). Do not define individual components yet — only high-level sections.
  72. </instruction>
  73. <instruction>
  74. For each section described, store:
  75. - section_name
  76. - section_purpose
  77. - section_priority (primary / secondary)
  78. </instruction>
  79. <instruction>
  80. Confirm the section list with the user before proceeding.
  81. </instruction>
  82. <gate type="data-captured" required="layout_sections" minimum-count="1"
  83. failure-message="At least one layout section must be defined. Do not proceed to components without a section structure."/>
  84. <gate type="section-attributes-complete" required-per-section="name purpose priority"
  85. failure-message="Each section must have a name, purpose, and priority before proceeding."/>
  86. <gate type="user-confirms" prompt="Layout sections defined and confirmed?"/>
  87. <output>layout_sections stored — section names, purposes, and priorities captured.</output>
  88. </step>
  89. <!-- ═══════════════════════════════════════════════════════════════════ -->
  90. <!-- STEP 3 — Components and Object IDs -->
  91. <!-- ═══════════════════════════════════════════════════════════════════ -->
  92. <step id="3-components-objects" name="Identify components and assign Object IDs" step-file="steps-p/step-03-components-objects.md">
  93. <instruction>
  94. Work through each section identified in step 2. For each section, go top-to-bottom,
  95. left-to-right. Ask the user to describe the next object in the section.
  96. </instruction>
  97. <instruction>
  98. For each object described, load and execute the object router:
  99. data/object-types/object-router.md
  100. The router will: ask for object type, load the correct object-type template, guide through
  101. complete documentation, generate a specification with an Object ID, then return here.
  102. </instruction>
  103. <instruction>
  104. After each component specification is complete, check project config:
  105. if design system is enabled, run workflows/wds-7-design-system/design-system-router.md
  106. to check for similar components and extract component-level info. Update page spec with
  107. the reference. If design system is disabled, keep the full specification on the page.
  108. </instruction>
  109. <instruction>
  110. Continue until the user confirms all objects in the section are documented.
  111. Move to the next section. Continue until all sections are complete.
  112. Present a summary: sections processed, total components, components by type, all Object IDs assigned.
  113. </instruction>
  114. <gate type="all-sections-processed" rule="every-layout-section-has-been-worked-through"
  115. failure-message="All sections from step 2 must be processed. Do not skip any section."/>
  116. <gate type="object-ids-assigned" rule="every-component-has-an-object-id"
  117. failure-message="Every documented component must have an Object ID before proceeding to content. Missing IDs block downstream steps."/>
  118. <gate type="object-router-used" rule="every-component-routed-through-object-router"
  119. failure-message="Object-type routing must be used for every component. Do not document components without using the router."/>
  120. <gate type="design-system-check-performed" condition="design-system-enabled"
  121. failure-message="Design system check must be performed after every component when design system is enabled."/>
  122. <gate type="user-confirms" prompt="All components documented with Object IDs, design system checks complete?"/>
  123. <output>Component registry complete — all Object IDs assigned, design system references updated where applicable.</output>
  124. </step>
  125. <!-- ═══════════════════════════════════════════════════════════════════ -->
  126. <!-- STEP 4 — Content and Languages -->
  127. <!-- ═══════════════════════════════════════════════════════════════════ -->
  128. <step id="4-content-languages" name="Specify all text content in all languages" step-file="steps-p/step-04-content-languages.md">
  129. <instruction>
  130. Ask the user what languages this page supports. Store as supported_languages array.
  131. </instruction>
  132. <instruction>
  133. For every text element on the page (labels, buttons, headings, messages, placeholders,
  134. error text — derived from the component list), ask the user to provide content in every
  135. supported language. Primary language first, then each additional language.
  136. </instruction>
  137. <instruction>
  138. Store multilingual_content keyed by element and language.
  139. No text element may have content in only a subset of languages — full coverage is required.
  140. </instruction>
  141. <gate type="languages-defined" required="supported_languages-array-not-empty"
  142. failure-message="Supported languages must be defined before collecting content. Ask the user for the language list first."/>
  143. <gate type="multilingual-coverage" rule="every-text-element-has-content-in-every-language"
  144. failure-message="Every text element must have content in ALL supported languages. Do not proceed with incomplete language coverage."/>
  145. <gate type="user-confirms" prompt="All text content specified in all supported languages?"/>
  146. <output>multilingual_content stored — all text elements captured in all supported languages.</output>
  147. </step>
  148. <!-- ═══════════════════════════════════════════════════════════════════ -->
  149. <!-- STEP 5 — Interactions -->
  150. <!-- ═══════════════════════════════════════════════════════════════════ -->
  151. <step id="5-interactions" name="Define interaction behaviors per component" step-file="steps-p/step-05-interactions.md">
  152. <instruction>
  153. For each interactive component in the registry (from step 3), ask the user what happens
  154. when the user interacts with it. Cover: on click / on input / on focus,
  155. immediate response, state changes, navigation (if applicable), data sent/received.
  156. </instruction>
  157. <instruction>
  158. Store interaction_behavior keyed by Object ID. Do not generate behaviors without
  159. user input — ask for each component individually.
  160. </instruction>
  161. <instruction>
  162. Do not define visual states in this step — that is step 6.
  163. </instruction>
  164. <gate type="all-interactive-components-covered" rule="every-interactive-object-id-has-interaction-behavior"
  165. failure-message="Every interactive component must have defined behaviors. Do not skip any."/>
  166. <gate type="interaction-types-covered" rule="click-input-focus-navigation-data-considered-per-component"
  167. failure-message="Consider all relevant interaction types for each component before moving on."/>
  168. <gate type="user-confirms" prompt="All interaction behaviors defined for every interactive component?"/>
  169. <output>interaction_behavior stored per Object ID — all interactive components covered.</output>
  170. </step>
  171. <!-- ═══════════════════════════════════════════════════════════════════ -->
  172. <!-- STEP 6 — States -->
  173. <!-- ═══════════════════════════════════════════════════════════════════ -->
  174. <step id="6-states" name="Define page-level and component-level states" step-file="steps-p/step-06-states.md">
  175. <instruction>
  176. Define page-level states first. Ask the user to describe each situation:
  177. default/loaded, empty (no data), loading (fetching), error (something went wrong),
  178. success (after action completes). For each: when it occurs, what user sees, available actions.
  179. </instruction>
  180. <instruction>
  181. For each component with multiple possible appearances, ask the user to define applicable states:
  182. default, hover, active/pressed, focus, disabled, loading, error, success.
  183. Only specify states that actually apply to each component.
  184. </instruction>
  185. <instruction>
  186. Store page_states and component_states.
  187. Do not define validation rules in this step — that is step 7.
  188. </instruction>
  189. <gate type="page-states-defined" required="default-state-minimum"
  190. failure-message="At minimum, the default page state must be defined."/>
  191. <gate type="component-states-defined" rule="multi-state-components-have-all-applicable-states"
  192. failure-message="Components with multiple appearances must have all applicable states documented. Do not skip multi-state components."/>
  193. <gate type="user-confirms" prompt="All page-level and component-level states defined?"/>
  194. <output>page_states and component_states stored — all state variations documented.</output>
  195. </step>
  196. <!-- ═══════════════════════════════════════════════════════════════════ -->
  197. <!-- STEP 7 — Validation -->
  198. <!-- ═══════════════════════════════════════════════════════════════════ -->
  199. <step id="7-validation" name="Define validation rules and error messages" step-file="steps-p/step-07-validation.md">
  200. <instruction>
  201. Identify all fields and inputs that require validation. For each, ask:
  202. - What makes it valid / invalid?
  203. - Required or optional?
  204. - Format rules and length limits?
  205. - Custom rules?
  206. - Validation timing: on blur, on submit, or real-time?
  207. </instruction>
  208. <instruction>
  209. For each validation rule, define error messages in ALL supported languages.
  210. Assign an error code (e.g., ERR_EMAIL_INVALID) to every message.
  211. </instruction>
  212. <instruction>
  213. Store validation_rules and error_messages per field, with codes and translations.
  214. Do not generate the specification document yet — that is step 9.
  215. </instruction>
  216. <check-if condition="page-has-input-fields-or-forms">
  217. <then>
  218. Proceed with full validation definition. Every input field must have rules and error messages.
  219. </then>
  220. <else>
  221. No validated fields on this page. Store an empty validation_rules object and note
  222. "No form inputs on this page" before proceeding to step 8.
  223. </else>
  224. </check-if>
  225. <gate type="validation-rules-complete" rule="every-input-field-has-rules"
  226. condition="page-has-input-fields"
  227. failure-message="Every input field must have validation rules defined. Do not skip any field."/>
  228. <gate type="error-messages-translated" rule="every-error-code-has-message-in-every-language"
  229. condition="page-has-input-fields"
  230. failure-message="Error messages must be provided in ALL supported languages. Incomplete translations block step 9."/>
  231. <gate type="error-codes-assigned" rule="every-error-message-has-a-code"
  232. condition="page-has-input-fields"
  233. failure-message="Every error message must have an error code (e.g., ERR_EMAIL_INVALID)."/>
  234. <gate type="user-confirms" prompt="Validation rules and error messages complete?"/>
  235. <output>validation_rules and error_messages stored — all fields covered, all languages translated, all codes assigned.</output>
  236. </step>
  237. <!-- ═══════════════════════════════════════════════════════════════════ -->
  238. <!-- STEP 8 — Spacing and Typography -->
  239. <!-- ═══════════════════════════════════════════════════════════════════ -->
  240. <step id="8-spacing-typography" name="Define spacing objects and typography tokens" step-file="steps-p/step-08-spacing-typography.md">
  241. <instruction>
  242. Walk through adjacent section pairs top-to-bottom. For each pair, ask the user which
  243. spacing token applies. Present the full table of gaps at once for efficiency.
  244. Available tokens: zero, sm, md, lg, xl, 2xl, 3xl.
  245. Zero-spacing is an intentional design choice — document it, never skip it.
  246. Store spacing objects using naming convention:
  247. - {page-slug}-v-space-{size} for vertical spacing
  248. - {page-slug}-v-separator-{size} for lines/dividers with spacing
  249. Also capture grid gaps for sections with repeated items (card grids, lists).
  250. </instruction>
  251. <instruction>
  252. For each heading in the content (from step 4), define typography tokens.
  253. Collect from the user: semantic tag (h1/h2/h3) and visual size per breakpoint
  254. (mobile / tablet / desktop).
  255. Available heading tokens: heading-xxs (14px), heading-xs (16px), heading-sm (18px),
  256. heading-md (20px), heading-lg (24px), heading-xl (30px), heading-2xl (36px),
  257. heading-3xl (44px), heading-4xl (56px).
  258. Rule: use token names only — never arbitrary pixel values.
  259. Rule: step up one token size per breakpoint (mobile → tablet → desktop) as a guide.
  260. Store typography_tokens with Object ID, tag, and visual size per breakpoint.
  261. </instruction>
  262. <instruction>
  263. Present the complete invisible layer to the user — spacing objects and typography tokens.
  264. Ask if anything needs adjusting before generating the specification.
  265. </instruction>
  266. <gate type="spacing-complete" rule="every-section-boundary-has-spacing-object"
  267. failure-message="Every adjacent section pair must have a spacing object. Including zero-spacing decisions."/>
  268. <gate type="no-pixel-values" rule="only-token-names-used-in-spacing-and-typography"
  269. failure-message="Only token names are allowed (zero, sm, md, lg, xl, 2xl, 3xl for spacing; heading-xxs through heading-4xl for typography). No pixel values."/>
  270. <gate type="typography-complete" rule="every-heading-has-tag-and-responsive-token"
  271. failure-message="Every heading must have a semantic tag and visual token for all three breakpoints."/>
  272. <gate type="grid-gaps-documented" condition="page-has-card-grids-or-repeated-items"
  273. failure-message="Grid gaps must be documented for sections containing repeated items (card grids, lists)."/>
  274. <gate type="user-confirms" prompt="Spacing objects and typography tokens reviewed and approved?"/>
  275. <output>spacing_objects and typography_tokens stored — every section boundary and heading documented with tokens.</output>
  276. </step>
  277. <!-- ═══════════════════════════════════════════════════════════════════ -->
  278. <!-- STEP 9 — Generate Specification -->
  279. <!-- ═══════════════════════════════════════════════════════════════════ -->
  280. <step id="9-generate-spec" name="Compile and save the complete page specification" step-file="steps-p/step-09-generate-spec.md">
  281. <instruction>
  282. Verify all data from steps 1-8 is present before generating:
  283. page_basics, layout_sections, component registry with Object IDs, multilingual_content,
  284. interaction_behavior, page_states, component_states, validation_rules, error_messages,
  285. spacing_objects, typography_tokens.
  286. If any section is missing, return to the relevant step to complete it first.
  287. </instruction>
  288. <instruction>
  289. Generate the complete specification document using the template at:
  290. templates/page-specification.template.md
  291. Fill ALL sections with data from steps 1-8. Do not invent new formats —
  292. the template defines the structure.
  293. </instruction>
  294. <instruction>
  295. Run the validation script before saving:
  296. wds-validate.js --page {current-page-path}
  297. Review any errors or warnings reported. Fix issues in the relevant data sections
  298. and re-run until validation passes.
  299. </instruction>
  300. <instruction>
  301. Save the complete specification to:
  302. {output_folder}/C-UX-Scenarios/{scenario-slug}/pages/{NN}.{step}-{page-slug}/{NN}.{step}-{page-slug}.md
  303. Present the summary to the user: sections, components, languages, interactions, states,
  304. validation rules, spacing objects, typography tokens — with counts.
  305. </instruction>
  306. <instruction>
  307. Update the design log: append a row to the Design Loop Status table with status "specified":
  308. | [scenario-slug] | [NN.step] | [page-name] | specified | [YYYY-MM-DD] |
  309. Remove this page from the Current table. Do NOT skip this — the design log drives the
  310. adaptive dashboard across sessions.
  311. </instruction>
  312. <gate type="all-data-sections-present" required="page_basics layout_sections components multilingual_content interaction_behavior page_states validation_rules spacing_objects typography_tokens"
  313. failure-message="All data sections from steps 1-8 must be present before generating the specification. Return to incomplete steps."/>
  314. <gate type="script-run" script="src/scripts/wds-validate.js" args="--page {current-page-path}"
  315. failure-message="Validation script must pass before saving the specification. Fix reported issues and re-run."/>
  316. <gate type="file-saved" path="{output_folder}/C-UX-Scenarios/{scenario-slug}/pages/{NN}.{step}-{page-slug}/{NN}.{step}-{page-slug}.md"
  317. failure-message="Specification file must be saved to the correct path before this step is complete."/>
  318. <gate type="design-log-updated" rule="design-loop-status-row-appended-with-status-specified"
  319. failure-message="Design log must be updated with 'specified' status before this step is complete. This is not optional."/>
  320. <output>Complete page specification generated, validated, saved, and design log updated with 'specified' status.</output>
  321. </step>
  322. <!-- ═══════════════════════════════════════════════════════════════════ -->
  323. <!-- COMPLETION -->
  324. <!-- ═══════════════════════════════════════════════════════════════════ -->
  325. <completion>
  326. <require step="all" failure-message="All 9 steps must be completed. The specification is not valid until step 9 passes validation and saves the file."/>
  327. <output-file>{output_folder}/C-UX-Scenarios/{scenario-slug}/pages/{NN}.{step}-{page-slug}/{NN}.{step}-{page-slug}.md</output-file>
  328. <post-completion>
  329. Return to the calling workflow's transition logic. If called from step-01-exploration.md (Discuss)
  330. or workflow-suggest.md (Suggest), the calling step determines what comes next.
  331. The design log status "specified" is the signal that this page is done.
  332. </post-completion>
  333. </completion>
  334. </workflow>