From anima-pack
Optimizes Anima API costs with TypeScript usage trackers, caching, incremental generation, and smart policies for Figma-to-code workflows.
How this skill is triggered — by the user, by Claude, or both
Slash command
/anima-pack:anima-cost-tuningThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Anima uses partner-based pricing (not self-service). API access is currently granted to partners with custom agreements. Costs are typically per-generation or per-seat.
Anima uses partner-based pricing (not self-service). API access is currently granted to partners with custom agreements. Costs are typically per-generation or per-seat.
| Strategy | Savings | Implementation |
|---|---|---|
| Generation cache | 60-80% | Cache results; only regenerate on design change |
| Incremental generation | 40-60% | Detect changed components; skip unchanged |
| Batch scheduling | 20-30% | Generate during off-peak; avoid real-time |
| Output reuse | 30-50% | Generate once, customize programmatically |
// src/cost/usage-tracker.ts
interface GenerationRecord {
timestamp: string;
fileKey: string;
nodeId: string;
cached: boolean;
durationMs: number;
}
class AnimaUsageTracker {
private records: GenerationRecord[] = [];
record(entry: GenerationRecord): void { this.records.push(entry); }
getReport(): { total: number; cached: number; savings: string } {
const total = this.records.length;
const cached = this.records.filter(r => r.cached).length;
return {
total,
cached,
savings: total > 0 ? `${((cached / total) * 100).toFixed(0)}% saved by caching` : 'No data',
};
}
}
// Only generate when:
// 1. Figma file version changed (check via Figma API)
// 2. Cache is expired (>1 hour for active dev, >24h for CI)
// 3. Settings changed (new framework/styling)
// 4. Force flag passed (manual override)
async function shouldGenerate(
fileKey: string,
nodeId: string,
cache: any,
): Promise<boolean> {
// Check cache first
const cached = cache.get(fileKey, nodeId);
if (cached && Date.now() - new Date(cached.generatedAt).getTime() < 3600000) {
console.log('Using cached generation (< 1 hour old)');
return false;
}
return true;
}
For architecture design, see anima-reference-architecture.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin anima-packImplements file-based caching and incremental Figma node checks to optimize Anima code generation latency for single components and batches.
Optimizes Figma API usage to minimize costs by tracking request volumes, reducing calls with techniques like depth parameters, and selecting plan tiers based on limits.
Optimizes Framer costs with plan selection, CMS usage monitoring in TypeScript, batch publishing, and dev/prod site strategies. For billing analysis and budget management.