Write a project component (components/<tag>/) when a video needs an element the project does not have yet, drawn frame by frame with M3 Expressive's springs, tokens and shapes.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Component?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/humanharness-component)
---
name: component
description: Write a project component (components/<tag>/) when a video needs an element the project does not have yet, drawn frame by frame with M3 Expressive's springs, tokens and shapes.
---
A project component is a custom element the project owns. An element uses it by its tag (`"type": "component"`, `props.tag`), so it keyframes, lints, translates and is reused. Reach for one when keyframes on plain layers would be a pile of rects; reach for a code layer instead for WebGL, a library or physics.
1. `search` kind component first: use one the project has when it fits (M3 Expressive's `m3e-*` elements come as `@m3e/*` packages: `import_package`). Otherwise `new_component <tag>` (a lowercase name with a hyphen) and read what it wrote.
2. Write `component.tsx` with `put_component <tag> --file component.tsx` (or `.ts`, `.jsx`, `.js`). The default export is a class extending `HTMLElement` with `renderAt(t, props, ctx)`:
- `t`: seconds since the scene began. `props`: the schema's props, typed, defaults filled in, colour tokens resolved for the theme.
- Draw only from `t`, `props` and `ctx`. No timers, `requestAnimationFrame`, `Date`, CSS transitions or animations, or `Math.random`: any frame must render the same in any order. Build the DOM once (the first call), then only change it.
- Keep a frame cheap enough to play live (about 16 ms, on an iPad too): the stage and the Hub play it in real time, not only in a render. No SVG filter (`feGaussianBlur`, goo, `filter: url(#…)`) or `backdrop-filter` across the whole frame every frame: browsers draw them on the CPU. Blur with a CSS mask ramp or `filter: blur()`; draw fields, glows and blobs in a WebGL shader at the size the canvas shows at, not the frame's.
- Time your parts from props (`start`, `each`, `steps: [{ at, to }]`) and compute each part's progress from `t`, so the person can retime it without touching code.
3. Make it M3 Expressive:
- **Motion**: `ctx.ease(ease, s)` is how far a move is `s` seconds after it began, on any ease a keyframe takes: `'{md.sys.motion.spring.expressive.spatial.default}'` (position, scale; it swings a little past 1 and settles), `…expressive.effects.default` (opacity, colour; no swing), `…spatial.fast|slow`, `{ curve: 'outQuart', dur: 1.8 }`, `{ bounce: 0.2, dur: 0.5 }`. `ctx.tween(a, b, ease, s)` mixes numbers or colours. Stagger parts by starting each one `each` seconds later. Let a spring overshoot: do not clamp spatial moves, only opacity.
- **Tokens**: CSS reads `var(--md-sys-color-primary)`, `var(--md-sys-shape-corner-extra-large)`, `var(--md-sys-typescale-display-large-font)`, `var(--md-sys-elevation-level2)` and the rest; they follow the composition's seed and theme. In code, `ctx.token('md.sys.color.tertiary')`. Never write a raw colour.
- **Layout**: the element's box is fixed, what is inside it flows. Flex or grid sized from the box (`container-type: size`, `cqmin`), text that wraps before it shrinks and never clips, the end state laid out once and moved with transforms. The `responsive-layout` guide says how, and which parts are one component and which are their own elements.
- **Self-contained**: a component carries everything it draws in its own folder (import its own files). Compose by layering: a badge on a tile is its own element (`"on": "<tile>"`), not a component inside another. M3's shapes (`cookie-9`, `sunny`, `flower`, `soft-burst`…) and their morphs are `m3e-shape` (`@m3e/shape`) and `expressive-shape` in `examples/components`.
- Other things it gets: `ctx.fps`, `ctx.frame`, `ctx.width`, `ctx.height` (the element's box), `ctx.duration` (seconds the element is on screen: time an exit to land at its end), `ctx.theme`, `ctx.seed` and `ctx.random(i)` (seeded, the same every render). A picture it loads is a project file's address through `ctx.src('/media/shot.png')`, and the frame waits for it when the load is handed to `ctx.wait(promise)` (`ctx.wait(img.decode())`), so no render captures it half-loaded.
4. `schema.json`: every prop with a type, a default and a description. Mark numbers an element may keyframe `"x-m3e-animatable": true`, words the person reads `"x-m3e-text": true` (for arrays, on `items`), and choices as `enum`.
5. `preview_component <tag>` and look at both sheets. Fix every error it returns. Before publishing, add `"x-moga-preview": { "w", "h", "attrs", "anim", "dur" }` to `schema.json`: how it is placed in a 1920×1080 frame to show it off (leave out w and h for one that covers the frame; `"under": "cut"` puts two shots under a transition, `"shot"` one under a pointer or callout). The Hub's live preview and the package's cover use it. Give it a colour and an icon too, `"x-moga-label"` (blue, purple, pink, red, clay, amber, green, teal) and `"x-moga-icon"` (`component` or a composition's icon): the library row and the Hub's chip for it show them (unset: teal and the component mark in the library, the next colour round the wheel in a pack). Then place it, `lint` the composition (the render rules check its text size and contrast inside it) and `look` at the moments that matter.
`examples/components` has four to start from: `stat-tile` (a count-up on springs), `stagger-list` (rows entering one after another, a selection that moves), `nav-pill` (an indicator that stretches as it moves: the leading edge on the fast spring, the trailing edge on the slow one) and `expressive-shape` (M3's shapes morphing as `step` is keyframed, with its own shapes code).
Reply with the component's tag, what it draws, its props, and the preview sheets.