Set Design Rules
set_design_rulesDefine explicit design rules for AI code generation per Figma file and append or replace them to enforce spacing, color, and typography standards across sessions.
Instructions
Define explicit design rules that the AI should follow when generating code.
Rules supplement auto-inferred patterns and take precedence over them. Stored locally and persist across sessions.
Args:
figma_file_key (string): The Figma file key to associate rules with
rules (array): Design rules with optional category
mode ('replace' | 'append'): Whether to replace all rules or append (default: 'append')
Returns: Confirmation with total rule count.
Examples:
"Always use 8px grid" -> set_design_rules with rules: [{ rule: "Always use 8px grid", category: "spacing" }]
"Reset all rules" -> set_design_rules with mode: "replace", rules: [{ rule: "New rule" }]
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"figma_file_key": "<figma_file_key>",
"rules": "<rules>"
},
"name": "set_design_rules"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'replace' overwrites all rules, 'append' adds to existing (default: 'append') | append |
| rules | Yes | Design rules to add or set | |
| figma_file_key | Yes | The Figma file key |