Skip to content

Hawks6/SNow-Claude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

❄️ SNow-Claude

A lightweight, powerful meta-prompting & context engineering system
for ServiceNow development with Claude AI

Installation β€’ Quickstart β€’ How It Works β€’ File Reference β€’ Examples β€’ Customization β€’ Contributing

ServiceNow Version Claude Compatible Files No Dependencies License


The Problem

You ask Claude to write a ServiceNow Business Rule. You get back generic JavaScript that:

  • ❌ Uses let/const (Rhino engine doesn't fully support ES6)
  • ❌ Calls GlideRecord on the client side (synchronous, insecure)
  • ❌ Hardcodes sys_ids that break across instances
  • ❌ Skips input validation, error handling, and logging
  • ❌ Ignores scoped application boundaries
  • ❌ Has no idea what current.setAbortAction(true) does

SNow-Claude fixes this. Paste our context files into Claude and get production-grade ServiceNow code β€” every time.


The Solution

SNow-Claude is a collection of composable markdown files β€” no dependencies, no tooling, no npm install. Just copy β†’ paste β†’ build.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    SYSTEM.md                             β”‚
β”‚            The Brain β€” Expert Persona,                   β”‚
β”‚         Coding Standards, Quality Gates                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  contexts/  β”‚   specs/    β”‚  prompts/    β”‚ knowledge/   β”‚
β”‚             β”‚             β”‚              β”‚              β”‚
β”‚ 13 deep     β”‚ 9 fill-in   β”‚ 4 role       β”‚ 5 reference  β”‚
β”‚ knowledge   β”‚ spec        β”‚ modes        β”‚ documents    β”‚
β”‚ modules     β”‚ templates   β”‚              β”‚              β”‚
β”‚             β”‚             β”‚              β”‚              β”‚
β”‚ Load per    β”‚ Spec β†’      β”‚ /architect   β”‚ API patterns β”‚
β”‚ task        β”‚ production  β”‚ /developer   β”‚ Anti-patternsβ”‚
β”‚             β”‚ code        β”‚ /reviewer    β”‚ Naming       β”‚
β”‚             β”‚             β”‚ /debugger    β”‚ Scoping      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ What You Get

Without SNow-Claude With SNow-Claude
Generic JavaScript Platform-aware scoped app code
No naming conventions <Table> - <When> <Description> everywhere
Hardcoded sys_ids gs.getProperty() + system properties
Missing error handling try/catch + structured logging with source IDs
No input validation gs.nil() checks, type validation, GlideRecordSecure
No naming conventions <Table> - <Action> <Description> everywhere
Silent about bad practices 25-point quality gate with pass/fail report

Before & After

❌ Without SNow-Claude β€” What Claude typically generates
// "Create a business rule that sets priority based on VIP caller"

var gr = new GlideRecord('sys_user');
gr.addQuery('sys_id', current.caller_id);
gr.query();
if (gr.next()) {
    if (gr.vip == 'true') {
        current.priority = 1;
    }
}

Problems: No timing specified, no operation guard, uses dot-notation instead of getValue(), no logging, no error handling, no null checks, no naming convention, no scope awareness.

βœ… With SNow-Claude β€” Production-grade output
/**
 * Business Rule: Incident - Before Set VIP Priority
 * Table: incident | When: before | Insert: true, Update: true
 * Condition: caller_id changes
 * 
 * @description Automatically elevates priority for VIP callers.
 *              Delegates lookup to avoid unnecessary queries on non-VIP callers.
 */
(function executeRule(current, previous) {

    var LOG_PREFIX = '[Incident - Before Set VIP Priority]';

    // Only process when caller changes
    if (!current.caller_id.changes()) {
        return;
    }

    var callerId = current.getValue('caller_id');
    if (gs.nil(callerId)) {
        return;
    }

    var grCaller = new GlideRecord('sys_user');
    if (grCaller.get(callerId)) {
        if (grCaller.getValue('vip') === 'true') {
            current.setValue('priority', '1');
            current.setValue('urgency', '1');
            gs.info(LOG_PREFIX + ' VIP caller detected, priority elevated for: ' + 
                    current.getValue('number'));
        }
    } else {
        gs.warn(LOG_PREFIX + ' Caller not found: ' + callerId);
    }

})(current, previous);

Includes: Proper naming, JSDoc, IIFE wrapper, change detection, null checks, getValue(), structured logging, graceful handling of missing caller.


πŸ“¦ Installation

Prerequisites

  • A Claude account (free or Pro) at claude.ai β€” or access via Claude API / Claude Desktop
  • That's it. No npm, no pip, no build tools. SNow-Claude is just markdown files.

Option 1: Clone the Repository

git clone https://github.com/Hawks6/SNow-Claude.git
cd SNow-Claude

Option 2: Download as ZIP

  1. Click the green <> Code button at the top of this GitHub page
  2. Select Download ZIP
  3. Extract the ZIP to any folder on your machine

What You Get

After cloning or extracting, you'll have this folder structure:

snow-claude/
β”œβ”€β”€ SYSTEM.md                    ← 🧠 The brain β€” start here
β”œβ”€β”€ QUICKSTART.md                ← ⚑ 5-minute guide
β”œβ”€β”€ README.md                    ← πŸ“– You're reading it
β”œβ”€β”€ LICENSE                      ← πŸ“„ MIT License
β”‚
β”œβ”€β”€ contexts/                    ← πŸ“š Knowledge modules (load per task)
β”‚   β”œβ”€β”€ _base.md                 ←    Always needed (core platform)
β”‚   β”œβ”€β”€ business-rules.md        ←    Business Rule patterns
β”‚   β”œβ”€β”€ script-includes.md       ←    Script Include patterns
β”‚   β”œβ”€β”€ client-scripts.md        ←    Client Scripts & UI Policies
β”‚   β”œβ”€β”€ gliderecord.md           ←    GlideRecord / GlideAggregate
β”‚   β”œβ”€β”€ flow-designer.md         ←    Flow Designer & IntegrationHub
β”‚   β”œβ”€β”€ service-portal.md        ←    Service Portal widgets
β”‚   β”œβ”€β”€ now-experience.md        ←    UI Builder / Now Experience
β”‚   β”œβ”€β”€ rest-api.md              ←    Scripted REST APIs
β”‚   β”œβ”€β”€ atf.md                   ←    Automated Test Framework
β”‚   β”œβ”€β”€ security.md              ←    ACLs, roles, data policies
β”‚   β”œβ”€β”€ performance.md           ←    Query optimization
β”‚   └── update-sets.md           ←    Update set management
β”‚
β”œβ”€β”€ specs/                       ← πŸ“ Fill-in-the-blank spec templates
β”‚   β”œβ”€β”€ _spec-guide.md           ←    How specs work
β”‚   β”œβ”€β”€ business-rule.spec.md
β”‚   β”œβ”€β”€ script-include.spec.md
β”‚   β”œβ”€β”€ client-script.spec.md
β”‚   β”œβ”€β”€ rest-endpoint.spec.md
β”‚   β”œβ”€β”€ widget.spec.md
β”‚   β”œβ”€β”€ flow.spec.md
β”‚   β”œβ”€β”€ integration.spec.md
β”‚   └── scoped-app.spec.md
β”‚
β”œβ”€β”€ prompts/                     ← 🎭 Role-based meta-prompts
β”‚   β”œβ”€β”€ architect.md             ←    Design & architecture mode
β”‚   β”œβ”€β”€ developer.md             ←    Code generation mode
β”‚   β”œβ”€β”€ reviewer.md              ←    Code review mode
β”‚   └── debugger.md              ←    Debugging mode
β”‚
└── knowledge/                   ← πŸ“– Reference material
    β”œβ”€β”€ api-patterns.md          ←    15 most-used API patterns
    β”œβ”€β”€ anti-patterns.md         ←    Common mistakes & fixes
    β”œβ”€β”€ naming-conventions.md    ←    Naming standards
    β”œβ”€β”€ scoping-rules.md         ←    Cross-scope access rules
    └── table-reference.md       ←    Key system tables

πŸ’‘ Tip: You don't need all 34 files for every task. Most of the time you'll use SYSTEM.md + 1-2 context modules. Think of it as a toolbox β€” grab what you need.


πŸš€ Quickstart

Step 1: Get the Files

Clone or download the repo (see Installation above).

Step 2: Choose Your Setup

Option A: Claude Projects (Recommended β€” Set Up Once, Use Forever)

Claude Projects let you attach files as persistent knowledge. Every conversation in the project automatically has access to your SNow-Claude context.

  1. Go to claude.ai and click "Create Project"

  2. Name it something like ServiceNow Development

  3. Click "Add project knowledge" and upload these files from your cloned repo:

    Always upload:

    • SYSTEM.md
    • contexts/_base.md

    Upload based on your daily work (pick 3-4 to start):

    • contexts/business-rules.md
    • contexts/script-includes.md
    • contexts/gliderecord.md
    • contexts/client-scripts.md

    Highly recommended reference material:

    • knowledge/anti-patterns.md
    • knowledge/naming-conventions.md

    Optional (Based on your workflow):

    • prompts/story-analyzer.md (If you frequently map agile stories to technical designs)
    • specs/user-story.spec.md (If you want Claude to know the exact format required for stories)
  4. Start a new conversation inside the project

  5. Ask Claude to build something β€” it already has full ServiceNow expertise loaded

πŸ’‘ You can always add more files later. Working on REST APIs next week? Upload contexts/rest-api.md to the project.

Option B: Per-Conversation (Quick & Flexible β€” No Setup Required)

For one-off tasks or if you don't have Claude Pro:

  1. Open SYSTEM.md in a text editor
  2. Select all and copy (Ctrl+A β†’ Ctrl+C)
  3. Paste into a new Claude conversation as your first message
  4. Open the relevant context module (e.g., contexts/business-rules.md)
  5. Copy and paste that too, right after
  6. Now ask Claude to build your ServiceNow artifact
πŸ“‹ Step 1 β€” Paste: SYSTEM.md
πŸ“‹ Step 2 β€” Paste: contexts/business-rules.md
πŸ“‹ Step 3 β€” Your request:

"Create a before Business Rule on incident that validates resolution 
requirements when state changes to Resolved:
- Resolution code is filled
- Close notes are at least 20 chars  
- P1 incidents must have a linked problem"

Claude will generate the complete Business Rule with naming conventions, quality gate results, and deployment notes.

Step 3: Level Up with Specs (Optional)

For structured, repeatable code generation:

  1. Open a spec template from specs/ (e.g., business-rule.spec.md)
  2. Fill in the <placeholder> fields with your requirements
  3. Paste the filled spec into your Claude conversation (after SYSTEM.md + context)
  4. Claude generates production-ready code matching your exact specification

Step 4: Switch Roles (Optional)

Paste a role prompt from prompts/ to change Claude's behavior:

File to Paste What Changes
prompts/architect.md Claude evaluates design options before coding
prompts/story-analyzer.md Claude acts as an architect to map user stories to technical designs
prompts/developer.md Claude generates code from specs with full output format
prompts/reviewer.md Claude reviews your existing code for issues
prompts/debugger.md Claude systematically diagnoses your ServiceNow problems

πŸ”§ How It Works

SNow-Claude is built on three core ideas:

1. Composable Context Modules

Don't dump 50KB of context into every conversation. Load only what you need:

Building a Business Rule?     β†’ Load business-rules.md
Need GlideRecord queries?     β†’ Add gliderecord.md
Worried about performance?    β†’ Add performance.md

Modules can be combined freely. They're designed to complement, not conflict.

2. Spec-Driven Development

Fill in a structured spec template β†’ get production-ready code:

artifact_type: Business Rule
table: incident
name: Incident - Before Validate Resolution
when: before
operation: update
condition: state changes to 6 (Resolved)
scope: x_acme_itsm_ext

description: |
  Validate that resolution requirements are met before allowing 
  an incident to move to Resolved state.

criteria:
  - Blocks if resolution_code is empty
  - Blocks if close_notes < 20 characters
  - Blocks P1 resolution without linked problem
  - Shows specific error messages per validation failure
  - Admin users bypass all checks

Claude reads the spec, applies all context modules, runs quality gates, and delivers deployable code.

3. Role-Based Meta-Prompts

Switch Claude's behavior mode for different stages of work:

Command Mode Best For
/architect πŸ—οΈ Architect "Should I use a Flow or a Business Rule?"
/developer πŸ’» Developer "Build this Script Include from spec"
/reviewer πŸ” Reviewer "Review this code for anti-patterns"
/debugger πŸ› Debugger "My Business Rule isn't firing"

πŸ“ File Reference

Core Files

File What It Does
SYSTEM.md The brain. Expert persona, coding standards, 25-point quality gate, response format. Always load this first.
QUICKSTART.md 5-minute setup guide with examples

Context Modules β€” contexts/

Composable knowledge modules. Load per task.

Module Lines Load When You're Working On
_base.md ~350 Always β€” core platform APIs, scoped app model, table hierarchy
business-rules.md ~300 Business Rules β€” timing, patterns, anti-patterns, performance
script-includes.md ~160 Script Includes β€” prototype pattern, GlideAjax, cross-scope
client-scripts.md ~150 Client Scripts, UI Policies, catalog scripts
gliderecord.md ~180 GlideRecord, GlideAggregate, GlideRecordSecure
flow-designer.md ~100 Flows, Subflows, Actions, IntegrationHub
service-portal.md ~120 Service Portal widgets (AngularJS)
now-experience.md ~100 UI Builder / Now Experience components
rest-api.md ~130 Scripted REST APIs, outbound integrations
atf.md ~90 Automated Test Framework
security.md ~100 ACLs, roles, data policies, GlideRecordSecure
performance.md ~100 Query optimization, caching, batch processing
update-sets.md ~70 Update set management, deployment order

Spec Templates β€” specs/

Fill-in-the-blank YAML templates. Complete one β†’ paste it with SYSTEM.md + context β†’ get code.

Template Generates
business-rule.spec.md Business Rule with full configuration
script-include.spec.md Script Include class with methods
client-script.spec.md Client Script with GlideAjax calls
user-story.spec.md Agile user story definition for the /story skill
rest-endpoint.spec.md Scripted REST API with resources
widget.spec.md Service Portal widget (server + client + HTML)
flow.spec.md Flow Designer flow with steps
integration.spec.md External system integration
scoped-app.spec.md Full scoped application architecture
_spec-guide.md How spec-driven development works

Meta-Prompt Roles β€” prompts/

Paste one of these to change Claude's mode of operation.

Role File Behavior
πŸ—οΈ Architect architect.md Evaluates design alternatives, produces ADRs, plans app structure
πŸ“– Story Analyzer story-analyzer.md Parses agile user stories into technical solution maps
πŸ’» Developer developer.md Spec-to-code pipeline, complete output with config + tests
πŸ” Reviewer reviewer.md Systematic code review with severity ratings (πŸ”΄πŸŸ πŸŸ‘πŸŸ’)
πŸ› Debugger debugger.md Root cause analysis, platform diagnostic tools, resolution steps

Knowledge Base β€” knowledge/

Reference material. Upload to Claude Projects for always-on access.

File Contents
api-patterns.md 15 most-used ServiceNow API patterns (copy-paste ready)
anti-patterns.md 15+ common mistakes with severity ratings and fixes
naming-conventions.md Naming standards for every artifact type
scoping-rules.md Cross-scope access rules, Application Access matrix
table-reference.md Key system tables, Task hierarchy, CMDB structure

πŸ’‘ Examples

Example 1: Build a Script Include

πŸ“‹ SYSTEM.md + contexts/script-includes.md + contexts/gliderecord.md

"Create a Script Include called IncidentEscalationUtils in scope x_acme_itsm 
that provides methods to:
1. Check if an incident has been stale for N days (configurable via property)
2. Escalate stale incidents by bumping priority and adding a work note
3. Get a count of all stale incidents per assignment group"

Example 2: Review Existing Code

πŸ“‹ SYSTEM.md + prompts/reviewer.md + contexts/business-rules.md

"Review this Business Rule for issues:

(function executeRule(current, previous) {
    var gr = new GlideRecord('sys_user');
    gr.addQuery('sys_id', current.caller_id);
    gr.query();
    if (gr.next()) {
        if (gr.vip == true) {
            current.priority = 1;
            current.update();
        }
    }
})(current, previous);"

Claude will return a severity-rated issue table with specific fixes for every problem found.

Example 3: Debug an Issue

πŸ“‹ SYSTEM.md + prompts/debugger.md + contexts/flow-designer.md

"My Flow isn't triggering when a Change Request moves to 'Implement' state.
The flow was working last week. We deployed an update set yesterday.
Flow name: ITSM - Change State Implement Approval Flow"

Example 4: Architecture Decision

πŸ“‹ SYSTEM.md + prompts/architect.md

"We need to automate the approval process for Change Requests over $10,000.
Should we use a Business Rule with Script Include, Flow Designer, 
or a combination? We're on the Washington DC release with IntegrationHub."

Example 5: User Story Analysis (The /story skill)

πŸ“‹ SYSTEM.md + prompts/story-analyzer.md

"As an ITIL Manager, I want to automatically close stale incident tasks 
after 30 days of inactivity, so that my metrics are accurate."

Claude will output a Technical Solution Map detailing the exact ServiceNow artifacts needed (e.g., Scheduled Job, Business Rule), required context files, and acceptance criteria. It will then hand off execution to the /developer role to generate the final code.


πŸ› οΈ Customization

Add Your Team's Conventions

Edit SYSTEM.md Section 5 (Code Standards) to match your organization:

// Change the vendor prefix
x_acme_  β†’  x_yourcompany_

// Add custom naming rules
// Modify JSDoc requirements
// Adjust quality gate thresholds

Create Domain-Specific Context Modules

Create a new file in contexts/ for your specific domain:

# Context Module: HR Service Delivery

> **Module:** `hrsd.md`
> **Load when:** Building HRSD customizations
> **Depends on:** `_base.md`

---

## Key Tables
- sn_hr_core_case (HR Case)
- sn_hr_core_task (HR Task)
...

## Common Patterns
...

## Anti-Patterns
...

Create Custom Spec Templates

Copy any template from specs/ and add fields specific to your artifact type β€” catalog items, record producers, transform maps, etc.


πŸ—οΈ Architecture Principles

SNow-Claude is designed around these ideas:

  1. Composable, not monolithic β€” Load 3KB of context, not 50KB. Your Claude context window stays efficient.

  2. Convention over configuration β€” Sensible defaults for naming, logging, error handling. Override only what you need.

  3. Spec-driven, not prompt-dependent β€” Structured specs produce consistent output regardless of how you phrase your request.

  4. Quality gates built-in β€” Every code generation runs a 25-point mental checklist covering security, performance, maintainability, upgrade safety, and testability.

  5. Zero dependencies β€” Pure markdown. Works with Claude.ai, Claude API, Claude Desktop, or any interface that accepts text.


🀝 Contributing

Contributions are welcome! Here's how you can help:

Add a New Context Module

  1. Create contexts/your-module.md following the existing format
  2. Include: key concepts, patterns, anti-patterns, and decision guides
  3. Reference _base.md as a dependency
  4. Submit a PR with a usage example

Improve Existing Modules

  • Found a missing API pattern? Add it
  • Discovered a new anti-pattern? Document it
  • Have a better code example? Replace the old one

Add Spec Templates

  • Create templates for artifact types not yet covered (e.g., Transform Maps, Record Producers, Notifications)
  • Follow the YAML structure in existing templates

Report Issues

  • If Claude generates incorrect code using SNow-Claude, open an issue with:
    • Which modules were loaded
    • What you asked for
    • What Claude generated (the bad part)
    • What the correct output should be

πŸ“‹ Compatibility

Platform Supported
Claude.ai (Web) βœ…
Claude Projects βœ… (Recommended)
Claude Desktop App βœ…
Claude API βœ…
Other LLMs ⚠️ Untested β€” likely works with adjustments
ServiceNow Release Supported
Washington DC βœ…
Xanadu βœ…
Vancouver βœ… (minor API differences)
Utah and earlier ⚠️ Some APIs may differ

πŸ“„ License

MIT License β€” use it, modify it, share it. See LICENSE for details.


Stop prompting. Start engineering.
Built for ServiceNow developers who want Claude to write platform code the right way, every time.

About

A light-weight and powerful meta-prompting, context engineering and spec-driven development system for servicenow development

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors