AI Collaboration Framework

Tools & Context

Achieving breakthrough results through AI-powered design and development

Claude Code Agent + Figma MCP + Schema = Breakthrough Results

The right tools plus structured context fundamentally changes what's possible. Design and ship production-ready systems faster.

The Complete Workflow

Figma Design Design System Components & Tokens MCP Schema Patterns & Rules Knowledge Base Context Claude Code AI Agent Code Generation Generate Production Code Consistent & Tested Design-Aligned Iterative Refinement Loop

Design specifications flow from Figma through your schema into Claude Code, which generates production-ready code. The feedback loop enables continuous refinement.

System Architecture

Complete Design System Flow

Design tokens power everything. Figma components and MUI components share the same source of truth, coordinated by an AI agent that interprets designs and generates production patterns.

DESIGN TOKENS Source of Truth Colors • Typography • Spacing • Shadows FIGMA COMPONENTS Button • Card • Input • Modal 🎨 Design Source ↓ Using Design Tokens MUI COMPONENTS + MUI THEME ⚛️ React Implementation ↓ Using Design Tokens PATTERN PACKAGES npm registry 📦 Distribution ↓ Versioned Patterns FIGMA PATTERNS Login Form • Dashboard • Nav Composed from Components 🤖 AGENT COORDINATOR 1. Interprets Figma Designs → Reads components via MCP 2. Maps to Themed Components → Matches MUI + Design Tokens 3. Generates New Patterns → Creates production code ✨ GENERATED PATTERNS Production-Ready React Code Pixel-Perfect • Typed • Accessible • Themed KEY: Design Tokens Figma Layer MUI Layer AI Agent Output

How it works: Design tokens cascade through every layer, ensuring consistency. The agent coordinator reads Figma designs via MCP, understands the MUI theme and available components, references pattern packages from npm, and generates production code that's perfectly aligned with your design system. Every pattern is typed, accessible, and pixel-perfect because it's built on the same foundational tokens.

Step 0

Plan First with Claude Code

Before writing code or invoking tools—start in plan mode. The most important step.

Why Plan Mode Matters

Think through the approach before implementation. Surfaces edge cases, architecture decisions, and issues early when they're cheapest to fix. Saves hours by investing minutes upfront.

📋 Clarify Requirements

Refine vague ideas into concrete specs through clarifying questions.

🏗️ Explore Approaches

Review strategies and consider tradeoffs before choosing a path.

🎯 Define Success

Set clear completion criteria. Prevents scope creep.

⚠️ Surface Risks

Identify blockers and constraints early.

💡 Pro Tip

Use plan mode for any non-trivial task. Planning often reveals better approaches you hadn't considered. The best developers spend more time planning than coding.

The Tools

Each tool serves a specific purpose. Together, they amplify human creativity with AI capabilities.

Design Bridge

Figma MCP

Bridges design and code by giving AI direct access to Figma files.

  • Reads Figma designs and components
  • Extracts design tokens and properties
  • Generates code from design specifications
  • Maintains design-code consistency
Learn more MCP Spec
Knowledge Base

Schema

Structured knowledge defining patterns, conventions, and architecture. The rulebook AI follows for consistent output.

  • Component patterns and usage guidelines
  • Design token definitions and relationships
  • Code conventions and best practices
  • Project-specific context and requirements
Framework

The Four Pillars of Effective Prompts

Every effective prompt is built on four fundamental components that work together to guide AI output.

Framework by: Gabe De Mesa | Google Prompt Engineering 2025

👤 Persona Who is the AI? Define role & perspective 🎯 Task What to do? Clear action & objective 📋 Context What background? Relevant details & constraints 📝 Format How to present? Output structure & style

Example in Action

You are a program manager in [industry].
Draft an executive summary email to
[persona] based on [details about relevant program docs].
Limit to bullet points.
Persona
Task
Context
Format
Best Practices

Avoiding Hallucinations

Five essential strategies to keep AI responses grounded in reality and reduce the risk of fabricated information.

⚠️ HALLUCINATIONS Unreliable Output PREVENTION STRATEGIES RELIABLE OUTPUT Accurate & Grounded
🎯

Clear & Specific Prompts

Use precise and well-defined prompts to guide the LLM towards specific information, reducing the chance of it relying on assumptions or creativity.

🧩

Break Down Complex Prompts

Divide complex or broad prompts into smaller, more manageable chunks to maintain focus and accuracy.

📏

Constrain Output

Limit the length or scope of the LLM's response to keep answers focused and prevent wandering into speculation.

Prompt for Verification

Structure prompts to encourage the LLM to clarify its statements or cite sources, building accountability into responses.

🎚️

Sampling Controls

Turn down temperature and sampling for more deterministic output, reducing randomness and creative speculation.

Example: Preventing Hallucinations

❌ PRONE TO HALLUCINATION
"Tell me about the latest features in React."

⚠️ Too vague, no constraints, AI might invent features

✓ HALLUCINATION-RESISTANT
"List the features introduced in React 18.0, as documented in the official React blog.
Limit to 5 features.
For each, cite the source URL.
If you're unsure, say 'I don't have verified information about this.'"

✓ Specific version • Constrained scope • Requires verification • Acknowledges uncertainty

Framework Credit: Gabe De Mesa - Google Prompt Engineering 2025

Prompting Styles

How you communicate with AI determines the quality of output. Different tasks require different approaches.

Declarative

State what you want, not how. Let AI determine the best approach.

Iterative

Build incrementally. Start simple, refine. Each iteration teaches AI your preferences.

Contextual

Reference existing patterns, files, and conventions. Ground requests in actual codebase.

Constraint-Based

Define boundaries and requirements upfront. What must be true, what must be avoided.

Exploratory

Ask "what if" questions. Explore possibilities before committing.

Meta-Cognitive

Reflect on the process. Ask AI to explain reasoning or suggest better approaches.

Example: Declarative + Contextual
"Create a dashboard layout using Patterns Figma. Include metrics cards, a data table, and action buttons. Follow the existing Agent Studio design language."
Result: AI generates code using known patterns, maintains consistency with existing designs, and follows established conventions—all without specifying exact implementation details.
Example: Iterative + Constraint-Based
"Start with a basic form component. Must be accessible (WCAG AA), use MUI inputs, and integrate with our validation schema. We'll add features incrementally."
Result: Foundation is solid and meets requirements. Subsequent iterations add complexity without breaking constraints.

Code Generation in Action

component.tsx
AI GENERATING...

Watch as Claude Code generates production-ready components in real-time

Advanced Techniques

10 Types of Prompts

Different prompting strategies unlock different AI capabilities. Master these approaches to handle any task.

System Prompting

Set global behavior and constraints for entire conversation

Contextual Prompting

Provide relevant background information and examples

Role Prompting

Assign specific expertise or perspective to AI

Step-back Prompting

Ask for principles before diving into specifics

Chain of Thought (CoT)

Linear step-by-step reasoning process

Self-Consistency

Multiple reasoning paths with voting mechanism

Tree of Thoughts (ToT)

Explore multiple reasoning branches simultaneously

ReAct (Reason & Act)

Interleave reasoning with actions and observations

Auto Prompt Engineering

Let AI optimize prompts automatically

Code Prompting

Structured prompts for code generation and review

Reasoning Strategy Comparison

Chain of Thought Self-Consistency Tree of Thoughts
Reasoning Approach Linear reasoning Multiple full-path reasoning Multiple reasoning branches
Decision Point At the end Vote on quorum at the end At each step
Compute Cost Low Medium High
Best For Simple problems 2nd or 3rd opinions Exploring very complex problems

Choose your reasoning strategy based on problem complexity and computational budget

Framework Credit: Gabe De Mesa - Google Prompt Engineering 2025

Types of Thinking

AI agents can employ different reasoning modes. Knowing when to use each unlocks better results.

1

System 1: Fast Thinking

Quick, intuitive responses based on patterns. Good for routine tasks, boilerplate code, and familiar patterns. "Generate a login form using MUI."

2

System 2: Deep Thinking

Deliberate, analytical reasoning for complex problems. Architectural decisions, system design, and novel challenges. "Design a state management system for multi-agent collaboration."

3

Chain of Thought

Step-by-step reasoning made explicit. Breaking down complex tasks into logical sequences. "Walk through how you would refactor this component to support theming."

4

Meta-Reasoning

Thinking about thinking. Reflecting on approach, identifying gaps in understanding, and suggesting process improvements. "What information would help you build this better?"

Context Distillation

The quality of AI output depends on the quality of context provided. Here's how to distill complex project knowledge into AI-readable context.

// Example: Design System Schema
const designSystemSchema = {
  // Component patterns from Patterns Figma
  patterns: {
    "card": {
      variants: ["elevated", "outlined", "filled"],
      tokens: ["spacing.card", "shadow.md", "radius.lg"],
      usage: "Container for related content with optional actions"
    }
  },

  // Design tokens
  tokens: {
    spacing: { card: "24px", section: "64px" },
    colors: { primary: "#3b82f6", accent: "#22c55e" }
  },

  // Conventions
  conventions: {
    naming: "kebab-case for files, PascalCase for components",
    structure: "components/[name]/[name].tsx"
  }
}

Layers of Context

Historical Context Previous decisions, patterns that worked, lessons learned 4 Task Context Current objective, constraints, success criteria 3 Design System Context Patterns, tokens, components available 2 Project Context Tech stack, architecture, conventions 1 FOUNDATION Build Up Context
1

Project Context

Tech stack, architecture, conventions. The foundation that informs all decisions.

2

Design System Context

Patterns, tokens, components. What's available and how to use it.

3

Task Context

Current objective, constraints, success criteria. What are we trying to achieve right now?

4

Historical Context

Previous decisions, patterns that worked, things that didn't. Learning from the journey.

Effective Context Example
"We're building Agent Studio, a management interface for AI agents. Tech: React + TypeScript + MUI. Design system: Patterns Figma with comprehensive component library. Current task: Create an agent configuration panel. Must follow existing dashboard layout patterns. Reference: see dashboard.tsx for structure."
This provides AI with: what we're building (project), what tools we have (design system), what we need now (task), and where to look for examples (historical).

Context Engineering

Context engineering is an iterative experimental process. You don't write perfect context once—you experiment, review results, and refine until the agent performs consistently. This cycle is where expertise is built.

The Experiment-Review-Refine Cycle

CONTEXT ENGINEERING 1 Experiment Write context & give task 2 Execute Run agent 3 Review Analyze results 4 Measure Track performance 5 Refine Edit context 6 Repeat Iterate
1

Experiment

Write context and give the agent a task. Try different approaches, structures, and levels of detail.

2

Execute

Let the agent run with the context. Observe how it interprets instructions and makes decisions.

3

Review

Analyze results. Did it follow patterns? Make correct assumptions? Handle edge cases? Miss anything?

4

Measure

Quantify performance: accuracy, consistency, speed, error rate. Track what works and what doesn't.

5

Refine

Edit context based on learnings. Add missing info, clarify ambiguity, remove noise. Be specific where needed.

6

Repeat

Run again with refined context. Compare results. Iterate until performance is consistent and reliable.

The key insight: Context engineering is debugging for AI. You're not just writing instructions—you're diagnosing why the agent made certain choices and adjusting the context to guide better decisions. Each iteration teaches you what the agent needs to know and how it interprets information.

Context Refinement in Action

Real examples showing how editing context improves agent performance.

Iteration 1: Vague Context
❌ Inconsistent
"Build a form component.
Make it look good.
Add validation."
Accuracy: 40%
Consistency: Low
Issues: Wrong patterns, inconsistent styling, generic validation
Iteration 5: Refined Context
✓ Performant
"Build a form component using Patterns Figma.
Style: Use MUI TextField, follow 8px grid.
Validation: Yup schema, inline errors.
Reference: See auth-form.tsx for pattern.
Must: WCAG AA, match design tokens."
Accuracy: 95%
Consistency: High
Result: Correct patterns, accessible, production-ready

What Changed Between Iterations

1

Added Specificity

"Build a form" → "Build a form using Patterns Figma with MUI TextField"
Why: Agent was guessing which patterns to use. Explicit reference eliminated ambiguity.

2

Defined Standards

"Make it look good" → "Follow 8px grid, match design tokens"
Why: "Good" is subjective. Concrete standards ensure consistency.

3

Clarified Validation

"Add validation" → "Yup schema, inline errors"
Why: Agent implemented basic HTML validation. Specified the exact library and UX pattern needed.

4

Provided Reference

Added: "Reference: See auth-form.tsx for pattern"
Why: Concrete example shows exactly what's expected. Agent can match the pattern.

5

Added Constraints

Added: "Must: WCAG AA, match design tokens"
Why: Non-negotiable requirements prevent the agent from taking shortcuts.

The pattern: Each refinement addressed a specific problem observed in the output. Vague instructions → inconsistent results. Specific context → reliable performance. The cycle revealed exactly what the agent needed to succeed.

Measuring Context Performance

How do you know if context is working? Track these metrics across iterations.

Accuracy

Does the output match requirements? Are the right patterns used? Are constraints followed?

Consistency

Does the agent produce similar quality across multiple runs? Or does output vary wildly?

Completeness

Does it include everything needed? Or do you have to ask for missing pieces every time?

Correctness

Is the code/output actually correct? Does it work without modifications? Are there bugs?

Efficiency

How much back-and-forth is needed? Does good context reduce iteration cycles?

Edge Cases

Does it handle unusual inputs gracefully? Or only work for the happy path?

Context Performance Over Iterations

100% 80% 60% 40% 20% Iter 1 40% Iter 2 55% Iter 3 70% Iter 4 85% Iter 5 95% Metrics Accuracy: +138% Consistency: High Speed: +45% Errors: -80% Result: Production Ready Performance Score Context Iterations
Measuring in Practice
Run the same task 3-5 times with the same context. If results vary significantly, context needs refinement. If results are consistently good, context is performant. Track success rate, time to completion, and issues encountered.
Example: First iteration of form context produced 2/5 correct forms. After refinement: 5/5 correct forms that passed code review without changes. That's measurable improvement from context engineering.

Keep a log: Document what context produced what results. Track changes between iterations. Note what improvements worked. Build a knowledge base of effective patterns. This becomes your schema—the distilled expertise that makes future agents performant from the start.

Context engineering IS the work: It's not overhead or extra steps. It's how you transfer human expertise into AI-readable form. The better your context engineering process, the more performant your agents become. This is where 10x improvements come from.

Breakthrough Results

Speed: What used to take days now takes hours. Agent Studio—an entire agent management system—was designed with 80% of the work done through AI workflows. Not 80% faster. 80% of the actual design work generated by AI.

Quality: Consistent, production-ready code that follows patterns and conventions. No translation errors between design and code. Design tokens flow directly from Figma to implementation.

Exploration: Try 10 different approaches in the time it used to take to build one. Rapid prototyping that doesn't sacrifice quality. Learn what works before committing.

Documentation: Code that documents itself. Patterns that are both human and AI readable. A system that new team members (human or AI) can understand and extend.

Iteration: Ship, learn, improve, repeat. The feedback loop is measured in minutes, not sprints. Real user testing with real working prototypes on day one.

Resources & Documentation

Official tools, documentation, and resources for building your own AI collaboration workflow.

Claude Code

Official AI pair programmer from Anthropic with full codebase access and autonomous task execution.

Figma MCP

Model Context Protocol integration for Figma, enabling AI to read designs and generate code directly from design files.

Puppeteer MCP

Advanced browser automation and debugging tool via Model Context Protocol. Essential for testing, visual regression, and E2E workflows.

Design Systems

Resources for building and maintaining design systems with AI-powered workflows.

AI & Automation

Additional AI tools and automation resources for design and development workflows.

React & TypeScript

Core technologies used in this portfolio and AI-powered development workflows.

Community & Learning

Connect with others building AI-powered workflows and share knowledge.

Want to Work This Way?

Let's discuss how AI-augmented workflows can transform your design and development process