agentleFS
atezeratezer/FMCP/skills/extract-contract/SKILL.md

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.

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
  1. Very specific:

    Orphan tespiti: Default variant ağacında hiçbir katmanın referans vermediği BOOLEAN/TEXT/INSTANCE_SWAP prop'ları rapora yazılır.

    line 41

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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? })
  • nodeId verilmezse 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ı.
  • importPathTemplate ile anchors.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ı boolean tipine ve is prefix'li camelCase ada çevrilir (Selected → isSelected).
  • State detection: "State" / "Durum" / "Interaction" adlı variant prop değerleri states dizisine 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 -2 soneki 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

  1. report.suggestedFileName ile dosya adını bildir: {kebab-name}-spec.json.
  2. Kısa rapor sun: kaç prop, kaç resolved token, a11y fail sayısı, orphan uyarıları.
  3. "Status: draft — anchors.code needs manual verification" notunu ilet.
  4. Kullanıcı isterse contract'ı dosyaya kaydet (Write) veya figma_execute ile seçili bileşenin pluginData'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):

  1. props + anatomy: componentPropertyDefinitions + default variant traverse (boundVariables → CSS eşleme).
  2. resolvedTokens + variantOverrides: variable alias zinciri (visited set ile döngü koruması) + her variant prop değerinin default'la diff'i.
  3. a11y + baseSpecs: WCAG relative luminance (0.2126R + 0.7152G + 0.0722B, linearize edilmiş) ve ham ölçüler.

Hata Yönetimi

HataAnlamıÇözüm
NO_SELECTIONFigma'da seçim yok ve nodeId verilmediKullanı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_FOUNDnodeId bu dosyada yokfigma_get_file_data ile doğru id'yi bul; fileKey/figmaUrl routing'ini kontrol et
CONNECTION / plugin not connectedF-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 bitmediVariant sayısı çok yüksekse nodeId ile tek COMPONENT hedefle; sonucu birleştir
{unresolved:VariableID:...} token referansıVariable silinmiş/erişilemezRapordaki 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.notes bunu belirtir.
  • Contract'ı implement-design, code-design-mapper veya component-documentation skill'lerine girdi olarak verebilirsin.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.