component-rules

组件规则(Figma):在 Figma 中创建 UI 元素时触发(如“创建卡片”“构建导航”“添加区块”“制作组件”),强制采用库优先的组件查找、确保正确自动布局结构并使用语义化节点命名;视觉属性绑定(颜色、文本样式、间距)参考 figma-style-binding 的实现方式。

仓库最近推送
GitHub Stars
210
Forks
17
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "component-rules":https://skillpi.com/zh/skills/deepskill-4f616e5010236fc0f855120682d419bf8af90f4d6172bc7047431a46e0533327。安装前核对上游来源和版本:https://github.com/senlindesign/claude2figma。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

组件规则(Figma):在 Figma 中创建 UI 元素时触发(如“创建卡片”“构建导航”“添加区块”“制作组件”),强制采用库优先的组件查找、确保正确自动布局结构并使用语义化节点命名;视觉属性绑定(颜色、文本样式、间距)参考 figma-style-binding 的实现方式。

0 下载

介绍来源: third_party · senlindesign · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: component-rules
description: "Triggers when building any UI element in Figma — 'create a card', 'build a nav', 'add a section', 'make a component'. Enforces library-first component lookup, correct Auto Layout structure, and semantic node naming. For visual property binding (colors, text styles, spacing values), defer to figma-style-binding."
disable-model-invocation: false

Component Rules

Governs how Claude constructs UI in Figma. Supplements figma-generate-design. For visual property binding, defer to figma-style-binding.


Rule 1 — Library-first hierarchy

Before building anything, resolve the component source in this order:

1. search_design_system → importComponentByKeyAsync → createInstance()
2. Local file scan → createInstance()
3. Build from scratch — ONLY if nothing matches

Never rebuild primitives the DS provides: Button, Input, Checkbox, Toggle, Badge, Tag, Avatar, Icon, Tab, Breadcrumb, Toast, Alert, Spinner.

// Library import
const comp = await figma.importComponentByKeyAsync("key_from_search");
const instance = comp.createInstance();
parent.appendChild(instance);

// For component sets (variants)
const set = await figma.importComponentSetByKeyAsync("key");
const instance = set.defaultVariant.createInstance();

Rule 2 — Auto Layout

Every container must use Auto Layout. Property order matters:

  1. Set layoutMode FIRST ("VERTICAL" or "HORIZONTAL")
  2. Set layoutSizingHorizontal / layoutSizingVertical AFTER appendChild
  3. Set layoutMode BEFORE any setBoundVariable call
Goal primaryAxisSizing counterAxisSizing layoutSizingH layoutSizingV
Hug both AUTO AUTO HUG HUG
Fixed card FIXED FIXED FIXED FIXED
Full-width section AUTO FIXED FILL HUG

Rule 3 — Node naming

Name every node semantically with slash hierarchy. Never leave defaults.

Card / Container    Card / Title    Card / Body    Card / Action Row
Hero / Background   Nav / Link Group   Button / Primary

Rule 4 — Incremental building

One section per use_figma call. Validate via screenshot after each step. Return all created/mutated node IDs:

return { created: { card: card.id, title: title.id } };

当前收录版本

0.0.1

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值88/100

亮点

  • 提供 Figma UI 构建的标准化规则,解决设计系统一致性与开发效率的核心痛点
  • 覆盖组件复用、自动布局、语义命名等高频刚需场景
触发精准92/100

亮点

  • 触发词精准覆盖 Figma UI 构建核心动作(create card/build nav/add section/make component)
  • 边界清晰,无明显歧义或与其他 Skill 重叠
结构规范95/100

亮点

  • Phase/步骤清晰(Rule 1~4),每步有具体执行逻辑与代码示例
  • 包含端到端示例与 frontmatter 完整,单文件长度合理
执行可靠90/100

亮点

  • Figma API 使用规范明确(importComponentByKeyAsync/createInstance/setBoundVariable)
  • 强调参数顺序与异常路径覆盖,不可逆操作有流程控制
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。