# Instructions for Fluent NowAssist Skill Config API
Always reference the NowAssist Skill Config API specifications for more details.
1. Import `NowAssistSkillConfig` from `@servicenow/sdk/core`. This is a **two-argument function**: `NowAssistSkillConfig(definition, promptConfig)`.
2. **First argument (definition):** The `$id` and `name` fields are mandatory. Use `shortDescription` for a brief one-liner and `description` for detailed explanation. Set `state: 'published'` to publish; omit for draft.
3. Define `inputs` as an array of `InputAttribute` objects. Each requires `$id` (using `Now.ID`), `name`, and `dataType` ('string'|'numeric'|'boolean'|'glide_record'|'simple_array'|'json_object'|'json_array'). For `glide_record` type, both `tableName` and `tableSysId` are REQUIRED. Use `mandatory: true` for required inputs.
4. Define `outputs` as an array of `OutputAttribute` objects with the same structure as inputs (`$id`, `name`, `dataType` are mandatory). Output names must not contain underscores. **SDK v4.6.0**: When `outputs` is omitted or an empty array, five standard outputs are auto-generated — `response`, `provider`, `errorcode`, `status`, `error`. Custom outputs can be added alongside these standard outputs.
4a. **`dataType` options (SDK v4.6.0)**: scalar — `'string'`, `'numeric'`, `'boolean'`; complex — `'glide_record'`, `'simple_array'`, `'json_object'`, `'json_array'`. For `'glide_record'`, `tableName` is REQUIRED. The optional `truncate` flag is only valid for `'string'`, `'numeric'`, `'boolean'`, `'glide_record'` — NOT supported for `'simple_array'`, `'json_object'`, `'json_array'`.
5. `securityControls` is **MANDATORY**. It requires `userAccess` with its own `$id` (either `{ $id: Now.ID['...'], type: 'authenticated' }` for any logged-in user or `{ $id: Now.ID['...'], type: 'roles', roles: [...] }` for specific roles; without `$id` it is TS2322 and the build cannot identify the generated `sys_security_acl`) plus at least one role list. **SDK v4.7.0**: provide either `roleMap` (array of role **names** — preferred on ZP10/AP3+, maps to the `sys_agent_access_role_mapping` table) or `roleRestrictions` (array of role **sys_ids** — legacy path, maps to the `role_list` glide_list column). At least one of `roleMap`/`roleRestrictions` must be non-empty; both accept `string | Role | DbRecord<'sys_user_role'>` entries.
6. Use `tools` callback to define a tool graph: `tools: (t) => ({ myTool: t.Script(...), ... })`. Available tool types: `Script`, `InlineScript`, `FlowAction`, `Subflow`, `Skill`, `WebSearch`, `Decision`. Access skill inputs via `t.input.fieldName`. Chain dependencies via `depends` array. Return tool handles to enable type-safe prompt access.
7. **Second argument (promptConfig):** Must contain `providers` array with at least one provider. Each provider has `provider` name (e.g., 'Now LLM Service', 'Azure OpenAI'), `prompts` array, and optional `defaultPrompt`. Each prompt has `name` and a `versions` array (a prompt has no `$id`; each version has `$id`, `model`, optional `temperature`, `promptState`, and `prompt`, a string or builder callback `(p) => ...`).
8. In prompt builder callbacks, access inputs via `p.input.fieldName` and tool outputs via `p.tool.ToolName.output` (for single-output tools) or `p.tool.ToolName.fieldName` (for multi-output tools).
9. Use `deploymentSettings` to configure where the skill is deployed: `uiAction` for form-level UI Actions (`{ $id, table }` — `$id` is mandatory), `nowAssistPanel` for NAP deployment (requires `enabled: true` and `roles`), `flowAction: true` for workflow trigger.
10. Use `skillSettings` for pre/postprocessing providers that transform request/response payloads before/after LLM calls.
