From 6eca7a90ad39bd02df282ae7d6aaf1e16d1b4212 Mon Sep 17 00:00:00 2001 From: Armaan Gupta Date: Tue, 2 Jun 2026 15:50:30 +0530 Subject: [PATCH 1/4] added create headless component skills --- .claude/skills/create-component.md | 514 +++++++++++++++++++++++++++++ 1 file changed, 514 insertions(+) create mode 100644 .claude/skills/create-component.md diff --git a/.claude/skills/create-component.md b/.claude/skills/create-component.md new file mode 100644 index 0000000..07f3c0b --- /dev/null +++ b/.claude/skills/create-component.md @@ -0,0 +1,514 @@ +# Skill: create-component + +## Trigger +Use this skill when the user asks to **create a new headless form component** for the `react-vanilla-components` package. They will typically provide a component name and a CRISP JSON (AEM Core Components schema) that describes the component's properties, constraints, and resource type. + +If no CRISP JSON is provided, ask for it. If the user does not have one, ask them to describe the component's fields so you can infer the correct mapping. + +--- + +## What this skill produces + +1. `packages/react-vanilla-components/src/components/{ComponentName}.tsx` — component source +2. `packages/react-vanilla-components/__tests__/components/{ComponentName}.test.tsx` — test suite +3. `src/utils/mappings.ts` — updated with the new component's field type and resource type keys +4. `src/index.ts` — updated to import and re-export the component + +--- + +## Step 0 — Understand the CRISP JSON before writing any code + +Before writing the component, extract and reason about these fields: + +| CRISP field | What to derive from it | +|---|---| +| `fieldType` | Primary key in `mappings.ts` | +| `":type"` | Secondary key in `mappings.ts` (resource type string) | +| `type` + `format` | HTML element type (see table below) | +| Constraint fields (`minimum`, `maximum`, `minLength`, etc.) | **Do not assume they reach props** — verify against af-core state (see af-core state contract below) | +| `default` | Becomes `props.value` on first render — check format compatibility with the HTML input | +| `enum` / `enumNames` | Indicates a select-type component | +| `items` present | Container component — use `withRuleEnginePanel` instead of `withRuleEngine` | +| `properties['afs:layout']` | Passed through to `props.layout` by `withRuleEngine` — use as a general-purpose side-channel for data af-core may strip | + +### `type` + `format` → HTML element + +| `type` | `format` | HTML element / `type` attribute | +|---|---|---| +| `string` | _(none)_ | `` | +| `string` | `date` | `` | +| `string` | `date-time` | `` | +| `string` | `time` | `` | +| `string` | `email` | `` | +| `string` | `uri` | `` | +| `number` / `integer` | _(any)_ | `` | +| `boolean` | _(any)_ | `` | +| with `enum`/`enumNames` | _(any)_ | `