extract-contract
Skill10 starsChanged 29 days agoMITView on GitHub
Seçili Component Set'i analiz edip design contract JSON spec üretir — props, anatomy, token bindings, variant overrides, resolved tokens, a11y kontrast ve base specs dahil. "contract çıkar", "JSON spec üret", "contract extract", "bileşen speci", "design contract", "component spec çıkar" ifadeleriyle tetiklenir. F-MCP Bridge plugin bağlantısı gerektirir.
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
- figjam-diagram-builderSkill
- figma-a11y-auditSkill
- figma-canvas-opsSkill
- 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, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 41
Orphan tespiti: Default variant ağacında hiçbir katmanın referans vermediği BOOLEAN/TEXT/INSTANCE_SWAP prop'ları rapora yazılır.
≈ “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
Contract Extractor
Seçili bir Component Set'i (veya içindeki bir variant'ı / instance'ını) analiz ederek tam bir design contract JSON spec üret. Contract; props, anatomy (token bindings), variant overrides, resolved tokens (mode bazlı alias chain), base specs ve WCAG kontrast denetimini tek dosyada toplar — design-to-code handoff'un ve bileşen codegen'inin tek doğruluk kaynağıdır.
Tetikleme
Kullanıcı bir Component Set (veya içindeki bir variant) seçtiğinde ya da nodeId/URL verdiğinde ve şu ifadeleri kullandığında: "contract çıkar", "JSON spec üret", "contract extract", "bileşen speci", "design contract", "component spec".
Birincil Yol — figma_extract_contract (tek çağrı)
v1.9.14+ sunucuda bu iş tek araca indirgendi:
figma_extract_contract({ nodeId?: "12:345", figmaUrl?, fileKey?, importPathTemplate? })nodeIdverilmezse aktif Figma seçimi kullanılır. COMPONENT_SET, COMPONENT veya INSTANCE kabul edilir (variant/instance otomatik set'e çözülür).- Araç 3 aşamalı okur: structure (props + default variant ağacı) → overrides (her variant değerinin default'a karşı token diff'i) → tokens (tüm mode'larda alias-chain çözümü). Birleştirme sunucu tarafında yapılır.
- Dönüş:
{ success, contract, report }.contract— aşağıdaki şemada tam spec (status: "draft").report— prop sayısı, çözülen token sayısı, a11y fail sayısı, orphan prop listesi, önerilen dosya adı.
importPathTemplateileanchors.code.importPathşablonu değiştirilebilir (default@ds/components/{Name}).
Araç çıktısında otomatik olan davranışlar
- Boolean-like variant: Seçenekleri tam olarak True/False olan VARIANT prop'ları
booleantipine veisprefix'li camelCase ada çevrilir (Selected→isSelected). - State detection: "State" / "Durum" / "Interaction" adlı variant prop değerleri
statesdizisine normalize edilir (pressed→active,focus→focus-visible). - Semantic naming: Generic adlar (Frame 1, Group 2) bağlama göre anlamlı ada çevrilir (label, divider, content); instance'lar main component set adının kebab-case halini alır; çakışmalar
-2soneki alır. - A11y kontrast: Her stil varyantı için root background × text foreground token çifti tüm renk mode'larında (Light/Dark vb.) WCAG 2.1 oranıyla hesaplanır. Alpha'lı renkler alpha-blend edilir (opak varsayımı yapılmaz — 8 haneli hex'lerde oran bu yüzden daha düşük/doğru çıkabilir). Şeffaf zeminli stiller (ghost/clear) çift üretmez.
- Orphan tespiti: Default variant ağacında hiçbir katmanın referans vermediği BOOLEAN/TEXT/INSTANCE_SWAP prop'ları rapora yazılır.
Sonuç sunumu
report.suggestedFileNameile dosya adını bildir:{kebab-name}-spec.json.- Kısa rapor sun: kaç prop, kaç resolved token, a11y fail sayısı, orphan uyarıları.
- "Status: draft — anchors.code needs manual verification" notunu ilet.
- Kullanıcı isterse contract'ı dosyaya kaydet (Write) veya
figma_executeile seçili bileşeninpluginData'sına yaz.
Contract Şeması (özet)
{
"id": "ds.badge",
"name": "Badge",
"version": "0.1.0",
"status": "draft",
"semantics": { "element": "div" },
"props": [ { "name", "type", "default", "bindings": { "figma", "code" } } ],
"anatomy": { "layout", "tokens": { "gap": "{Spacing.sm}" }, "parts" },
"resolvedTokens": { "Color.badge.primary.background": { "type", "collection", "values", "aliasChain" } },
"baseSpecs": { "root", "children" },
"a11y": { "contrastPairs": [ { "foreground", "background", "ratios", "wcagAA", "wcagAAA" } ] },
"anchors": { "figma": { "fileKey", "componentSetKey", "nodeId" }, "code": { "importPath", "export" } },
"variantOverrides": { "styleOverrides": { "primary": { "root": { "tokens" }, "children": { "tokens" } } } }
}Token referans formatı: {Collection.Path.Name} (variable adındaki / → .). Default'tan kaldırılan değerler "(none)".
Fallback Yolu — figma_extract_contract yoksa
Eski sunucu sürümlerinde aynı çıktıyı 3 ayrı figma_execute çağrısıyla üret (tek seferde çok büyük olur — böl):
- props + anatomy:
componentPropertyDefinitions+ default variant traverse (boundVariables → CSS eşleme). - resolvedTokens + variantOverrides: variable alias zinciri (visited set ile döngü koruması) + her variant prop değerinin default'la diff'i.
- a11y + baseSpecs: WCAG relative luminance (
0.2126R + 0.7152G + 0.0722B, linearize edilmiş) ve ham ölçüler.
Hata Yönetimi
| Hata | Anlamı | Çözüm |
NO_SELECTION | Figma'da seçim yok ve nodeId verilmedi | Kullanıcıdan Component Set seçmesini iste veya nodeId/URL al |
NOT_COMPONENT:<type> | Seçili node set'e çözülemedi (ör. FRAME) | COMPONENT_SET / COMPONENT / INSTANCE seçilmeli |
NODE_NOT_FOUND | nodeId bu dosyada yok | figma_get_file_data ile doğru id'yi bul; fileKey/figmaUrl routing'ini kontrol et |
CONNECTION / plugin not connected | F-MCP Bridge plugin kapalı | Figma → Plugins → F-MCP ATezer Bridge açtır, "Bridge active" bekle |
| TIMEOUT (çok büyük set) | 30 sn'de aşama bitmedi | Variant sayısı çok yüksekse nodeId ile tek COMPONENT hedefle; sonucu birleştir |
{unresolved:VariableID:...} token referansı | Variable silinmiş/erişilemez | Rapordaki id'yi kullanıcıya bildir; kütüphane bağlantısını kontrol et |
Notlar
- Bu araç salt okunurdur — tuvale hiçbir şey yazmaz. Kaydetme işlemleri (dosya, pluginData, canvas text node) ayrı ve onaylı adımlardır.
- DS-agnostic: koleksiyon/font/tema adı varsaymaz; ne bağlıysa onu raporlar.
- Çok büyük setlerde token çözümü ilk 150 variable ile sınırlanır;
report.notesbunu belirtir. - Contract'ı
implement-design,code-design-mapperveyacomponent-documentationskill'lerine girdi olarak verebilirsin.
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.

