$npx -y skills add guilhermebatista-gbs/servicenow-architect --skill sn-sdk-setupUse when setting up, configuring, building, or deploying with the ServiceNow SDK — scaffolding new projects, configuring Basic or OAuth authentication, converting existing applications, building and deploying to an instance, or validating a development environment. Covers all ini
| 1 | # ServiceNow SDK Setup |
| 2 | |
| 3 | The ServiceNow SDK (now-sdk) CLI scaffolds, builds, and deploys Fluent DSL applications. Use this skill for any SDK installation, project creation, authentication, or environment validation task. |
| 4 | |
| 5 | ## Reference Files |
| 6 | |
| 7 | Read only the file relevant to your task. Do not pre-load references at session start. |
| 8 | |
| 9 | | File | When to read | |
| 10 | |------|--------------| |
| 11 | | `references/setup-workflows.md` | When scaffolding a new project, configuring auth, converting an existing app, or diagnosing environment issues | |
| 12 | | `references/auth-profiles.md` | When configuring Basic or OAuth auth, managing named aliases, or passing `--auth` to commands | |
| 13 | | `references/init-templates.md` | When choosing a project template or passing non-interactive init flags | |
| 14 | | `references/convert-existing-app.md` | When converting an existing application from XML metadata or Update Set | |
| 15 | | `references/third-party-libraries.md` | When adding npm packages to an SDK project | |
| 16 | | `references/js-modules-types.md` | When using JS modules in src/server/, TypeScript in server-side modules, or @servicenow/glide type definitions | |
| 17 | | `references/cli-reference.md` | When looking up auth, init, build, install, download, or dependencies command flags | |
| 18 | |
| 19 | ## Scripts |
| 20 | |
| 21 | | Script | When to use | |
| 22 | |--------|------------| |
| 23 | | `scripts/check-environment.sh` | When validating the developer environment before starting SDK work. Use `--offline` in CI pipelines. | |
| 24 | |
| 25 | ## Hard Rules |
| 26 | |
| 27 | 1. **Read before advising.** Always read `references/setup-workflows.md` before giving setup instructions. Do not rely on memory for command syntax — SDK commands change between versions. |
| 28 | 2. **Use `now-sdk auth --add`, not `auth save` or `login`.** `auth save` does not exist. `login` is deprecated. The correct command is `now-sdk auth --add <url> --alias <name>`. |
| 29 | 3. **Always use a named alias.** Use `now-sdk auth --add <url> --alias dev` — aliases allow multiple instances. |
| 30 | 4. **Never pick a template without understanding the use case.** Follow the discovery flow in the scaffold behavior below. Default to `typescript.basic` only as a last resort after two unanswered prompts. |
| 31 | 5. **The scope prefix comes from now.config.json.** For writing Fluent DSL code after setup, read the main file in `../sn-sdk-fluent/` — that sub-skill owns code generation. |
| 32 | 6. **Never run install without a successful build first.** `now-sdk install` deploys whatever is in `dist/`. Running it without a prior `now-sdk build` silently pushes stale or missing artifacts. Build must complete cleanly before deploy. |
| 33 | 7. **Always verify auth before deploying.** OAuth tokens expire silently. Run `now-sdk auth --list` and confirm the correct alias is active before every deploy. A mid-deploy auth failure is confusing and hard to diagnose. |
| 34 | 8. **`sys_app.do` is the app record, not the running UI.** After deploy, the link in the install output points to the app record. The live UI URL is the `endpoint` value defined in the `UiPage()` call in the `.now.ts` source — e.g. `https://<instance>.service-now.com/<endpoint>.do`. |
| 35 | |
| 36 | ## Behavior by Task Type |
| 37 | |
| 38 | ### New project scaffold |
| 39 | |
| 40 | Read `references/setup-workflows.md` and `references/init-templates.md` first, then follow this flow: |
| 41 | |
| 42 | **Step 1 — Instance URL** |
| 43 | If not already provided, ask: |
| 44 | > "What's your ServiceNow instance URL? (e.g. https://dev12345.service-now.com)" |
| 45 | |
| 46 | **Step 2 — Auth** |
| 47 | - Recommend OAuth. Ask: "OAuth (recommended) or Basic auth?" |
| 48 | - **Important:** OAuth requires interactive terminal input — Claude Code cannot handle this. See `references/cli-reference.md` → **auth --add (token refresh)** for the Terminal workaround. |
| 49 | - Once they confirm auth succeeded, verify with: `now-sdk auth --list` |
| 50 | |
| 51 | **Step 3 — What to build** |
| 52 | Ask one question with examples to guide the answer: |
| 53 | > "What are you building? For example: |
| 54 | > - Business rules, script includes, flows, Service Portal widgets → `typescript.basic` |
| 55 | > - App with a custom React UI page → `typescript.react` |
| 56 | > - App with a custom Vue UI page → `typescript.vue`" |
| 57 | |
| 58 | - If they answer → map to the right template, state your reasoning in one sentence, confirm with user, then scaffold. |
| 59 | - If no answer → ask once more: "Does it need a custom UI, or is it server-side only?" |
| 60 | - If still no answer → use `typescript.basic` and say: "Going with `typescript.basic` — works for everything server-side. You can add React later with `partial.typescript.react`." |
| 61 | |
| 62 | **Step 4 — Scaffold** |
| 63 | ```bash |
| 64 | now-sdk init \ |