Skip to content

Commit d172878

Browse files
os-zhuangclaude
andauthored
docs(skill): teach the metadata doc embed in objectstack-ui (ADR-0051) (#1971)
The "Docs — Package Documentation" section told authors NOT to embed live components ("there is no inline SDUI") — directly contradicted by ADR-0051. Rewrite that callout (still: link *live instances* like dashboards/reports; but embed *structural views*) and add an "Inline metadata views" subsection teaching the `metadata` fence: the three types (state_machine / flow / permission), required vs optional fields, the `os build` lint (body shape + same-package reference liveness), and the permission P3 projection caveat. Body-only change; skills/README.md + the skills guide stay in sync (check:skill-docs passes). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e627225 commit d172878

1 file changed

Lines changed: 49 additions & 3 deletions

File tree

skills/objectstack-ui/SKILL.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -688,9 +688,55 @@ navigation: [
688688
A platform-level "Documentation" portal (browse/search all docs by
689689
package) is a later, additive concern — author-side, nothing to model now.
690690

691-
> **Dynamic content.** Don't try to embed a live component (a flow
692-
> diagram, a record table) in a doc — there is no inline SDUI. Link to the
693-
> metadata by URL; the platform renders the live view, the doc points at it.
691+
> **Live instances vs. structural views.** For a *live, interactive
692+
> instance* — a dashboard, a report, a record table — **don't embed it**:
693+
> link to it by URL and let the platform render it (one source, never a
694+
> stale copy). But for *structural metadata that no single screen shows as
695+
> one picture* — a state machine, a flow, a permission matrix — embed a
696+
> read-only view inline with a `metadata` fence (below).
697+
698+
### Inline metadata views — the `metadata` fence (ADR-0051)
699+
700+
A reader who can't open Studio (a business user, a PM, an auditor) can't
701+
see the *whole shape* of a process or the *full* set of legal state
702+
transitions from a running screen. A `metadata` fenced block embeds a
703+
**live, read-only** view of one metadata item, resolved from the *current*
704+
metadata at render time — change the rule and the diagram follows, it is
705+
never a screenshot. The body is flat `key: value` **data, not code**, so it
706+
stays inside the §3.4 trust boundary (it compiles to the read-only
707+
`element:metadata_viewer` component — the same one a page can render).
708+
709+
Three view kinds:
710+
711+
| `type` | renders | required | optional |
712+
| :--- | :--- | :--- | :--- |
713+
| `state_machine` | a record's lifecycle transition graph (from a `state_machine` validation rule) | `object` + `name` (the rule) | `detail`, `mode` |
714+
| `flow` | a flow's steps; `detail: business` (default) folds purely technical nodes | `name` | `detail` (`business`\|`technical`), `mode` |
715+
| `permission` | a permission set's object-level C/R/U/D matrix | `name` | `mode` |
716+
717+
````md
718+
Tasks move across the board only by these rules:
719+
720+
```metadata
721+
type: state_machine
722+
object: crm_task
723+
name: crm_task_status_flow
724+
```
725+
````
726+
727+
`os build` lints every fence: `type` must be one of the three (typo →
728+
did-you-mean), `name` is required, `state_machine` also needs `object`, and
729+
the referenced object-rule / flow / permission set **must exist in this
730+
package** — a dead same-package reference fails the build (same posture as
731+
a broken link). At render time a missing or forbidden reference degrades to
732+
a placeholder, never a crash.
733+
734+
Scope is deliberately narrow: **only** `state_machine`, `flow`,
735+
`permission`. Embedding an `object` (data model) or an arbitrary SDUI
736+
component is **not** supported. **`permission` caveat:** the matrix is not
737+
yet projected to the reader's own permissions (ADR-0051 P3) — do not place a
738+
`permission` embed in a doc reachable by less-privileged or anonymous
739+
readers until that lands.
694740

695741
### Example
696742

0 commit comments

Comments
 (0)