# fyloss/spec-kit-figma architecture

> Architecture diagram of the GitHub repository fyloss/spec-kit-figma, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fyloss/spec-kit-figma
- Repository: https://github.com/fyloss/spec-kit-figma

## Overview

spec-kit-figma is a SpecKit extension that supplies Figma design context to specification, planning, task, analysis, and implementation workflows. Its main path is: SpecKit phase hooks trigger context refresh; the extension resolves whether Figma applies, gathers design context, and renders it for document-generating phases. Verification checks generated sections, while drift checks compare analyzed documents with current Figma designs. The README also documents manual introspection and image export. Relationships below are based on README statements; source excerpts were not available.

Main entry points: [`scripts/bash/figma-ensure-context.sh`](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-ensure-context.sh) (Ensure context), [`scripts/bash`](https://github.com/fyloss/spec-kit-figma/tree/main/scripts/bash) (REST context engine), [`commands/speckit.figma.ensure.md`](https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.ensure.md) (Ensure command), [`scripts/bash/figma-render-section.sh`](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-render-section.sh) (Section renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["SpecKit workflow"]
  node_speckit["SpecKit phases"]
  node_ensure_cmd["Ensure command"]
  node_ensure_script["Ensure context"]
  node_render["Section renderer"]
  node_spec_templates["Spec / plan / task sections"]
end

subgraph group_context["Design context"]
  node_config["Project config"]
  node_introspect_cmd["Introspect command"]
  node_rest_engine["REST context engine"]
  node_mcp_engine["MCP context engine"]
end

subgraph group_guidance["Design guidance"]
  node_design_rules["Design rules"]
end

subgraph group_checks["Validation and assets"]
  node_verify_cmd["Verify command"]
  node_verify_script["Section verification"]
  node_drift_cmd["Drift command"]
  node_drift_script["Design drift check"]
  node_export_cmd["Export command"]
  node_export_script["Image export"]
end

node_developer(("Developer / agent"))
node_figma(("Figma"))

node_speckit -->|"invokes before phases"| node_ensure_cmd
node_ensure_cmd -->|"runs"| node_ensure_script
node_ensure_script -->|"uses project config"| node_config
node_ensure_script -->|"provides rules"| node_design_rules
node_ensure_script -->|"refreshes context"| node_rest_engine
node_ensure_script -->|"renders context"| node_render
node_introspect_cmd -->|"supports deep dives"| node_rest_engine
node_rest_engine -->|"fetches snapshots"| node_figma
node_ensure_script -.->|"may select"| node_mcp_engine
node_mcp_engine -.->|"fetches richer context"| node_figma
node_rest_engine -.->|"fallbacks to REST"| node_mcp_engine
node_render -->|"supplies sections"| node_spec_templates
node_speckit -->|"invokes after generation"| node_verify_cmd
node_verify_cmd -->|"runs section check"| node_verify_script
node_speckit -->|"invokes after analyze"| node_drift_cmd
node_drift_cmd -->|"runs drift check"| node_drift_script
node_drift_script -->|"compares with designs"| node_figma
node_developer -->|"requests introspection"| node_introspect_cmd
node_developer -->|"requests export"| node_export_cmd
node_export_cmd -->|"runs image export"| node_export_script
node_export_script -->|"exports node images"| node_figma

click node_ensure_cmd "https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.ensure.md"
click node_ensure_script "https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-ensure-context.sh"
click node_config "https://github.com/fyloss/spec-kit-figma/blob/main/config/figma.projects.config.schema.json"
click node_introspect_cmd "https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.introspect.md"
click node_rest_engine "https://github.com/fyloss/spec-kit-figma/tree/main/scripts/bash"
click node_mcp_engine "https://github.com/fyloss/spec-kit-figma/tree/main/scripts/bash"
click node_design_rules "https://github.com/fyloss/spec-kit-figma/blob/main/.figma/figma-design-rules.md"
click node_render "https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-render-section.sh"
click node_spec_templates "https://github.com/fyloss/spec-kit-figma/tree/main/templates"
click node_verify_cmd "https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.verify.md"
click node_verify_script "https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-verify-section.sh"
click node_drift_cmd "https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.drift.md"
click node_drift_script "https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-check-drift.sh"
click node_export_cmd "https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.export.md"
click node_export_script "https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-export-images.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_speckit,node_ensure_cmd,node_ensure_script,node_render,node_spec_templates toneBlue
class node_config,node_introspect_cmd,node_rest_engine,node_mcp_engine toneAmber
class node_design_rules toneMint
class node_verify_cmd,node_verify_script,node_drift_cmd,node_drift_script,node_export_cmd,node_export_script toneRose
class node_developer,node_figma toneIndigo
```

## Components

### SpecKit workflow

- **SpecKit phases**
- [Ensure command](https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.ensure.md): `commands/speckit.figma.ensure.md`
- [Ensure context](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-ensure-context.sh): `scripts/bash/figma-ensure-context.sh`
- [Section renderer](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-render-section.sh): `scripts/bash/figma-render-section.sh`
- [Spec / plan / task sections](https://github.com/fyloss/spec-kit-figma/tree/main/templates): `templates`

### Design context

- [Project config](https://github.com/fyloss/spec-kit-figma/blob/main/config/figma.projects.config.schema.json): `config/figma.projects.config.schema.json`
- [Introspect command](https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.introspect.md): `commands/speckit.figma.introspect.md`
- [REST context engine](https://github.com/fyloss/spec-kit-figma/tree/main/scripts/bash): `scripts/bash`
- [MCP context engine](https://github.com/fyloss/spec-kit-figma/tree/main/scripts/bash): `scripts/bash`

### Design guidance

- [Design rules](https://github.com/fyloss/spec-kit-figma/blob/main/.figma/figma-design-rules.md): `.figma/figma-design-rules.md`

### Validation and assets

- [Verify command](https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.verify.md): `commands/speckit.figma.verify.md`
- [Section verification](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-verify-section.sh): `scripts/bash/figma-verify-section.sh`
- [Drift command](https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.drift.md): `commands/speckit.figma.drift.md`
- [Design drift check](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-check-drift.sh): `scripts/bash/figma-check-drift.sh`
- [Export command](https://github.com/fyloss/spec-kit-figma/blob/main/commands/speckit.figma.export.md): `commands/speckit.figma.export.md`
- [Image export](https://github.com/fyloss/spec-kit-figma/blob/main/scripts/bash/figma-export-images.sh): `scripts/bash/figma-export-images.sh`

### Other components

- **Developer / agent**
- **Figma**

## Connections

- SpecKit phases → Ensure command: invokes before phases (evidence: `README.md`)
- Ensure command → Ensure context: runs (evidence: `README.md`)
- Ensure context → Project config: uses project config (evidence: `README.md`)
- Ensure context → Design rules: provides rules (evidence: `README.md`)
- Ensure context → REST context engine: refreshes context (evidence: `README.md`)
- Ensure context → Section renderer: renders context (evidence: `README.md`)
- Introspect command → REST context engine: supports deep dives (evidence: `README.md`)
- REST context engine → Figma: fetches snapshots (evidence: `README.md`)
- Ensure context → MCP context engine: may select (evidence: `README.md`)
- MCP context engine → Figma: fetches richer context (evidence: `README.md`)
- REST context engine → MCP context engine: fallbacks to REST (evidence: `README.md`)
- Section renderer → Spec / plan / task sections: supplies sections (evidence: `README.md`)
- SpecKit phases → Verify command: invokes after generation (evidence: `README.md`)
- Verify command → Section verification: runs section check (evidence: `README.md`)
- SpecKit phases → Drift command: invokes after analyze (evidence: `README.md`)
- Drift command → Design drift check: runs drift check (evidence: `README.md`)
- Design drift check → Figma: compares with designs (evidence: `README.md`)
- Developer / agent → Introspect command: requests introspection (evidence: `README.md`)
- Developer / agent → Export command: requests export (evidence: `README.md`)
- Export command → Image export: runs image export (evidence: `README.md`)
- Image export → Figma: exports node images (evidence: `README.md`)
