figma-to-code-mcp: Agent for Claude Code

.opencode/agents/api-consolidator.md

api-consolidator is an agent for Claude Code, OpenCode from felixAnhalt/figma-to-code-mcp. It costs 26 tokens per session (479 once invoked), scanned A, original, MIT.

A code-maintenance agent that moves scattered Figma API requests into one FigmaService class. Figma is a design tool with an API for reading files, components, styles, and variables.

In plain words
What is it for?
It is for finding Figma API calls outside FigmaService and moving them into the canonical methods.
Why use it?
It prevents Figma requests from being spread across unrelated files and keeps them using one service layer.

Agent for Claude CodeOpenCode

Written for OpenCode and Claude Code: installed under .opencode/, but also a Claude Code subagent (agents/*.md). Also seen: mentions subagents.

This is felixAnhalt/figma-to-code-mcp's own configuration. It tells Claude Code and OpenCode how to work on figma-to-code-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything figma-to-code-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to felixAnhalt/figma-to-code-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/felixAnhalt/figma-to-code-mcp/main/.opencode/agents/api-consolidator.md
Clone the repo
git clone --depth 1 https://github.com/felixAnhalt/figma-to-code-mcp

Made for: Claude Code, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-consolidator

README.md
[![agentmods](https://agentmods.dev/badge/agents/felixanhalt/figma-to-code-mcp/api-consolidator.svg)](https://agentmods.dev/agents/felixanhalt/figma-to-code-mcp/api-consolidator)
Your own site
<a href="https://agentmods.dev/agents/felixanhalt/figma-to-code-mcp/api-consolidator"><img src="https://agentmods.dev/badge/agents/felixanhalt/figma-to-code-mcp/api-consolidator.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 479 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00026 $0.00479
Opus 5 $0.00013 $0.00239
Sonnet 5 $0.00005 $0.00096
Haiku 4.5 $0.00003 $0.00048

Measured 7d ago against content hash 40c7d4b2315f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

api-consolidator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.opencode/agents/api-consolidator.md · 51 lines

What it actually says

You consolidate Figma REST API calls back into the canonical service layer.

Rule

All Figma REST API calls must route through FigmaService in src/services/figmaConnector.ts. No other file may construct https://api.figma.com/v1/... URLs or call httpClient()/httpClientRaw() for Figma endpoints.

Known violations to fix

File Functions What to do
src/figma/fetch.ts fetchStyles(), fetchComponents(), fetchVariables(), fetchComments() Move each as a method on FigmaService. They all follow the same this.request() pattern.
src/figma/batchFetch.ts fetchNodesBatch() Move to FigmaService.getNodesBatch() or merge into getRawNode()
src/figma/mcp/componentMap.ts component resolution + library fetch Move to FigmaService.resolveComponentFileKey() and FigmaService.getComponents()

Migration pattern

Before (fetch.ts):

const url = `https://api.figma.com/v1/files/${fileKey}/styles`;
return httpClient(url, { headers: authHeaders });

After (figmaConnector.ts):

async getStyles(fileKey: string): Promise<GetStylesResponse> {
  return this.request(`/files/${fileKey}/styles`);
}

Process

  1. Add the method to FigmaService
  2. Update all callers to use figmaService.methodName() instead of the standalone function
  3. Remove the old function (and file if empty)
  4. Update src/figma/index.ts exports
  5. Run pnpm type-check && pnpm lint && pnpm test
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 51 lines · 26 tokens per session scan A 40c7d4b2315f

Subscribe to this mod's changes

api-consolidator is an agent published in the GitHub repository felixAnhalt/figma-to-code-mcp (5 stars, last pushed 9d ago), licensed MIT. It adds 26 tokens to every session and 479 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other agents, from other repositories