packages/opencode/src/bundled-skills/es5-compliance/SKILL.md
This skill should be used when the user asks to "write a business rule", "create a script include", "write server-side code", "fix SyntaxError", "background script", "scheduled job", "workflow script", or any ServiceNow server-side JavaScript development.
npx skillsauth add groeimetai/snow-flow es5-complianceInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
ServiceNow runs on Mozilla Rhino engine which only supports ES5 JavaScript (2009 standard). All server-side scripts MUST use ES5 syntax.
| ES6+ Syntax | ES5 Alternative |
| --------------------- | -------------------------------------- |
| const x = 5 | var x = 5 |
| let items = [] | var items = [] |
| () => {} | function() {} |
| `Hello ${name}` | 'Hello ' + name |
| for (x of arr) | for (var i = 0; i < arr.length; i++) |
| {a, b} = obj | var a = obj.a; var b = obj.b; |
| [a, b] = arr | var a = arr[0]; var b = arr[1]; |
| ...spread | Use Array.prototype.slice.call() |
| class MyClass {} | Use constructor functions |
| async/await | Use GlideRecord callbacks |
| Promise | Use GlideRecord with callbacks |
// WRONG - ES6
const MAX_RETRIES = 3
let currentUser = gs.getUser()
// CORRECT - ES5
var MAX_RETRIES = 3
var currentUser = gs.getUser()
// WRONG - Arrow functions
var active = incidents.filter((inc) => inc.active)
var process = () => {
return "done"
}
// CORRECT - ES5 functions
var active = []
for (var i = 0; i < incidents.length; i++) {
if (incidents[i].active) {
active.push(incidents[i])
}
}
var process = function () {
return "done"
}
// WRONG - Template literals
var message = `Incident ${number} assigned to ${user}`
// CORRECT - String concatenation
var message = "Incident " + number + " assigned to " + user
// WRONG - for...of
for (var item of items) {
gs.info(item)
}
// CORRECT - Traditional for loop
for (var i = 0; i < items.length; i++) {
gs.info(items[i])
}
// WRONG - Default parameters
function process(incident, priority = 3) {
// ...
}
// CORRECT - Manual defaults
function process(incident, priority) {
if (typeof priority === "undefined") {
priority = 3
}
// ...
}
Before deploying any server-side script:
const/let declarations - convert to var=> - convert to function()` - convert to string concatenation{a, b} - convert to explicit property accessfor...of loops - convert to index-based loopsClient-side scripts (Client Scripts, UI Policies) run in the browser and MAY support ES6+ depending on user's browser. However, for maximum compatibility, ES5 is still recommended.
development
This skill should be used when the user asks to "App Engine Studio", "workspace builder", "custom workspace", "AES", "low code", "app development", "studio", or any ServiceNow App Engine Studio development.
tools
This skill should be used when the user asks to "create a widget", "build a widget", "service portal widget", "sp_widget", "fix widget", "widget not working", "ng-click not working", or any Service Portal widget development.
development
This skill should be used when the user asks to "create chatbot", "virtual agent", "VA topic", "NLU", "conversation", "chat flow", "topic block", or any ServiceNow Virtual Agent development.
development
This skill should be used when the user asks to "vendor", "supplier", "contract", "procurement", "SLA", "vendor risk", "vendor performance", or any ServiceNow Vendor Management development.