Skip to content

Commit 8474ea2

Browse files
committed
docs(skills): teach one naming rule, every package-authored metadata name starts with its namespace
State the rule once in objectstack-platform beside the object rule, with the four exceptions (fields, object extensions, container views, translations) and what main enforces today. Rename every bare non-object name the skills' examples and evals show or generate to the crm_ prefix (or the snippet's own package namespace), cross-references included. Token ratchets are paid by same-file deletion of restatements. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cw4B24PbS5MZbX1r5j
1 parent 3da9a4c commit 8474ea2

28 files changed

Lines changed: 128 additions & 114 deletions
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/skills': patch
3+
---
4+
5+
docs(skills): the authoring skills teach one naming rule, every metadata name a package authors starts with its namespace
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Before.** `objectstack-platform` stated the prefix rule for objects only, and claimed `os lint` warns on bare app, page, dashboard, flow, action, report and dataset names whenever a namespace is set. The examples across the skills named flows, actions, hooks, pages, dashboards, reports, datasets, queues, positions, permission sets, assignment rules, agents and skills bare (`lead_conversion`, `sales_rep`, `support_intake`).
11+
- **Now.** `objectstack-platform` states the rule once, beside the object rule: every metadata name a package authors starts with its namespace (`crm_send_email`, `crm_sales_rep`). The exceptions are fields, object extensions, container views and translations (`<ns>_<locale>`). It also says what is enforced today: `defineStack` refuses a bare object name, `os build` refuses a bare doc name, and `os lint`'s `naming/namespace-prefix` warns only on a name one package declares twice. Every example and eval that showed or generated a bare non-object name now carries `crm_` (or its package's namespace where the snippet has one), cross-references included.
12+
- Connector ids, the inbound api flow whose name is part of its webhook URL, and the datasource whose name keys its password variable keep their names. No schema, key or behaviour changes.

‎skills/README.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ carries `SKILL.md` alone — `gen:skill-refs` only visits skills listed in its
9595
## Conventions enforced across skills
9696

9797
- **Zod first.** Never invent types — read `node_modules/@objectstack/spec/src/**/*.zod.ts`.
98-
- **Short object names** (`account`, `task`); no `namespace`, no `tableName`.
98+
- **Every non-object name carries the namespace** (`crm_send_email`, `crm_sales_rep`);
99+
a snippet with no manifest uses `crm`. Exempt: fields, object extensions,
100+
container views, translations (`<ns>_<locale>`). The one rule lives in
101+
`objectstack-platform/SKILL.md`.
102+
- **Short object names in snippets** (`account`, `task`); no object-level
103+
`namespace`, no `tableName`.
99104
- **CEL for all expressions** — predicates, conditions, schedules. Use the
100105
`F\`\``, `P\`\``, `cel\`\``, `cron\`\``, `tmpl\`\`` tagged templates from
101106
`@objectstack/spec`. Legacy `OLD` / `NEW` are not CEL — use

‎skills/objectstack-ai/SKILL.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ copilot claiming abilities it did not have.
9494
import { defineSkill } from '@objectstack/spec';
9595

9696
export default defineSkill({
97-
name: 'case_management',
97+
name: 'crm_case_management',
9898
label: 'Case Management',
9999
description: 'Triage, query, and escalate support cases.',
100100
instructions: `
@@ -104,8 +104,8 @@ export default defineSkill({
104104
- Escalated cases must summarise the actions already taken.
105105
`,
106106
// Every name resolves: two platform tools (rung 2) plus one action tool
107-
// materialised from this stack's own `escalate_case` Action (rung 3).
108-
tools: ['query_records', 'get_record', 'action_escalate_case'],
107+
// materialised from this stack's own `crm_escalate_case` Action (rung 3).
108+
tools: ['query_records', 'get_record', 'action_crm_escalate_case'],
109109
triggerConditions: [
110110
{ field: 'objectName', operator: 'eq', value: 'support_case' },
111111
],

‎skills/objectstack-ai/evals/skills-tools-knowledge.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"evals": [
44
{
55
"id": 1,
6-
"prompt": "Add `src/skills/case-triage.skill.ts` for our support app: the assistant should be able to query and read support cases and run our existing `escalate_case` Action on a case. Only activate it when the user is working on the `support_case` object.",
7-
"expected_output": "Emits a `defineSkill` with a snake_case `name`, `label`, `instructions`, and a `tools` list where every name resolves: platform tools `query_records` / `get_record` plus the action tool `action_escalate_case` materialised from the stack's own Action. Routing is a `triggerConditions` entry `{ field: 'objectName', operator: 'eq', value: 'support_case' }` (a string value for `eq`). No `permissions` key on the skill (removed in 17) and no `*.agent.ts` file.",
6+
"prompt": "Add `src/skills/case-triage.skill.ts` for our support app: the assistant should be able to query and read support cases and run our existing `crm_escalate_case` Action on a case. Only activate it when the user is working on the `support_case` object.",
7+
"expected_output": "Emits a `defineSkill` with a namespace-prefixed snake_case `name`, `label`, `instructions`, and a `tools` list where every name resolves: platform tools `query_records` / `get_record` plus the action tool `action_crm_escalate_case` materialised from the stack's own Action. Routing is a `triggerConditions` entry `{ field: 'objectName', operator: 'eq', value: 'support_case' }` (a string value for `eq`). No `permissions` key on the skill (removed in 17) and no `*.agent.ts` file.",
88
"files": [],
99
"assertions": {
10-
"must_contain": ["defineSkill", "tools", "action_escalate_case", "triggerConditions"],
10+
"must_contain": ["defineSkill", "tools", "action_crm_escalate_case", "triggerConditions"],
1111
"must_not_contain": ["permissions:", "defineAgent("]
1212
}
1313
},
@@ -33,8 +33,8 @@
3333
},
3434
{
3535
"id": 4,
36-
"prompt": "Write a `*.tool.ts` so the assistant can call our `close_case` action on a support case.",
37-
"expected_output": "Does not author a tool record: the default path is to opt the Action in with `ai: { exposed: true, description: '<40+ chars>' }` on the object's action, which materialises `action_close_case`, and to name that tool in a skill's `tools`. `defineTool` is only for presentation refinement and cannot make anything executable (no `handler` / `implementation`; `ToolSchema` is strict).",
36+
"prompt": "Write a `*.tool.ts` so the assistant can call our `crm_close_case` action on a support case.",
37+
"expected_output": "Does not author a tool record: the default path is to opt the Action in with `ai: { exposed: true, description: '<40+ chars>' }` on the object's action, which materialises `action_crm_close_case`, and to name that tool in a skill's `tools`. `defineTool` is only for presentation refinement and cannot make anything executable (no `handler` / `implementation`; `ToolSchema` is strict).",
3838
"files": [],
3939
"assertions": {
4040
"must_contain": ["exposed", "description", "action_", "tools"],
@@ -43,7 +43,7 @@
4343
},
4444
{
4545
"id": 5,
46-
"prompt": "Create `src/ai/support-bot.agent.ts` with defineAgent({ name: 'support_bot', tools: ['query_records', 'action_close_case'], knowledge: ['support_kb'] }) and register it under agents.",
46+
"prompt": "Create `src/ai/support-bot.agent.ts` with defineAgent({ name: 'crm_support_bot', tools: ['query_records', 'action_crm_close_case'], knowledge: ['support_kb'] }) and register it under agents.",
4747
"expected_output": "Refuses the agent: the `agent` type is closed to third parties (a stack-authored agent is filtered out, refused by `loadAgent()` and 404s on chat), and `agent.tools` / `agent.knowledge` are protocol-17 tombstones. Re-declares the two tools in a `defineSkill` (registered under `skills`) with a `surface`, and restricts retrieval at the knowledge-source level (`aiExposed`, `where`) rather than on an agent. The runtime's `ask` / `build` agents pick the skill up by surface.",
4848
"files": [],
4949
"assertions": {

‎skills/objectstack-automation/SKILL.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ write them right the first time:
292292

293293
## Assignment rules — route a new record to a queue or a person
294294

295-
The third automation family: `assignmentRules` on the stack routes each inserted
295+
`assignmentRules` on the stack routes each inserted
296296
row of an `ownership: 'user'` object whose `owner_id` and `queue` are both still
297297
empty — once, after every `beforeInsert` hook, never on update, never refusing the
298298
insert (ADR-0142 D5). Entries are ordered; the first whose `criteria` (CEL over
@@ -303,20 +303,20 @@ insert (ADR-0142 D5). Entries are ordered; the first whose `criteria` (CEL over
303303
import { defineAssignmentRule } from '@objectstack/spec/automation';
304304

305305
export const caseIntake = defineAssignmentRule({
306-
name: 'case_intake',
306+
name: 'crm_case_intake',
307307
object: 'crm_case',
308308
entries: [
309309
{ name: 'urgent', criteria: 'record.priority == "urgent"',
310-
assignTo: { type: 'queue', value: 'escalations' } }, // no strategy: parked for a claim
311-
{ name: 'rest', assignTo: { type: 'queue', value: 'support_intake' },
310+
assignTo: { type: 'queue', value: 'crm_escalations' } }, // no strategy: parked for a claim
311+
{ name: 'rest', assignTo: { type: 'queue', value: 'crm_support_intake' },
312312
strategy: 'least_loaded', load: 'record.status != "closed"' }, // or 'round_robin'; `load` only with least_loaded
313313
],
314314
});
315315
```
316316

317317
`strategy` is for a queue target only; `assignTo: { type: 'user', value: '<id>' }`
318318
names one owner. Queues are declared in `queues` (objectstack-data); an approval
319-
for the same people is `approvers: [{ type: 'queue', value: 'support_intake' }]`
319+
for the same people is `approvers: [{ type: 'queue', value: 'crm_support_intake' }]`
320320
([Approver Types](./references/state-machines-and-approvals.md#approver-types)).
321321
⛔ Never a `beforeInsert` hook that picks an owner, nor a round-robin counter field.
322322

‎skills/objectstack-automation/evals/approvals/test-revise-loop.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This file states only what a grader scores, so the rule has one home.
1111

1212
## Scenario
1313

14-
> Build an autolaunched flow `budget_approval` on the `project` object: when
14+
> Build an autolaunched flow `crm_budget_approval` on the `project` object: when
1515
> `budget` increases past 100000, route to a manager for approval. The manager
1616
> can **approve**, **reject**, or **send the record back to the submitter for
1717
> revision**; after the submitter reworks and resubmits, it returns to the

‎skills/objectstack-automation/evals/flows-triggers-approvals.json‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
},
4444
{
4545
"id": 3,
46-
"prompt": "Build an autolaunched flow `budget_approval` on `project`: when `budget` increases past 100000, route to a manager who can approve, reject, or send it back to the submitter for revision; a resubmission returns to the manager. Cap it at two send-backs.",
47-
"expected_output": "The ADR-0044 shape: an `approval` node (`type: 'approval'`, `approvers: [{ type: 'position', value: 'manager' }]`, `lockRecord: true`, `maxRevisions: 2`) with `approve` / `reject` out-edges plus a `revise` out-edge to an `approval_revise` node, and a resubmit edge back into the approval node typed `type: 'back'` — what legalises the cycle for `registerFlow`. The flow lives in `flows` (no `approvals` collection).",
46+
"prompt": "Build an autolaunched flow `crm_budget_approval` on `project`: when `budget` increases past 100000, route to a manager who can approve, reject, or send it back to the submitter for revision; a resubmission returns to the manager. Cap it at two send-backs.",
47+
"expected_output": "The ADR-0044 shape: an `approval` node (`type: 'approval'`, `approvers: [{ type: 'position', value: 'crm_manager' }]`, `lockRecord: true`, `maxRevisions: 2`) with `approve` / `reject` out-edges plus a `revise` out-edge to an `approval_revise` node, and a resubmit edge back into the approval node typed `type: 'back'` — what legalises the cycle for `registerFlow`. The flow lives in `flows` (no `approvals` collection).",
4848
"files": [],
4949
"assertions": {
5050
"must_contain": [
@@ -120,8 +120,8 @@
120120
},
121121
{
122122
"id": 7,
123-
"prompt": "An expense approval only holders of `expense.approve_request` may start; route to the `finance_manager` position; the submitter must never approve their own expense.",
124-
"expected_output": "Flow-level `requiredPermissions: ['expense.approve_request']`, checked at every door that starts the flow (never a run-user positions check inside it); the `approval` node names `approvers: [{ type: 'position', value: 'finance_manager' }]` with `excludeSubmitter: true`, and `onEmptyApprovers` is anything but `auto_approve`, refused beside it.",
123+
"prompt": "An expense approval only holders of `expense.approve_request` may start; route to the `crm_finance_manager` position; the submitter must never approve their own expense.",
124+
"expected_output": "Flow-level `requiredPermissions: ['expense.approve_request']`, checked at every door that starts the flow (never a run-user positions check inside it); the `approval` node names `approvers: [{ type: 'position', value: 'crm_finance_manager' }]` with `excludeSubmitter: true`, and `onEmptyApprovers` is anything but `auto_approve`, refused beside it.",
125125
"files": [],
126126
"assertions": {
127127
"must_contain": [
@@ -155,7 +155,7 @@
155155
},
156156
{
157157
"id": 9,
158-
"prompt": "Build a screen flow `convert_lead` that asks for a company name and a contact name, creates a `crm_account` and a linked `crm_contact`, and ends on a screen linking to both new records.",
158+
"prompt": "Build a screen flow `crm_convert_lead` that asks for a company name and a contact name, creates a `crm_account` and a linked `crm_contact`, and ends on a screen linking to both new records.",
159159
"expected_output": "A `type: 'screen'` flow: a `screen` collecting `company_name` and `contact_name`; two `create_record` nodes with `outputVariable` (`account`, `contact`), the contact linked by `account: { dialect: 'cel', source: 'account.id' }`; a last `screen` of two `type: 'record_link'` fields with `reference` (`crm_account`, `crm_contact`) and `defaultValue: { dialect: 'cel', source: 'account.id' }` / `'contact.id'`, no `required`, `placeholder` or `options`. The `end` carries no `message` (refused when completed), the `description` no markdown link — the links are the `record_link` fields, never the object field type.",
160160
"files": [],
161161
"assertions": {
@@ -190,7 +190,7 @@
190190
},
191191
{
192192
"id": 11,
193-
"prompt": "When a `contractor` is marked `onboarded`, grant its linked user (`contractor.user_id`) the `contractor_portal` permission set; run the flow as system so the grant always lands.",
193+
"prompt": "When a `contractor` is marked `onboarded`, grant its linked user (`contractor.user_id`) the `crm_contractor_portal` permission set; run the flow as system so the grant always lands.",
194194
"expected_output": "Not as system: a system-context insert into `sys_user_permission_set` (as into `sys_user_position`, `sys_invitation` or `sys_member`) is refused with `PERMISSION_DENIED` — elevation does not lift a governed identity write, a system subflow included. The flow runs `runAs: 'user'`: its `create_record` on `sys_user_permission_set` is judged by the delegated-administration gate as the user whose write fired it, recorded as `granted_by`; a user the gate would not let grant the set is refused — the rule, not a defect.",
195195
"files": [],
196196
"assertions": {
@@ -210,7 +210,7 @@
210210
{
211211
"id": 12,
212212
"prompt": "Spread new `crm_case` records evenly across the support team; a `refund_requested` case needs sign-off from the support-leads queue.",
213-
"expected_output": "An assignment rule, not a flow or hook: `defineAssignmentRule({ name: 'case_intake', object: 'crm_case', entries: [{ name: 'all', assignTo: { type: 'queue', value: 'support_team' }, strategy: 'round_robin' }] })` in `assignmentRules` — evaluated once per insert on a still-ownerless row, never on update; no counter field. The sign-off is an `approval` node (`type: 'approval'`) with `approvers: [{ type: 'queue', value: 'support_leads' }]`: the queue's members join the slate at node entry; an empty queue adds nobody.",
213+
"expected_output": "An assignment rule, not a flow or hook: `defineAssignmentRule({ name: 'crm_case_intake', object: 'crm_case', entries: [{ name: 'all', assignTo: { type: 'queue', value: 'crm_support_team' }, strategy: 'round_robin' }] })` in `assignmentRules` — evaluated once per insert on a still-ownerless row, never on update; no counter field. The sign-off is an `approval` node (`type: 'approval'`) with `approvers: [{ type: 'queue', value: 'crm_support_leads' }]`: the queue's members join the slate at node entry; an empty queue adds nobody.",
214214
"files": [],
215215
"assertions": {
216216
"must_contain": [

‎skills/objectstack-automation/references/examples-flows.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import { defineFlow } from '@objectstack/spec';
1717

1818
export const EscalateOverdueCasesFlow = defineFlow({
19-
name: 'escalate_overdue_cases',
19+
name: 'crm_escalate_overdue_cases',
2020
label: 'Escalate Overdue Cases',
2121
type: 'schedule',
2222
status: 'active',
@@ -82,7 +82,7 @@ day, a threshold is never missed.
8282

8383
```typescript
8484
{
85-
name: 'renewal_alert',
85+
name: 'crm_renewal_alert',
8686
label: 'Renewal Alert',
8787
type: 'schedule',
8888
runAs: 'system', // a sweep has no trigger user — elevate explicitly

‎skills/objectstack-automation/references/integration-recipes.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const StripeConnector = defineConnector({
4141
});
4242
// crm_account gains `stripe_available` (currency) and `stripe_synced_at` (datetime).
4343
export const StripeBalanceSweep = defineFlow({
44-
name: 'stripe_balance_sweep', label: 'Stripe balance → house account',
44+
name: 'crm_stripe_balance_sweep', label: 'Stripe balance → house account',
4545
type: 'schedule', runAs: 'system',
4646
nodes: [
4747
{ id: 'start', type: 'start', label: 'Nightly 03:00',

0 commit comments

Comments
 (0)