agentleFS
Happy-Technologies-LLCHappy-Technologies-LLC/happy-platform-skills/skills/admin/script-sync/SKILL.md

script-sync

Skill40 starsChanged 4 months agoApache-2.0View on GitHub

Explicit pull, local edit, freshness check, and push workflow for ServiceNow scripts with Happy Platform MCP 5.1

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

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

    Use this explicit workflow to pull the current record, edit a local copy, check that the remote record has not changed, and push the …

    line 28
  2. Distinctive:

    Read and write access to the target script table

    line 39
  3. Distinctive:

    Use a bounded query with explicit fields.

    line 50
  4. Very specific:

    Stop if the query is ambiguous.

    line 63
  5. Very specific:

    Write only the returned script value to a local .js file.

    line 77
  6. Distinctive:

    After the freshness check passes, update only the intended field:

    line 115
  7. Distinctive:

    Do not use a background script for this normal record update.

    line 127
  8. Very specific:

    Read the record again with SN-Get-Record.

    line 132
  9. Very specific:

    Use explicit instance on every live record call, especially in concurrent work or critical environments.

    line 162
  10. Distinctive:

    Keep the original pulled version until verification succeeds.

    line 166
  11. Distinctive:

    Commit local changes only after reviewing the diff and remote verification.

    line 167
  12. Distinctive:

    Never store instance credentials or access tokens with local script files.

    line 168
  13. Distinctive:

    Do not push. Save the local edits, retrieve the new remote script, and perform a three-way merge using the original pull as the base.

    line 174
  14. Distinctive:

    Keep the explicit workflow, or build a separately reviewed deployment pipeline with equivalent freshness and verification gates.

    line 193

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Script Pull, Edit, and Push Workflow

Overview

Happy Platform MCP 5.1 has no automatic script synchronization or watch tool. Use this explicit workflow to pull the current record, edit a local copy, check that the remote record has not changed, and push the intended script field with SN-Update-Record.

This workflow favors reviewable changes and conflict detection over background automation. It works for Business Rules, Script Includes, Client Scripts, UI Scripts, UI Actions, Scheduled Jobs, and other records whose script is stored in a table field.

Prerequisites

  • Read and write access to the target script table
  • The target ServiceNow instance name
  • A local directory outside the installed npm package
  • Git or another local version-control system
  • The table name, record sys_id, and script field name
  • The correct application scope and update set selected before any push

Procedure

1. Discover the record

Use a bounded query with explicit fields. Always route the request to the intended instance.

Tool: SN-Query-Table
Parameters:
  table_name: sys_script_include
  query: name=IncidentUtils
  fields: sys_id,name,script,sys_updated_on,sys_mod_count,sys_scope
  limit: 5
  instance: dev

Stop if the query is ambiguous. Select one sys_id; do not update multiple same-named scripts by assumption.

2. Pull the authoritative record

Tool: SN-Get-Record
Parameters:
  table_name: sys_script_include
  sys_id: <script_sys_id>
  fields: sys_id,name,script,sys_updated_on,sys_mod_count,sys_scope
  instance: dev

Write only the returned script value to a local .js file. In adjacent local metadata, record the table, sys_id, instance, sys_updated_on, and sys_mod_count from this pull. Do not put ServiceNow credentials in the file or repository.

Example layout:

scripts/servicenow/script_includes/IncidentUtils.js
scripts/servicenow/script_includes/IncidentUtils.metadata.json

3. Edit and review locally

Edit the JavaScript in the IDE, run applicable static checks or tests, and inspect the Git diff. Keep the change scoped to the script field you intend to deploy.

4. Check remote freshness before pushing

Immediately before updating, retrieve the record again:

Tool: SN-Get-Record
Parameters:
  table_name: sys_script_include
  sys_id: <script_sys_id>
  fields: sys_id,script,sys_updated_on,sys_mod_count
  instance: dev

Compare both sys_updated_on and sys_mod_count with the saved pull metadata. Also compare the returned script with the original local base. If any value has changed, stop: pull the new version, review the remote changes, and merge them locally. Never overwrite a fresher remote edit automatically.

5. Push the reviewed script field

After the freshness check passes, update only the intended field:

Tool: SN-Update-Record
Parameters:
  table_name: sys_script_include
  sys_id: <script_sys_id>
  data:
    script: <reviewed_local_script>
  instance: dev

Do not use a background script for this normal record update. The generic MCP update is the primary operation and preserves per-call instance routing.

6. Verify the push

Read the record again with SN-Get-Record. Confirm that the remote script matches the reviewed local content and record the new sys_updated_on and sys_mod_count. Then verify the associated sys_update_xml capture in the current update set with a bounded SN-Query-Table query.

7. Repeat explicitly for later edits

There is no watch mode in Happy Platform MCP 5.1. For each change, repeat the freshness check, update, and verification. A local file watcher may run linting or tests, but it must not push ServiceNow changes without the explicit conflict check and update sequence above.

Supported Record Patterns

Script typeTableCommon script field
Business Rulesys_scriptscript
Script Includesys_script_includescript
Client Scriptsys_script_clientscript
UI Scriptsys_ui_scriptscript
UI Actionsys_ui_actionscript
Scheduled Jobsysauto_scriptscript
Fix Scriptsys_script_fixscript

Confirm unfamiliar table and field names with SN-Get-Table-Schema before adapting this workflow.

Best Practices

  • Set the application scope and update set before pushing configuration.
  • Use explicit instance on every live record call, especially in concurrent work or critical environments.
  • Pull immediately before editing and check freshness immediately before push.
  • Limit field selection to the script and concurrency metadata you need.
  • Keep the original pulled version until verification succeeds.
  • Commit local changes only after reviewing the diff and remote verification.
  • Never store instance credentials or access tokens with local script files.

Troubleshooting

The remote record changed after the pull

Do not push. Save the local edits, retrieve the new remote script, and perform a three-way merge using the original pull as the base. Re-run the freshness check after resolving the merge.

The update succeeded but no update-set record appears

Confirm the correct application scope and current update set, then inspect sys_update_xml. Do not retry blindly: first determine whether the table or field is update-set captured.

The local and remote scripts differ after update

Retrieve the record again and compare exact content. Check whether a business rule, formatter, or scoped-app policy transformed the value. Treat the remote record as authoritative until the discrepancy is understood.

Continuous synchronization is required

Happy Platform MCP 5.1 does not provide automatic pull, push, or watch tools. Keep the explicit workflow, or build a separately reviewed deployment pipeline with equivalent freshness and verification gates.

Related Skills

  • admin/update-set-management
  • development/business-rules
  • development/script-includes

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.