feat(data-ai): type-first data authoring with pinned schemas - #163
Merged
Conversation
Invert the type<->schema relationship. Types are hand-authored as the readable source of truth (rich types like F32/Vec3 for IntelliSense and semantic meaning); schemas become optional and are written to match the type — often later, by the agent, e.g. when implementing the ECS — pinned to it with `type _Pin = Assert<Equal<Schema.ToType<typeof schema>, T>>` so they cannot drift. `Schema.ToType` is used only in that assertion, never as the exported type. Updates features/data/index.md, global/namespace.md, data-modelling.md, and the build-data skill. Bumps @adobe/data-ai to 0.9.92. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ed from test file - The feature's assembled database alias is now `MainService` in the folder-eponymous `main-service.ts` (namespace export: `MainService.plugin` / `MainService.Store`), matching the namespace pattern; cross-feature form is `<Feature>MainService`. Updates main-service/index.md, element.md, conformance.md, and the build-app-entry / build-systems skills. - State-transform cases are now exported from the `<transform>.test.ts` file itself (no separate `<transform>.cases.ts`); the conformance runner imports them from `<transform>.test.js`. Updates features/data/state.md, main-service/conformance.md, features/index.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
One exception to one-declaration-per-file: a namespace folder may have a single `constants.ts` exporting several plain `const` literals (no functions, no types), re-exported via public.ts so callers reach them as `<TypeName>.<constant>`. Function declarations stay one per file. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…atures/ui/ moves Rules referenced the old flat `.claude/rules/<name>.md` paths from before the reorg; repoint them at the real locations: - `.claude/rules/binding-element.md` → `features/ui/binding-element.md` - `.claude/rules/presentation.md` → `features/ui/presentation.md` - `.claude/rules/hooks.md` / `ecs.md` → the rules-root `hooks.md` / `ecs.md` - drop the dangling `.claude/rules/squirrel/ui-data-access.md` (FFP-only, no data-ai equivalent) from observe.md. Touches observe.md, ecs.md, lit.md, features/ui/binding-element.md, global/react.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Synchronized version bump across all packages for the data-ai standard changes (type-first schemas, cases-in-test, MainService rename, constants.ts, rule reference fixes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…/actions examples Matches the code-side rename (computed/services/actions parameter renamed to `service`, MainService-slice terminology); transactions keep `t`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Invert the type↔schema relationship in the
@adobe/data-aiarchitecture rules & skills to type-first:The type is hand-authored in
<type>.ts— the readable source of truth. Authors use the richest types available (F32,Vec3, unions, branded aliases) for strong IntelliSense and self-documenting members.The schema is optional and derived from the type, not the reverse. It is written to match the type — often later, by the agent (e.g. when implementing the ECS) — and pinned with a compile-time assertion so the two cannot drift:
Schema.ToTypeappears only in that assertion, never as the exported type.Why
Makes data types easier to read and write, with better IntelliSense/hover and semantic meaning per property, while still guaranteeing the schema stays exactly in sync. Humans no longer need to hand-write schemas up front.
Changes
features/data/index.md,global/namespace.md,data-modelling.md— reworded to type-first + the pinning pattern.skills/build-data/SKILL.md— schema now optional/derived + pinned.components.md/archetypes.mdalready bound<Type>.schemaand used the pin — unchanged.)@adobe/data-ai0.9.91 → 0.9.92 (package.json+.claude-plugin/plugin.json).Docs/rules only — no runtime code changes.
🤖 Generated with Claude Code