component-docs

A command that turns Figma component sets into reference documentation, including their options, examples, spacing, guidelines, and code snippets in a Storybook-style layout.

In plain words
What is it for?
Use it to document a design system from a Figma file and create reference material for developers building the matching interface.
Why use it?
It removes the need to write and maintain component reference pages by hand. Developers can see how each component is configured and used.

Command

Part of the naksha-studio plugin — 47 commands, 7 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/adityaraj0421/naksha-studio/component-docs
Clone the repo
git clone --depth 1 https://github.com/Adityaraj0421/naksha-studio

Or install naksha-studio, the plugin that ships this one along with the rest of its 47 commands, 7 agents.

Per session 28 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,097 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00028 $0.02097
Opus 5 $0.00014 $0.01048
Sonnet 5 $0.00006 $0.00419
Haiku 4.5 $0.00003 $0.00210

Measured 3d ago against content hash 524cc2003448, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

component-docs 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 3d 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.

commands/component-docs.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/component-docs

You are generating component documentation from Figma component sets. This creates Storybook-style reference docs with visual examples, prop tables, usage guidelines, and code snippets.

Input: $ARGUMENTS

Read ${CLAUDE_PLUGIN_ROOT}/skills/design/references/design-system-lead.md for token/component architecture and ${CLAUDE_PLUGIN_ROOT}/skills/design/references/figma-creation.md for Figma API patterns.

Process

1. Connect & Identify Components

figma_get_status → verify Desktop Bridge connection

Find all component sets in the file:

figma_execute: `
  await figma.loadAllPagesAsync();
  const sets = figma.root.findAllWithCriteria({ types: ['COMPONENT_SET'] });
  const components = figma.root.findAllWithCriteria({ types: ['COMPONENT'] })
    .filter(c => c.parent?.type !== 'COMPONENT_SET');

  return {
    componentSets: sets.map(cs => ({
      id: cs.id,
      name: cs.name,
      variantCount: cs.children.length,
      variants: cs.children.map(v => v.name),
      properties: cs.componentPropertyDefinitions
        ? Object.entries(cs.componentPropertyDefinitions).map(([key, def]) => ({
            name: key.split('#')[0],
            type: def.type,
            defaultValue: def.defaultValue,
            variantOptions: def.variantOptions
          }))
        : [],
      description: cs.description,
      page: cs.parent?.parent?.name || cs.parent?.name
    })),
    standaloneComponents: components.map(c => ({
      id: c.id,
      name: c.name,
      description: c.description,
      page: c.parent?.parent?.name || c.parent?.name
    }))
  };
`

2. Extract Component Details

For each component set, gather detailed specs:

Visual Specs
figma_execute: `
  const cs = await figma.getNodeByIdAsync('COMPONENT_SET_ID');
  const variants = cs.children.map(v => {
    const texts = v.findAllWithCriteria({ types: ['TEXT'] });
    return {
      name: v.name,
      width: Math.round(v.width),
      height: Math.round(v.height),
      layoutMode: v.layoutMode,
      padding: v.paddingLeft ? {
        top: v.paddingTop, right: v.paddingRight,
        bottom: v.paddingBottom, left: v.paddingLeft
      } : null,
      itemSpacing: v.itemSpacing,
      cornerRadius: v.cornerRadius,
      fills: v.fills?.map(f => {
        if (f.type === 'SOLID') {
          const c = f.color;
          return '#' + [c.r, c.g, c.b].map(x => Math.round(x * 255).toString(16).padStart(2, '0')).join('');
        }
        return f.type;
      }),
      textContent: texts.map(t => ({
        text: t.characters?.substring(0, 50),
        fontSize: t.fontSize,
        fontWeight: t.fontName?.style
      }))
    };
  });
  return variants;
`

Read the full file on GitHub · 278 lines

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. 3d ago First seen · 278 lines · 28 tokens per session scan A 524cc2003448

Subscribe to this mod's changes

component-docs is a command published in the GitHub repository Adityaraj0421/naksha-studio (316 stars, last pushed 2mo ago), licensed MIT. It adds 28 tokens to every session and 2,097 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-30.