agents/projects/chrome-design-system/skills/figma-to-webui/SKILL.md
//src/).When given a Figma design URL (e.g., https://www.figma.com/design/:fileKey/:fileName?node-id=:nodeId):
fileKey and the nodeId (replace hyphens with colons, e.g. 54800-5491 becomes 54800:5491).get_design_context with fileKey and nodeId to fetch the metadata, layout hierarchy, layer styles, and a screenshot of the node.project-knowledge skill to map Figma components to Chromium WebUI components.project-knowledge skill to translate Figma variables (e.g., desktop/sys/surface-colors/surface-2) to equivalent Chromium CSS variables (--color-sys-surface2).Before writing any code, first check if the user already did an audit of this Figma design against production coding standards within the current chat session's recent history (past 5 commands). If not, perform the audit. Incorporate the feedback from this audit into the following code implementation.
<component_name>.tsThe main TypeScript file defining the element class. It must:
CrLitElement.is getter (returning the kebab-case tag name).import { getCss } from './<component_name>.css.js';
import { getHtml } from './<component_name>.html.js';
Example Boilerplate:
// other imports go here...
import { CrLitElement } from '//resources/lit/v3_0/lit.rollup.js';
import { getCss } from './my_component.css.js';
import { getHtml } from './my_component.html.js';
export interface MyComponentElement {
$: {
dialog: CrDialogElement,
};
}
export class MyComponentElement extends CrLitElement {
static get is() {
return 'my-component';
}
static override get styles() {
return getCss();
}
override render() {
return getHtml.bind(this)();
}
static override get properties() {
return {
value_: {type: String},
};
}
protected accessor value_: string = 'Default Mock Value';
}
customElements.define(MyComponentElement.is, MyComponentElement);
<component_name>.html.tsThe HTML template containing the Lit markup.
html literal.slot="title", slot="body", slot="footer").get_design_context). Ensure outer cards, inner subcards, and sibling elements maintain their exact nesting relationships.Example Boilerplate:
import {html} from '//resources/lit/v3_0/lit.rollup.js';
import type {MyComponentElement} from './my_component.js';
export function getHtml(this: MyComponentElement) {
return html`
<!-- HTML goes here... -->
`;
}
<component_name>.cssStylesheet guidelines:
<link rel="stylesheet" href="chrome://theme/colors.css?sets=ui,chrome"> so dynamic Material 3 --color-sys-* color pipeline variables are defined at runtime./* #css_wrapper_metadata_start
* #type=style-lit
* #import=//resources/cr_elements/cr_shared_vars.css.js
* #scheme=relative
* #css_wrapper_metadata_end */
:host {
display: block;
}
/* Styles go here... */
Create an artifact that summarizes the work performed. Explain rationale for the following: