Skip to content

Commit b3f5997

Browse files
committed
feat: improve flex positionement skills
1 parent ecc8317 commit b3f5997

File tree

4 files changed

+81
-6
lines changed

4 files changed

+81
-6
lines changed

.claude/skills/rustmotion/SKILL.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Read individual rule files for detailed explanations, GOOD/BAD examples, and con
4949
- [rules/card-flex-layout.md](rules/card-flex-layout.md) - Scene = implicit flex container; use card/flex for nested layout
5050
- [rules/continuous-presets.md](rules/continuous-presets.md) - Continuous presets (pulse, float, shake, spin) need loop: true
5151
- [rules/timing-constraints.md](rules/timing-constraints.md) - Timing: start_at must be < end_at, duration > 0
52-
- [rules/icon-format.md](rules/icon-format.md) - Icon format must be "prefix:name" (e.g. "lucide:home")
52+
- [rules/icon-format.md](rules/icon-format.md) - Icons use Iconify (200k+ icons), format "prefix:name" (e.g. "lucide:home")
53+
- [rules/grid-card-height.md](rules/grid-card-height.md) - Grid containers need explicit height (not "auto") to prevent row stretching
5354
- [rules/wiggle-additive.md](rules/wiggle-additive.md) - Wiggle is additive on top of presets and keyframes
5455
- [rules/prefer-presets.md](rules/prefer-presets.md) - Prefer presets over manual keyframes (31 built-in presets)
5556
- [rules/hex-colors.md](rules/hex-colors.md) - Colors in hex format only (#RRGGBB or #RRGGBBAA)
@@ -559,7 +560,7 @@ Types: `linear`, `radial`.
559560

560561
### 5. `icon`
561562

562-
Renders an icon from the Iconify library. See Rule 11.
563+
Renders an icon from the **Iconify** open-source framework (200,000+ icons from 150+ sets). Icons are fetched from the Iconify API at render time. Browse all icons: https://icon-sets.iconify.design/
563564

564565
```json
565566
{
@@ -578,6 +579,8 @@ Renders an icon from the Iconify library. See Rule 11.
578579

579580
Style: `color` (default `"#FFFFFF"`)
580581

582+
Common prefixes: `lucide` (UI), `mdi` (Material), `heroicons`, `ph` (Phosphor), `tabler`, `simple-icons` (brand logos), `devicon` (dev tools)
583+
581584
### 6. `video`
582585

583586
```json
@@ -707,7 +710,7 @@ Each dimension of `size` can be a number or `"auto"`.
707710
}
708711
```
709712

710-
**Grid example (2x2):**
713+
**Grid example (2x2):** Note: grid containers need explicit `height` (not `"auto"`) — see [rules/grid-card-height.md](rules/grid-card-height.md).
711714
```json
712715
{
713716
"type": "card",

.claude/skills/rustmotion/rules/card-flex-layout.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ Key patterns:
3535

3636
Children flow in the flexbox. Use `positioned` container for absolute positioning.
3737

38+
**Grid height warning:** Grid containers need an explicit `height` (not `"auto"`) to prevent rows from stretching to fill all available space. See [rules/grid-card-height.md](rules/grid-card-height.md).
39+
3840
**GOOD** (icon + text row):
3941
```json
4042
{
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Rule: Grid Cards Need Explicit Container Height
2+
3+
Grid cells stretch to fill their row height. When the grid container has `height: "auto"`, rows expand to consume all available space from the parent flex layout, making cards much taller than their content.
4+
5+
**Always set an explicit height on grid containers** and use `grid-template-rows` to control row sizes.
6+
7+
**GOOD:**
8+
```json
9+
{
10+
"type": "card",
11+
"size": { "width": 1200, "height": 400 },
12+
"style": {
13+
"display": "grid",
14+
"grid-template-columns": [{ "fr": 1 }, { "fr": 1 }, { "fr": 1 }],
15+
"grid-template-rows": [{ "fr": 1 }, { "fr": 1 }],
16+
"gap": 24
17+
},
18+
"children": [ ... ]
19+
}
20+
```
21+
22+
**BAD** (cards stretch to fill scene height):
23+
```json
24+
{
25+
"type": "card",
26+
"size": { "width": 1200, "height": "auto" },
27+
"style": {
28+
"display": "grid",
29+
"grid-template-columns": [{ "fr": 1 }, { "fr": 1 }, { "fr": 1 }],
30+
"gap": 24
31+
},
32+
"children": [ ... ]
33+
}
34+
```
35+
36+
## Why This Happens
37+
38+
1. Scene flex layout gives the grid container all remaining vertical space
39+
2. Without `grid-template-rows`, rows default to equal shares of that space
40+
3. Grid cells stretch to fill their assigned row height
41+
4. Child `height: "auto"` is ignored — the grid cell size wins
42+
43+
## Tips
44+
45+
- Calculate container height: `(row_count × estimated_card_height) + ((row_count - 1) × gap) + (padding × 2)`
46+
- Use `grid-template-rows` with `{ "fr": 1 }` entries to distribute rows evenly within the explicit height
47+
- For single-row grids, a flex row with `"flex-direction": "row"` may be simpler
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
1-
# Rule: Icon Format Must Be prefix:name
1+
# Rule: Icon Format Must Be prefix:name (Iconify)
22

3-
The `icon` field must be an Iconify identifier in `"prefix:name"` format. Requires internet access for fetching from the Iconify API.
3+
The `icon` component renders icons from the **Iconify** open-source icon framework — over 200,000 icons from 150+ icon sets. Icons are fetched from the Iconify API at render time (requires internet access).
44

5-
Common prefixes: `lucide`, `mdi`, `heroicons`, `ph`, `tabler`, `ri`, `devicon`.
5+
The `icon` field must use the `"prefix:name"` format.
6+
7+
**Browse all available icons:** https://icon-sets.iconify.design/
68

79
**GOOD:**
810
```json
911
{ "type": "icon", "icon": "lucide:home" }
1012
{ "type": "icon", "icon": "mdi:account-circle" }
13+
{ "type": "icon", "icon": "simple-icons:github" }
1114
```
1215

1316
**BAD:**
1417
```json
1518
{ "type": "icon", "icon": "home" }
1619
{ "type": "icon", "icon": "fa-home" }
1720
```
21+
22+
## Common Icon Sets
23+
24+
| Prefix | Name | Style | Count | Best for |
25+
| --- | --- | --- | --- | --- |
26+
| `lucide` | Lucide | Clean line icons | 1500+ | UI, general purpose |
27+
| `mdi` | Material Design Icons | Filled & outlined | 7000+ | Material UI, Android |
28+
| `heroicons` | Heroicons | Tailwind-style | 300+ | Tailwind projects |
29+
| `ph` | Phosphor | Flexible weights | 7000+ | Modern UI |
30+
| `tabler` | Tabler Icons | Stroke-based | 5000+ | Dashboards |
31+
| `ri` | Remix Icon | Clean dual-tone | 2800+ | Web apps |
32+
| `devicon` | Devicon | Dev tool logos | 800+ | Tech stack |
33+
| `simple-icons` | Simple Icons | Brand logos | 3000+ | Company logos |
34+
35+
## Tips
36+
37+
- Default to `lucide` for general UI icons (clean, consistent style)
38+
- Use `simple-icons` for brand/company logos (e.g. `simple-icons:github`, `simple-icons:docker`)
39+
- Use `devicon` for programming language logos (e.g. `devicon:rust`, `devicon:python`)
40+
- All icons are monochrome and colored via `style.color`

0 commit comments

Comments
 (0)