π¦ Frontend Library Blueprint¶
π Purpose, Scope, and Placement in the Factory¶
This blueprint governs the autonomous generation of frontend UI libraries and component systems across the ConnectSoft AI Software Factory. It defines how agents scaffold, validate, test, and publish reusable, accessible, and observable frontend components.
π― Purpose¶
To provide a declarative contract that drives:
- UI component scaffolding (e.g.,
Button,Card,Modal) - Full-featured frontend modules (e.g.,
BookingForm,Dashboard) - Static and dynamic page generation (e.g.,
HomePage,SettingsPage) -
Integration with:
-
Styling systems (Tailwind, SCSS)
- UI frameworks (React, Angular, Blazor)
- L10n and i18n engines
- Observability and telemetry
- Storybook and visual regression tools
- Secure, testable, versioned, and sharable artifacts
π§± Scope¶
| Domain | Included |
|---|---|
| Component Design | β Structure, slots, inputs/outputs, props |
| Styling | β CSS, tokens, responsive rules |
| Accessibility | β WCAG, ARIA roles, keyboard navigation |
| Localization | β i18n hooks, string injection |
| Observability | β Frontend telemetry, performance spans |
| Testing | β Unit, snapshot, E2E, a11y tests |
| Docs | β Storybook, usage, MDX |
| CI/CD | β Linting, previews, deploy pipelines |
π§ Blueprint's Role in the Factory¶
flowchart TD
idea[Product Idea or Epic]
--> vision["Vision β UX Agent"]
--> blueprint["π Frontend Blueprint"]
--> component[π§± Generated UI Components]
--> tests[π§ͺ Auto-Generated Tests]
--> docs[π Storybook + Docs]
--> pipeline[π CI/CD + Deploy Previews]
πͺ Example Use Case¶
Input:
Output:
UserCard.tsxUserCard.test.tsxUserCard.stories.tsxREADME.md- Tailwind + ARIA + test coverage hooks
- Azure pipeline for deployment preview
π§ Agents Triggered by This Blueprint¶
| Agent | Role |
|---|---|
| Component Scaffolder Agent | Generates JSX/TSX, slots, state bindings |
| Style Agent | Injects theme-based Tailwind or SCSS |
| Accessibility Agent | Ensures WCAG/ARIA compliance |
| Test Generator Agent | Builds tests with coverage targets |
| Docs Agent | Storybook stories, props table |
| CI/CD Agent | Preview site and visual diff pipelines |
| Localization Agent | String extraction and translation stubs |
π Files and Artifacts Produced¶
/src/components/UserCard.tsx
/src/components/UserCard.styles.ts
/tests/UserCard.test.tsx
/stories/UserCard.stories.tsx
/docs/UserCard.md
/ci/frontend-preview.yml
/package.json
β Summary¶
- This blueprint governs the entire lifecycle of frontend libraries
- Ensures all components are:
- Generated
- Localized
- Tested
- Documented
- Versioned
- Observable
- Supports multi-framework (React, Angular, Blazor) generation
- Enables end-to-end integration with CI/CD, design tokens, and UX agents
π¦ Output Types: Components, Modules, Pages¶
This section defines the types of frontend artifacts that can be generated using the blueprint, how they differ in purpose, complexity, structure, and agent responsibilities. Each output type has its own generation pattern, testing scope, and documentation logic.
π Blueprint Field: type¶
This field drives branching in the scaffold logic and output structure.
π§± Output Type Definitions¶
| Type | Description |
|---|---|
component |
A reusable UI element, such as a Button, Card, or Avatar, meant to be composed inside larger modules |
module |
A self-contained UI unit with local state, multiple child components, service calls, etc. (e.g., BookingForm, UserProfilePanel) |
page |
A top-level route/view, possibly combining multiple modules and full layout responsibility (e.g., DashboardPage, HomePage) |
ποΈ Folder Structures by Type¶
# Component
/components/
βββ UserCard/
βββ UserCard.tsx
βββ UserCard.styles.ts
βββ UserCard.test.tsx
βββ UserCard.stories.tsx
# Module
/modules/
βββ BookingForm/
βββ BookingForm.tsx
βββ hooks.ts
βββ useBooking.ts
βββ BookingForm.test.tsx
βββ index.ts
# Page
/pages/
βββ DashboardPage/
βββ DashboardPage.tsx
βββ DashboardPage.test.tsx
βββ route.ts
βββ layout.tsx
π§ Agent Behavior Differences¶
| Agent | component |
module |
page |
|---|---|---|---|
| Component Scaffolder | β JSX/TSX + props | β Multiple child components | β Layout with routing |
| Test Agent | β Unit tests | β State & validation tests | β Full render + route guards |
| Docs Agent | β Storybook | β Storybook + usage docs | β Page MDX |
| CI Agent | β Lint/test | β + coverage | β + visual regression |
π DSL Differences (Example)¶
Component DSL:
Module DSL:
name: BookingForm
state:
- bookingDate: Date
- selectedService: string
validation:
- required: [bookingDate]
Page DSL:
name: DashboardPage
layout: MainLayout
route: /dashboard
modules:
- BookingForm
- UpcomingAppointments
π Composability¶
- Pages include multiple modules
- Modules include multiple components
- All can be generated separately or as part of a larger hierarchy
π§© Prompt Injection Logic¶
Agents inject "type": "component" or "type": "module" into generation prompts, enabling multi-purpose skill templates.
β Summary¶
- The blueprint supports 3 major frontend artifact types:
- UI components
- Logical modules
- Top-level pages
- Each type affects:
- File layout
- Prompt shape
- Test scope
- Documentation expectations
- The
typefield in the blueprint determines how agents scaffold the full artifact lifecycle
π¨ Styling Integration: CSS, Tailwind, Theme Tokens¶
This section defines how frontend blueprints handle styling strategies, including support for utility-first CSS frameworks, design tokens, component theming, and scoped CSS management. It ensures every generated artifact is visually consistent, configurable, and brandable.
π Blueprint Styling Field¶
style:
engine: tailwind # or css-modules | scss | tokens
tokens: true
responsive: true
darkMode: supported
π¨ Supported Styling Engines¶
| Engine | Description |
|---|---|
tailwind |
Utility-first CSS with JIT and configuration file (tailwind.config.js) |
css-modules |
Locally scoped styles with .module.css or .module.scss |
scss |
Sass-based hierarchical styles with optional global and scoped blocks |
tokens |
Design token-driven styling (e.g., spacing, color, border, typography) via JSON or CSS Variables |
π§© Blueprint β Styles Mapping¶
UserCard/
βββ UserCard.tsx
βββ UserCard.styles.ts β Tailwind or tokens helpers
βββ user-card.module.css β If css-modules
βββ theme.tokens.json β Optional per-token styles
π― Design Token Injection¶
Blueprints with tokens: true trigger agents to reference shared or module-specific design token libraries.
Example:
Injected as:
βοΈ Tailwind Configuration DSL¶
Blueprints may auto-generate scoped configuration files:
tailwind:
extend:
colors:
primary: '#0060df'
background: '#f7f8fa'
spacing:
xs: '4px'
sm: '8px'
md: '16px'
π Dark Mode Support¶
Blueprints support dark mode modes:
Agents wrap generated code with:
Or create useDarkModeTokens() helpers.
π§ Style Agent Responsibilities¶
| Task | Output |
|---|---|
| Inject Tailwind classes | .tsx markup scaffolding |
Create *.styles.ts files |
Theme + token wrappers |
Inject css-modules or SCSS |
Based on engine |
| Apply tokens | From shared or module-local palette |
| Validate theme compliance | Token usage and override hooks |
π§ Prompt Context Injection¶
This shapes how the generator agent constructs output HTML/JSX/CSS.
π Docs Snippet (README.md)¶
## π¨ Styling
- Styling engine: Tailwind CSS (JIT)
- Design tokens enabled: β
- Responsive and dark mode supported
- Token usage from `theme.tokens.json`
β Summary¶
- Blueprints allow rich styling strategy configuration
- Support multiple styling engines + tokens and themes
- Auto-wire design systems into generated components
- Enforce consistency across modules and platforms
π§± Blueprint Structure and Required Metadata¶
This section defines the core structure, required fields, and metadata layout for every frontend blueprint. It ensures agents receive a predictable, traceable, and extensible specification that drives code, tests, styles, and documentation.
π Minimal Valid Blueprint Structure¶
name: ConnectSoft.UI.UserCard
type: component
framework: react
style:
engine: tailwind
tokens: true
slots:
- avatar
- username
- footer
π Required Fields¶
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | β | Fully qualified component/module/page name |
type |
string | β | component, module, or page |
framework |
string | β | Target UI framework (e.g., react, angular, blazor) |
style.engine |
string | β | Styling strategy (e.g., tailwind, scss) |
slots |
list | β for components | Dynamic content placeholders |
state |
object | βοΈ (module only) | Local state management blueprint |
route |
string | βοΈ (page only) | Routing path for pages |
π§© Optional Metadata Fields¶
| Field | Description |
|---|---|
tags |
UI, shared, auth, dashboard (used for doc grouping) |
group |
Logical grouping of related components |
description |
Short human-readable summary |
author |
Blueprint author or originating agent |
createdAt |
ISO timestamp or system-populated |
version |
Starting semantic version (e.g., 1.0.0) |
repo |
Link to Git repo (if external component) |
priority |
Optional generation priority for multi-agent execution plans |
π Metadata Example¶
metadata:
tags: [shared, user, profile]
group: Profile
description: A card displaying user profile info
author: ui-designer-agent
createdAt: 2025-06-07T14:00Z
version: 1.0.0
π§ Metadata Use by Agents¶
| Agent | Usage |
|---|---|
| Doc Agent | Groups and categorizes docs |
| Component Agent | Names output file/folder structure |
| Prompt Agent | Injects tags, type, and name into generation context |
| Pipeline Agent | Adds build metadata and badges |
| Observability Agent | Tags spans and events with metadata context |
π Internal Normalization Flow¶
Agents apply enrichment defaults if fields are omitted:
type: component β default = "component"
style.engine: tailwind β default = "tailwind"
framework: react β default = "react"
This ensures minimal blueprints can still execute fully.
π Validation Example¶
Invalid blueprint:
Validator Agent Output:
β Summary¶
- Blueprint structure is cleanly divided into required and optional metadata
- Used across prompt generation, validation, grouping, doc rendering, and runtime context
- Enables modular, traceable, and multi-agent-compatible execution
- Simplifies onboarding new agents and scaffolding consistent frontend libraries
π Folder and File Structure Conventions¶
This section defines the standardized output layout for all frontend blueprints, including how files are named, grouped, and exported for components, modules, and pages. This structure ensures predictable integration, testability, and reusability.
π Base Output Folder¶
This produces a folder under /src/components/UserCard/ (or /src/modules/ or /src/pages/ based on type).
π Standard Folder Structure (by Type)¶
πΉ Component¶
/src/components/UserCard/
βββ UserCard.tsx
βββ UserCard.styles.ts
βββ UserCard.test.tsx
βββ UserCard.stories.tsx
βββ index.ts
πΉ Module¶
/src/modules/BookingForm/
βββ BookingForm.tsx
βββ useBookingForm.ts
βββ BookingForm.test.tsx
βββ BookingForm.stories.tsx
βββ validation.schema.ts
βββ index.ts
πΉ Page¶
/src/pages/DashboardPage/
βββ DashboardPage.tsx
βββ DashboardPage.test.tsx
βββ DashboardPage.route.ts
βββ DashboardPage.layout.tsx
βββ index.ts
β All folders include a default
index.tsfor barrel exports
π¦ Additional Folder Layers¶
| Purpose | Location Example |
|---|---|
| Global styles | /styles/theme.tokens.ts, /styles/base.css |
| Hooks | /hooks/useBooking.ts |
| i18n | /i18n/en/user-card.json, /i18n/es/user-card.json |
| Types | /types/UserCard.types.ts |
| Docs | /docs/components/UserCard.md |
| Visual tests | /tests/visual/UserCard.spec.ts |
π§© File Purpose by Suffix¶
| Suffix | Purpose |
|---|---|
.tsx |
Main implementation |
.styles.ts |
Utility + Tailwind + tokens |
.test.tsx |
Unit or functional test |
.stories.tsx |
Storybook story file |
.layout.tsx |
Page layout template (for pages only) |
.route.ts |
Routing definition (pages only) |
.schema.ts |
Optional validation schema |
.i18n.json |
Localized string bundles |
π Blueprint-to-Files Mapping Logic¶
flowchart TD
blueprint["π frontend-library-blueprint.yaml"]
--> ComponentAgent
--> StylesAgent
--> TestAgent
--> DocsAgent
--> Files["UserCard.tsx, UserCard.test.tsx, UserCard.stories.tsx"]
π§ Agents That Use File Convention¶
| Agent | Output |
|---|---|
| Component Generator | .tsx, index.ts |
| Style Agent | .styles.ts, tokens |
| Test Agent | .test.tsx |
| Documentation Agent | .stories.tsx, .md |
| CI Agent | Visual regression tests and coverage mappings |
π Example index.ts Export¶
Used to support clean imports:
β Summary¶
- Standard folder layout ensures consistent agent output
- Naming conventions drive test discovery, doc rendering, and barrel exports
- Supports clear boundaries between logic, styles, tests, stories, and schemas
- Enables seamless usage across Storybook, design systems, CI, and downstream consumers
π Dependency and UI Toolkit References¶
This section explains how frontend blueprints declare UI toolkit dependencies, shared libraries, and third-party packages. It enables agent-generated components to seamlessly integrate with design systems, shared UI kits, and external packages like Material UI, Radix UI, or Fluent.
π Blueprint Dependency Field¶
dependencies:
uiToolkit: material-ui
sharedLibraries:
- ConnectSoft.UI.Base
- ConnectSoft.Theme.Tokens
external:
- react-hook-form
- zod
- date-fns
π§© UI Toolkit Options¶
| Toolkit | Description |
|---|---|
material-ui |
Prebuilt MUI components, theming system |
radix-ui |
Low-level primitives with full accessibility |
fluent-ui |
Microsoft Fluent Design components |
bootstrap |
Basic grid and form layout components |
tailwind-ui |
Styled Tailwind component sets |
none (default) |
Pure atomic component generation |
π Agent Behavior with uiToolkit¶
| Toolkit | Agent Behavior |
|---|---|
material-ui |
Uses <Button />, <Card />, <ThemeProvider /> |
radix-ui |
Composes from primitives with ARIA attributes |
fluent-ui |
Wraps Fluent components, applies Fluent tokens |
tailwind-ui |
Uses Tailwind + pattern presets |
none |
Generates raw components from blueprint DSL + design tokens |
π File Injection Patterns¶
// With Material UI
import { Button, Typography } from '@mui/material';
export function UserCard() {
return (
<Card>
<Typography>{username}</Typography>
<Button>Send</Button>
</Card>
);
}
// With Radix UI
import * as Avatar from '@radix-ui/react-avatar';
<Avatar.Root>
<Avatar.Image src="/user.jpg" />
<Avatar.Fallback>JD</Avatar.Fallback>
</Avatar.Root>
π¦ sharedLibraries References¶
Used for:
- Importing shared UI components (
Avatar,Divider, etc.) - Composing utilities or themes (
useTheme(),spacing())
Agents resolve the shared component blueprint first, then inject usage.
π Dependency Resolution in Prompts¶
Agents auto-inject into context:
{
"uiToolkit": "material-ui",
"usesThemeProvider": true,
"sharedLibraries": ["ConnectSoft.UI.Base", "ConnectSoft.Theme.Tokens"]
}
This alters the generation prompt to wrap generated components accordingly.
π Output: package.json Snippet¶
{
"dependencies": {
"@mui/material": "^5.15.0",
"react-hook-form": "^7.45.0",
"zod": "^3.22.2",
"date-fns": "^2.30.0"
}
}
Injected by the Dependency Agent based on blueprint.
π CI/CD Linting for Declared vs Used¶
Helps detect stale or missing sharedLibraries and enforces alignment.
β Summary¶
- Blueprints declare toolkits, shared modules, and external libraries
- Agent output adapts scaffolding to match design systems or component kits
- Supports both composable primitives (Radix) and higher-order libraries (MUI, Fluent)
- Drives correct file structure, props usage, and dependency declarations
- Enables consistency and interoperability across frontend platforms
βΏ Accessibility (ARIA, WCAG) Compliance Metadata¶
This section defines how frontend blueprints enforce accessibility (a11y) standards, such as ARIA roles, keyboard navigation, and WCAG 2.1 compliance. It ensures that every generated UI artifact is inclusive, navigable, and screen-reader friendly by design.
π Blueprint Accessibility Field¶
accessibility:
enabled: true
roles:
- button
- region
keyboardNavigation: true
labelStrategy: auto
contrast: enforce
auditScoreTarget: 90
β Key Metadata Definitions¶
| Field | Description |
|---|---|
enabled |
Enables a11y generation features |
roles |
ARIA roles applied to outer or semantic elements |
keyboardNavigation |
Auto-generates keyboard interaction logic |
labelStrategy |
auto (use slot names) or manual (require label DSL) |
contrast |
Enforce minimum color contrast |
auditScoreTarget |
Minimum Lighthouse accessibility score (0β100) |
π§ Generated Output Examples¶
Button with ARIA:
Keyboard Navigation:
High-contrast Mode:
.color-text {
color: var(--text-default);
}
@media (prefers-contrast: more) {
.color-text {
color: black;
background-color: white;
}
}
π§ͺ A11y Tests Example¶
Auto-generated by Test Agent:
it('should have correct ARIA role', () => {
render(<UserCard />);
const el = screen.getByRole('region');
expect(el).toBeInTheDocument();
});
π§ Agents Using Accessibility Metadata¶
| Agent | Action |
|---|---|
| Component Agent | Injects roles, aria-labels, keyboard handlers |
| Test Agent | Emits WCAG unit tests |
| Doc Agent | Adds a11y notes in README/stories |
| A11y Validator Agent | Audits Lighthouse accessibility score |
| Prompt Agent | Shapes generation to ensure semantic HTML and navigability |
π§© Blueprint β Audit Flow Diagram¶
flowchart TD
blueprint --> A11yGenerator
A11yGenerator --> A11yValidator
A11yValidator --> Report["Accessibility Score β₯ 90"]
π README.md Section (Generated)¶
## βΏ Accessibility
- Uses semantic HTML and ARIA roles
- Keyboard navigation enabled
- Contrast meets WCAG AA
- Accessibility score target: 90+
π§ Prompt Context¶
{
"accessibility": {
"enabled": true,
"roles": ["button", "region"],
"keyboardNavigation": true,
"contrast": "enforce",
"auditScoreTarget": 90
}
}
β Summary¶
- Accessibility is first-class in all frontend blueprints
- Metadata drives ARIA injection, keyboard navigation, contrast handling
- Agents auto-generate a11y-focused tests and validation gates
- Promotes inclusive, production-grade component generation
π Localization and i18n/i10n Handling¶
This section defines how frontend blueprints handle internationalization (i18n) and localization (l10n). It ensures every generated UI element is language-ready, region-sensitive, and supports multi-language rendering from day one.
π Blueprint Localization Field¶
localization:
enabled: true
engine: i18next
defaultLocale: en
supportedLocales:
- en
- es
- fr
externalization: auto # or manual
fallback: true
π§© Key Metadata Options¶
| Field | Description |
|---|---|
enabled |
Enables localization for all text, labels, messages |
engine |
Library used: i18next, ngx-translate, blazor-loc, etc. |
defaultLocale |
Primary language fallback |
supportedLocales |
List of locales to generate translation files for |
externalization |
auto: agents extract hardcoded strings into JSON |
fallback |
Use default text if no translation exists |
π Output: Locale Files¶
/i18n/
βββ en/
β βββ user-card.json
βββ es/
β βββ user-card.json
βββ fr/
β βββ user-card.json
Each file includes:
π§ Component Integration Example (i18next)¶
import { useTranslation } from 'react-i18next';
export function UserCard() {
const { t } = useTranslation('user-card');
return (
<div>
<h2>{t('title')}</h2>
<button>{t('submit')}</button>
</div>
);
}
π§ Agent Responsibilities¶
| Agent | Action |
|---|---|
| Component Agent | Wraps all user-facing strings with t() |
| i18n Agent | Extracts text β generates *.json bundles |
| Test Agent | Validates fallback and missing key behavior |
| Localization Agent | Syncs shared dictionary across modules/pages |
| Prompt Agent | Converts hardcoded labels into t() tokens in output |
π§ͺ Tests for Localization¶
it('renders translated title in French', () => {
i18n.changeLanguage('fr');
render(<UserCard />);
expect(screen.getByText('Profil Utilisateur')).toBeInTheDocument();
});
π README.md Auto-Section¶
## π Localization
- i18next enabled with auto-externalization
- Supported locales: en, es, fr
- Fallback to default if key missing
- All user-facing strings use `t()` syntax
π i18n Context in Prompt¶
{
"localization": {
"engine": "i18next",
"externalization": "auto",
"defaultLocale": "en",
"supportedLocales": ["en", "es", "fr"]
}
}
β Summary¶
- Blueprints define localization policy and supported languages
- Agents generate translation-ready components and i18n files
- Supports
i18next, Angular i18n, or Blazor localization providers - Enables robust multilingual UI generation with fallback logic
- Validated by tests, doc injection, and pipeline checks
βοΈ Component Configuration DSLs¶
This section introduces how frontend blueprints reference or embed Component DSLs (Domain-Specific Languages) to declaratively define a componentβs props, slots, events, state, and validation logic. These DSLs act as the blueprint schema drivers for scaffolded UI code, tests, and stories.
π DSL Reference Field¶
OR inline:
dsl:
type: component
inline:
props:
avatarUrl: string
username: string
isVerified: boolean
events:
onClick: void
slots:
- avatar
- footer
π§ What Component DSLs Enable¶
| Element | Effect |
|---|---|
props |
Generates typed props interface or @Input() decorators |
slots |
Renders children or Angular <ng-content> |
events |
Emits callback props or @Output() bindings |
state |
Injects useState() / local signals |
validation |
Adds form validation (Zod, yup, reactive forms) |
defaultValues |
Sets initial props or state defaults |
π DSL-Driven Type Output (React Example)¶
interface UserCardProps {
avatarUrl: string;
username: string;
isVerified?: boolean;
onClick?: () => void;
}
Used to scaffold:
export function UserCard({ avatarUrl, username, isVerified, onClick }: UserCardProps) {
return (
<div onClick={onClick}>
<img src={avatarUrl} />
<h2>{username}</h2>
{isVerified && <VerifiedBadge />}
</div>
);
}
π Validation DSL Example¶
Mapped to:
π§© DSL for Angular / Blazor¶
Yields:
@Input() inputData!: string;
@Input() isEditable = false;
@Output() onSave = new EventEmitter<void>();
π DSL Location Patterns¶
dsl/components/β for atomic UI elementsdsl/modules/β for forms or logic-heavy UI unitsdsl/pages/β for layout and routing blueprints
π§ Agent Responsibilities with DSLs¶
| Agent | Task |
|---|---|
| Component Agent | Reads DSL and scaffolds props/slots/state |
| Test Agent | Generates test data from props + validation rules |
| Storybook Agent | Maps props into argTypes with controls |
| Docs Agent | Injects auto-generated props tables |
| Schema Validator | Verifies DSL structure against component type |
π Prompt Injection Sample¶
{
"dsl": {
"props": {
"username": "string",
"isVerified": "boolean"
},
"events": {
"onClick": "void"
}
}
}
β Summary¶
- Component DSLs define the contract of a frontend artifact declaratively
- Blueprints reference or embed them to enable precise agent scaffolding
- Enables consistent generation of props, events, state, validation, and docs
- Supported across React, Angular, and Blazor ecosystems
- Fully integrated into testing, storybook, and documentation agents
π§ͺ Test Blueprint: Unit, Snapshot, E2E¶
This section defines how frontend blueprints specify the testing strategy for generated components, modules, or pages β including unit tests, snapshot tests, and end-to-end (E2E) flows. The blueprint acts as a test plan contract for agents to generate the correct coverage, structure, and assertions.
π Blueprint Test Field¶
test:
enabled: true
types:
- unit
- snapshot
- e2e
coverageThreshold: 85
scenarios:
- "renders with minimal props"
- "responds to click events"
- "displays avatar and username"
π Test Types Overview¶
| Type | Description |
|---|---|
unit |
Validates logic, rendering, and props behavior |
snapshot |
Captures component render output to detect drift |
e2e |
Runs browser-based tests using Playwright or Cypress for full flow testing |
π§ Test Output File Examples¶
/tests/components/UserCard.test.tsx β unit tests
/tests/components/UserCard.snapshot.tsx β snapshots
/tests/e2e/UserCard.spec.ts β Playwright/Cypress
π§ͺ Sample Unit Test Output¶
test('renders with default props', () => {
render(<UserCard username="Alice" />);
expect(screen.getByText('Alice')).toBeInTheDocument();
});
πΈ Sample Snapshot Test¶
test('matches snapshot', () => {
const tree = renderer.create(<UserCard username="Snapshot" />).toJSON();
expect(tree).toMatchSnapshot();
});
π― E2E Test Structure¶
test('UserCard interaction works', async ({ page }) => {
await page.goto('/components/user-card');
await page.locator('text=Submit').click();
await expect(page.locator('.confirmation')).toBeVisible();
});
π README.md Test Section¶
## π§ͺ Tests
- Unit, Snapshot, and E2E tests auto-generated
- Coverage target: 85%
- Scenarios:
- renders with minimal props
- displays avatar and username
- responds to click events
π§ Test Agent Responsibilities¶
| Task | Output |
|---|---|
| Scaffold basic render & assertion tests | β |
| Snapshot generation using Jest or equivalent | β |
| Auto-generate E2E flows with input + click simulation | β |
| Enforce coverage thresholds in CI pipelines | β |
| Align tests with DSL-provided props and event logic | β |
π§ Prompt Context Example¶
{
"test": {
"types": ["unit", "snapshot", "e2e"],
"coverageThreshold": 85,
"scenarios": [
"renders with minimal props",
"responds to click events"
]
}
}
β Summary¶
- Blueprints define test strategies declaratively
- Support full test stack: unit, snapshot, and E2E
- Scenarios guide agent-generated assertions
- Testing agents scaffold compliant and maintainable tests
- Blueprint-driven testing ensures coverage from day one
π§ Agent Roles in Frontend Generation¶
This section defines the roles of ConnectSoft AI Factory agents involved in the full lifecycle of frontend blueprint execution β from DSL parsing to component generation, styling, localization, testing, and publishing.
π§ Primary Agents Involved¶
| Agent Name | Purpose |
|---|---|
ComponentScaffolderAgent |
Generates JSX/TSX, props, slots, and layout based on DSL |
StyleAgent |
Applies Tailwind, SCSS, or design tokens styling |
TestAgent |
Builds unit, snapshot, and E2E tests |
LocalizationAgent |
Extracts strings, builds i18n bundles |
DocsAgent |
Generates README, Storybook, MDX |
AccessibilityAgent |
Injects ARIA roles, keyboard navigation, and WCAG hooks |
PipelineAgent |
Configures CI/CD pipelines for lint/test/deploy |
DependencyAgent |
Resolves npm packages, shared lib refs |
PromptShaperAgent |
Shapes DSL β generation prompt for LLM |
ValidatorAgent |
Ensures blueprint structure and test coverage thresholds |
StorybookAgent |
Creates *.stories.tsx and props tables |
VisualRegressionAgent |
Adds Playwright/Cypress visual tests |
FeatureFlagAgent |
Wraps outputs in feature toggles if enabled |
π Generation Flow with Agents¶
graph TD
blueprint["π frontend-library-blueprint.yaml"]
dsl["π§© Component DSL"]
blueprint --> dsl
dsl --> prompt[π§ PromptShaperAgent]
prompt --> scaffold[π οΈ ComponentScaffolderAgent]
scaffold --> test[π§ͺ TestAgent]
scaffold --> style[π¨ StyleAgent]
scaffold --> docs[π DocsAgent]
scaffold --> loc[π LocalizationAgent]
style --> ci[βοΈ PipelineAgent]
test --> ci
docs --> ci
π― Agent Collaboration Summary¶
| Lifecycle Phase | Primary Agents |
|---|---|
| π οΈ Scaffold Code | ComponentScaffolderAgent, StyleAgent |
| π§ͺ Generate Tests | TestAgent, VisualRegressionAgent |
| βΏ Inject Accessibility | AccessibilityAgent |
| π Localization | LocalizationAgent |
| π¦ Package/Deploy | PipelineAgent, DependencyAgent |
| π Document UI | DocsAgent, StorybookAgent |
| β Validate | ValidatorAgent, Coverage Checker Agent |
π Agent Interop¶
-
Agents publish blueprint status updates on event bus:
-
ComponentGenerated TestsScaffoldedLocalizationBundleReady- All events include
traceId,blueprintId, andagentId
π§ Example Interaction Trace¶
{
"event": "TestsScaffolded",
"blueprintId": "ConnectSoft.UI.UserCard",
"agentId": "TestAgent",
"traceId": "abc123",
"outputs": ["/tests/components/UserCard.test.tsx"]
}
π Agent Prompt Responsibilities¶
- Enrich prompts with DSL, styling, localization, and a11y contexts
- Route blueprint fields to specialized sub-skills (e.g., form logic, list rendering)
β Summary¶
- Frontend blueprint execution involves a cooperative agent cluster
- Each agent handles a modular, observable stage in the lifecycle
- All agents publish events and trace IDs to ensure orchestrated output
- Agentic separation ensures maintainability, parallelism, and extensibility
π Observability and Client-Side Telemetry¶
This section defines how frontend blueprints embed observability hooks, such as telemetry spans, event logging, and performance metrics. This ensures all generated components are production-grade, debuggable, and traceable in real-world usage.
π Blueprint Observability Field¶
observability:
enabled: true
tracing: true
metrics: true
events:
- render
- click
- loadComplete
provider: "@connectsoft/telemetry"
π¦ What Gets Instrumented?¶
| Event Type | Behavior |
|---|---|
render |
Logs a trace span when component mounts |
click |
Logs a custom event on button interactions |
loadComplete |
Marks performance timing when async data is resolved |
π§ Output Code Example (React)¶
import { useTelemetry } from '@connectsoft/telemetry';
export function UserCard({ username }: Props) {
const telemetry = useTelemetry();
useEffect(() => {
telemetry.trace('UserCard.render');
}, []);
return (
<div onClick={() => telemetry.event('UserCard.click')}>
<h2>{username}</h2>
</div>
);
}
π Custom Metrics Injection¶
Blueprints can also define domain-specific metrics:
metrics:
enabled: true
values:
- name: avatarLoadTime
type: performance
- name: userCardClicks
type: counter
Emitted by the agent via:
π Performance Timing Snippet¶
const start = performance.now();
// ... render logic
telemetry.metric('UserCard.RenderTime', performance.now() - start);
π README.md β Observability Section¶
## π Observability
- Tracing enabled: `UserCard.render`, `UserCard.click`
- Custom metrics: `avatarLoadTime`, `userCardClicks`
- Events auto-wired to ConnectSoft Telemetry SDK
π§ Observability Agent Responsibilities¶
| Task | Output |
|---|---|
| Wire telemetry provider usage | import { useTelemetry } from ... |
| Inject tracing spans | telemetry.trace(...) |
| Emit custom metrics | telemetry.metric(...) |
| Define test coverage for event emission | expect(telemetry.event).toHaveBeenCalled() |
Enable opt-out via observability.enabled: false |
Scaffold clean variant |
π Prompt Context Example¶
{
"observability": {
"enabled": true,
"events": ["render", "click"],
"metrics": [
{ "name": "userCardClicks", "type": "counter" }
]
}
}
β Summary¶
- Observability-first design enables traceable, diagnosable UIs
- Supports custom events, spans, metrics, and performance logs
- Integrated into all generated components automatically if enabled
- Agents follow blueprint instructions and inject telemetry accordingly
- Powered by a pluggable SDK (ConnectSoft or external)
π Feature Flags and Conditional Rendering¶
This section explains how frontend blueprints integrate with feature flag systems to support conditional logic, phased rollouts, A/B testing, and canary deployment of components. Agents use blueprint instructions to wrap logic and visuals with toggle checks or client-side experiments.
π Blueprint Feature Flag Field¶
featureFlags:
enabled: true
provider: "@connectsoft/feature-flags"
flags:
- name: userCardRedesign
default: false
description: Enable redesigned layout with new avatar styling
π§ Feature Flag Output Example¶
import { useFeatureFlag } from '@connectsoft/feature-flags';
export function UserCard({ username }: Props) {
const showRedesign = useFeatureFlag('userCardRedesign');
return showRedesign ? (
<div className="rounded shadow bg-slate-100">
<Avatar size="xl" />
<h2 className="text-xl">{username}</h2>
</div>
) : (
<div>
<Avatar size="md" />
<span>{username}</span>
</div>
);
}
π¦ Flag Declaration Snippet¶
If provider = LaunchDarkly, ConfigCat, or ConnectSoft SDK, agents generate required setup files and flag contracts:
π Test Output (Toggle Awareness)¶
test('renders redesign layout when flag is enabled', () => {
mockFeatureFlag('userCardRedesign', true);
render(<UserCard />);
expect(screen.getByRole('heading')).toHaveTextContent('Alice');
});
π§ Prompt Context Injection¶
{
"featureFlags": {
"enabled": true,
"flags": [
{
"name": "userCardRedesign",
"default": false,
"description": "Enable redesigned layout"
}
]
}
}
π README.md Generated Section¶
## π Feature Flags
- Controlled by: `@connectsoft/feature-flags`
- Flags defined:
- `userCardRedesign` β toggles new layout
- All flags injected with `useFeatureFlag()` hook
π§ Agent Responsibilities¶
| Agent | Action |
|---|---|
| Component Agent | Wraps UI blocks in if (flag) logic |
| Test Agent | Validates both toggled and default render paths |
| Pipeline Agent | Optionally deploys to separate environments (canary vs stable) |
| Docs Agent | Describes flag behavior in usage docs |
| FlagAgent | Optionally creates flag definitions in external systems |
π§© Related Use Cases¶
- Phased rollout of redesigned UI components
- Dynamic experimentation (A/B/C) per cohort or locale
- Feature testing during development without risk to all users
β Summary¶
- Blueprints support flag-driven rendering logic with SDKs
- Allows conditional layout, props, or even entire render branches
- Fully testable and documented in generated output
- Enables seamless support for ConnectSoft or third-party flag providers
π Auto-Generated Documentation (README, Storybook, MDX)¶
This section defines how frontend blueprints automatically produce developer-facing documentation β including usage examples, prop tables, Storybook stories, and markdown READMEs β ensuring every generated artifact is self-documenting and discoverable.
π Blueprint Documentation Field¶
documentation:
enabled: true
formats:
- readme
- storybook
- mdx
includePropsTable: true
includeUsageExamples: true
includeAccessibilityNotes: true
π README.md Output Structure¶
# π§© UserCard Component
## π‘ Description
A reusable profile card component showing avatar and username.
## β¨ Props
| Prop | Type | Required | Description |
|------------|----------|----------|-------------|
| `username` | string | β
| The userβs display name |
| `avatarUrl`| string | β | Optional image URL |
## π¦ Usage
```tsx
import { UserCard } from 'ConnectSoft.UI';
<UserCard username="Alice" avatarUrl="/a.jpg" />
βΏ Accessibility¶
- Uses
<button>with ARIA labels - Fully keyboard navigable
---
### π Storybook Generation (Auto)
**Output File:**
```plaintext
/src/components/UserCard/UserCard.stories.tsx
Content Example:
export default {
title: 'Components/UserCard',
component: UserCard,
args: {
username: 'Demo User',
avatarUrl: '/user.jpg'
}
};
export const Default = (args) => <UserCard {...args} />;
π MDX Documentation (Optional)¶
Used for rendering in docs sites, with:
- Props table (auto from DSL)
- Design rationale
- Links to design system Figma
- Feature flag status
- Accessibility score
- I18n keys
π§ Docs Agent Responsibilities¶
| Task | Output |
|---|---|
| Generate README with usage, props, a11y | β |
Scaffold *.stories.tsx for Storybook |
β |
Create *.mdx docs with metadata blocks |
β |
| Inject theme and locale controls in Storybook | β |
| Sync doc URLs with platform docsite structure | β |
π§ Prompt Context Injection¶
{
"documentation": {
"formats": ["readme", "storybook", "mdx"],
"includePropsTable": true,
"includeUsageExamples": true
}
}
π Agent Collaboration Hooks¶
- DocsAgent receives enriched DSL + styling info + test coverage
- Hooks into
ComponentGeneratedβDocsReadyevent stream - Storybook and MDX files are auto-linked to CI pipeline
β Summary¶
- Blueprints define rich doc output preferences for each artifact
- Docs cover usage, props, accessibility, localization, flags
- Output includes
README.md,*.stories.tsx, and optionally MDX - Generated by
DocsAgentand injected into platform knowledge base - Enables plug-and-play Storybook with controls, themes, and locales
π§© Slot and Composition Strategies¶
This section defines how frontend blueprints declare and manage slots, enabling flexible content injection, layout customization, and component composition. Slots allow blueprint-defined components to expose structured regions for consumer-defined content β similar to children, ng-content, or RenderFragment.
π Blueprint Slot Field¶
slots:
- name: avatar
required: true
description: "Slot for user avatar image or initials"
- name: footer
required: false
description: "Optional footer with actions or badges"
π§ Output for React¶
type UserCardProps = {
avatar: React.ReactNode;
footer?: React.ReactNode;
username: string;
};
export function UserCard({ avatar, footer, username }: UserCardProps) {
return (
<div className="user-card">
<div className="avatar-slot">{avatar}</div>
<div className="info">{username}</div>
{footer && <div className="footer-slot">{footer}</div>}
</div>
);
}
π§ Output for Angular¶
<ng-content select="[slot=avatar]"></ng-content>
<span>{{ username }}</span>
<ng-content select="[slot=footer]"></ng-content>
Used in consumer like:
<user-card username="Alice">
<img slot="avatar" src="a.jpg" />
<span slot="footer">Premium User</span>
</user-card>
π DSL-Powered Slot Definition¶
Blueprints can also define slots inside DSL:
π§ Agents That Use Slot Definitions¶
| Agent | Behavior |
|---|---|
| Component Agent | Injects ReactNode or <ng-content> placeholders |
| Test Agent | Verifies rendering behavior when slots are present/missing |
| Docs Agent | Renders slot usage examples and constraints |
| Storybook Agent | Creates multiple stories using different slot fills |
π Generated Story Variants¶
export const WithFooter = () => (
<UserCard username="Alice" footer={<span>VIP</span>}>
<Avatar slot="avatar" />
</UserCard>
);
π README.md Slot Section¶
## π§© Slots
| Name | Required | Description |
|--------|----------|-------------|
| avatar | β
| Main user avatar |
| footer | β | Actions or badges under the card |
π§ Prompt Context Sample¶
π Related Patterns¶
- Works with
childrenin React - Converts to
RenderFragmentin Blazor - Supports
ng-content selectin Angular - Enables reusable shell-like layout blocks
β Summary¶
- Slots are first-class in blueprint composition logic
- Declared via blueprint metadata or DSL
- Enable flexible injection of sub-elements or extensions
- Used across code, stories, docs, and test generation
- Promote reusable, composable UI patterns across frameworks
π CI/CD: Linting, Previews, and Build Pipelines¶
This section defines how frontend blueprints automate continuous integration and deployment workflows β including linting, test execution, Storybook previews, static builds, and publishing β ensuring every UI artifact is pipeline-ready from creation.
π Blueprint CI/CD Field¶
cicd:
enabled: true
lint: true
test: true
storybookPreview: true
buildArtifacts: true
publishTo:
- type: npm
scope: "@connectsoft/ui"
- type: storybook
target: "https://ui.connectsoft.dev"
βοΈ Output Pipelines (Azure DevOps Example)¶
trigger:
branches:
include:
- main
jobs:
- job: lint
steps:
- script: yarn lint
- job: test
steps:
- script: yarn test
- job: build
steps:
- script: yarn build
- job: storybook
steps:
- script: yarn build-storybook
displayName: "Build Storybook"
- task: PublishPipelineArtifact@1
inputs:
targetPath: storybook-static
π Artifacts Produced¶
| Artifact | Description |
|---|---|
dist/UserCard/ |
Transpiled component |
coverage/ |
Jest or Cypress code coverage |
storybook-static/ |
Static Storybook instance |
README.md |
Linked from docs site |
*.test.tsx, *.spec.ts |
Test logs and snapshot diffs |
π§ Agents That Drive CI/CD Output¶
| Agent | Role |
|---|---|
| PipelineAgent | Assembles full azure-pipelines.yml |
| TestAgent | Adds coverage gates |
| DocsAgent | Adds publish-to-Storybook steps |
| DependencyAgent | Adds npm publish step if blueprint type is library |
| QualityAgent | Enforces thresholds (lint/test/coverage) |
π Blueprint to Pipeline Flow¶
flowchart TD
blueprint["π frontend-library-blueprint.yaml"]
blueprint --> cicd
cicd --> PipelineAgent
PipelineAgent --> YAML["azure-pipelines.yml"]
YAML --> Artifact["dist + docs + storybook + test"]
π README.md CI Section (Auto-Generated)¶
## π CI/CD
- Lint, Test, and Build enabled
- Storybook deployed to: https://ui.connectsoft.dev
- Artifacts:
- /dist/UserCard
- /coverage
- /storybook-static
π Prompt Context Sample¶
{
"cicd": {
"lint": true,
"test": true,
"storybookPreview": true,
"publishTo": [
{ "type": "npm", "scope": "@connectsoft/ui" }
]
}
}
π¦ Example Publishing Targets¶
| Target Type | Destination |
|---|---|
npm |
@connectsoft/ui |
storybook |
https://ui.connectsoft.dev |
azure-storage |
Static preview site for marketing / QA |
docs-site |
Push MDX and metadata to ConnectSoft documentation |
β Summary¶
- CI/CD blueprint section ensures components are pipeline-ready
- Agents generate
azure-pipelines.yml, lint/test/build commands - Storybook previews and publishing logic are scaffolded
- Coverage, build size, and test health are enforced by default
- Artifacts are versioned, published, and traceable
π§© Component Composition and Slot Injection¶
This section describes how frontend blueprints support compositional patterns, enabling one component to wrap, nest, or extend others using slot injection, children hierarchies, or template overrides. This promotes modular reuse, design system enforcement, and agentic UI layering.
π Blueprint Composition Field¶
composition:
extends: ConnectSoft.UI.BaseCard
slots:
content: Injects detailed content (username, avatar)
actions: Button group slot for user operations
template:
layout: vertical
border: true
π§ Composition Strategies¶
| Strategy | Description |
|---|---|
extends |
Inherits layout or styling from another component |
wraps |
Embeds the target component as child content |
slots |
Declares where downstream components inject content |
template |
Declares visual structure and styling intent |
π¦ Output (React Example β Composition + Slots)¶
export function UserCard({ children, actions }: Props) {
return (
<BaseCard layout="vertical" border>
<div className="user-content">{children}</div>
<div className="user-actions">{actions}</div>
</BaseCard>
);
}
Consumer usage:
π Blueprint Inheritance Chain¶
Agents resolve these dependencies and inline references via:
- Import statements
- Slot bindings
- Component tree structure
π§ DSL Integration for Composition¶
π Storybook Variant for Composition¶
export const Composed = () => (
<UserCard
actions={<div><Button>Edit</Button></div>}
>
<Avatar size="lg" />
<span>Alice</span>
</UserCard>
);
π§ Agent Responsibilities¶
| Agent | Role |
|---|---|
| Component Agent | Reads extends, wraps, and slots to build component tree |
| Docs Agent | Adds composition graph and usage |
| Test Agent | Verifies that injected content renders correctly |
| PromptShaperAgent | Uses composition graph to expand prompts for rendering logic |
| SlotAgent | Maps blueprint-defined slots into proper prop/slot constructs |
π README.md Composition Section¶
## π§© Composition
- Extends: `BaseCard`
- Injects:
- `children` (user content)
- `actions` (button area)
- Uses: `Avatar`, `UsernameLabel`
π Prompt Context Example¶
{
"composition": {
"extends": "ConnectSoft.UI.BaseCard",
"slots": {
"content": "required",
"actions": "optional"
},
"wraps": ["Avatar", "UsernameLabel"]
}
}
β Summary¶
- Composition allows components to inherit, extend, or wrap others
- Enables UI layering, atomic reuse, and slot-based flexibility
- Agents generate proper imports, slot maps, and rendering hierarchy
- Storybook and docs reflect composed structure for developer clarity
- Blueprint-driven composition supports both atomic and complex layouts
β‘ Performance Hints and Lighthouse Rules¶
This section defines how frontend blueprints encode performance budgets, rendering heuristics, and Lighthouse rules to guide agents in generating fast, optimized, and responsive UI components. These hints shape everything from asset loading to animation behavior.
π Blueprint Performance Field¶
performance:
enabled: true
lighthouseTargetScore: 95
lazyLoadAssets: true
debounceInputs: true
avoidHeavyRerenders: true
hydrationStrategy: optimized
π― Common Performance Targets¶
| Hint | Description |
|---|---|
lighthouseTargetScore |
Target score (0β100) in CI Lighthouse runs |
lazyLoadAssets |
Lazy-load images, icons, subcomponents |
debounceInputs |
Add debounce to text fields and filters |
avoidHeavyRerenders |
Use memo, PureComponent, or OnPush |
hydrationStrategy |
Static HTML or optimized SSR compatibility |
π§ Output Examples¶
Lazy Image Load:
Debounced Input:
React Memoization:
π Agent-Generated Lighthouse Audit Step (CI)¶
- job: lighthouse
steps:
- script: |
npm run build
npx lighthouse http://localhost:3000 \
--output=json --output-path=report.json \
--only-categories=performance \
--budget-path=./budget.json
budget.json (example):
π README.md Performance Section¶
## β‘ Performance
- Target Lighthouse score: β₯95
- Lazy load: enabled
- Debounced inputs: enabled
- Memoization: applied
π§ Agent Responsibilities¶
| Agent | Task |
|---|---|
| Component Agent | Inserts loading="lazy", React.memo, OnPush |
| Test Agent | Validates render performance heuristics (e.g. debounce timing) |
| Pipeline Agent | Adds Lighthouse performance tests in CI |
| Docs Agent | Outputs expected behavior in docs |
| PromptShaperAgent | Injects performance targets into prompt context |
π Prompt Context Example¶
{
"performance": {
"lighthouseTargetScore": 95,
"lazyLoadAssets": true,
"debounceInputs": true,
"avoidHeavyRerenders": true
}
}
β Summary¶
- Performance hints guide low-latency UI generation from the start
- Lazy loading, debouncing, and memoization are blueprint-driven
- Lighthouse audits can be auto-configured in CI pipelines
- Helps meet ConnectSoftβs observability-first and user-experience-first goals
π¦ Packaging, Distribution, and Versioning¶
This section defines how frontend blueprints declare packaging, publishing, and versioning policies β enabling generated components and libraries to be shared, published, and consumed across multiple solutions within the ConnectSoft ecosystem or external registries.
π Blueprint Packaging Field¶
packaging:
enabled: true
type: library
format: esm
bundler: vite
outputDir: dist/ui/user-card
exportType: named
registry:
type: npm
scope: "@connectsoft/ui"
versioning:
strategy: semantic
initialVersion: 0.1.0
π¦ Supported Options¶
| Field | Description |
|---|---|
type |
library (component lib) or bundle (design system export) |
format |
esm, cjs, umd |
bundler |
vite, rollup, tsup, webpack |
registry |
Target NPM registry, GitHub packages, Azure artifacts |
versioning |
semantic, manual, calver |
π§ Output Example (ESM Package)¶
Package.json:
{
"name": "@connectsoft/ui-user-card",
"version": "0.1.0",
"main": "dist/index.js",
"module": "dist/index.js",
"exports": {
".": "./dist/index.js"
},
"types": "dist/index.d.ts"
}
π§ͺ Versioning & Tags¶
semantic: auto-bumped via CI based on changesets or Git historymanual: user-defined bump via blueprint revisioncalver: calendar-based (e.g.,2025.06.01)
π README.md Packaging Section¶
## π¦ Packaging
- Format: `esm` via Vite
- Output: `dist/ui/user-card`
- Registry: `@connectsoft/ui-user-card`
- Version: `0.1.0` (semantic versioning)
π§ Agent Responsibilities¶
| Agent | Action |
|---|---|
| Pipeline Agent | Builds bundle via vite, copies dist/ |
| Docs Agent | Generates install/use instructions |
| Versioning Agent | Applies 0.1.0 and calculates bumps |
| PackageAgent | Publishes to NPM, GitHub, Azure registry |
| RegistryAgent | Validates name, scope, access permissions |
π Prompt Context Example¶
{
"packaging": {
"type": "library",
"format": "esm",
"registry": {
"type": "npm",
"scope": "@connectsoft/ui"
},
"versioning": {
"strategy": "semantic",
"initialVersion": "0.1.0"
}
}
}
π¦ Related Topics¶
- Packaging connects blueprint β artifact delivery
- Enables inclusion via
npm i @connectsoft/ui-user-card - Aligns with modular platform design for cross-project reuse
β Summary¶
- Blueprints define how generated UI libraries are built, versioned, and published
- Bundler (e.g.,
vite) and registry (npm, GitHub, Azure) are configurable - Versioning is managed by agents (semantic, manual, calver)
- Supports ConnectSoftβs plug-and-play, reusable microfrontend strategy
π§Ύ Docs & UX Documentation Generation¶
This section focuses on how blueprints automate the generation of user experience documentation, including design intent, behavioral notes, Figma links, and UX decisions. These are in addition to technical READMEs and help developers, designers, and testers understand the βwhyβ behind the UI.
π Blueprint UX Documentation Field¶
uxDocumentation:
enabled: true
sections:
- usageGuidelines
- doAndDont
- figmaReference
- behaviorNotes
- accessibilityConsiderations
figmaUrl: "https://www.figma.com/file/abc123/UserCardDesign"
π Output: UX .mdx or Markdown Block¶
## π§ UX Guidelines
This component is intended to display a userβs avatar and name in a compact card layout. Avoid overloading it with detailed profile info.
### β
Do
- Use it in profile lists
- Combine with action menus
### β Donβt
- Nest within table cells
- Display inside modals without spacing
### π¨ Figma Reference
[Figma: User Card Design Spec](https://www.figma.com/file/abc123/UserCardDesign)
### β οΈ Behavior Notes
- Avatar loads lazily on scroll
- Card has hover and focus states
### βΏ Accessibility Considerations
- Keyboard tab order enforced
- ARIA roles and landmarks used
π README.md Embedded Section (if includeInReadme: true)¶
## π§ UX Guidelines
- Optimized for lists, toolbars, and sidebars
- Avoid nesting in narrow containers
- Reference Figma spec: [link]
π Figma Agent Collaboration¶
If figmaUrl is provided:
- Agent will fetch metadata (component name, tokens, layout notes)
- Embed links or previews
- Optionally validate that blueprint matches spec
π§ Agent Responsibilities¶
| Agent | Task |
|---|---|
| DocsAgent | Scaffolds UX guidelines section (MDX or .md) |
| UXNarrativeAgent | Translates blueprint logic into plain-English UX rationale |
| FigmaAgent | Pulls or verifies design specs from Figma |
| DocsFormatterAgent | Merges UX content with API docs |
| StorybookAgent | Optionally renders usage tips or UX notes in preview panel |
π Prompt Context Example¶
{
"uxDocumentation": {
"enabled": true,
"sections": ["usageGuidelines", "behaviorNotes", "figmaReference"],
"figmaUrl": "https://www.figma.com/file/abc123/UserCardDesign"
}
}
π Benefits¶
- Brings UX best practices into generated artifacts
- Provides context for devs who consume components
- Enables automated documentation without relying on manual writing
- Enhances handoff from design to engineering
β Summary¶
- UX documentation is first-class in blueprint generation
- Supports markdown and MDX output, optionally embedded in README or Storybook
- Pulls metadata from Figma and enriches it with usage rationale
- Ensures components are not just functional β but understandable and usable
π Drift Detection and Visual Regression Testing¶
This section defines how frontend blueprints enable visual regression tracking and blueprint drift detection, ensuring that changes to components β intentional or accidental β are observable, traceable, and testable across commits, environments, or blueprint revisions.
π Blueprint Drift & Visual Regression Field¶
visualRegression:
enabled: true
strategy: storybook-snapshots
baselineStorage: azure-blob
diffThreshold: 0.01
monitoredStates:
- default
- hover
- focused
πΌοΈ Output: Snapshot & Diff Storage¶
| File | Description |
|---|---|
__snapshots__/UserCard.snap.png |
Baseline image |
__snapshots__/UserCard.diff.png |
Pixel diff overlay |
__snapshots__/UserCard.new.png |
New render for PR comparison |
π§ Output Tooling (Playwright Example)¶
test('UserCard visual snapshot', async ({ page }) => {
await page.goto('/storybook');
const userCard = page.locator('#user-card-default');
expect(await userCard.screenshot()).toMatchSnapshot('usercard.png', {
threshold: 0.01
});
});
βοΈ Cloud-Based Diff Storage¶
If baselineStorage = azure-blob, agents:
- Push baseline and diff images to a storage account container
- Expose public links or markdown embeds for diff PR comments
- Auto-expire after
TTLif configured
π Drift Detection Blueprint Comparison¶
If blueprint definition changes (e.g. props, styles, layout):
BlueprintDriftAgentcomputes structural diff- Emits
BlueprintDriftDetectedevent with summary
{
"event": "BlueprintDriftDetected",
"component": "UserCard",
"changedFields": ["styles.border", "props.avatarSize"],
"origin": "commit abc123"
}
π README.md Snapshot Section (Optional)¶
## πΈ Visual Testing
- Snapshots generated for:
- Default
- Hover
- Focused
- Visual diff threshold: 1%
π§ Agent Responsibilities¶
| Agent | Task |
|---|---|
| VisualRegressionAgent | Generates snapshots and diffs using Playwright/Cypress |
| SnapshotPublisherAgent | Uploads diffs to blob storage or GitHub PRs |
| BlueprintDriftAgent | Tracks YAML/DSL mutations across commits |
| TestAgent | Validates diff acceptance threshold in CI |
| DocsAgent | Embeds drift info into generated docs if needed |
π Prompt Context Example¶
{
"visualRegression": {
"enabled": true,
"diffThreshold": 0.01,
"monitoredStates": ["default", "hover"]
}
}
π Use Cases¶
- Prevent regressions after LLM prompt updates
- Detect unexpected UI shifts during refactoring
- Enable trust and review for auto-generated components
- Make visual changes traceable and auditable
β Summary¶
- Blueprints enable visual testing and change tracking out of the box
- Snapshots, diffs, and structural drifts are managed by agents
- Integration with blob storage or GitHub PRs ensures visibility
- Reinforces design fidelity and CI confidence
π§ Blueprint Memory and Traceability Metadata¶
This section describes how frontend blueprints embed metadata for traceability, long-term memory indexing, and reproducibility. These metadata fields ensure every generated component is traceable to its agent lineage, source DSL, design origin, and factory run context β vital for audits, drift handling, reuse, and agentic learning.
π Blueprint Metadata Fields¶
metadata:
id: ConnectSoft.UI.UserCard
version: 0.1.0
createdBy: ComponentScaffolderAgent
createdAt: 2025-06-07T13:00:00Z
originatingRunId: RUN-3421
designSource:
figmaUrl: "https://figma.com/file/abc/UserCard"
designSystemToken: "card.avatar.compact"
memoryScope: global
traceTags:
- frontend
- profile
- card
- interactive
π¦ Purpose of Each Field¶
| Field | Description |
|---|---|
id |
Unique identifier in blueprint registry |
version |
Semantic version or Git SHA of blueprint snapshot |
createdBy |
Which agent generated the blueprint |
originatingRunId |
Factory execution session for trace replay |
designSource |
Link back to design tool or token system |
memoryScope |
global, project, module β memory storage context |
traceTags |
Used for search, similarity indexing, prompt enrichment |
π§ Output: Embedded in Artifact Headers¶
/**
* Blueprint: ConnectSoft.UI.UserCard
* Version: 0.1.0
* Generated By: ComponentScaffolderAgent
* Source: RUN-3421
* Tags: [frontend, profile, card]
*/
Also attached as blueprint.meta.json:
{
"id": "ConnectSoft.UI.UserCard",
"version": "0.1.0",
"createdBy": "ComponentScaffolderAgent",
"originatingRunId": "RUN-3421"
}
π§ Memory and Search Indexing¶
-
Metadata is embedded in:
-
vector DB (
blueprint-memory-graph) - file system (
.factory-cache) - Azure Table/Blob (long-term trace archive)
Agents use these to:
- Search similar blueprints
- Detect reuse opportunities
- Regenerate from blueprint-only snapshots
π Blueprint Run Trace Events¶
{
"event": "BlueprintPublished",
"blueprintId": "ConnectSoft.UI.UserCard",
"version": "0.1.0",
"agentId": "DocsAgent",
"traceId": "abc-trace-20250607"
}
π README.md Metadata Block (Optional)¶
## π§ Metadata
- Blueprint ID: `ConnectSoft.UI.UserCard`
- Version: `0.1.0`
- Generated by: `ComponentScaffolderAgent`
- Figma: [link]
π§ Agent Responsibilities¶
| Agent | Task |
|---|---|
| MemoryIndexerAgent | Stores metadata in factory memory graphs |
| TraceLoggerAgent | Emits BlueprintPublished and ArtifactLinked |
| DocsAgent | Embeds metadata in docs and headers |
| RegenerationAgent | Uses metadata to restore or fork blueprints |
| AuditAgent | Verifies provenance and generation trace logs |
β Summary¶
- Blueprint metadata provides a structured identity for every UI artifact
- Enables traceability, versioning, regeneration, and agent coordination
- Stored across memory systems (vector, blob, table) for long-term use
- Ensures reproducibility and insight into how each component was created
π Analytics and Feedback Hooks¶
This section defines how frontend blueprints include support for usage analytics, user feedback hooks, and runtime behavior tracking. These enable ConnectSoft agents to observe real-world component adoption, interaction frequency, and usability outcomes β feeding back into future agent decisions and blueprint refinements.
π Blueprint Analytics Field¶
analytics:
enabled: true
provider: "@connectsoft/analytics"
events:
- name: userCardViewed
trigger: onRender
- name: userCardClicked
trigger: onClick
feedback:
enabled: true
type: thumbs
storage: azure-table
π Event Emission Example (React)¶
import { useAnalytics } from '@connectsoft/analytics';
const analytics = useAnalytics();
useEffect(() => {
analytics.track('userCardViewed');
}, []);
return (
<div onClick={() => analytics.track('userCardClicked')}>
<Avatar />
<span>{username}</span>
</div>
);
π§ Feedback Button Injection (Optional)¶
Stores:
π Output: Storage Targets¶
| Type | Output |
|---|---|
| Analytics | Azure App Insights, Segment, PostHog |
| Feedback | Azure Table, CosmosDB, file blob |
| Agent Memory | Feedback aggregated into blueprint scoring models |
π README.md Analytics Section¶
## π Analytics
- Tracks: `userCardViewed`, `userCardClicked`
- Feedback: Thumbs rating (enabled)
- Events published via `@connectsoft/analytics`
π Prompt Context Example¶
{
"analytics": {
"enabled": true,
"events": [
{ "name": "userCardViewed", "trigger": "onRender" },
{ "name": "userCardClicked", "trigger": "onClick" }
],
"feedback": {
"enabled": true,
"type": "thumbs",
"storage": "azure-table"
}
}
}
π§ Agent Responsibilities¶
| Agent | Task |
|---|---|
| AnalyticsAgent | Injects event bindings, initializes tracking client |
| FeedbackAgent | Adds feedback widget and storage logic |
| TraceLoggerAgent | Captures usage + feedback in platform memory |
| QualityAgent | Uses event/failure frequency for blueprint scoring |
| UXImprovementAgent | Analyzes feedback for blueprint evolution suggestions |
π Use Cases¶
- Measure which UI elements get most attention
- Identify drop-off points or missing states
- Collect user feedback in a low-friction way
- Guide agentic UX optimization across factory runs
β Summary¶
- Analytics and feedback enhance visibility into real usage
- Hooks are injected automatically if enabled in the blueprint
- Feedback is stored and traceable per component or user cohort
- Reinforces observability-first and continuous-improvement goals
π§© Final Summary and Blueprint Lifecycle Diagram¶
This final section consolidates the full scope of a frontend library blueprint and presents the end-to-end lifecycle β from DSL and agent prompts to artifact generation, deployment, usage feedback, and memory integration β within the AI Software Factory.
β Final Summary: What a Frontend Blueprint Encodes¶
| Area | Encoded by Blueprint |
|---|---|
| π Structure | Component name, props, slots, layouts |
| π§ Behavior | Events, feature flags, conditional logic |
| π§ͺ Quality | Test expectations, coverage, a11y rules |
| π Documentation | README, Storybook, UX guidelines |
| π CI/CD | Pipelines, artifacts, publish rules |
| π¦ Packaging | Registry metadata, bundling config |
| π Observability | Telemetry hooks, performance rules |
| π¨ UX Context | Figma link, usability rationale |
| π Traceability | Metadata, run ID, memory scope |
| π§Ύ Analytics | Runtime feedback, usage metrics |
π Blueprint Lifecycle Diagram¶
flowchart TD
subgraph Authoring
A1[DSL / YAML / Prompt]
A2[Agent Prompts]
end
subgraph Generation
G1[Component Generator]
G2[Test Generator]
G3[Docs Generator]
G4[CI/CD Pipeline]
G5[Telemetry Hook Inserter]
G6[Storybook + MDX Writer]
end
subgraph Publishing
P1[NPM / GitHub / Azure]
P2[Storybook Deployment]
P3[README + Metadata Index]
end
subgraph Runtime
R1[Usage + Analytics]
R2[Feedback Collector]
R3[Visual Drift Detector]
end
subgraph Memory
M1[Blueprint Trace Store]
M2[Memory Index (vector + table)]
M3[Agent Scoring & Evolution]
end
A1 --> G1
A2 --> G1
G1 --> G2 --> G3 --> G4 --> G5 --> G6 --> P1 & P2 & P3
P1 --> R1 --> R2
P3 --> M1
R2 --> M2
M2 --> M3
π Blueprint Longevity and Reusability¶
-
Blueprints live across:
-
π Agent retries
- π§ Factory memory graphs
- π§ͺ Regeneration attempts
-
π¦ Microfrontend registries
-
Each blueprint:
-
Is reproducible and version-controlled
- Can be forked by new agents
- Has traceable memory impact and usage footprint
π Future Extension Topics¶
| Area | Description |
|---|---|
| π§© Multi-Framework Targets | Generate for React, Angular, Blazor, Vue |
| π§ͺ Behavioral Testing DSLs | Auto-generate Cypress, Playwright |
| π§ Custom UI SDK Integration | Tailwind, Chakra, Material UI configs |
| π§ Active Learning Loops | Feed analytics into LLM prompt refinement |
| π§° Live Playground Scaffolds | Auto-deploy component playgrounds for QA/UX review |
π§ Blueprint = Executable Design Contract¶
βEach frontend blueprint is a modular contract between agents β describing not just what to build, but how it behaves, how it performs, and how it evolves.β