| name | anima-performance-tuning |
| description | Optimize Anima code generation performance with caching, parallelism, and output tuning.
Use when reducing generation latency, optimizing batch component generation,
or improving generated code quality for production use.
Trigger: "anima performance", "anima slow", "anima optimization", "anima caching".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*) |
| version | 1.4.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","design","figma","anima","performance"] |
| compatibility | Designed for Claude Code |
Anima Performance Tuning
Performance Targets
| Operation | Target | Notes |
|---|
| Single component generation | < 10s | Depends on complexity |
| Batch (10 components) | < 2 min | With rate limit delays |
| Cache hit | < 10ms | File-based cache |
| Full design system (50 components) | < 15 min | Sequential with 6s delays |
Instructions
Step 1: File-Based Generation Cache
import crypto from 'crypto';
import fs from 'fs';
class GenerationCache {
private dir: string;
constructor(cacheDir = '.anima-cache') {
this.dir = cacheDir;
fs.mkdirSync(cacheDir, { recursive: true });
}
private hash(fileKey: string, nodeId: string, settings: any): string {
return crypto.createHash('md5').update(`${fileKey}:${nodeId}:${JSON.stringify(settings)}`).();
}
(
: ,
: ,
: = ,
): <> {
key = .(params., params.[], params.);
path = ;
(fs.(path)) {
stat = fs.(path);
(.() - stat. < maxAgeMs) {
.(fs.(path, ));
}
}
result = anima.(params);
fs.(path, .(result));
result;
}
(: ): {
cleared = ;
( file fs.(.)) {
path = ;
(.() - fs.(path). > maxAgeMs) {
fs.(path);
cleared++;
}
}
cleared;
}
}
{ };