business-rule-patterns

business-rule-patterns is a skill for Claude Code from serac-labs/serac. It costs 43 tokens per session (1,283 once invoked), scanned A, original, Apache-2.0.

Guidance for writing ServiceNow business rules, which are server-side scripts that run when records are displayed, created, changed, or deleted. It covers rules that run before saving, after saving, in the background, or when a form loads.

In plain words
What is it for?
Use it to compare old and new record values, stop invalid updates, change fields, create related records, send notifications, or dispatch slow work asynchronously.
Why use it?
It helps place record validation, field updates, notifications, and heavy processing at the appropriate point in ServiceNow's record lifecycle. It also helps avoid unwanted repeated rule execution.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the skills plugin — 56 skills shipped together

Good fit Use it to compare old and new record values, stop invalid updates, change fields, create related records, send notifications, or dispatch slow work asynchronously.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/serac-labs/serac/business-rule-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add serac-labs/serac --skill business-rule-patterns
Clone the repo
git clone --depth 1 https://github.com/serac-labs/serac

Made for: Claude Code.

Or install skills, the plugin that ships this one along with the rest of its 56 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for business-rule-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/serac-labs/serac/business-rule-patterns/github.svg)](https://agentmods.dev/skills/serac-labs/serac/business-rule-patterns)
Your own site
<a href="https://agentmods.dev/skills/serac-labs/serac/business-rule-patterns"><img src="https://agentmods.dev/badge/skills/serac-labs/serac/business-rule-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for business-rule-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/serac-labs/serac/business-rule-patterns"><img src="https://agentmods.dev/badge/skills/serac-labs/serac/business-rule-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,283 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high System Prompt Leakage · line 164
    Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
    Fix: Remove any instructions that reveal, print, or output system prompts or internal rules. System instructions should never be exposed to end users.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.01283
Opus 5 $0.00022 $0.00642
Sonnet 5 $0.00009 $0.00257
Haiku 4.5 $0.00004 $0.00128

Measured 9d ago against content hash 4e9c19a55148, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

business-rule-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packages/skills/business-rule-patterns/SKILL.md · 196 lines

How it starts

The opening of the file, as written. The whole thing — 196 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Business Rule Best Practices for ServiceNow

Business Rules are server-side scripts that execute when records are displayed, inserted, updated, or deleted.

When to Use Each Type

Type Timing Use Case Performance Impact
Before Before database write Validate, modify current record Low
After After database write Create related records, notifications Medium
Async Background (after commit) Heavy processing, integrations None (background)
Display When form loads Modify form display, set defaults Low

Available Objects

// In Business Rules, these are always available:
current // The record being operated on
previous // The record BEFORE changes (update/delete only)
gs // GlideSystem utilities

Before Business Rules

Use for validation and field manipulation:

// Prevent update if condition not met
;(function executeRule(current, previous) {
  if (current.state == 7 && previous.state != 6) {
    current.setAbortAction(true)
    gs.addErrorMessage("Must resolve before closing")
  }
})(current, previous)
// Auto-populate fields
;(function executeRule(current, previous) {
  if (current.isNewRecord()) {
    current.setValue("caller_id", gs.getUserID())
    current.setValue("opened_by", gs.getUserID())
  }
})(current, previous)

Never do in Before rules:

  • Call current.update() (causes recursion!)
  • Query other tables (keep it fast)
  • External API calls

After Business Rules

Use for related record operations:

// Create child record when priority is P1
;(function executeRule(current, previous) {
  if (current.priority.changesTo(1)) {
    var task = new GlideRecord("task")
    task.initialize()
    task.setValue("short_description", "P1 Follow-up: " + current.number)
    task.setValue("parent", current.sys_id)
    task.insert()
  }
})(current, previous)

Read the full file on GitHub · 196 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 196 lines · 43 tokens per session scan A 4e9c19a55148

Subscribe to this mod's changes

business-rule-patterns is a skill published in the GitHub repository serac-labs/serac (78 stars, last pushed 14d ago), licensed Apache-2.0. It adds 43 tokens to every session and 1,283 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.