figma-canvas-ops
Skill10 starsChanged 29 days agoMITView on GitHub
F-MCP Bridge ile Figma tuvalinde güvenli yazma/düzenleme için zorunlu önkoşul kılavuzu. figma_execute çağrısı öncesi bu skill yüklenmelidir.
In this repository28 other files it gives its agents.
- ai-handoff-exportSkill
- apply-figma-design-systemSkill
- audit-figma-design-systemSkill
- code-design-mapperSkill
- component-documentationSkill
- design-drift-detectorSkill
- design-system-rulesSkill
- design-token-pipelineSkill
- ds-change-trackerSkill
- ds-impact-analysisSkill
- extract-contractSkill
- figjam-diagram-builderSkill
- figma-a11y-auditSkill
- figma-prototype-flowSkill
- figma-screen-analyzerSkill
- fix-figma-design-system-findingSkill
- fmcp-ds-audit-orchestratorSkill
- fmcp-intent-routerSkill
- fmcp-project-rulesSkill
- fmcp-screen-orchestratorSkill
- fmcp-screen-recipesSkill
- fmcp-token-sync-orchestratorSkill
- generate-figma-librarySkill
- generate-figma-screenSkill
- implement-designSkill
- inspiration-intakeSkill
- ux-copy-guidanceSkill
- visual-qa-compareSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 144
Default font (Inter vb., text style olmadan):
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Figma Canvas Ops — figma_execute Güvenli Kullanım Kılavuzu
Araç Eşleme (topluluk → F-MCP)
| Topluluk | F-MCP Bridge | Not |
use_figma | figma_execute | JS çalıştırma |
get_metadata | figma_get_file_data | Yapı/metadata |
get_screenshot | figma_capture_screenshot | Görsel doğrulama |
search_design_system | figma_search_components + figma_get_design_system_summary | İki araç birlikte |
Prerequisites
- F-MCP Bridge plugin bağlı olmalı (
figma_get_status()) - Aktif DS context:
.claude/design-systems/active-ds.md→Status: ✅
🔒 Live DS Discovery (v3.3+ — İLK YOL): Yerel cache YOK. DS Library Registry'deki file key'lerle canlı oku:
figma_enumerate_published_components(libraryFileKey, filter)— componentKey listesi (REST, dosya kapalıyken de çalışır)figma_enumerate_library_components(libraryFileKey|libraryName)— dosya AÇIKSA plugin'den daha hızlı listefigma_get_library_variables(query?)— variableKey listesi (teamLibrary, hedef dosyada çalışır)Registry boşsa/REST token yoksa Rule 24.1+ fallback chain'e düş. Token hedefi: ödeme/login ekranı ≤6 tool call total.
0. Design System Context (ZORUNLU)
0a — Active DS check
1. ÖNCE `.claude/design-systems/registry.local.md` oku; yoksa orchestrator'daki registry tablosuna bak (v3.3+)
✅ Kayıtlı → Library Name + libraryFileKey not al, 0b'ye geç
❌ Kayıtlı değil → orchestrator Adım -2 AUTO-ONBOARD'u çalıştır (kullanıcıya sormadan keşfet + registry.local.md'ye yaz)
2. Klasik akış (cache miss): Read .claude/design-systems/active-ds.md
3. ✅ Aktif → Library Name not al, 0b'ye geç
❌ Seçilmedi → 0c'ye geç
"DS bypass mode" → DS'siz devam0b — DS asset cache hazırlığı
1. .claude/design-systems/<library-id>/components.md var mı?
2. .claude/design-systems/<library-id>/tokens.md var mı?
3. Yoksa: figma_get_library_variables + figma_search_assets ile keşfet, cache'e yaz0c — Kullanıcıya DS seçimi sor
active-ds.md ❌ ise: "Hangi DS? (Ana-DS / Material / HIG / Kendi / Hiçbiri)". Yanıt sonrası active-ds.md güncelle, 0b'ye geç. Sonraki turlarda TEKRAR SORMA.
1. Kritik Kurallar
returnile veri dön.figma.closePlugin()çağırma.Düz JS, top-level
await. Kod otomatik async sarılır.(async()=>{})()sarma. Async API zorunlu — dynamic-page mode'da sync API'ler throws:❌ YASAK (sync) ✅ ZORUNLU (async) instance.mainComponentawait instance.getMainComponentAsync()figma.getNodeById(id)await figma.getNodeByIdAsync(id)figma.variables.importVariableByKey(key)await figma.variables.importVariableByKeyAsync(key)figma.importComponentByKey(key)await figma.importComponentByKeyAsync(key)figma.importStyleByKey(key)await figma.importStyleByKeyAsync(key)node.effectStyleId = xawait node.setEffectStyleIdAsync(x)node.textStyleId = xawait node.setTextStyleIdAsync(x)figma.listAvailableFonts()await figma.listAvailableFontsAsync()figma.loadFont(...)await figma.loadFontAsync(...)figma.variables.getVariableCollectionById(id)await figma.variables.getVariableCollectionByIdAsync(id)figma.root.findAll()/page.findAll()Önce await figma.loadAllPagesAsync()(v2+ Plugin API gereksinimi). Tek sayfa traversal içinawait figma.currentPage.loadAsync()yeterli.findAllçağrıldığında page explicit yüklü değilse runtime error.figma.notify()çalışmaz — kullanma.console.log()dönmez —returnkullan.Küçük adımlarla çalış. Timeout: varsayılan 15000ms, max 30000ms.
5a. CHUNKING MANDATE (v2.0)
Her
figma_executemax 15 atomic operation. Atomic op'lar: node/instance oluşturma, variable/style/component import, font load, bind operasyonu, getNodeByIdAsync, getMainComponentAsync.- 1 execute = 1 mega-goal (discovery, frame+structure, 3-4 component placement)
- 25+ op → 2-3 execute'a böl
- Execute arası state: nodeId'leri
returnet, sonraki executegetNodeByIdAsyncile al - Her execute sonrası 1 satır Türkçe micro-report
- Renkler 0–1 aralığında (0–255 değil). Hardcoded renk YASAK — DS'den oku.
- Fills/strokes read-only array — klonla, değiştir, ata:
const fills = [...node.fills]; fills[0] = { ...fills[0], color: DS_COLOR }; node.fills = fills; Font yükleme zorunlu. Sıra: (a) DS cache'ten font oku → (b) Yoksa kullanıcıya sor → (c) "Sen seç" → Inter.
8a-1) Font weight check (ZORUNLU):
loadFontAsyncöncesilistAvailableFontsAsyncile kontrol et. Fallback helper:const dsFontFamily = activeDS.fontFamily; // active-ds.md veya cache'ten dinamik oku — hardcoded font ismi YASAK const allFonts = await figma.listAvailableFontsAsync(); const styles = allFonts.filter(f => f.fontName.family === dsFontFamily).map(f => f.fontName.style); function pickStyle(desired, available) { if (available.indexOf(desired) >= 0) return desired; var fb = { "Medium":["Semi Bold","Regular"], "ExtraBold":["Bold"], "Black":["Bold"], "Thin":["Light","Regular"] }; var alts = fb[desired] || []; for (var i = 0; i < alts.length; i++) { if (available.indexOf(alts[i]) >= 0) return alts[i]; } return available.find(s => s.indexOf("Italic") < 0) || available[0]; } await figma.loadFontAsync({ family: dsFontFamily, style: pickStyle("Medium", styles) });FigJam:
createShapeWithText()varsayılan "Inter Medium". Metin düzenlemeden önceawait figma.loadFontAsync(shape.text.fontName).Rule 8b-pre — Font Family Source (v2.0+ ZORUNLU):
loadFontAsync({ family })çağırmadan ÖNCEfamilydeğerini şu kaynaklardan sırayla dene:- Adım 1.6 çıktısı:
fontFamilies[0]—fmcp-screen-recipesAdım 1.6 session'da önceden çalıştıysa (recommended) style.fontName.family:getStyleByIdAsyncsonucundan (library'den gelen style objesinde mevcut)- Fallback
"Inter": ADVISORY warning zorunlu — log'a yaz:_warnings: ["FONT_FAMILY_FALLBACK_INTER"]
YASAK: Hardcoded
"Inter"family'yi doğrudan yazmak, DS'nin fontunu varsaymadan font load etmek. Yanlış family ileloadFontAsync+ doğru family bekleyensetTextStyleIdAsync→ silent mismatch (text görünmez veya default font'a düşer).Rule 8b — Text Style + Font Ordering (v1.9.9+ ZORUNLU):
Library text style uygularken MUTLAK SIRALAMA:
const style = await figma.importStyleByKeyAsync(textStyleKey); // 1. import await figma.loadFontAsync(style.fontName); // 2. font load await textNode.setTextStyleIdAsync(style.id); // 3. style apply❌ YANLIŞ:
setTextStyleIdAsyncönce,loadFontAsyncsonra → runtime error ("font not loaded"). ❌ YANLIŞ:loadFontAsync({family: "Inter"})ama style'ın gerçek fontu farklı → silent mismatch, text render'ı beklenmedik.Default font (Inter vb., text style olmadan):
await figma.loadFontAsync({ family: "Inter", style: "Regular" }); // ÖNCE textNode.fontName = { family: "Inter", style: "Regular" }; // SONRA- Adım 1.6 çıktısı:
- Sayfa konteksti her çağrıda sıfırlanır. Farklı sayfa:
await figma.setCurrentPageAsync(page). Tüm tasarım değerleri DS variable'a BAĞLANMALI (ZORUNLU).
Renk, spacing, padding, radius — HİÇBİR değer hardcoded yazılmaz. Token yoksa DURDUR, kullanıcıya sor.
Akış:
- Variable import:
const v = await figma.variables.importVariableByKeyAsync("KEY") - Renk bind:
node.fills = [figma.variables.setBoundVariableForPaint(fills[0], "color", v)] - Spacing bind:
node.setBoundVariable("paddingLeft", v) - Text style:
await textNode.setTextStyleIdAsync(style.id) - Text renk:
textNode.fills = [figma.variables.setBoundVariableForPaint(textFills[0], "color", textColorVar)]
Hardcoded
node.fills = [{ type: "SOLID", color: {...} }]YASAK.- Variable import:
10a. Inline Bind Verification (v1.9.4, ZORUNLU). Her execute sonunda oluşturulan node'ları tara. Bind eksikse throw atılır — execute başarısız sayılır, Claude retry eder. Şablon:
```js
// Execute'un sonunda, createdNodes listesini tarayıp bind kontrolü yap:
function assertBound(node) {
// Fill bind
if (Array.isArray(node.fills)) {
for (var i = 0; i < node.fills.length; i++) {
var f = node.fills[i];
if (f && f.visible !== false && f.type === "SOLID") {
var fbv = node.boundVariables && node.boundVariables.fills;
var bound = fbv && (Array.isArray(fbv) ? fbv[i] : true);
if (!bound) throw new Error("UNBOUND_FILL: " + node.name + " — setBoundVariableForPaint cagrisi eksik");
}
}
}
// Padding/itemSpacing/radius bind (auto-layout frame)
if (node.type === "FRAME" || node.type === "COMPONENT") {
var padProps = ["paddingTop","paddingBottom","paddingLeft","paddingRight"];
for (var j = 0; j < padProps.length; j++) {
var p = padProps[j];
if (typeof node[p] === "number" && node[p] > 0 && !(node.boundVariables && node.boundVariables[p])) {
throw new Error("UNBOUND_PADDING: " + node.name + "." + p + "=" + node[p] + " — setBoundVariable cagrisi eksik");
}
}
if (typeof node.itemSpacing === "number" && node.itemSpacing > 0 && !(node.boundVariables && node.boundVariables.itemSpacing)) {
throw new Error("UNBOUND_ITEMSPACING: " + node.name + " — setBoundVariable('itemSpacing', v) cagrisi eksik");
}
var radProps = ["cornerRadius","topLeftRadius","topRightRadius","bottomLeftRadius","bottomRightRadius"];
for (var k = 0; k < radProps.length; k++) {
var r = radProps[k];
if (typeof node[r] === "number" && node[r] > 0 && !(node.boundVariables && node.boundVariables[r])) {
throw new Error("UNBOUND_RADIUS: " + node.name + "." + r + "=" + node[r]);
}
}
}
// Text style
if (node.type === "TEXT" && !(node.textStyleId && typeof node.textStyleId === "string" && node.textStyleId !== "")) {
throw new Error("UNBOUND_TEXTSTYLE: '" + (node.characters||"").slice(0,30) + "' — setTextStyleIdAsync(style.id) cagrisi eksik");
}
}
// Tüm oluşturulan node'ları doğrula:
for (var n = 0; n < createdNodes.length; n++) assertBound(createdNodes[n]);
```
Bu kontrol atlanırsa `figma_scan_ds_compliance` final gate'te sonuç zaten BLOCKING olur — ama inline check erkendedir ve context'i az yer. **v1.9.4 önerisi:** Her mega-step sonunda bu assertion bloğunu execute'un sonuna koy.11. appendChild sıralaması kritik. ÖNCE parent.appendChild(child), SONRA child.layoutSizingHorizontal = "FILL" / layoutPositioning = "ABSOLUTE":
js
parent.appendChild(child); // ÖNCE
child.layoutSizingHorizontal = "FILL"; // SONRA
Hata: "Can only set layoutPositioning = ABSOLUTE if parent has layoutMode !== NONE" → child append edilmemiş.
- Yeni node'ları (0,0)'dan uzağa konumlandır. Boş alan bul.
- Hata durumunda DUR. Hata oku, düzelt, tekrar çalıştır. Atomik — hata olursa değişiklik uygulanmaz.
- Tüm node ID'lerini RETURN ET:
return { createdNodeIds: [...] } - Variable scope'ları: Arka plan:
["FRAME_FILL"], Metin:["TEXT_FILL"], Boşluk:["GAP"] - Her Promise'i
awaitet. v1.9.5 Concise Query Rule — tek satır boyut/metadata sorguları.
Boyut, renk, layout sorgulamak için 20+ satır JS YAZMA. Tek satır yeter:
// İYİ — tek satır, minimal context return await figma.getNodeByIdAsync(id).then(n => ({ w: n.width, h: n.height, children: n.children?.length })); // İYİ — toplu (birden fazla node) return Promise.all(ids.map(async id => { const n = await figma.getNodeByIdAsync(id); return { id, name: n?.name, size: n ? [n.width, n.height] : null }; })); // KÖTÜ — 30 satır "defensive" kod boyut sorgusu için // await figma.loadAllPagesAsync(); for (var pg of ...) { if (...) ... }Kural: Tek nodeId için size → 1 satır. Multi-node metadata → 1 Promise.all. Complex traversal sadece üretim mantığında gerekli — keşifte değil.
2. Sayfa Kuralları
const page = figma.root.children.find(p => p.name === "Sayfa");
await figma.setCurrentPageAsync(page);Sync figma.currentPage = page HATA verir. Her figma_execute'ta currentPage sıfırlanır.
3. Auto-Layout Kalıpları
const frame = figma.createFrame();
frame.layoutMode = "VERTICAL";
frame.primaryAxisSizingMode = "AUTO";
frame.counterAxisSizingMode = "AUTO";
frame.itemSpacing = 16;
frame.paddingTop = frame.paddingBottom = 24;
frame.paddingLeft = frame.paddingRight = 24;FILL boyutlandırma: ÖNCE appendChild, SONRA layoutSizingHorizontal = "FILL" (Rule 11).
4. Bileşen ve Instance Kalıpları
// Local component
const comp = figma.root.findOne(n => n.type === "COMPONENT" && n.name === "Button");
const instance = comp.createInstance();
// Variant seçimi
const set = figma.root.findOne(n => n.type === "COMPONENT_SET" && n.name === "Button");
const variant = set.children.find(c => c.name === "Size=Large, Type=Primary");
const inst = variant.createInstance();5. Variable Bağlama
const variable = await figma.variables.importVariableByKeyAsync("KEY");
// Fill bind
const fills = [...node.fills];
node.fills = [figma.variables.setBoundVariableForPaint(fills[0], "color", variable)];
// Spacing bind
node.setBoundVariable("paddingLeft", variable);6. Ek API Gotcha'lar
importkeyword yasağı. Plugin sandbox'ta reserved word.async function getVar(k)kullan.setEffectStyleIdAsynczorunlu. Syncnode.effectStyleId = idhata verir.setTextStyleIdAsynckullan, fontSize binding YASAK:const style = await figma.importStyleByKeyAsync("KEY"); await textNode.setTextStyleIdAsync(style.id);setExplicitVariableModeForCollection— string ID çalışmaz. Library API chain ile collection OBJECT al:var colls = await figma.teamLibrary.getAvailableLibraryVariableCollectionsAsync(); var sem = colls.find(c => c.name.indexOf("Semantic Colors") !== -1); var vars = await figma.teamLibrary.getVariablesInLibraryCollectionAsync(sem.key); var first = await figma.variables.importVariableByKeyAsync(vars[0].key); var coll = await figma.variables.getVariableCollectionByIdAsync(first.variableCollectionId); var darkMode = coll.modes.find(m => m.name === "Dark"); frame.setExplicitVariableModeForCollection(coll, darkMode.modeId);- Escaped quote dikkat.
figma_executecode'da\"yerine düz"kullan. - Style Import Sessiz Fail.
importStyleByKeyAsyncnull/throws olabilir. Her zaman try-catch:
Fast Path: roleMap hazırsalet style = null; try { style = await figma.importStyleByKeyAsync("KEY"); } catch(e) {} if (style) { await textNode.setTextStyleIdAsync(style.id); await figma.loadFontAsync(textNode.fontName); textNode.characters = "Metin"; } else { await figma.loadFontAsync({ family: "Inter", style: "Regular" }); textNode.fontName = { family: "Inter", style: "Regular" }; textNode.characters = "Metin (fallback)"; }setTextStyleIdAsync(roleMap[role].id)direkt kullan, import atla (bkz. fmcp-screen-recipes Adım 1.6). - Component Discovery Fallback.
figma_search_assetsboş dönerse manuel instance scan:
Sıra: (1) Cache → (2)const instances = figma.currentPage.findAll(n => n.type === "INSTANCE"); const map = new Map(); for (const inst of instances) { const main = await inst.getMainComponentAsync(); if (main && main.remote && main.key && !map.has(main.name)) map.set(main.name, { name: main.name, key: main.key }); } return Array.from(map.values());figma_search_assets→ (3) Manuel scan → (4) Key biliniyor →importComponentByKeyAsync(key)direkt. figma_validate_screenTimeout Fallback. 3 seviyeli:- Seviye 1:
figma_validate_screen(nodeId, minScore=80)— timeout olursa: - Seviye 2: Content Body wrapper'ı validate et (daha küçük tree), minScore=70
- Seviye 3: Manuel QA Checklist üret:
- Instance coverage ≥60%
- Rastgele 5 fill'de variable icon 🎨 var mı
- Rastgele 3 spacing variable-bound mu
- Auto-layout tüm frame'lerde aktif mi
- Dark mode renkleri doğru mu
- Seviye 1:
Component Property Discovery — Tek Execute.
const comp = await figma.importComponentByKeyAsync(key); let set = comp.parent?.type === "COMPONENT_SET" ? comp.parent : comp; const propDefs = set.componentPropertyDefinitions || {}; return { componentName: comp.name, propertyDefinitions: Object.entries(propDefs).map(([n, d]) => ({ name: n, type: d.type, defaultValue: d.defaultValue, variantOptions: d.variantOptions || [] })) };figma_instantiate_componenttimeout olursa:figma_executeiçindeimportComponentByKeyAsync(key)+comp.createInstance().Text Style Discovery: (1) Instance scan:
findAll(TEXT)→textStyleId→getStyleByIdAsync(2) Boşsafigma_search_assets(3) Boşsa team library API (4) Fallback Inter + hardcoded size.
7. Hata Kurtarma
| Hata | Çözüm |
Cannot read property of undefined | Node ID geçersiz / sayfa yüklenmemiş |
Font not loaded | loadFontAsync eksik |
Font could not be loaded | Weight yok → pickStyle() fallback (Rule 8a-1) |
Cannot set FILL before appendChild | Rule 11 sırası |
Maximum call stack | Küçük parçalara böl |
Resource links not supported | Yanlış MCP (resmi) → F-MCP kullan |
8. Doğrulama
Her yazma sonrası: figma_capture_screenshot + gerekirse figma_get_file_data.
Skill Koordinasyonu
- fmcp-screen-orchestrator — DS GATE, Fast Path routing
- fmcp-screen-recipes — Fast Path (Rule 25 validate, Rule 26 discovery referans alınır)
- generate-figma-screen — Tam workflow
- generate-figma-library / apply-figma-design-system / fix-figma-design-system-finding / figjam-diagram-builder
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

