Building a ServiceNow Governance App End-to-End with Claude: Dev-Time Tooling and Runtime AI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Building a ServiceNow Governance App End-to-End with Claude: Dev-Time Tooling and Runtime AI
Two different Claude integrations went into this project — Claude Code as the agentic development accelerator that built the app, and the Claude API as the runtime engine that powers its recommendations. This is the technical breakdown of both.
Two Integration Points, Not One
Most "I used AI to build X" posts collapse into a single story: a chatbot helped write some code. This project actually has two distinct, separable integrations, and conflating them undersells both:
- Claude Code — the agentic CLI that did the actual scoped-app development: scaffolding, scripting, governance review prep, and the GitHub commit cycle.
- The Claude API — wired directly into the running application as the AI Recommendation Engine, generating remediation guidance from live scan findings.
The first is a development-time accelerator. The second is a runtime feature of the shipped product. Here's both, with the actual mechanics.
Part 1: Claude Code as the Development Accelerator
What Claude Code actually does in this workflow
Claude Code is an agentic coding engine that operates from the terminal, reads the existing codebase and platform context, and executes development tasks end-to-end rather than producing snippets to copy-paste. For ServiceNow specifically, that means it can reason about scoped application structure, table schemas, ACL conventions, and scripting patterns — not just generic JavaScript.
Three capabilities mattered most for this build:
- Understand — comprehends platform architecture, business context, and existing code before generating anything
- Generate — produces scoped-app code, table configs, and documentation that match ServiceNow conventions natively
- Accelerate — collapses iteration cycles that normally involve switching between an IDE, ServiceNow Studio, and documentation lookups
The toolchain architecture
┌─────────────────────────────────────────────────────────┐
│ Claude Code (CLI) │
│ AI Engine: Anthropic Claude Sonnet / Opus │
└───────────┬───────────────────────────────┬───────────────┘
│ │
▼ ▼
┌─────────────────┐ ┌────────────────────┐
│ ServiceNow SDK │ │ Fluent Plugin │
│ now-sdk CLI │◄─────────│ ServiceNow-aware │
│ Platform API │ │ completions & │
│ bindings + scoped │ │ code generation │
│ app scaffolding │ └────────────────────┘
└─────────┬───────────┘
│
▼
┌─────────────────┐ ┌────────────────────┐
│ GitHub / Source │ │ ServiceNow Platform │
│ Control │ ───────▶│ Scoped app deployed │
│ Automated commits, │ │ to dev/test/prod │
│ PRs, versioning │ └────────────────────┘
└─────────┬───────────┘
│
▼
┌─────────────────────┐
│ Governance & Reporting│
│ ATF tests, code review,│
│ documentation artifacts │
└─────────────────────┘The Fluent Plugin is the piece that makes this ServiceNow-specific rather than generic AI coding: it teaches Claude Code platform APIs, scripting conventions, and table structures, so what comes out fits the platform instead of needing translation.
Setup (Windows)
The actual install sequence, in order:
# 1. Verify Node.js — required runtime for both toolchains node -v npm -v # 2. Install the ServiceNow SDK npm install -g @servicenow/sdk now-sdk --version # 3. Install Claude Code irm https://claude.ai/install.ps1 | iex claude --version # 4. Install the Fluent Plugin (run inside Claude Code) /plugin marketplace add servicenow/sdk /plugin install fluent /reload-plugins
Component Why it's there
| Node.js | Runtime both the ServiceNow SDK and Claude Code CLI depend on |
| ServiceNow SDK | Provides now-sdk, which syncs source between the local filesystem and the ServiceNow instance |
| Claude Code | The agent that reads the project and executes development tasks from the terminal |
| Fluent Plugin | Makes Claude Code platform-aware — APIs, scripting conventions, table structures — so output fits ServiceNow natively |
The development workflow
This is the pipeline an idea actually moves through, start to finish:
Business Markdown SDK + Fluent Code & Governance GitHub Deploy to Requirement → Spec File → Analysis → Config Gen → Review → Commit → ServiceNow
- Business Requirement — the problem stated in plain language (in this case: "administrators can't see platform technical debt proactively")
- Markdown spec file — the requirement gets written down as a structured spec before any code — this is the PRD-equivalent step
- SDK + Fluent analysis — Claude Code reads the spec against the existing ServiceNow instance context via the Fluent Plugin
- Code & config generation — scoped app tables, scan modules, scoring logic generated to match the spec
- Governance review — generated code checked against ATF test coverage and documentation completeness before commit
- GitHub commit — versioned, with Claude Code handling the commit/PR cycle
- Deploy to ServiceNow — pushed to the target instance via the SDK sync
What changes versus a traditional build isn't the steps — it's the cycle time per step. A scoped app that traditionally takes 4–6 weeks compresses to 2–5 days when each step above is AI-assisted rather than manual.
Part 2: The Claude API as the Runtime AI Engine
This is the part that ships inside the application, not the part that built it. Once Claude Code generated the scan modules and scoring logic, the application itself needed its own AI integration — calling the Claude API live, every time a scan runs, to turn findings into remediation guidance.
Why a separate integration was necessary
Claude Code operates at development time, against your codebase. It has no role at 2 AM when an administrator runs a scan against production data and needs an explanation of why a finding matters. That's a separate, runtime-only integration, talking to the Claude API directly from inside the scoped app via ServiceNow's native REST framework — no SDK, no CLI, just an HTTPS call from server-side script.
The mechanics
REST Message configuration — a standard Outbound REST Message
Credential handling — the API key lives in a password2-type System Property, pulled via gs.getProperty() at execution time. Never hardcoded, never logged.
What gets sent — metadata only. Domain, finding type, severity, affected table, affected record name, count. No field values, no PII, no script bodies leave the instance:
{
"domain": "Security",
"finding_type": "acl_no_read_control",
"severity": "Critical",
"affected_table": "sys_security_acl",
"affected_count": 3,
"platform_version": "Yokohama"
}Structured output enforcement — the system prompt instructs Claude to respond only in JSON matching an exact schema (severity_confirmed, business_impact, technical_impact, remediation_steps, estimated_effort, expected_benefit), at temperature: 0.3 for consistency. The response gets parsed directly:
var rm = new sn_ws.RESTMessageV2('Claude API', 'Post Message');
rm.setRequestBody(JSON.stringify({
model: gs.getProperty('x_gov_copilot.ai.model'),
max_tokens: 1024,
system: SYSTEM_PROMPT,
messages: [{ role: "user", content: findingBatch }]
}));
var response = rm.execute();
var result = JSON.parse(response.getBody());
var recommendation = JSON.parse(result.content[0].text);Fallback — three retries with exponential backoff (30s/90s/270s), then a static fallback recommendation from System Properties if the API stays unavailable. Every recommendation record carries an ai_status: generated, pending, failed, or unavailable — nothing silently looks complete when it isn't.
The Application: Platform Governance & Health Copilot
Platform Governance & Health Copilot is a ServiceNow scoped application built for administrators and platform owners who need to see technical debt before it becomes an incident, not after. Instead of discovering a misconfigured ACL or an orphaned scheduled job during an outage retro, an administrator runs a scan on demand and gets back a single health score, a prioritized findings list across five domains, and because of the Claude integration, plain-language guidance on what each finding actually means and how to fix it. It's the difference between a list of red flags and an answer to "okay, so what do I do about this.
This is what both integrations above produced together: a scoped ServiceNow application that runs as a five-layer pipeline every time an administrator triggers a scan.
How It Actually Works, End to End
- Trigger — an administrator clicks "Run Scan Now" on the dashboard. No scheduling in this version; every scan is a deliberate, on-demand action, and a second request while one is already running gets rejected rather than queued silently.
- Scan — five domain modules run via Progress Worker, each querying ServiceNow tables directly. A CMDB check, for example, is a GlideAggregate query grouping cmdb_ci by assigned_to and support_group to surface CIs with no owner. A Performance check is a regex pass over sys_script looking for GlideRecord instantiation inside while/for loops. Every match becomes one row in x_gov_copilot_finding.
- Score — findings roll up per domain: each domain starts at 100 and loses points per finding by severity (Critical −15, High −8, Medium −4, Low −1), with the deduction values read from System Properties rather than hardcoded. Domain scores combine into a single weighted Overall Health Score, and if any module fails mid-scan, the score is deliberately suppressed rather than calculated from incomplete data.
- Recommend — every finding gets batched to the Claude API integration from Part 2, which returns business impact, technical impact, and remediation steps in place of a bare severity flag.
- Report — the dashboard updates, a post-scan email goes out, and a single Admin Report — built as a ServiceNow UI Page rather than a native report, since it needs to join across four tables that native reporting can't — captures the full findings list.
What It Actually Scans
Five domains are scanned directly, each with its own detection rules. Governance and Tech Debtbelow are composite indicators — rolled up from findings across the other five — rather than separate modules with their own scan logic:
Domain Score Automated Checks Example Finding
| Security | 92 | 8 | ACL: No Read Control (Critical), Hardcoded Credential (Critical) |
| Integration | 90 | 6 | MID Server Offline (Critical), Deprecated REST Endpoint (High) |
| Service Catalog | 88 | 7 | Item: Never Requested (High), Broken Catalog Flow (High) |
| CMDB | 85 | 7 | Critical CI – No Owner (Critical), Duplicate CI Records (High) |
| Performance | 79 | 10 | BR: GlideRecord in Loop (High), Job: Frequently Failing (High) |
| Governance (composite) | 88 | — | Catalog and policy compliance roll-up |
| Tech Debt (composite) | 81 | — | Cross-domain technical debt roll-up |
| Overall Health Score | 87 / 100 | Weighted average of the five scanned domains |
Every finding code above — acl_no_read_control, mid_server_offline, ci_no_owner — is exactly the kind of input that gets batched to the Claude API integration described in Part 2, turning a severity flag into a remediation paragraph an administrator can act on without first decoding what the finding code even means.
The Data Model Behind It
Four custom tables carry the whole pipeline — deliberately kept lean after an earlier schema draft had a fifth table that turned out to duplicate data already available on the scan record:
Table Holds
| x_gov_copilot_scan_run | One record per scan: status, timing, module completion tracking, overall score |
| x_gov_copilot_finding | One record per detected issue: domain, severity, affected record, remediation status |
| x_gov_copilot_domain_score | One row per domain per scan — what powers the trend chart |
| x_gov_copilot_recommendation | The Claude-generated guidance, linked back to its originating finding |
All scoring weights, severity deductions, health thresholds, and AI configuration live in System Properties — tunable by an administrator without a redeploy.
What's Next
The same dev-time + runtime pattern extends naturally to a sixth domain (Incident & Problem Management), scheduled scans, and eventually AI-assisted remediation script generation — once the text-recommendation engine has proven itself in practice. The broader trajectory: AI-generated Flow Designer flows, predictive incident prevention, and a standardized AI development framework across the platform rather than a one-off integration.
Try It Yourself
Full source — scan modules, scoring engine, and both Claude integrations described above:
https://github.com/snehamalik09/Platform-Governance-and-Debt-tracker
Built on ServiceNow Yokohama. Developed with Claude Code. AI recommendations powered by the Claude API.