Commit 940c128
skills(data): optimization flight — hooks consolidated, generic patterns cut, sharingModel/Field.* /storage.notNull taught (net −9,044 tokens) (#14427)
* skills(data): consolidate hooks into references/data-hooks.md
DATA-B-01 / I-03 — rules/hooks.md called itself "a reference pointer" and then
restated five sections of the canonical file. Delete it; references/data-hooks.md
is the single hooks file and the catalog's hooks anchor. Its ceiling row is
dropped from scripts/check-skills-token-ratchet.mjs (the only edit to that file).
DATA-B-02 second H1 + "When to Use This Skill" inside a reference.
DATA-B-04 three registration methods, compact -- keeping the four load-bearing
facts (AppPlugin auto-binds; the `functions` map; `packageId`; and
that programmatic binding gets NO declarative condition/retry/
timeout/onError/async semantics).
DATA-B-05 10+10 generic DO/DON'T -> the compact 5+5 rules/hooks.md carried.
DATA-C-03 vitest + LiteKernel harnesses -> one-line pointer to
objectstack-platform, which claims that surface in its frontmatter.
DATA-D-01/02/03 invented benchmark table, plain-JS "Advanced Topics", generic
Troubleshooting and the Summary that repeated the DO list verbatim.
The References block survives, and absorbs the two cross-package
pointers rules/hooks.md carried so no routing is lost.
DATA-D-04 patterns 1,2,4,5,7,9 (generic JS) deleted; 3,6,8,10 kept, renumbered.
DATA-E-04 the file prescribed `body` and demonstrated `handler` ten times: two
surviving patterns are now sandboxed `body` with declared capabilities.
INC-03 (found while rewriting pattern 8, evidence pinned): "There is NO
`updateMany`" is true of the HANDLER-side repo -- ObjectRepository, what
ctx.api.object() returns, packages/objectql/src/engine.ts:13575-13600 -- but the
SANDBOX repo does install updateMany/deleteMany
(packages/runtime/src/sandbox/quickjs-runner.ts:544-545), exactly as this file's
own capability table says. The comment now names the surface it is true of.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(data): SKILL.md -- teach sharingModel/Field face, correct INC-01/02, cut restatement
Additions (all paid by deletions in this same file; SKILL.md 13892 -> 12535):
DATA-F-01 `sharingModel` row + the four canonical values. Used by 31/31 real
objects and absent from both property tables. A publish with no
authored sharingModel is refused (`security-owd-unset`, 422) --
maintainer ruling 2026-08-13 recorded at
packages/lint/src/authoring-rules.ts:1293-1296; enum at
packages/spec/src/data/object.zod.ts:2177.
DATA-F-02 `required` (write contract) vs `storage: { notNull: true }` (the DDL),
ADR-0113 -- never mentioned in the package before.
DATA-F-03 `icon` / `pluralLabel` / `highlightFields` rows.
DATA-F-04 four security lint rows; three are publish-blocking errors.
DATA-E-05 the Quick-Start Template now carries the face every real object has
(pluralLabel/description/icon/highlightFields) and drops `indexes`,
which appears in 1 of 26 corpus files.
INC-01 (HIGH) -- the schema-evolution table named `required` as the NOT NULL dial
and claimed dev auto-heals it. Both wrong: schema-drift.ts:795-798 compares
`field.storage?.notNull`, explicitly NOT `required`; the emitted op is
severity 'warning' / category 'needs_confirm' / 'relax_not_null' and the comment
says "never auto-applied"; sql-driver.ts:10746 applies only category 'safe'.
INC-02 (MED) -- the tell-tale promised a clean 400 "<field> is required".
schema-drift.ts:800-802: that configuration dies as a RAW DRIVER ERROR instead.
Deletions: DATA-A-03 (intro + when-to-use restating the frontmatter), DATA-C-01
(two verbatim error transcripts; the query skill carries the same 400 text),
DATA-C-04 (standalone tombstones -- each key is refused by a parse error
carrying its own prescription, and objectstack-upgrade owns that path),
DATA-C-05 (protection: schema + lock table + ONE example survive), DATA-D-12,
DATA-D-13, DATA-D-15, DATA-F-06, DATA-G-01 (one CLI spelling: `os`).
DATA-F-05 is a SHRINK, not a removal (retirement deferred pending #14296):
`defineObjectExtension` and `readScope`/`writeScope` each keep one
schema-pointing row -- zero corpus usage is evidence, not proof.
DATA-A-01/A-02/F-06 rewrite the frontmatter description: it never said
datasource / external / federated though rules/datasources.md is entirely that
surface, never said lifecycle or protection, and fired on `*.seed.ts` -- a
pattern that matches nothing in the repo.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(data): rules/ diet -- naming, indexing, validation, relationships, field-types
DATA-D-11 naming.md six ❌/✅ pairs + Critical Rules restatements + Rationale for a
rule the regex in the table already states. 773 -> 248.
DATA-D-05/06/07 indexing.md: generic RDBMS 101 ("when to add indexes"), four
❌/✅ pairs + three subsections teaching one textbook fact
(left-to-right) collapsed to one paragraph, the unsourced
`Table Size -> Max Indexes` table, the pg_stat_user_indexes /
SHOW INDEX SQL, and a 10-item Best Practices restating the
file. The naming block survives -- `name` is a declared key.
DATA-C-04 indexing.md's standalone `type`/`partial` tombstone clause;
the in-line ❌ block at "Retired and Redundant Keys" stays,
because there a wrong key sits beside the right one.
DATA-C-02 validation CEL-vs-SQL is objectstack-formula's anchor and this package's
description already says to load it alongside. The INVERSION
rule stays -- it is validation-specific and lives nowhere else.
DATA-D-09/D-10 validation.md: five patterns restating four examples already on
the page; 10 best practices + 4 unsourced performance claims
about two rules that lower to the same CEL evaluator.
DATA-B-07 the "no `unique` validation type" rule was stated at 7 sites;
the restatements in validation.md and relationships.md go.
DATA-D-08 relationships.md Best Practices + Performance Considerations.
DATA-D-14/E-03/G-02 field-types.md: three ❌/✅ pairs duplicating naming.md, the type
table and a lint rule (the autonumber pair survives) pay for the
`Field.*` factory preamble -- the corpus is ~92% factory
(~250 calls vs 22 literals) and this file had zero `Field.*`.
DATA-E-02 two blocks carried an `import` and then opened `{` /
`validations: [` at statement position, which TS parses as a
labelled-statement block. Both are now real declarations.
DATA-E-01 `os:check` markers on the two self-contained SKILL.md blocks
that compile (definePermissionSet, the protection example).
Verified: `check:skill-examples` type-checks 261 marked blocks.
Two liveness-ledger bindings needed handling, both fallout of deleting rules/hooks.md
and the F-05 shrink:
- the `### Access depth (scope-depth) …` heading is ledger-bound, so the shrink's
incidental rename is reverted -- the ledger is right.
- `hook-lifecycle-events-rule` binds a heading in the deleted file. The gate's own
message prescribes "Re-point `heading`, or delete the row"; re-pointing would
duplicate `hook-lifecycle-events-reference`, which already binds the same symbol
(HookEvent) to the surviving canonical file, so the row is dropped. This is the
one edit outside the declared file surface and it is reported as such.
`check:skill-docs` DEMANDED regeneration (it runs in CI, lint.yml:3986): the
frontmatter description changed, so `pnpm --filter @objectstack/spec gen:skill-docs`
regenerated skills/README.md and content/docs/ai/skills-reference.mdx. Generated
`references/_index.md` is untouched and `check:skill-refs` is green.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
* skills(data): ratchet DOWN the role-word baseline for SKILL.md (4 -> 2)
The DATA-C-04 / D-12 / D-13 deletions removed two role-word occurrences from
skills/objectstack-data/SKILL.md, so `pnpm check:role-word` failed as a
ratchet-DOWN: "role-word count improved 4 -> 2 — run
`node scripts/check-role-word.mjs --update` and commit the baseline". That
remedy is the author's own (baseline EXPANSION is the maintainer-only
direction), so the baseline is updated here. The diff is one line, for this
file only, and it shrinks.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LraLgQVGq8egUwfYZpbYt1
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6aea1f5 commit 940c128
13 files changed
Lines changed: 200 additions & 1418 deletions
File tree
- content/docs/ai
- scripts
- skills
- objectstack-data
- references
- rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | 309 | | |
318 | 310 | | |
319 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
404 | 404 | | |
405 | 405 | | |
406 | 406 | | |
407 | | - | |
408 | 407 | | |
409 | 408 | | |
410 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments