From iris-dev
Provides syntax rules, hard checks, and examples for ObjectScript MAC routines including label structure, #include, $ZTRAP error handling, extrinsic functions. Use for .mac files, legacy CHUI apps, pre-class IRIS code.
npx claudepluginhub intersystems-community/iris-devThis skill uses the workspace's default tool permissions.
Before generating any `.MAC` code, verify all 8 items:
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Before generating any .MAC code, verify all 8 items:
| # | Check | Wrong | Right |
|---|---|---|---|
| 1 | Routine entry | MYROUTINE() (parens) | MYROUTINE (no parens) |
| 2 | Label indentation | LABEL { (braces) | LABEL then tab-indented body |
| 3 | Include syntax | Include %occStatus | #include %occStatus |
| 4 | Extrinsic call | ##class(X).Method() | $$LABEL(args) or $$LABEL^RTN(args) |
| 5 | Error trap | Try { } Catch e { } | Set $ZTRAP="ERRHAN" ... ERRHAN Set err=$ZE |
| 6 | Cross-routine call | .Method() | Do LABEL^ROUTINE or $$FUNC^ROUTINE(args) |
| 7 | Variable scope | Method-scoped (class) | New var to create local scope |
| 8 | Return from subroutine | Return | Quit (no value) in a DO label |
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
MYROUTINE
Set $ZTRAP = "ERRHAN"
; ... code that might error ...
Quit
;
ERRHAN
Set err = $ZE
Set $ZTRAP = ""
Write "Error: ",err,!
Quit
iris_read_document("MYROUTINE.mac") → returns full source
iris_write_document("MYROUTINE.mac", fixedCode) → writes + compiles
iris_list_documents(filter="PATH*", category="MAC") → lists routines
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 subroutinesQuit value in a Do-called subroutine → exits subroutine cleanly; Quit with no value for void