This project provides an AI-powered multi-agent system for Figma plugins, featuring intelligent translation, content generation, accessibility analysis, and automated design workflows.
figma_translation_agent/
backend/
app/
main.py
agents/
api/
orchestrator/
services/
translations/
...
pyproject.toml
plugin/
code.ts # Main plugin logic
ui.html # Advanced UI with dynamic resizing
manifest.json # Plugin configuration
agents/
infoAgent.ts # LLM-powered knowledge agent
contentFillerAgent.ts # Smart content generation
contrastAgent.ts # LLM-enhanced accessibility checker
resizeAgent.ts # Intelligent frame resizing
translateAgent.ts # Multi-language translation
orchestrator/
agentOrchestrator.ts # Agent coordination system
shared/
llmClient.ts # LLM integration
utils/
types.ts # TypeScript definitions
build.js # Build system with env support
- Info Agent: Intelligent for general queries and guidance
- Content Filler: Smart text generation with input field detection
- Contrast Checker: LLM-enhanced WCAG accessibility analysis
- Resize Agent: Frame creation with content preservation and scaling
- Translation Agent: Multi-language text translation
- Agent Output Field: Rich HTML display for detailed LLM reports and analysis
- Process Log: Clean, focused logging with contrast agent exclusion
- Agent Info Modal: Comprehensive agent descriptions with status badges
- Context Chaining: Seamless data flow between agents
- Smart Task Planning: LLM analyzes user intent and coordinates multiple agents
- Content Preservation: Maintains design integrity across agent operations
- Error Handling: Robust fallback systems and comprehensive error reporting
- LLM-Powered Contrast Analysis: Professional reports with specific recommendations
- WCAG Compliance: Accurate AA/AAA assessment with actionable fixes
- Color Recommendations: Intelligent suggestions for accessibility improvements
- Python 3.8+ (for backend services)
- Node.js 16+ (for plugin development)
- Figma Desktop App (for plugin testing and development)
- API Keys: OpenAI/LLM provider for AI features
-
Create environment file in the plugin directory:
cd plugin -
Configure API keys in
.env:GROQ_KEY=your_openai_key_here # Add other LLM provider keys as needed
-
Navigate to the backend directory:
cd figma_translation_agent/backend -
Install Python dependencies:
poetry install
-
Run the backend server:
python app/main.py
-
Navigate to plugin directory:
cd plugin -
Install dependencies:
npm install
-
Build the plugin:
node build.js
The build system automatically loads environment variables and compiles TypeScript
-
Development workflow:
- Edit TypeScript files in
plugin/directory - Run
node build.js || npm run buildafter changes in the../plugin/directory - Refresh plugin in Figma to see updates
- Edit TypeScript files in
- Open Figma Desktop
- Navigate to:
Plugins β Development β Import plugin from manifest - Select: The
manifest.jsonfile from the plugin directory - Launch: Find "UDA Plugin" in your plugins menu
The plugin follows a sophisticated multi-agent orchestration pattern:
// Agent Orchestration Flow
User Input β Agent Orchestrator β Specific Agent β LLM Analysis β Response-
Create agent file in
plugin/agents/:export async function runYourAgent( context: PluginContext, userMessage: string ): Promise<AgentResponse> { // Agent implementation }
-
Register in orchestrator (
agentOrchestrator.ts):const agentMap = { // ... existing agents "your-agent": runYourAgent, };
-
Update UI (
ui.html) with agent info and descriptions
Create .env file in plugin directory:
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=optional_claude_key
GROQ_API_KEY=optional_groq_keyThe build process (build.js):
- Loads environment variables securely
- Compiles TypeScript with proper error handling
- Bundles code for Figma plugin runtime
- Select any frame or element
- Ask general questions: "How can I improve this design?"
- Get AI-powered guidance and suggestions
- Select frames with text elements
- Request: "Fill this form with sample user data"
- Watch intelligent content generation with input field detection
- Select elements with text/background
- Get detailed WCAG accessibility reports
- Receive specific color recommendations
- Select frames to resize
- Specify dimensions or scaling factors
- Content automatically preserved and repositioned
- Location:
backend/app/translations/ - Format: JSON files (e.g.,
da.json,fi.json) - Processing: Use provided scripts to clean and validate JSON
- Fork the repository
- Create feature branch:
git checkout -b feat/your-amazing-feature
- Make your changes following the established patterns
- Test thoroughly with the Figma plugin
- Commit with clear messages:
git add . git commit -m "feat: add amazing new feature" git push origin feat/your-amazing-feature
- Open a pull request with detailed description
- TypeScript: Strict typing with proper interfaces
- Error Handling: Comprehensive try-catch with user feedback
- Agent Pattern: Follow established orchestrator integration
- UI Consistency: Maintain glassmorphism design language
- API Keys: Always use environment variables (
.env) - Git Ignore: Never commit sensitive credentials
- Environment Separation: Use different keys for development/production
Plugin Not Loading:
# Rebuild and refresh
node build.js
# Refresh plugin in FigmaAPI Errors:
# Check environment variables
cat .env
# Verify API key validityAgent Not Responding:
# Check console for TypeScript errors
# Verify agent registration in orchestratorMIT License - see LICENSE file for details