$npx -y skills add guilhermebatista-gbs/servicenow-architect --skill sn-sdk-fluentUse when working with ServiceNow Fluent DSL (.now.ts files) — generating, reviewing, or explaining metadata definitions for tables, ACLs, business rules, UI pages, client scripts, script includes, flows, service portal widgets, and other ServiceNow metadata types. Covers all 6 co
| 1 | # ServiceNow Fluent SDK |
| 2 | |
| 3 | ServiceNow Fluent is a TypeScript-based DSL for defining application metadata (sys_metadata) as code. Files use the `.now.ts` extension and are compiled with `now-sdk build`. Two-way sync keeps metadata in sync between code and the ServiceNow instance. All Fluent APIs import from `@servicenow/sdk/core`. |
| 4 | |
| 5 | ## Reference Files |
| 6 | |
| 7 | Read these files when you need them — do not pre-load all references at session start. Paths are relative to the skill root (the directory containing this file). |
| 8 | |
| 9 | | File | When to read | |
| 10 | |------|--------------| |
| 11 | | `references/metadata-types.md` | When generating or reviewing any Fluent metadata type | |
| 12 | | `references/column-types.md` | When working with Table column definitions (StringColumn, IntegerColumn, etc.) | |
| 13 | | `references/now-globals.md` | When using Now.ID, Now.include, or the script tagged template literal | |
| 14 | | `references/getting-started.md` | When helping someone install the SDK or create their first project | |
| 15 | | `references/project-structure.md` | When explaining file layout, now.config.json, or scope prefix rules | |
| 16 | | `references/gotchas.md` | When encountering auth errors, XML/source conflicts, --reinstall questions, Now.ID or Now.ref usage, -now: import prefix issues, JS module sync questions, or npx vs now-sdk confusion | |
| 17 | | `references/cli-reference.md` | When running or explaining build, install, transform, clean, or pack commands | |
| 18 | |
| 19 | ## Example Assets |
| 20 | |
| 21 | Use these as structural templates — only read the example that matches your target type, do not pre-load all examples: |
| 22 | |
| 23 | | File | Metadata type | |
| 24 | |------|--------------| |
| 25 | | `assets/examples/table.now.ts` | Table (all 6 column types) | |
| 26 | | `assets/examples/acl.now.ts` | Acl + Role | |
| 27 | | `assets/examples/business-rule.now.ts` | BusinessRule | |
| 28 | | `assets/examples/client-script.now.ts` | ClientScript (.client.js extension) | |
| 29 | | `assets/examples/script-include.now.ts` | ScriptInclude | |
| 30 | | `assets/examples/ui-action.now.ts` | UiAction | |
| 31 | | `assets/examples/ui-page.now.ts` | UiPage | |
| 32 | | `assets/examples/rest-api.now.ts` | RestApi | |
| 33 | | `assets/examples/flow.now.ts` | Flow (trigger + action) | |
| 34 | |
| 35 | ## Hard Rules |
| 36 | |
| 37 | 1. **Read before writing.** Always read the relevant reference file before generating or reviewing Fluent code. Do not write from memory. |
| 38 | 2. **Only use documented APIs.** Only use field names and options that appear in the reference files. If a user requests something not in the reference, say so and suggest the closest documented alternative. |
| 39 | 3. **GlideRecord never defines metadata — but script bodies still use Glide APIs.** Fluent replaces the legacy way of *creating metadata* (tables, fields, ACLs, rules as records) — never emulate that with GlideRecord. The **contents** of `script` properties, `Now.include()` files, and `src/server/` modules (Business Rule logic, Script Include methods, scripted REST handlers) are regular ServiceNow server-side JavaScript that correctly uses `GlideRecord`, `gs.*`, and `current`. Write those bodies following the `../sn-scripting/` references (`gliderecord.md`, `server-side.md`, `gotchas.md`). |
| 40 | 4. **Never omit `Now.ID` where required.** Check the `$id-required types` list in the header of `references/metadata-types.md` before writing any metadata type. |
| 41 | 5. **Always import from `@servicenow/sdk/core`.** Never from `@servicenow/sdk` — the `/core` subpath is required. |
| 42 | 6. **Scope prefix comes from `now.config.json`.** NEVER invent or assume the scope prefix. Read `references/project-structure.md` for the schema. If `now.config.json` is absent from the workspace, ask the user for their application scope before writing any names (table names, API names, role names, etc.). |
| 43 | |
| 44 | 7. **Build, deploy, auth, and failure triage belong to `sn-sdk-setup`.** This sub-skill owns *writing* Fluent code. For the build→deploy→verify lifecycle, auth checks, and the failure table — including the destructive `--reinstall` caveat (`references/gotchas.md` #3) — read the main file in `../sn-sdk-setup/` instead of improvising commands. |
| 45 | |
| 46 | **ATF tests:** When a user asks to generate ATF tests, do NOT generate ATF code from this skill. ATF API surface is extensive and version-sensitive. Direct them to: `github.com/ServiceNow/sdk-examples/tree/main/test-atf-sample` |
| 47 | |
| 48 | ## Behavior by Task Type |
| 49 | |
| 50 | ### Build & Deploy |
| 51 | |
| 52 | Owned by the **sn-sdk-setup** sub-skill — read the main file in `../sn-sdk-setup/` (section "Build & Deploy") for the pre-deploy checklist, the build→install sequence, post-deploy verification |