intersystems-community/iris-agentic-dev/objectscript-mac-routines

Claude Code and agent skill by intersystems-community/iris-agentic-dev

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

MAC routine syntax — label-based structure, #include, $ZTRAP error traps, extrinsic functions, and Quit vs Return. Use when working with .mac files, legacy CHUI applications, or any pre-class ObjectScript code.

Install

npx vskill@latest install intersystems-community/iris-agentic-dev/objectscript-mac-routines

SKILL.md

MAC Routine Hard Gate — Check BEFORE Writing Code

Before generating any .MAC code, verify all 8 items:

#CheckWrongRight
1Routine entryMYROUTINE() (parens)MYROUTINE (no parens)
2Label indentationLABEL { (braces)LABEL then tab-indented body
3Include syntaxInclude %occStatus#include %occStatus
4Extrinsic call##class(X).Method()$$LABEL(args) or $$LABEL^RTN(args)
5Error trapnoneTry { } Catch e { } or Set $ZTRAP="ERRHAN"
6Cross-routine call.Method()Do LABEL^ROUTINE or $$FUNC^ROUTINE(args)
7Variable scopeMethod-scoped (class)New var to create local scope
8Return from subroutinenoneQuit or Return

Correct MAC Structure

objectscript
MYROUTINE
;Entry point - no parens, no braces
Set x = $$CALC(3,4)
Quit
;
CALC(a,b) ;Extrinsic function - called with $$CALC(a,b)
Quit a+b
;
HELPER ;Subroutine - called with Do HELPER
Write "done",!
Quit

$ZTRAP Error Handling (legacy pattern)

objectscript
MYROUTINE
Set $ZTRAP = "ERRHAN"
; ... code that might error ...
Quit
;
ERRHAN
Set err = $ZE
Set $ZTRAP = ""
Write "Error: ",err,!
Quit

Reading and writing .MAC via Atelier

VS Code's isfs:// provider does not always expose routines, so go at the Atelier REST API directly. The document name includes the .mac extension.

bash
# Read
iris-agentic-dev tool iris_doc --args '{"mode":"get","name":"MYROUTINE.mac"}'
# Write (checks the document out of source control first when one is configured)
iris-agentic-dev tool iris_doc --args '{"mode":"put","name":"MYROUTINE.mac","content":"MYROUTINE\n Quit\n"}'
# List MAC routines
iris-agentic-dev tool iris_doc --args '{"mode":"list","pattern":"*.mac"}'

Without the CLI, call Atelier with curl -K -, which reads the credential from stdin so it stays out of the process list. IRIS_SCHEME is https for an HTTPS endpoint:

bash
printf 'user = "%s:%s"\n' "${IRIS_USERNAME:-_SYSTEM}" "$IRIS_PASSWORD" \
| curl -s -K - "${IRIS_SCHEME:-http}://${IRIS_HOST:-localhost}:${IRIS_WEB_PORT:-52773}/api/atelier/v1/${IRIS_NAMESPACE:-USER}/doc/MYROUTINE.mac"

A PUT to the same URL with ?ignoreConflict=1 overwrites regardless of the server timestamp.

A PUT does not compile — follow it with POST /action/compile and a body of ["MYROUTINE.mac"], or use the iris_compile MCP tool. Always re-read after writing; the PUT response body is not a reliable confirmation. See the compile skill.

Common Bugs in Legacy MAC Code

  • result used after a For loop but never initialized → <UNDEFINED> if no rows
  • #include file not found → check ^%INCLUDE global or .inc file spelling
  • $$FUNC vs Do LABEL confusion: $$ for functions returning values, Do for subroutines
  • Quit value in a Do-called subroutine → exits subroutine cleanly; Quit with no value for void

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/intersystems-community/iris-agentic-dev/objectscript-mac-routines/badge)](https://verified-skill.com/skills/intersystems-community/iris-agentic-dev/objectscript-mac-routines)

Something wrong with this skill or its page? Tell us.