All docs

Docs

Spring Design Library — AI Agentic Workflow Overview

Audience: Engineering and design-system leadership
Purpose: Introduce the outcome-first agentic workflow — roles, guardrails, rules, and skills
Format: Copy-ready for Google Docs (tables, diagram, ~4–6 pages)


1. Executive Summary

Problem: Design-to-code work was inconsistent — wrong file targets, missing validation, duplicate components, and unclear handoff to product engineers.

Approach: An outcome-first workflow where AI agents classify every request before coding, reuse existing package and gallery patterns, stop for human approval when structure is uncertain, and close with named validation.

Benefit: Predictable placement in the monorepo, gallery routes as visual source of truth, and reviewable handoffs instead of opaque code dumps.

Most work starts from a ready Figma file. UX persona documentation is optional and used only for target-user variants or vibe-coded refinements.


2. How Work Flows (End-to-End)

Paste this diagram into Google Docs (Drawings, mermaid.live, or Lucidchart):

flowchart TD
  request[InboundRequest] --> classify[ClassifyOutcome]
  classify --> context[ContextCheck]
  context -->|"missing info"| askUser[AskUser]
  context -->|"ready"| investigate[InvestigateReuse]
  investigate --> plan[BuildPlan]
  plan --> gate[HumanApprovalGate]
  gate -->|"changes"| plan
  gate -->|"approved"| build[Implement]
  build --> inject[UpdateExportsRoutesNav]
  inject --> validate[ValidateLintBuild]
  validate -->|"fail max 3 loops"| correct[SelfCorrect]
  correct --> build
  validate -->|"blocked"| escalate[EscalateToHuman]
  validate -->|"pass"| handoff[DeveloperHandoff]

Caption: Every task starts with what we are building (outcome type), not with code. Humans approve the plan when new components, tokens, routes, or structural changes are involved. Validation (lint, build, token sync, etc.) must pass before handoff.


3. Seven Outcome Types (Cheat Sheet)

OutcomeWhat it producesWhere it livesTypical validation
A — Reusable componentImportable UI in @spring/ds-reactpackages/spring-ds-react/src/components/ + export in index.tslint, build, Code Connect parse
B — Gallery doc pageComponent or foundation documentationapps/design-library/src/gallery/ + thin route under /library/build
C — AppFlow screenPersonal-loan flow preview stepgallery/page/appflow/screens/ + registry in personalLoanFlow.tsbuild, optional manual-qa
D — Static library pageInformational or foundation pagegallery + route shellbuild
E — Token/foundationDesign token system changedesign-tokens.mjs + generated CSStokens:sync, restart dev, clear .next, build
F — Icon changeIcon set updatepackages/spring-ds-react/src/icons/icons:sync, build
G — Docs/rulesWorkflow or repo guidancedocs/, docs/ai/, .cursor/rules/doc links updated

Key principle: One request = one classified outcome. Mixing outcomes (e.g. new component + token change + nav) triggers the approval gate.


4. Five Agent Roles

These are logical roles — one AI session may play several, but responsibilities stay separate.

RoleMandateKey outputsMust not
1. Workflow ConductorIntake, outcome classification, approval gates, loop limits, final handoffWorkflowRunState, approved BuildPlan, handoff summarySkip validation; hide failures; revert unrelated changes
2. Design & Token AnalystMap Figma/design to existing tokens; report gapsNormalizedDesignTree, TokenGapReportWrite components; use raw hex/spacing without token decision
3. Structure & Reuse ArchitectReuse vs extend vs create; file map and registriesAgenticImplementationPlan, injection planCreate duplicate components; put AppFlow in wrong package folder
4. Implementation BuilderBuild only the approved outcomePatches, routes, exports, nav, registry, Code ConnectPut logic in route shells; add production APIs to gallery previews
5. Guardrail CriticRun validation, self-correction (max 3 loops), block if stuckValidationApprovalLog or BlockedValidationReportMark complete without naming what was validated

Human touchpoints

  • Plan approval before implementation when structure, new components, tokens, routes, or registries are uncertain.
  • Token approval for any change to design-tokens.mjs.
  • UX deviation approval when the agent proposes changes beyond supplied Figma.
  • Escalation after 3 failed validation loops — agent stops with a blocker report.
  • Resume after interruption — agent re-states phase, approval status, and changed files before continuing.

5. Three Layers: Docs vs Rules vs Skills

LayerLocationPurposeAudienceWhen loaded
Long-form docsdocs/ai/, docs/ux/Full workflow, contracts, UX researchAgents + engineers maintaining the systemRead in defined order at intake/planning
Rules.cursor/rules/*.mdcShort, enforceable guardrails in the IDECursor agent (auto by file scope)Always or when editing matching files
Skills.cursor/skills/*/SKILL.mdRepeatable playbooks for common task typesCursor agent (when task matches)On demand when user/task triggers description

Analogy: Docs = policy manual; Rules = lint rules in the editor; Skills = runbooks ("how to ship an AppFlow screen").


6. Cursor Rules Reference (All 5)

Rule fileScopeWhat it enforces
agentic-workflow.mdcAlways onOutcome-first routing, read order, file boundaries, token/Code Connect/resume protocol
next-react-standards.mdcAll *.ts/tsxApp Router, Server Components default, Spring tokens, no production logic in previews
gallery-page-standard.mdcGallery + /library routesThin route shells, doc page layout primitives, no placeholder nav
appflow-context.mdcAppFlow screensPresentational previews, registry fields, no production integrations
appflow-flow-map.mdcFlow map + previewsThumbnail behavior, iframe embed rules, Figma flow-map reference

7. Project Skills Reference (2)

spring-agentic-workflow — default for design-to-code work

  • Triggers: components, gallery pages, AppFlow, Code Connect, tokens, repo structure
  • Requires: outcome classification, build plan, validation commands, handoff artifacts

spring-ux-variant — optional, not default

  • Triggers: persona variants, vibe-coded screens, copy/tone, drop-off, declined/success states, AppFlow logic review
  • Sources: docs/ux/user-insights-report.md, ux-strategy-logic.md, personal-loans-flow.md
  • When NOT used: complete Figma provided with no UX variation requested

Default path: Figma + existing patterns + workflow contracts.
UX skill path: Only when we need persona-specific variants or UX judgment beyond the approved design.


8. Quality Gates and Handoff

Before delivery, agents check

  • Outcome matches files changed (docs/ai/review-checklist.md)
  • Required injection points updated (exports, nav, registry, Code Connect, tokens)
  • Commands run: typically npm run lint, npm run build; plus tokens:sync / code-connect:parse when relevant

Handoff package includes

  • Outcome type and workflow phase
  • Files changed + route/import path (/library/* for visual review)
  • Validation results and any skipped checks
  • Risks or pre-existing repo issues affecting confidence

Gallery as source of truth

Product engineers consume @spring/ds-react components and bind real data/APIs outside the gallery; /library/* is the approved visual reference.


9. Optional UX Knowledge Base (Injectable, Not Always On)

DocUse when
docs/ux/user-insights-report.mdTarget-user / persona variants
docs/ux/ux-strategy-logic.mdTrust, urgency, copy, decline/success framing
docs/ux/personal-loans-flow.mdAppFlow step order and branch validation

10. What We Do Not Automate

  • Production API, analytics, database, or partner integrations in gallery or AppFlow previews
  • Token changes without explicit approval
  • Overriding an approved Figma design unless the user requests UX refinement
  • Persisted workflow state files (.spring/) in normal Cursor sessions — resume relies on conversation and documented handoff state

11. Appendix — Deep Links for Engineers

Doc hub: docs/README.md

NeedDocument
Intake and outcome routingdocs/ai/project-context.md
Full workflowdocs/ai/operational-manifesto.md
File placement & contractsdocs/ai/workflow-contracts.md
Pre-delivery checklistdocs/ai/review-checklist.md
Test/validation matrixdocs/ai/workflow-test-plan.md
Repo mapdocs/REPOSITORY_STRUCTURE.md
Adding componentsdocs/COMPONENT_ADDITION.md

Last updated: June 2026. Copy into Google Docs; add title page and date; export the diagram from mermaid.live if needed.