figma-local 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/package.json +1 -1
- package/skills/figma-library/SKILL.md +172 -0
- package/src/.figma-client-1774014578401.9038.mjs +4198 -0
- package/src/index.js +184 -3
package/README.md
CHANGED
|
@@ -395,7 +395,7 @@ fig-start --safe --here # launch from your project dir; Claude sees both you
|
|
|
395
395
|
|
|
396
396
|
## Claude Code Plugin (Skills)
|
|
397
397
|
|
|
398
|
-
figma-local ships as a Claude Code plugin with
|
|
398
|
+
figma-local ships as a Claude Code plugin with 9 skills that teach coding agents how to use it automatically:
|
|
399
399
|
|
|
400
400
|
| Skill | Triggers on |
|
|
401
401
|
|-------|------------|
|
|
@@ -407,6 +407,7 @@ figma-local ships as a Claude Code plugin with 8 skills that teach coding agents
|
|
|
407
407
|
| **figma-document** | "document this component", "full spec sheet", "deep breakdown" |
|
|
408
408
|
| **figma-screenshot** | "take a screenshot", "export as PNG/SVG", "capture this" |
|
|
409
409
|
| **figma-compare** | "compare", "does this match", "visual diff", "check against design" |
|
|
410
|
+
| **figma-library** | "library components", "import from library", "team library variables" |
|
|
410
411
|
|
|
411
412
|
### Install the skills
|
|
412
413
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: figma-library
|
|
3
|
+
description: |
|
|
4
|
+
Use this skill when the user wants to access, browse, import, or use components and variables from a Figma team library or external Figma file. Triggers on: "library components", "import component", "library variables", "team library", "use components from another file", "get the button from the library", "what components are available", "design system components", "import from library", "library collections", "index the library", "scan components", "search for a component". Also use when building UI and the user references a design system or component library in another Figma file.
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Bash(fig library *)
|
|
7
|
+
- Bash(fig library)
|
|
8
|
+
- Bash(fig inspect *)
|
|
9
|
+
- Bash(fig read *)
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Figma Library
|
|
13
|
+
|
|
14
|
+
Access team library components and variables from other Figma files. Index libraries, search components by name, import by key, and browse design tokens.
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
- The `fig` CLI must be connected: `fig daemon status`. If not: `fig connect --safe`.
|
|
19
|
+
- The Figma plugin must have `teamlibrary` permission in its manifest. If library commands fail with a permission error, re-import the plugin in Figma (Plugins → Development → Import from manifest).
|
|
20
|
+
- Libraries must be enabled in the current Figma file (check Assets panel → team library icon).
|
|
21
|
+
|
|
22
|
+
## IMPORTANT: How to access library components
|
|
23
|
+
|
|
24
|
+
Figma's plugin API does **not** allow browsing library components directly. To work with library components, you must **index** them first:
|
|
25
|
+
|
|
26
|
+
1. Open the **library file** in Figma (the file that contains the components)
|
|
27
|
+
2. Run `fig library index` — this scans all pages and saves every component with its key
|
|
28
|
+
3. Switch to your **working file**
|
|
29
|
+
4. Run `fig library search --name "button"` — finds components from indexed libraries
|
|
30
|
+
5. Run `fig library import --key "<key>"` — imports the component
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
### Index a library (run in the library file)
|
|
35
|
+
|
|
36
|
+
Open the library/design system file in Figma, then:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
fig library index
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This scans ALL pages in the file and saves every component (name, key, description, page, size, component set) to `~/.figma-local/libraries/<filename>.json`.
|
|
43
|
+
|
|
44
|
+
Re-run this command after the library is updated to refresh the index.
|
|
45
|
+
|
|
46
|
+
### Search indexed libraries
|
|
47
|
+
|
|
48
|
+
Search across all indexed libraries by component name:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
fig library search --name "button"
|
|
52
|
+
fig library search --name "input"
|
|
53
|
+
fig library search --name "card"
|
|
54
|
+
fig library search --name "checkbox"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Returns: component name, key (for importing), component set, page, size, and library name.
|
|
58
|
+
|
|
59
|
+
Use `--json` for structured output:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
fig library search --name "button" --json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### List indexed libraries
|
|
66
|
+
|
|
67
|
+
See what libraries have been indexed:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
fig library list
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Returns: library name, component count, page count, and when it was indexed.
|
|
74
|
+
|
|
75
|
+
### Import a component by key
|
|
76
|
+
|
|
77
|
+
Import a library component onto the canvas by its key:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
fig library import --key "abc123def456..."
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Import and rename:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
fig library import --key "abc123def456..." --name "PrimaryButton"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The imported component instance is placed at the viewport center and selected.
|
|
90
|
+
|
|
91
|
+
### List library variable collections
|
|
92
|
+
|
|
93
|
+
See what variable collections are available from linked libraries:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
fig library collections
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### List library variables
|
|
100
|
+
|
|
101
|
+
Browse all variables across all linked library collections:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
fig library variables
|
|
105
|
+
fig library variables --name "color"
|
|
106
|
+
fig library variables --name "spacing"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### List components on current page
|
|
110
|
+
|
|
111
|
+
Find library components that are already used on the current page:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
fig library components
|
|
115
|
+
fig library components --name "button"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### JSON output
|
|
119
|
+
|
|
120
|
+
All commands support `--json` for structured output.
|
|
121
|
+
|
|
122
|
+
## Workflow: Building UI with library components
|
|
123
|
+
|
|
124
|
+
1. **Index** the library (one-time, in the library file):
|
|
125
|
+
```bash
|
|
126
|
+
fig library index
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
2. **Switch** to your working file in Figma.
|
|
130
|
+
|
|
131
|
+
3. **Search** for the components you need:
|
|
132
|
+
```bash
|
|
133
|
+
fig library search --name "button"
|
|
134
|
+
fig library search --name "input"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
4. **Import** each component by key:
|
|
138
|
+
```bash
|
|
139
|
+
fig library import --key "<key-from-search>"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
5. **Inspect** the imported component to get its full specs:
|
|
143
|
+
```bash
|
|
144
|
+
fig inspect --deep
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
6. **Get variables** for design tokens:
|
|
148
|
+
```bash
|
|
149
|
+
fig library variables --name "primary" --json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
7. **Replicate** in code using the exact specs and token values.
|
|
153
|
+
|
|
154
|
+
## Workflow: Extracting a full design system
|
|
155
|
+
|
|
156
|
+
1. Open the design system file → `fig library index`
|
|
157
|
+
2. Get all components: `fig library search --name "" --json`
|
|
158
|
+
3. Get all variables: `fig library variables --json`
|
|
159
|
+
4. Import key components one by one and document them:
|
|
160
|
+
```bash
|
|
161
|
+
fig library import --key "<key>"
|
|
162
|
+
fig document --json
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Tips
|
|
166
|
+
|
|
167
|
+
- **Index once, search many times** — the index is saved locally and persists across sessions.
|
|
168
|
+
- Re-index when the library is updated: open the library file → `fig library index`.
|
|
169
|
+
- `fig library components` only finds components already on the current page. Use `search` for the full library.
|
|
170
|
+
- After importing a component, use `fig inspect --deep` to get full specs including variable bindings.
|
|
171
|
+
- Component keys are stable across file versions — save them for repeated imports.
|
|
172
|
+
- Use `fig library search --name "button" --json | jq '.[].key'` to extract just the keys.
|