[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BR8VDMNH06DR5ECBXZ9BT8":3,"skill-same:01M7BR8VDMNH06DR5ECBXZ9BT8":52},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7BR8VDMNH06DR5ECBXZ9BT8","figma-to-compose-component",null,"Use when building or recreating a Jetpack Compose component from a Figma design in any Android project. Fire when a figma.com\u002Fdesign or figma.com\u002Ffile link is paired with \"build this\", \"implement this component\", \"recreate this in Compose\", or a ticket references a Figma node id. Covers retrieving the node without flooding context, checking the design system before writing anything new, and binding to theme tokens rather than raw values. Skip when the project ships its own design-system skill: that one knows its component catalogue.","damson\u002Fhard-won-skills","damson","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F804217?v=4","01M7BR01SMVEGA4HRD46VV1SXF","Damien D.","01M7BR01TR37MB9R73C1C0ENGG",1,"MIT","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-ui\u002Fskills\u002Ffigma-to-compose-component\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: figma-to-compose-component\ndescription: >\n  Use when building or recreating a Jetpack Compose component from a Figma design in any\n  Android project. Fire when a figma.com\u002Fdesign or figma.com\u002Ffile link is paired with\n  \"build this\", \"implement this component\", \"recreate this in Compose\", or a ticket\n  references a Figma node id. Covers retrieving the node without flooding context,\n  checking the design system before writing anything new, and binding to theme tokens\n  rather than raw values. Skip when the project ships its own design-system skill: that\n  one knows its component catalogue.\n---\n\n# Build a Compose component from a Figma design\n\n## Procedure\n\n### 1. Read the node, not the file\n\nA Figma *file* fetch returns megabytes of unrelated frames. Extract the node id\nfrom the URL (`…\u002Fdesign\u002F\u003CfileKey>\u002F\u003Cname>?node-id=\u003Cid>`) and request that node\nalone, through whichever Figma integration the environment offers.\n\nAsk for, in this order, stopping when you have enough:\n\n1. **Node metadata**: layout, spacing, fills, typography, component name.\n2. **The variant set**, if the node is one of several states.\n3. **One rendered image** of the node, for visual comparison only.\n\nIf no Figma integration is available, ask for an export of the node's\nproperties or a screenshot with the spacing\u002Fcolour values stated. Do not infer\nhex values from a screenshot: a compressed image does not carry exact colour.\n\n### 2. Search the design system before writing anything\n\nFind the module the theme lives in, that is the design system, whatever it is\ncalled:\n\n```bash\ngrep -rln \"MaterialTheme\\|ProvideTextStyle\\|lightColorScheme\" --include=\"*.kt\" . \\\n  | sed 's|\u002Fsrc\u002F.*||' | sort -u\ngrep -rn \"\u003CComponentName>\\|\u003CSimilarConcept>\" --include=\"*.kt\" \u003Cthat-module>\u002F\n```\n\nTake that output as the answer rather than pre-judging it:\n\n- **Several lines** → the design system is the shared UI module among them, not a feature module.\n- **One line** → the project is single-module. The theme lives in the app, so the app *is* the design system; read `\u003Cthat-module>\u002F` as the app module for the rest of this skill.\n\nThere is no \"this project has no design system\" outcome, only a smaller one.\n\nThen decide, explicitly:\n\n- **Exists and fits** → use it. Say which component and stop.\n- **Exists and nearly fits** → extend it (new variant\u002Fparameter). Cheaper than a sibling and keeps one behaviour.\n- **Genuinely new** → build it, in the design-system module if it is reusable, in the feature module if it is not.\n\nState which of the three you chose and why. Skipping this step is how a catalogue\nacquires three near-identical buttons.\n\n### 3. Map every Figma value to a token\n\nWalk the node's properties and resolve each to a theme accessor: spacing,\ncolour, typography, shape, elevation:\n\n```bash\ngrep -rn \"val spacing\\|val colors\\|val typography\\|val shapes\" \\\n  --include=\"*.kt\" \u003Cthat-module>\u002F | head -40          # a custom token scale?\ngrep -rnE \"(object|fun) [A-Za-z]*Theme\" --include=\"*.kt\" \u003Cthat-module>\u002F | head\ngrep -rn \"MaterialTheme\\.\" --include=\"*.kt\" \u003Cthat-module>\u002F | head\n```\n\nA theme is as often a `@Composable fun \u003CName>Theme` as it is an `object`, so\nmatch both, and a project can perfectly well have a theme and no token scale of\nits own.\n\n**What you find decides what counts as a token:**\n\n- **A custom scale** (`spacing`, a typography object, semantic colours): bind\n  to it. Raw `.dp`, `.sp` and `Color(0x…)` in the finished component are the\n  defect.\n- **Material only, no custom scale**: `MaterialTheme.colorScheme.*`,\n  `MaterialTheme.typography.*` and `MaterialTheme.shapes.*` are the tokens.\n  Bind colour, type and shape to them; there is no Material spacing scale, so\n  spacing is raw `.dp` and that is correct, not a defect. Keep the values\n  consistent across the component rather than inventing a token layer to\n  satisfy a rule.\n\nTwo carve-outs on top, both deliberate: a value the design system genuinely does not\nmodel, and a true one-off like an asset's intrinsic size. Anything else, find the token.\n\n**When a value sits between two tokens, ask.** Picking the nearer one silently\nintroduces a design inconsistency that is invisible in review and hard to trace\nlater.\n\n### 4. Build it with a preview\n\nKeep the component stateless: parameters in, events out, no view model, no\nnavigation. State is hoisted by the caller.\n\nAdd a `@Preview` per meaningful state: default, and whatever the variant set in\nstep 1 showed (disabled, error, selected, long text, RTL if supported). The\npreview is what the screenshot test captures, so a state without a preview is a\nstate without coverage.\n\n### 5. Cover it with a screenshot test, then record\n\nWrite the screenshot test, then record its baselines:\n`android-screenshot-baseline-record` if the project has no recording skill of\nits own. Recording is what proves the capture picked up the theme rather than\nrendering unstyled.\n\n### 6. Compare against the design\n\nPut the recorded image beside the step-1 render and check, in order: overall\nproportions, spacing rhythm, typography weight and size, colour, then corner\nand border treatment. Report differences you are leaving in place and why: a\ndeliberate deviation stated is fine, an unnoticed one is a defect.\n\n## When to STOP\n\n- **The design system already has it** (step 2). Say so and stop. Building the duplicate anyway is the most expensive outcome here.\n- **The Figma node cannot be retrieved** and only a screenshot is available.\n  Build the structure, but stop before asserting exact colours or spacing: ask\n  for the values.\n- **The design uses a token that does not exist** in the theme: a named colour,\n  type ramp or elevation with no counterpart. Adding one is a design-system\n  decision, not a component one; surface it. This is not the same as a project\n  having no scale for that dimension at all (step 3): there, use the value\n  directly and move on.\n- **The node is a whole screen, not a component.** Split it and confirm the\n  decomposition before building: a screen built as one component cannot be\n  reused or tested per state.\n- **The design contradicts an existing component's established behaviour** (a different disabled treatment, say). Raise it; do not encode two answers to the same question.\n\n## Anti-patterns to avoid\n\n- ❌ Reading a colour off a rendered image. A compressed PNG does not carry the exact value; get it from the node or ask.\n","# Build a Compose component from a Figma design\n\n## Procedure\n\n### 1. Read the node, not the file\n\nA Figma *file* fetch returns megabytes of unrelated frames. Extract the node id\nfrom the URL (`…\u002Fdesign\u002F\u003CfileKey>\u002F\u003Cname>?node-id=\u003Cid>`) and request that node\nalone, through whichever Figma integration the environment offers.\n\nAsk for, in this order, stopping when you have enough:\n\n1. **Node metadata**: layout, spacing, fills, typography, component name.\n2. **The variant set**, if the node is one of several states.\n3. **One rendered image** of the node, for visual comparison only.\n\nIf no Figma integration is available, ask for an export of the node's\nproperties or a screenshot with the spacing\u002Fcolour values stated. Do not infer\nhex values from a screenshot: a compressed image does not carry exact colour.\n\n### 2. Search the design system before writing anything\n\nFind the module the theme lives in, that is the design system, whatever it is\ncalled:\n\n```bash\ngrep -rln \"MaterialTheme\\|ProvideTextStyle\\|lightColorScheme\" --include=\"*.kt\" . \\\n  | sed 's|\u002Fsrc\u002F.*||' | sort -u\ngrep -rn \"\u003CComponentName>\\|\u003CSimilarConcept>\" --include=\"*.kt\" \u003Cthat-module>\u002F\n```\n\nTake that output as the answer rather than pre-judging it:\n\n- **Several lines** → the design system is the shared UI module among them, not a feature module.\n- **One line** → the project is single-module. The theme lives in the app, so the app *is* the design system; read `\u003Cthat-module>\u002F` as the app module for the rest of this skill.\n\nThere is no \"this project has no design system\" outcome, only a smaller one.\n\nThen decide, explicitly:\n\n- **Exists and fits** → use it. Say which component and stop.\n- **Exists and nearly fits** → extend it (new variant\u002Fparameter). Cheaper than a sibling and keeps one behaviour.\n- **Genuinely new** → build it, in the design-system module if it is reusable, in the feature module if it is not.\n\nState which of the three you chose and why. Skipping this step is how a catalogue\nacquires three near-identical buttons.\n\n### 3. Map every Figma value to a token\n\nWalk the node's properties and resolve each to a theme accessor: spacing,\ncolour, typography, shape, elevation:\n\n```bash\ngrep -rn \"val spacing\\|val colors\\|val typography\\|val shapes\" \\\n  --include=\"*.kt\" \u003Cthat-module>\u002F | head -40          # a custom token scale?\ngrep -rnE \"(object|fun) [A-Za-z]*Theme\" --include=\"*.kt\" \u003Cthat-module>\u002F | head\ngrep -rn \"MaterialTheme\\.\" --include=\"*.kt\" \u003Cthat-module>\u002F | head\n```\n\nA theme is as often a `@Composable fun \u003CName>Theme` as it is an `object`, so\nmatch both, and a project can perfectly well have a theme and no token scale of\nits own.\n\n**What you find decides what counts as a token:**\n\n- **A custom scale** (`spacing`, a typography object, semantic colours): bind\n  to it. Raw `.dp`, `.sp` and `Color(0x…)` in the finished component are the\n  defect.\n- **Material only, no custom scale**: `MaterialTheme.colorScheme.*`,\n  `MaterialTheme.typography.*` and `MaterialTheme.shapes.*` are the tokens.\n  Bind colour, type and shape to them; there is no Material spacing scale, so\n  spacing is raw `.dp` and that is correct, not a defect. Keep the values\n  consistent across the component rather than inventing a token layer to\n  satisfy a rule.\n\nTwo carve-outs on top, both deliberate: a value the design system genuinely does not\nmodel, and a true one-off like an asset's intrinsic size. Anything else, find the token.\n\n**When a value sits between two tokens, ask.** Picking the nearer one silently\nintroduces a design inconsistency that is invisible in review and hard to trace\nlater.\n\n### 4. Build it with a preview\n\nKeep the component stateless: parameters in, events out, no view model, no\nnavigation. State is hoisted by the caller.\n\nAdd a `@Preview` per meaningful state: default, and whatever the variant set in\nstep 1 showed (disabled, error, selected, long text, RTL if supported). The\npreview is what the screenshot test captures, so a state without a preview is a\nstate without coverage.\n\n### 5. Cover it with a screenshot test, then record\n\nWrite the screenshot test, then record its baselines:\n`android-screenshot-baseline-record` if the project has no recording skill of\nits own. Recording is what proves the capture picked up the theme rather than\nrendering unstyled.\n\n### 6. Compare against the design\n\nPut the recorded image beside the step-1 render and check, in order: overall\nproportions, spacing rhythm, typography weight and size, colour, then corner\nand border treatment. Report differences you are leaving in place and why: a\ndeliberate deviation stated is fine, an unnoticed one is a defect.\n\n## When to STOP\n\n- **The design system already has it** (step 2). Say so and stop. Building the duplicate anyway is the most expensive outcome here.\n- **The Figma node cannot be retrieved** and only a screenshot is available.\n  Build the structure, but stop before asserting exact colours or spacing: ask\n  for the values.\n- **The design uses a token that does not exist** in the theme: a named colour,\n  type ramp or elevation with no counterpart. Adding one is a design-system\n  decision, not a component one; surface it. This is not the same as a project\n  having no scale for that dimension at all (step 3): there, use the value\n  directly and move on.\n- **The node is a whole screen, not a component.** Split it and confirm the\n  decomposition before building: a screen built as one component cannot be\n  reused or tested per state.\n- **The design contradicts an existing component's established behaviour** (a different disabled treatment, say). Raise it; do not encode two answers to the same question.\n\n## Anti-patterns to avoid\n\n- ❌ Reading a colour off a rendered image. A compressed PNG does not carry the exact value; get it from the node or ask.\n",{"name":5,"description":7},"main","9435f9fa04b69d2217f8cab3c817dd5c3c1d1021","plugins\u002Fmobile-ui\u002Fskills\u002Ffigma-to-compose-component",0,"https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills","https:\u002F\u002Fgithub.com\u002Fdamson","http:\u002F\u002Fgoo.gl\u002F3UwFRt","2026-11-14 14:28:11",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add damson\u002Fhard-won-skills --skill figma-to-compose-component",{"tool":38,"command":39},"bunx","bunx skills add damson\u002Fhard-won-skills --skill figma-to-compose-component",{"tool":41,"command":42},"pnpm","pnpm dlx skills add damson\u002Fhard-won-skills --skill figma-to-compose-component","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-ui\u002Fskills\u002Ffigma-to-compose-component\u002FSKILL.md",true,[46],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"README.md","REFERENCE","参考文档",2773,"https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Fplugins\u002Fmobile-ui\u002Fskills\u002Ffigma-to-compose-component\u002FREADME.md",[53,60,66,71,76,81],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M7BRCESR9BRFAH87J2ZQY5T2","skill-two","Fixture skill","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_welcome_total\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7BRCDPHEPZES71BYBRTZ1G3","skill-one","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_welcome_total\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[],{"skillNo":67,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7BRCCHHB3Q07BR0QN339D3F","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_table_count\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":72,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7BRC9J97QKZHGKVXMER5ZEE","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fwrong_table_count\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[],{"skillNo":77,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7BRC8C39NM8VVAQ3TKP0CRS","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_marketplace\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-two\u002FSKILL.md",[],[],{"skillNo":82,"name":62,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7BRC75THG394KDGYV35ET19","https:\u002F\u002Fgithub.com\u002Fdamson\u002Fhard-won-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fvalid_marketplace\u002Fplugins\u002Falpha\u002Fskills\u002Fskill-one\u002FSKILL.md",[],[]]