Skip to content

Skills optimization flight — skills/objectstack-query: RESTRUCTURE (≈ −4,088 tok, −33%) — seven rules stated twice across SKILL.md and rules/, 27% of tokens on an aggregation surface with zero app-author call sites, context (74 real usages) taught nowhere, and the canonical expand example expands nothing #14302

Description

@os-litant

Member card of the skills catalog optimization program #14292 (maintainer mandate 2026-09-02, verbatim: 「审核所有的 skills,进行全面的优化。」). Filed by the skills lane seat (session session_01LraLgQVGq8egUwfYZpbYt1). Read-only audit at objectstack origin/main a59f78d. The full findings table is the audit record: the dev posts it verbatim as the first comment on this card at claim time (seat scratchpad audit/objectstack-query/findings.md).

Audit summary

6 files, 12,270 tokens (SKILL.md 5,443 · aggregation.md 2,226 · filters.md 2,144 · pagination.md 1,381 · evals 558 · generated 518); total headroom 255. Real usage: 6 patterns. Option-key frequency in real query literals: where 169 · context 34 · fields 17 · orderBy 15 · expand 15 · search 12 · aggregations 9; in examples/apps .find 29, .count 0, .aggregate 0, context/...ctx 40. The package spends 27% (3,327 tok) on the aggregation cluster and zero on context. Verdict RESTRUCTURE: SKILL.md and rules/* restate seven rules near-verbatim; ~1,180 tokens are other packages' anchors; the package never states its own calling convention, so its most-copied example shape ({ object: 'account', … }) is not passable to any engine method (ENGINE_FIND_OPTION_KEYS rejects unlisted keys).

Top findings

id span proposal Δ
QRY-B-01 SKILL.md:214-231≡filters.md:100-115 + 6 more pairs MERGE-INTO rules/* — SKILL.md keeps one-line pointers −1,100
QRY-D-01 SKILL.md:274-279,327-337,440-445,550-558; aggregation.md:16-27,138-144,156-166; pagination.md:12-18,218-222 REWRITE-AS-CONSTRUCT — one 6-row "removed key → replacement" table; delete the history −700
QRY-D-05 evals/README.md:1-38 "Planned Evals" never built (DEFERRED, #14296 item 2) −558
QRY-C-01 SKILL.md:496-539 MERGE-INTO objectstack-data (same heading, prescription, example; :535-537 names data as the anchor) −470
QRY-C-02 filters.md:221-258 OVERRIDDEN — KEEP: query owns date-macros.zod.ts; ui deletes its copy and points here 0
QRY-C-04 filters.md:260-280 MERGE-INTO objectstack-automation :157-164 (delete + pointer) −330
QRY-C-03 SKILL.md:617-632 DELETE "CRM Analytics Query Blueprint" — ui's dataset/widget surface −260
QRY-B-02 SKILL.md:43-51 DELETE "When to Use This Skill" −180
QRY-E-03 SKILL.md:60-69,256-266,341-352,407-425 vs :371-377,390-396,604-612 ADD calling-convention table — engine find/aggregate (object first arg, legal keys) · protocol findData({object, query}) · nested expand · view filter rule +120
QRY-B-03 SKILL.md:32-40 DELETE "Skill Boundaries" −110
QRY-C-05 SKILL.md:624, aggregation.md:199-207 DELETE both compareTo copies; ui is the anchor −110
QRY-D-03 SKILL.md:20-28 DELETE blurb −100
QRY-D-02 aggregation.md:88-96 DELETE the alias/push-down bug-history parenthesis −95
QRY-F-01 absent ADD context / system reads — 3 lines + { where, limit: 1, context: SYS } +90
QRY-F-03 SKILL.md:136-146, filters.md:18-21 ADD $icontains/$like/$ilike + the case-sensitivity rule (filter.zod.ts:548-549) +70

Incidental falsehoods (fix in this flight)

  1. SKILL.md:407-425 — the canonical expand example expands nothing: it projects fields: ['title','status'] while expanding assignee and project, dropping both FK columns; packages/objectql/src/engine.ts:8345-8347 skips a projected-away FK. Contract at packages/spec/src/data/query.zod.ts:509, pinned at query-expression-conformance.test.ts:1575-1586. The Rules list at :427-434 omits the requirement — add it. HIGH.
  2. Sibling: objectstack-ui :1706-1708 "unknown placeholders silently pass through" is FALSE (throws UnknownFilterTokenError) — the ui flight deletes it; this package's filters.md:282-286 is the correct anchor and STAYS.

Flight scope

IMPLEMENT (shrink-only): QRY-B-01 (rules/* are the anchor; SKILL.md keeps one-line pointers — SKILL.md shrinks, rules do not grow), D-01, C-01, C-03, C-04, C-05, B-02, B-03, D-02, D-03, the three funded additions (E-03 paid by B-02+B-03; F-01 paid by C-01; F-03 paid by B-01 in SKILL.md and by deletions in filters.md), falsehood 1, E-02/E-04 corrected examples, QRY-A-01 description edit (regenerate skills/README.md).

ANCHOR RULINGS: this package is the anchor for the filter DSL, date macros / filter tokens (filters.md:221-258 and :282-286 STAY; the ui flight points here — if the ui flight's PR body lists a true row missing here, it becomes a follow-up on this card), pagination, aggregation grammar. Search mirror → anchor objectstack-data (C-01: delete + pointer). Flow-filter rule → anchor objectstack-automation (C-04). compareTo and dataset analytics → anchor objectstack-ui (C-03, C-05).

DEFER (pending #14296): QRY-D-05 / H-02 / H-03 (evals, item 2); QRY-B-05 (generator-owned _index.md headline — the fix is upstream in packages/spec/src/data/query.zod.ts: file the spec-side twin as an out-of-scope card).

Flight constraints (binding)

  • ONE draft PR, first line Fixes #<this card>; governed ⇒ stays draft; review requests are the seat's step.
  • Token ratchet: no ratcheted file may grow; additions paid by deletions in the SAME file; ⛔ re-wrap is not payment; ⛔ no ceiling raise; ⛔ no new files; ⛔ do not touch the ratchet script.
  • ⛔ Never edit another package's files: MERGE-INTO another package = DELETE here + one-line pointer; a missing/weaker anchor goes in the PR body under "follow-up for ".
  • Generated files untouched; frontmatter edits ⇒ regenerate skills/README.md (pnpm --filter @objectstack/spec gen:skill-docs).
  • Live surface with zero measured usage ⇒ one row pointing at its schema, never delete the last mention; retired/tombstoned surface ⇒ delete.
  • A false claim matching a spec .describe() string ⇒ file the spec-side twin as an out-of-scope card.
  • Gates: node scripts/check-skills-token-ratchet.mjs, pnpm --filter @objectstack/spec check:skill-examples, pnpm check:skill-compatibility, pnpm check:skill-identifier-liveness, plus node scripts/pm/dispatch-gates.mjs --commands <changed paths>; record the head sha.
  • PR body: per-item 落点 | before | after list keyed by finding id; per-file token delta; needs:contract-review on both carriers (falsehood 1 and the $icontains rows are contract-semantics claims).

Refs: #14292 · #14296 · #13658.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationdomain:skillspriority:p1High: required for production / M2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions