FluxStudio Specialized Agent Definitions
This document defines specialized Claude Code agents for FluxStudio development. Each agent is optimized for specific tasks within the FluxStudio ecosystem.
Table of Contents
- fluxstudio-test-coverage
- fluxstudio-ai-feature-dev
- fluxstudio-collab-debug
- fluxstudio-integration-manager
- fluxstudio-perf-optimizer
- fluxstudio-printing-expert
- fluxstudio-api-docs
- fluxstudio-security-auditor
fluxstudio-test-coverage
Purpose
Systematic test generation and coverage improvement for FluxStudio. This agent specializes in writing comprehensive tests across unit, integration, and end-to-end testing layers.
Recommended Tools
- Read: Analyze existing code to understand testing requirements
- Write: Create new test files
- Edit: Update existing tests
- Bash: Run test suites and check coverage
- Glob: Find files needing tests
- Grep: Search for untested code paths
Instructions
When invoked, this agent should:
-
Analyze Current Coverage
npm run test:coverage -
Follow Project Testing Conventions
- Unit tests: Use Vitest in
src/**/*.test.{ts,tsx} - Integration tests: Use Jest in
tests/integration/*.test.js - E2E tests: Use Playwright in
tests/e2e/*.spec.ts
- Unit tests: Use Vitest in
-
Test File Naming Conventions
- Component tests:
ComponentName.test.tsx - Hook tests:
useHookName.test.ts - Service tests:
serviceName.test.ts
- Component tests:
-
Test Structure Pattern
import { render, screen } from '@testing-library/react'; import { describe, it, expect, vi } from 'vitest'; import { MyComponent } from './MyComponent'; describe('MyComponent', () => { it('should render correctly', () => { render(<MyComponent />); expect(screen.getByRole('button')).toBeInTheDocument(); }); }); -
Priority Testing Areas
- Authentication flows (
src/contexts/AuthContext.tsx) - Real-time collaboration components (
src/components/collaboration/) - API service functions (
src/services/)
- Authentication flows (
fluxstudio-ai-feature-dev
Purpose
Implement AI-powered features using Claude/Anthropic API and other AI services.
Recommended Tools
- Read: Analyze existing AI implementation patterns
- Write/Edit: Implement AI features
- Bash: Test API integrations
Instructions
-
Anthropic SDK Usage
const { getClient } = require('../lib/ai/client'); const { getModelForTask, getMaxTokensForTask } = require('../lib/ai/config'); const stream = await getClient().messages.stream({ model: getModelForTask('chat'), max_tokens: getMaxTokensForTask('chat'), messages: [{ role: 'user', content: userMessage }], }); -
Key Files
/routes/ai.js- AI API endpoints/src/components/ai/- AI assistant components/services/ai-summary-service.js- AI utilities/src/services/aiDesignFeedbackService.ts- Design analysis
-
Streaming Pattern
for await (const event of stream) { if (event.type === 'content_block_delta') { process.stdout.write(event.delta.text); } } -
Context Building
- Include relevant project context
- Limit context size to avoid token limits
- Structure prompts for specific design tasks
fluxstudio-collab-debug
Purpose
Debug real-time collaboration features including Yjs/CRDT synchronization and WebSocket connections.
Recommended Tools
- Read: Analyze collaboration code
- Bash: Check WebSocket connections, view logs
- Grep: Find sync issues
Instructions
-
Architecture
server-collaboration.js- Yjs WebSocket server (port 4000)- Uses Yjs for CRDT-based conflict-free synchronization
- Socket.IO namespaces:
/auth,/messaging,/printing,/design-boards
-
Debugging Techniques
const ydoc = new Y.Doc(); ydoc.on('update', (update, origin) => { console.log('Update from:', origin); console.log('Update size:', update.length); }); provider.awareness.on('change', ({ added, updated, removed }) => { console.log('Awareness change:', { added, updated, removed }); }); -
Common Issues Checklist
- WebSocket connection established?
- Document synced across clients?
- Awareness states updating?
- Persistence layer working?
- Undo/redo managers initialized?
-
Key Files
/server-collaboration.js- Main Yjs server/src/components/collaboration/- Collaboration components/src/services/collaborationService.ts- Client-side service
fluxstudio-integration-manager
Purpose
Manage OAuth integrations with Figma, Slack, and GitHub.
Recommended Tools
- Read: Analyze integration code
- Edit: Update integration logic
- Bash: Test OAuth flows
Instructions
-
OAuth Flow Pattern
router.get('/oauth/:provider', (req, res) => { const authUrl = buildAuthUrl(provider, { client_id: process.env[`${provider}_CLIENT_ID`], redirect_uri: `${BASE_URL}/api/auth/callback/${provider}`, scope: getScopes(provider), }); res.redirect(authUrl); }); -
Key Files
/routes/auth.js- OAuth endpoints/routes/connectors.js- Integration connectors/src/components/organisms/FigmaIntegration.tsx/src/components/organisms/SlackIntegration.tsx/src/components/organisms/GitHubIntegration.tsx
-
Token Management
- Store tokens securely (encrypted in database)
- Implement token refresh flows
- Handle token revocation
-
Integration-Specific APIs
- Figma: Design file access, components, comments
- Slack: Notifications, channel messaging
- GitHub: Repository access, webhooks
fluxstudio-perf-optimizer
Purpose
Performance audits and optimizations for React, bundles, and database queries.
Recommended Tools
- Read: Analyze code for performance issues
- Edit: Implement optimizations
- Bash: Run bundle analysis, benchmarks
Instructions
-
Frontend Analysis
npm run build -- --analyze npx vite-bundle-visualizer -
React Optimization Patterns
// Memoize expensive components const MemoizedComponent = React.memo(ExpensiveComponent); // Memoize computed values const computed = useMemo(() => expensiveCalculation(data), [data]); // Memoize callbacks const handleClick = useCallback(() => { doSomething(id); }, [id]); // Virtualize long lists import { useVirtualizer } from '@tanstack/react-virtual'; -
Lazy Loading Pattern
const LazyComponent = React.lazy(() => import('./HeavyComponent')); <Suspense fallback={<Loading />}> <LazyComponent /> </Suspense> -
Database Optimization
- Add indexes for frequently queried columns
- Use connection pooling
- Implement Redis caching for hot data
- Analyze query plans with
EXPLAIN ANALYZE
-
Key Files
/src/utils/lazyLoad.ts- Lazy loading utilities/vite.config.ts- Build configuration
fluxstudio-printing-expert
Purpose
Develop 3D printing features including G-code, STL handling, and printer communication.
Recommended Tools
- Read: Analyze printing code
- Write/Edit: Implement printing features
- Bash: Test print jobs
Instructions
-
Supported Formats
const PRINTABLE_EXTENSIONS = ['stl', 'obj', 'gltf', 'glb', 'gcode', '3mf']; -
Materials and Quality
const VALID_MATERIALS = ['PLA', 'PETG', 'ABS', 'TPU', 'NYLON']; const VALID_QUALITIES = ['draft', 'standard', 'high', 'ultra']; -
Print Job Schema
{ fileId: string, material: 'PLA' | 'PETG' | 'ABS' | 'TPU' | 'NYLON', quality: 'draft' | 'standard' | 'high' | 'ultra', copies: number, infillDensity: number, // 0-100 supportsEnabled: boolean, notes?: string, } -
Key Files
/routes/printing.js- Printing API endpoints/services/printJobLogger.js- Print job logging/src/components/printing/- Printing UI components
fluxstudio-api-docs
Purpose
Generate and maintain API documentation using OpenAPI/Swagger.
Recommended Tools
- Read: Analyze existing routes
- Write: Create documentation files
- Grep: Find all API endpoints
Instructions
-
Documentation Format
openapi: 3.0.0 info: title: FluxStudio API version: 2.0.0 description: Creative collaboration platform API servers: - url: https://api.fluxstudio.art description: Production - url: http://localhost:3001 description: Local development paths: /api/auth/login: post: summary: Authenticate user tags: [Authentication] requestBody: required: true content: application/json: schema: type: object properties: email: type: string password: type: string responses: 200: description: Login successful -
Key Files
/docs/API_DOCUMENTATION.md- Main API docs/docs/api/- API reference files/routes/*.js- Route handlers to document
-
Response Format Standard
{ "success": true, "data": { ... } } { "success": false, "error": "Error message", "code": "ERROR_CODE" }
fluxstudio-security-auditor
Purpose
Security scanning and vulnerability detection following OWASP guidelines.
Recommended Tools
- Read: Analyze code for vulnerabilities
- Grep: Find security anti-patterns
- Bash: Run security scans
Instructions
-
OWASP Top 10 Checklist
- Injection (SQL, NoSQL, Command)
- Broken Authentication
- Sensitive Data Exposure
- XML External Entities (XXE)
- Broken Access Control
- Security Misconfiguration
- Cross-Site Scripting (XSS)
- Insecure Deserialization
- Using Components with Known Vulnerabilities
- Insufficient Logging & Monitoring
-
Security Patterns
// SQL Injection Prevention query('SELECT * FROM users WHERE id = $1', [userId]); // XSS Prevention import DOMPurify from 'dompurify'; element.innerHTML = DOMPurify.sanitize(userInput); // CSRF Protection app.use(csrfMiddleware); // Rate Limiting app.use(rateLimit({ windowMs: 15 * 60 * 1000, max: 100 })); -
Dependency Scanning
npm audit npm audit fix npm outdated -
Key Files
/lib/security/- Security utilities/middleware/security.js- Security middleware/lib/auth/- Authentication logic
-
Security Anti-Patterns to Find
# Find eval usage grep -r "eval(" --include="*.js" --include="*.ts" # Find innerHTML usage grep -r "innerHTML" --include="*.tsx" --include="*.jsx" # Find hardcoded secrets grep -r "password.*=" --include="*.js"
Usage Guide
Invoking Agents
Reference the agent purpose and follow specific instructions when working on related tasks.
Agent Collaboration
- Security + Test Coverage: Write tests after security fixes
- AI Feature Dev + Integration Manager: AI features with external services
- Perf Optimizer + Collab Debug: Real-time performance optimization
- API Docs + All Agents: Document new features after implementation