code-connect-best-practice

Provide guidelines for writing Figma Code Connect property mappings.

493|101|Updated Nov 8, 2024
One-click install
npx skills add https://github.com/coinbase/cds --skill code-connect-best-practice
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-connect-best-practice
Source: https://github.com/coinbase/cds/tree/main/.claude/skills/code-connect-best-practice
Command: npx skills add https://github.com/coinbase/cds --skill code-connect-best-practice

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides clear guidelines and best practices for writing effective property mappings in Figma Code Connect, ensuring seamless integration between design and development.

Core Features & Use Cases

  • Property Mapping Guidance: Learn how to use figma.enum(), figma.boolean(), figma.string(), figma.textContent(), figma.instance(), figma.children(), and figma.nestedProps() correctly.
  • Nested Property Understanding: Differentiate between direct and nested properties in Figma and how to map them accurately.
  • Common Mistakes: Avoid pitfalls like misusing figma.string() for text layers or incorrect property name formatting.
  • Use Case: When developing a new component, use this Skill to ensure your Figma Code Connect mappings are robust and correctly reflect the component's properties and structure.

Quick Start

Consult the documentation for guidance on mapping Figma properties to your React component.

Frequently Asked Questions about code-connect-best-practice

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I map Figma properties to React components using Code Connect?

To map Figma properties to React components, use Code Connect functions like figma.enum(), figma.boolean(), and figma.string() to link design properties directly to your component props. This ensures seamless integration between design and development.

What is the difference between direct and nested properties in Figma Code Connect?

Direct properties apply to the main component instance, while nested properties belong to child instances within the component. Use figma.nestedProps() to accurately map nested properties and ensure correct structure in your React code.

What are common mistakes when writing Figma Code Connect mappings?

Common Figma Code Connect mapping mistakes include misusing figma.string() for text layers instead of figma.textContent(), and using incorrect property name formatting. Following established best practices helps avoid these integration pitfalls.

How do I handle multi-variant React components in Figma Code Connect?

For multi-variant React components in Figma Code Connect, apply best practices for property mapping to ensure robust mappings. Correctly map enums and booleans to accurately reflect the component's properties and structural variations.

When should I use figma.children versus figma.instance in Code Connect?

Use figma.children() to map the children passed into a React component, and use figma.instance() to map specific nested component instances. Choosing the correct function ensures the design structure accurately reflects the code.