agentleFS
nathanolds22nathanolds22/servicenow-claude-kit/.claude/skills/flows/SKILL.md

flows

Skill0 starsChanged 6 months agoMITView on GitHub

Work with Flow Designer flows on the connected ServiceNow instance — verify/publish/health-check flows, invoke flows and subflows programmatically via sn_fd.FlowAPI, and route platform-managed GenAI capability subflows. Use when asked to "run a flow", "invoke a subflow", "check why a flow didn't fire", "call FlowAPI", "health-check flows after a deploy", or to wire a GenAI Generic Prompt subflow. NOT for authoring flow logic — there is no supported programmatic path (see §1).

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. cornch-k/baton★ 3same name
    2. erikreppel/skills★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read back active=true, status=published via Table API (step §2 below) — the UI lies less than memory, but the Table API doesn't lie at all.

    line 20
  2. Very specific:

    If the flow is bound to an sn_aia trigger config: re-assert trigger run_as/run_as_user/channel afterwards — Studio Publish wipes them (see …

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Flows — lifecycle and invocation (not authoring)

0. Gate

getCapability('flow_designer.api_available') must be true (unknown → npm run probe:quick first). The god-mode script paths in §2/§3/§5 additionally require getCapability('execute_script.available') to be true — when it isn't, health checks and input discovery still work over plain Table API, but sn_fd.FlowAPI invocation and setWorkflow(false) updates have no remote path on that instance.

1. The honest boundary: you cannot author a flow programmatically

A flow's executable logic lives in an opaque compiled snapshot (sys_hub_flow.latest_snapshot / master_snapshot → sys_hub_flow_snapshot), generated only by Flow Designer / Studio publish actions. Writing sys_hub_flow rows via REST produces a record with no working snapshot — the engine reads the snapshot, not the live row. Restoring a broken flow's active/status fields does not regenerate its snapshot either (production-verified: a flow restored to active=1, published after a bad regen still failed to dispatch until a manual Studio Publish rebuilt the snapshot).

Authoring is operator UI work. Give the operator this checklist:

  1. Flow Designer (or Agent Studio for sn_aia trigger flows) → create/edit the flow.
  2. Publish (not just Save) — publish compiles the snapshot.
  3. Read back active=true, status=published via Table API (step §2 below) — the UI lies less than memory, but the Table API doesn't lie at all.
  4. If the flow is bound to an sn_aia trigger config: re-assert trigger run_as/run_as_user/channel afterwards — Studio Publish wipes them (see .claude/rules/ai-agents.md).

What IS automatable: health checks, publishing-state assertions, invocation, and input/output schema discovery — the rest of this skill.

2. Flow health check (run after every deploy that touches flows or triggers)

GET /api/now/table/sys_hub_flow?sysparm_query=sys_id=<flow>&sysparm_fields=name,active,status,master_snapshot,latest_snapshot

Healthy = active=true, status=published, snapshot fields non-empty. Check every flow your change could have touched, not just the one you edited:

  • REST updates to sn_aia_trigger_configuration fire async_always BRs that regenerate the bound flow and can leave it active=false, status=draft — non-deterministically per flow, so three of five may survive and two break (production-verified). Route trigger UPDATEs through god-mode GlideRecord.setWorkflow(false).update() (requires execute_script.available=true; without it the only safe path is the Studio UI); brand-new trigger INSERTs still need one manual Studio Publish. Full rule: .claude/rules/fluent-metadata.md.
  • Execution evidence: sys_flow_context rows (state=COMPLETE) — query by flow=<sys_id> ordered by sys_created_on to prove a flow actually ran.

3. Invoke programmatically — sn_fd.FlowAPI

Full recipe with live-verified examples: reference/flowapi-invocation.md.

The 30-second version (server-side, global scope):

var r = sn_fd.FlowAPI.getRunner()
    .subflow('<scope>.<internal_name>')   // FQN, not the display name
    .inForeground()                        // or .inBackground() for async
    .withInputs({ /* keys = DECLARED input names */ })
    .run();
var outputs = r.getOutputs();

Discover the declared input names first — guessing produces "The undefined value has no properties" deep in the flow engine:

GET /api/now/table/sys_hub_flow_input?sysparm_query=model=<flow_sys_id>&sysparm_fields=element,label,internal_type,mandatory

element is the key .withInputs() expects. Outputs schema: same query against sys_hub_flow_output.

4. GenAI capability subflows — the _meta envelope

Platform-managed "Generic Prompt" model variants are Flow Designer subflows with ONE declared input (input, type json) whose first consumer hard-requires a _meta envelope. Bare {prompt} payloads fail with the same undefined-value error for every shape you try. The envelope and the model-routing knob (_meta.definition), plus how to verify routing from sys_gen_ai_log_metadata: reference/genai-meta-envelope.md.

5. Executor caveat (live-verified)

The kit's god-mode REST endpoint (scripts/lib/sn-rest.js executeScript) surfaces the value of the script's last expression; a top-level return yields result: null with success: true. The MCP execute_script tool wraps scripts in an IIFE, so return works there. End REST-path scripts with a bare expression (e.g. JSON.stringify(o);).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.