ServiceNow Fluent SDK
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.
Reference Files
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).
| File | When to read |
|---|---|
references/metadata-types.md | When generating or reviewing any Fluent metadata type |
references/column-types.md | When working with Table column definitions (StringColumn, IntegerColumn, etc.) |
references/now-globals.md | When using Now.ID, Now.include, or the script tagged template literal |
references/getting-started.md | When helping someone install the SDK or create their first project |
references/project-structure.md | When explaining file layout, now.config.json, or scope prefix rules |
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 |
references/cli-reference.md | When running or explaining build, install, transform, clean, or pack commands |
Example Assets
Use these as structural templates — only read the example that matches your target type, do not pre-load all examples:
| File | Metadata type |
|---|---|
assets/examples/table.now.ts | Table (all 6 column types) |
assets/examples/acl.now.ts | Acl + Role |
assets/examples/business-rule.now.ts | BusinessRule |
assets/examples/client-script.now.ts | ClientScript (.client.js extension) |
assets/examples/script-include.now.ts | ScriptInclude |
assets/examples/ui-action.now.ts | UiAction |
assets/examples/ui-page.now.ts | UiPage |
assets/examples/rest-api.now.ts | RestApi |
assets/examples/flow.now.ts | Flow (trigger + action) |
Hard Rules
-
Read before writing. Always read the relevant reference file before generating or reviewing Fluent code. Do not write from memory.
-
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.
-
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
scriptproperties,Now.include()files, andsrc/server/modules (Business Rule logic, Script Include methods, scripted REST handlers) are regular ServiceNow server-side JavaScript that correctly usesGlideRecord,gs.*, andcurrent. Write those bodies following the../sn-scripting/references (gliderecord.md,server-side.md,gotchas.md). -
Never omit
Now.IDwhere required. Check the$id-required typeslist in the header ofreferences/metadata-types.mdbefore writing any metadata type. -
Always import from
@servicenow/sdk/core. Never from@servicenow/sdk— the/coresubpath is required. -
Scope prefix comes from
now.config.json. NEVER invent or assume the scope prefix. Readreferences/project-structure.mdfor the schema. Ifnow.config.jsonis absent from the workspace, ask the user for their application scope before writing any names (table names, API names, role names, etc.). -
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--reinstallcaveat (references/gotchas.md#3) — read the main file in../sn-sdk-setup/instead of improvising commands.
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
Behavior by Task Type
Build & Deploy
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, live-URL lookup, and the common-failures table. Keeping a single copy avoids the two files drifting apart. One reminder that bears repeating here: never run now-sdk install --reinstall casually — it is destructive (see references/gotchas.md #3).
Generating Fluent code
- If the scope prefix, metadata type, or required fields have not been stated by the user and cannot be unambiguously determined from the workspace — gather them before writing (ask for each piece of information sequentially to avoid overwhelming the user)
- Read
references/metadata-types.mdfor the target metadata type - Read the matching example from
assets/examples/ - Write code following the example structure exactly
- Use
Now.ID['descriptive_key']for stable IDs; useNow.include('./filename.ext')for external scripts - When the type carries a script body (BusinessRule, ScriptInclude, RestApi, UiAction), write that body as standard Glide server-side JS following the
../sn-scripting/references — Hard Rule 3 - Prefix table names, API names, and role names with
x_scope_(wherescopecomes fromnow.config.json); ifnow.config.jsonis absent, apply Hard Rule 6
Reviewing Fluent code
- Read
references/metadata-types.md - Check every field and option in the code against the reference
- Flag options not in the reference as "not in reference — may be valid but verify against SDK docs"
- Flag missing
$idon types that require it (marked in the reference header) - Flag GlideRecord used to define or create metadata (that should be a Fluent definition). GlideRecord inside script bodies is correct — review those bodies against
../sn-scripting/references/gotchas.mdinstead - Flag imports from
@servicenow/sdk(should be@servicenow/sdk/core)
Explaining Fluent code
- Read the relevant section of
references/metadata-types.md - For each field, paraphrase the reference definition — do not explain from memory
- For Now.ID, Now.include, or
scripttag questions, also readreferences/now-globals.md


