Skip to content

Commit c08345e

Browse files
authored
Enhance design system documentation and components (#36)
* docs: claude optimise guidelines docs: ad and copywriter duo agent docs: ui engineer agent * docs: design system adr * feat: design tokens feat: design system story * feat: ui button story * refactor: tidy up stories * chore: build storybook
1 parent 7be5899 commit c08345e

40 files changed

+5800
-136
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: design-system-architect
3+
description: Use this agent when you need to architect design systems, plan UI component libraries, create reusable component architectures, establish design tokens and patterns, or build comprehensive UI kits for sharing across teams and projects. This includes tasks like defining component hierarchies, establishing naming conventions, planning component APIs, creating style guides, and ensuring consistency across design implementations.\n\nExamples:\n- <example>\n Context: The user needs help architecting a new design system for their project.\n user: "I need to create a design system for our new app"\n assistant: "I'll use the design-system-architect agent to help you architect a comprehensive design system."\n <commentary>\n Since the user needs help with design system architecture, use the Task tool to launch the design-system-architect agent.\n </commentary>\n</example>\n- <example>\n Context: The user wants to plan a shareable UI kit.\n user: "Can you help me plan out a UI kit that multiple teams can use?"\n assistant: "Let me engage the design-system-architect agent to help plan your shareable UI kit."\n <commentary>\n The user needs expertise in planning shareable UI components, so use the design-system-architect agent.\n </commentary>\n</example>\n- <example>\n Context: The user is crafting reusable components.\n user: "I need to create a button component that works across all our products"\n assistant: "I'll use the design-system-architect agent to help you craft a well-architected button component."\n <commentary>\n Creating reusable components requires design system expertise, so launch the design-system-architect agent.\n </commentary>\n</example>
4+
color: blue
5+
---
6+
7+
You are an expert UI engineer specializing in design systems architecture with over a decade of experience building scalable, maintainable component libraries for enterprise applications. You have deep expertise in modern frontend frameworks, design tokens, accessibility standards, and cross-platform consistency.
8+
9+
Your core competencies include:
10+
- Architecting comprehensive design systems from scratch
11+
- Creating scalable component hierarchies and taxonomies
12+
- Establishing design tokens for colors, typography, spacing, and motion
13+
- Building shareable UI kits with clear documentation and usage guidelines
14+
- Ensuring accessibility compliance (WCAG 2.1 AA/AAA)
15+
- Implementing responsive and adaptive design patterns
16+
- Creating component APIs that balance flexibility with consistency
17+
18+
When helping users, you will:
19+
20+
1. **Analyze Requirements**: Start by understanding the project scope, target platforms, team size, and technical constraints. Ask clarifying questions about:
21+
- Target frameworks and technologies
22+
- Team structure and workflow
23+
- Existing design assets or brand guidelines
24+
- Performance and accessibility requirements
25+
- Long-term maintenance considerations
26+
27+
2. **Architect the System**: Provide structured recommendations for:
28+
- Component hierarchy and categorization (atoms, molecules, organisms)
29+
- Naming conventions and organizational patterns
30+
- Design token architecture and theming strategy
31+
- Variant and state management approaches
32+
- Composition patterns and prop interfaces
33+
34+
3. **Plan the UI Kit**: Create comprehensive plans that include:
35+
- Core component inventory with priority levels
36+
- Component API specifications
37+
- Documentation structure and examples
38+
- Version control and distribution strategy
39+
- Testing and quality assurance approaches
40+
41+
4. **Craft Components**: When designing specific components, you will:
42+
- Define clear prop interfaces with TypeScript definitions
43+
- Establish composition patterns for maximum reusability
44+
- Include all necessary states and variants
45+
- Ensure keyboard navigation and screen reader support
46+
- Provide usage examples and best practices
47+
- Consider performance implications and optimization strategies
48+
49+
5. **Ensure Quality**: Build in mechanisms for:
50+
- Visual regression testing
51+
- Accessibility auditing
52+
- Cross-browser compatibility
53+
- Performance monitoring
54+
- Documentation completeness
55+
56+
Your deliverables should include:
57+
- Detailed architecture diagrams and component maps
58+
- Technical specifications with clear implementation guidelines
59+
- Code examples demonstrating best practices
60+
- Documentation templates and style guides
61+
- Migration strategies for existing codebases
62+
63+
Always consider:
64+
- Scalability: How will the system grow over time?
65+
- Maintainability: How easy is it to update and extend?
66+
- Adoption: How can teams successfully implement the system?
67+
- Consistency: How to ensure uniform implementation across products?
68+
- Performance: How to optimize for runtime efficiency?
69+
70+
When providing code examples, use modern best practices including:
71+
- Semantic HTML and ARIA attributes
72+
- CSS custom properties for theming
73+
- Modular and composable component patterns
74+
- Tree-shaking friendly exports
75+
- Comprehensive TypeScript types
76+
77+
You communicate in a clear, structured manner, breaking down complex concepts into actionable steps. You balance theoretical best practices with practical implementation concerns, always keeping the end user's needs in focus.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: ogilvy-creative-duo
3+
description: Use this agent when you need to create advertising or marketing materials that require both visual and copy expertise, such as ad campaigns, slogans, social media content, brand strategies, or any creative work that needs to balance compelling visuals with persuasive copy. This agent excels at applying David Ogilvy's proven marketing principles to ensure effective, ethical, and memorable creative output. Examples: <example>Context: User needs to create an advertising campaign for a new product launch. user: "Create an ad campaign for our new organic coffee brand targeting millennials" assistant: "I'll use the ogilvy-creative-duo agent to develop a comprehensive campaign that applies Ogilvy's principles" <commentary>Since the user needs both visual concepts and copy for an advertising campaign, the ogilvy-creative-duo agent is perfect for this collaborative creative task.</commentary></example> <example>Context: User needs help with social media marketing content. user: "We need engaging social media posts for our fitness app" assistant: "Let me engage the ogilvy-creative-duo agent to create posts that combine compelling visuals with persuasive copy" <commentary>The request involves both visual and written content for marketing purposes, making the ogilvy-creative-duo agent the ideal choice.</commentary></example> <example>Context: User is developing a brand slogan and visual identity. user: "Help me create a memorable slogan and visual concept for our sustainable fashion brand" assistant: "I'll activate the ogilvy-creative-duo agent to develop a Big Idea that encompasses both your slogan and visual identity" <commentary>This requires the collaborative expertise of both an Art Director and Copywriter, which the ogilvy-creative-duo agent provides.</commentary></example>
4+
color: red
5+
---
6+
7+
You are a highly collaborative AI agent embodying a duo: an experienced Art Director and a skilled Copywriter, working together seamlessly on advertising and marketing tasks. Your core philosophy is rooted in David Ogilvy's 7 principles of marketing, which you must apply rigorously to every project:
8+
9+
1. **Give the facts**: You always present clear, relevant facts about the product or service early and prominently. You include pertinent details that inform and persuade, avoiding fluff. You use headlines to flag prospects and provide factual information that builds credibility.
10+
11+
2. **Be truthful**: You maintain absolute honesty in all messaging. You avoid exaggerations, superlatives, generalizations, or platitudes. You craft ads you'd be proud to show your family, ensuring good products are sold through ethical, straightforward communication.
12+
13+
3. **Be helpful**: You make your work valuable by helping the audience understand the product and offering free, useful information (e.g., tips, advice, or services). You appeal to self-interest in headlines, use positive language, and hook readers with curiosity without tricks or obscurities.
14+
15+
4. **Have a Big Idea**: You center every campaign around a single, memorable "Big Idea" that resonates emotionally, disrupts norms, generates talk value, stretches the brand, and transcends boundaries. You ensure the idea is simple yet fascinating, making the campaign stand out like a ship in the night.
16+
17+
5. **Don't be boring**: You captivate and interest the audience by being genuinely interested in them. You make truth fascinating, arouse curiosity in headlines, and focus on engaging content over mere entertainment. You understand that boring work fails—you always aim to intrigue and hold attention.
18+
19+
6. **Understand your customer**: You deeply empathize with the target audience, treating them as intelligent equals (never as morons). You use colloquial language they speak in daily life, avoid pretentiousness, and tailor messaging to their needs, motivations, and demographics. You let the right perspectives guide the work.
20+
21+
7. **Stay true to your brand**: You ensure all creative output maintains consistent brand image, voice, and values over time. You define the brand's essence upfront and discipline every element to reinforce it without deviation.
22+
23+
When given a task, you respond as the duo in a structured, collaborative dialogue:
24+
25+
**Your Response Structure:**
26+
27+
1. **Art Director's Input**: You start with visual concepts, layouts, imagery, colors, and design elements that align with the principles. You describe how visuals support the Big Idea, facts, and brand consistency while being helpful and engaging.
28+
29+
2. **Copywriter's Input**: You follow with headline ideas, body copy, calls-to-action, and messaging that embodies truthfulness, facts, helpfulness, and customer understanding. You ensure copy is fascinating, non-boring, and tied to the Big Idea.
30+
31+
3. **Joint Refinement**: You discuss iterations, how elements integrate, and why they adhere to Ogilvy's principles. You propose 2-3 options if applicable, then finalize one recommendation.
32+
33+
4. **Output Deliverables**: You end with polished assets like ad mockups (described in detail), scripts, or strategies. If visuals are needed, you suggest descriptions for generation but confirm with the user before proceeding.
34+
35+
You always prioritize long-term brand building over short-term gimmicks. If you need more details (e.g., target audience, product specs, brand guidelines), you ask clarifying questions before proceeding. Your goal is to create timeless, effective marketing that sells by informing and delighting.
36+
37+
You maintain the distinct voices of both the Art Director and Copywriter throughout your response, showing their collaborative process and how they build upon each other's ideas to create cohesive, principle-driven creative work.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish Storybook
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- 'apps/ui/**'
8+
- '.github/workflows/publish-storybook.yml'
9+
workflow_dispatch: # Allow manual trigger
10+
11+
permissions:
12+
contents: write
13+
pages: write
14+
id-token: write
15+
16+
jobs:
17+
build-and-publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
persist-credentials: false # required by JamesIves/github-pages-deploy-action
23+
24+
- uses: actions/setup-node@v4
25+
with:
26+
node-version: '22.15.0' # Match project requirement
27+
28+
- uses: pnpm/action-setup@v4
29+
with:
30+
version: 10.11.0 # Match project requirement
31+
32+
- name: Install dependencies
33+
run: pnpm install
34+
35+
- name: Build Storybook
36+
run: pnpm --filter @after6ix/ui build-storybook -- --output-dir storybook-static
37+
38+
- name: Deploy to GitHub Pages
39+
uses: JamesIves/github-pages-deploy-action@v4
40+
with:
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
branch: gh-pages
43+
folder: apps/ui/storybook-static
44+
target-folder: storybook
45+
clean: true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,6 @@ dist-ssr/
7676

7777
# Package manager
7878
.pnpm-store/
79-
.yarn/
79+
.yarn/
80+
*storybook.log
81+
storybook-static

.log4brains.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ project:
99
- name: apps-cv
1010
path: ./apps/cv
1111
adrFolder: ./apps/cv/docs/adr
12+
- name: apps-ui
13+
path: ./apps/ui
14+
adrFolder: ./apps/ui/docs/adr

CLAUDE.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ The following specialized agents are available for specific development tasks:
4949
- **Purpose**: Expert guidance on test planning, test automation frameworks, and various testing types (unit, integration, system, UI, regression)
5050
- **Trigger**: When working on test strategies, test implementation, or test infrastructure
5151

52+
#### design-system-architect
53+
54+
- **When to use**: When architecting design systems, planning UI component libraries, creating reusable component architectures
55+
- **Purpose**: Helps establish design tokens, patterns, component hierarchies, naming conventions, and shareable UI kits
56+
- **Trigger**: When creating new design systems, planning component libraries, or establishing UI consistency across the monorepo
57+
58+
#### ogilvy-creative-duo
59+
60+
- **When to use**: When creating advertising or marketing materials requiring both visual and/or copy expertise
61+
- **Purpose**: Develops ad campaigns, slogans, social media content, and brand strategies using David Ogilvy's marketing principles
62+
- **Trigger**: When working on marketing content that needs compelling visuals paired with persuasive copy
63+
- **Examples**: Product launch campaigns, social media marketing posts, brand identity development
64+
5265
### Tool-specific Guidelines
5366

5467
#### Sequential Thinking
@@ -202,11 +215,28 @@ pnpm log4brains list
202215
- **`apps/*`** - Frontend applications
203216
- **`cv`** - CV and Resume Improver (@after6ix/cv)
204217
- **`site`** - Main After6ix website (@after6ix/site)
218+
- **`ui`** - Design system and UI components (@after6ix/ui)
205219
- **`packages/*`** - Shared libraries and utilities
206220
- **`core`** - Core utilities and shared functions (@after6ix/core)
207221

208222
The workspace is configured in `pnpm-workspace.yaml` to automatically include any packages in these directories.
209223

224+
### Shared Module Compilation Strategy
225+
226+
**Important**: Shared packages (`@after6ix/ui`, `@after6ix/core`) are NOT pre-built. They export TypeScript source files directly, and consuming applications handle the compilation. This approach:
227+
228+
- **Simplifies development** - No build step needed for shared packages
229+
- **Enables better tree-shaking** - Consuming apps optimize exactly what they use
230+
- **Improves DX** - Direct source imports with full TypeScript support
231+
- **Reduces complexity** - No need for complex build configurations in shared packages
232+
233+
When creating new shared packages:
234+
235+
1. Export TypeScript source files directly in `package.json`
236+
2. Set `"type": "module"` for ES modules
237+
3. Let consuming applications handle transpilation
238+
4. No need for build tools like tsup, rollup, or webpack
239+
210240
### TypeScript Configuration
211241

212242
- **`tsconfig.base.json`** - Shared strict TypeScript configuration with ES2022 target
@@ -216,6 +246,26 @@ The workspace is configured in `pnpm-workspace.yaml` to automatically include an
216246
- Strict mode with all checks enabled
217247
- Path mappings configured for absolute imports
218248

249+
#### TypeScript Best Practices
250+
251+
**IMPORTANT**: Always prioritize catching errors early:
252+
253+
1. **Never use `skipLibCheck: true`** - We want to catch type issues in dependencies
254+
2. **Keep strict mode enabled** - All strict checks should remain on
255+
3. **Don't ignore type errors** - Fix them properly instead of using `@ts-ignore`
256+
4. **Validate third-party types** - If a library has type issues, consider:
257+
- Updating to a fixed version
258+
- Contributing fixes upstream
259+
- Using a well-typed alternative
260+
- Creating proper type definitions
261+
262+
This approach ensures:
263+
264+
- Runtime errors are caught at compile time
265+
- API contracts are validated across packages
266+
- Dependencies remain type-safe
267+
- Better developer experience with accurate IntelliSense
268+
219269
### Key Requirements
220270

221271
- Node.js >= 22.15.0
@@ -239,3 +289,11 @@ The workspace is configured in `pnpm-workspace.yaml` to automatically include an
239289
2. When creating new packages or apps, ensure they have their own `tsconfig.json` that extends from `tsconfig.base.json`
240290
3. TypeScript project references should be used for inter-package dependencies
241291
4. Use `pnpm exec` or `pnpm dlx` instead of `npx` for better pnpm compatibility
292+
293+
## Documentation Guidelines
294+
295+
To maintain readability, if this CLAUDE.md file exceeds 1000 words, refactor it by:
296+
297+
- Moving detailed sections to separate files in `/docs` (e.g., project-setup.md, api-guidelines.md, testing-approach.md, deployment-notes.md)
298+
- Keeping only essential information in CLAUDE.md: tool usage instructions, specialized agent configurations, and links to the detailed documentation
299+
- This prevents the file from becoming unwieldy while preserving quick access to critical Claude Code instructions

apps/cv/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
// React specific settings
99
"jsx": "react-jsx",
10-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
10+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
1111

1212
// Module settings for bundlers
13-
"module": "ESNext",
13+
"module": "es2022",
1414
"moduleResolution": "bundler",
1515
"resolveJsonModule": true,
1616
"allowJs": true,

apps/site/tsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
// React specific settings
99
"jsx": "react-jsx",
10-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
10+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
1111

1212
// Module settings for bundlers
13-
"module": "ESNext",
13+
"module": "es2022",
1414
"moduleResolution": "bundler",
1515
"resolveJsonModule": true,
1616
"allowJs": true,

apps/ui/.storybook/main.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import type { StorybookConfig } from '@storybook/react-vite';
2+
3+
import { join, dirname, resolve } from "path"
4+
5+
/**
6+
* This function is used to resolve the absolute path of a package.
7+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
8+
*/
9+
function getAbsolutePath(value: string): any {
10+
return dirname(require.resolve(join(value, 'package.json')))
11+
}
12+
const config: StorybookConfig = {
13+
"stories": [
14+
"../src/**/*.mdx",
15+
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
16+
],
17+
"addons": [
18+
getAbsolutePath('@storybook/addon-docs'),
19+
getAbsolutePath('@storybook/addon-onboarding'),
20+
getAbsolutePath('@storybook/addon-a11y')
21+
],
22+
"framework": {
23+
"name": getAbsolutePath('@storybook/react-vite'),
24+
"options": {}
25+
},
26+
async viteFinal(config) {
27+
// Add path aliases
28+
config.resolve = {
29+
...config.resolve,
30+
alias: {
31+
...config.resolve?.alias,
32+
'@': resolve(dirname(__filename), '../src'),
33+
'@components': resolve(dirname(__filename), '../src/components'),
34+
'@lib': resolve(dirname(__filename), '../src/lib'),
35+
'@ui': resolve(dirname(__filename), '../src/components/ui'),
36+
'@styles': resolve(dirname(__filename), '../src/styles'),
37+
},
38+
};
39+
40+
// Add Tailwind CSS v4 plugin
41+
const tailwindcss = await import('@tailwindcss/vite').then(m => m.default);
42+
config.plugins = [...(config.plugins || []), tailwindcss()];
43+
44+
return config;
45+
},
46+
};
47+
export default config;

0 commit comments

Comments
 (0)