|
| 1 | +# Agnostic AI branch overview |
| 2 | + |
| 3 | +Branch: `marissahuysentruyt/feat-agnostic-folder-ai-stuff` |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## The problem this solves |
| 8 | + |
| 9 | +Our AI rules, skills, and agent config previously lived in `.cursor/` — a Cursor-specific directory. That meant everything was coupled to one IDE. Contributors using Claude Code, Gemini CLI, Codex, or any other agent wouldn't reliably find or use the same rules and workflows. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## The core idea: `.ai/` as the source of truth |
| 14 | + |
| 15 | +All rules and skills now live in **`.ai/`** — a tool-agnostic, plain-markdown directory that any agent or tool can read. IDE-specific directories (`.cursor/`, `.claude/`) become thin adapters that point back to `.ai/` via symlinks. |
| 16 | + |
| 17 | +- Edit once in `.ai/` → all tools see the update automatically |
| 18 | +- No sync step, no duplication, no drift between tools |
| 19 | +- New contributors or tools start from `AGENTS.md` at the repo root, which bootstraps everything |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +## What's in `.ai/` |
| 24 | + |
| 25 | +### Rules (`/.ai/rules/`) |
| 26 | + |
| 27 | +Markdown files that enforce consistency. Some apply automatically when matching files are edited; others are invoked on-demand. |
| 28 | + |
| 29 | +- **Stories** — what to document and how to structure Storybook story files |
| 30 | +- **CSS styles** — stylelint compliance, copyright year, custom property conventions, media query ordering |
| 31 | +- **Branch naming** — `username/type-description[-ticket]` convention |
| 32 | +- **Accessibility migration analysis** — required structure and content for per-component a11y docs |
| 33 | +- **Contributor docs** — nav script requirements, link validation |
| 34 | +- **Jira tickets** — title format, required sections, label validation |
| 35 | +- **GitHub descriptions** — PR title and description structure, severity classification |
| 36 | +- And more (component README, text formatting, deep understanding, MDX conversion) |
| 37 | + |
| 38 | +### Skills (`/.ai/skills/`) |
| 39 | + |
| 40 | +On-demand playbooks — the agent reads the skill before doing the work. 19 skills total, including: |
| 41 | + |
| 42 | +- **Component migration skills** — 8 phase-by-phase skills covering the full 1st-gen → 2nd-gen migration workflow (prep, setup, API, styling, accessibility, testing, documentation, review) (via a separate branch) |
| 43 | +- **Session retrospective** — agent self-documents lessons learned into `.ai/memory/` after corrections or surprising constraints |
| 44 | +- **Session handoff** — creates a context snapshot so another session can pick up exactly where this one left off |
| 45 | +- **Conventional commits** — enforces the project's commit message format |
| 46 | +- **Deep understanding** — requires thorough codebase research before planning or writing code |
| 47 | +- **Accessibility compliance**, **test-driven development**, **explain code**, and others |
| 48 | + |
| 49 | +### Memory (`/.ai/memory/`) |
| 50 | + |
| 51 | +Persistent lesson files written by the agent across sessions — non-obvious constraints, tool behaviors, and corrections that would otherwise need to be re-learned from scratch each time. |
| 52 | + |
| 53 | +- `agnostic-lessons.md` — project structure, path quirks, agent tooling behaviors, CI notes |
| 54 | +- `css-styling-lessons.md` — learnings from CSS style validation work (badge, divider) |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## How the symlinks work |
| 59 | + |
| 60 | +``` |
| 61 | +.ai/rules/*.md ← canonical source (edit here) |
| 62 | +
|
| 63 | +.cursor/rules/*.mdc ← per-file symlinks (Cursor expects .mdc extension) |
| 64 | +.claude/rules/ ← directory symlink → .ai/rules/ |
| 65 | +.claude/skills/ ← directory symlink → .ai/skills/ |
| 66 | +``` |
| 67 | + |
| 68 | +Cursor gets per-file symlinks because it expects `.mdc` extension. Currently, there's no "auto add a new symlink" if a new rule gets added for Cursor, so those need to be run manually (and perhaps we can mitigate some of this with the AI checks during CI). Claude Code gets directory-level symlinks because it reads `.md` natively. Either way, changes to `.ai/` typically propagate instantly to both. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## AGENTS.md files |
| 73 | + |
| 74 | +A new set of `AGENTS.md` files are placed at key locations in the repo tree. These give coding agents immediate context about the purpose and conventions of each directory — without having to read every file. |
| 75 | + |
| 76 | +- Repo root `AGENTS.md` — bootstrap: points to `.ai/`, summarizes where things live |
| 77 | +- `2nd-gen/AGENTS.md`, `2nd-gen/packages/core/AGENTS.md`, `2nd-gen/packages/swc/AGENTS.md` |
| 78 | +- `1st-gen/AGENTS.md`, `1st-gen/packages/AGENTS.md`, `1st-gen/tools/AGENTS.md`, `1st-gen/projects/AGENTS.md` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Component styling validation script (first draft, NOT final or vetted) |
| 83 | + |
| 84 | +A new Playwright-based script (`2nd-gen/packages/swc/scripts/validate-component-styling.mjs`) validates that a component's actual rendered CSS token values match a `{component}-styling-validation.md` spec file. Run with: |
| 85 | + |
| 86 | +```sh |
| 87 | +yarn validate:component-styling -- --badge |
| 88 | +yarn validate:component-styling -- --divider |
| 89 | +``` |
| 90 | + |
| 91 | +Strategy files live in `scripts/styling-validation/strategies/` — adding a new component means adding a strategy and a validation doc. This was an experiment in trying to get an agent to validate proper token usage in the stylesheets. |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## CI integration |
| 96 | + |
| 97 | +- `yarn lint:ai` runs `.ai/scripts/validate.js`, which checks story tags, AGENTS.md paths, and config schema — catches broken internal links and misconfigured rules before merge |
| 98 | +- Pre-commit hook runs the contributor docs nav script to keep breadcrumbs and TOCs in sync automatically |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +## What stays the same |
| 103 | + |
| 104 | +- All component source code, tests, and stories are unchanged by this branch |
| 105 | +- Existing Cursor rules still work exactly as before — they're now symlinked rather than authored in `.cursor/` |
| 106 | +- No changes to `package.json` dependencies beyond adding the validation script entry |
| 107 | + |
| 108 | +--- |
| 109 | + |
| 110 | +## Key takeaway for the team |
| 111 | + |
| 112 | +This branch makes our AI tooling a first-class, shared project asset — not a personal Cursor setup. Any contributor, any agent, any tool can start from `AGENTS.md` and immediately find the rules, skills, and accumulated lessons that keep the codebase consistent. |
0 commit comments