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)
| Outcome | What it produces | Where it lives | Typical validation |
|---|---|---|---|
| A — Reusable component | Importable UI in @spring/ds-react | packages/spring-ds-react/src/components/ + export in index.ts | lint, build, Code Connect parse |
| B — Gallery doc page | Component or foundation documentation | apps/design-library/src/gallery/ + thin route under /library/ | build |
| C — AppFlow screen | Personal-loan flow preview step | gallery/page/appflow/screens/ + registry in personalLoanFlow.ts | build, optional manual-qa |
| D — Static library page | Informational or foundation page | gallery + route shell | build |
| E — Token/foundation | Design token system change | design-tokens.mjs + generated CSS | tokens:sync, restart dev, clear .next, build |
| F — Icon change | Icon set update | packages/spring-ds-react/src/icons/ | icons:sync, build |
| G — Docs/rules | Workflow or repo guidance | docs/, 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.
| Role | Mandate | Key outputs | Must not |
|---|---|---|---|
| 1. Workflow Conductor | Intake, outcome classification, approval gates, loop limits, final handoff | WorkflowRunState, approved BuildPlan, handoff summary | Skip validation; hide failures; revert unrelated changes |
| 2. Design & Token Analyst | Map Figma/design to existing tokens; report gaps | NormalizedDesignTree, TokenGapReport | Write components; use raw hex/spacing without token decision |
| 3. Structure & Reuse Architect | Reuse vs extend vs create; file map and registries | AgenticImplementationPlan, injection plan | Create duplicate components; put AppFlow in wrong package folder |
| 4. Implementation Builder | Build only the approved outcome | Patches, routes, exports, nav, registry, Code Connect | Put logic in route shells; add production APIs to gallery previews |
| 5. Guardrail Critic | Run validation, self-correction (max 3 loops), block if stuck | ValidationApprovalLog or BlockedValidationReport | Mark 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
| Layer | Location | Purpose | Audience | When loaded |
|---|---|---|---|---|
| Long-form docs | docs/ai/, docs/ux/ | Full workflow, contracts, UX research | Agents + engineers maintaining the system | Read in defined order at intake/planning |
| Rules | .cursor/rules/*.mdc | Short, enforceable guardrails in the IDE | Cursor agent (auto by file scope) | Always or when editing matching files |
| Skills | .cursor/skills/*/SKILL.md | Repeatable playbooks for common task types | Cursor 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 file | Scope | What it enforces |
|---|---|---|
agentic-workflow.mdc | Always on | Outcome-first routing, read order, file boundaries, token/Code Connect/resume protocol |
next-react-standards.mdc | All *.ts/tsx | App Router, Server Components default, Spring tokens, no production logic in previews |
gallery-page-standard.mdc | Gallery + /library routes | Thin route shells, doc page layout primitives, no placeholder nav |
appflow-context.mdc | AppFlow screens | Presentational previews, registry fields, no production integrations |
appflow-flow-map.mdc | Flow map + previews | Thumbnail 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; plustokens:sync/code-connect:parsewhen 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)
| Doc | Use when |
|---|---|
docs/ux/user-insights-report.md | Target-user / persona variants |
docs/ux/ux-strategy-logic.md | Trust, urgency, copy, decline/success framing |
docs/ux/personal-loans-flow.md | AppFlow 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
| Need | Document |
|---|---|
| Intake and outcome routing | docs/ai/project-context.md |
| Full workflow | docs/ai/operational-manifesto.md |
| File placement & contracts | docs/ai/workflow-contracts.md |
| Pre-delivery checklist | docs/ai/review-checklist.md |
| Test/validation matrix | docs/ai/workflow-test-plan.md |
| Repo map | docs/REPOSITORY_STRUCTURE.md |
| Adding components | docs/COMPONENT_ADDITION.md |
Last updated: June 2026. Copy into Google Docs; add title page and date; export the diagram from mermaid.live if needed.