.claude/skills/max-js-agent/SKILL.md
Generate JavaScript code for Max js objects (V8) and Node for Max scripts (N4M)
npx skillsauth add taylorbrook/MAX-MSP_CC_Framework max-js-agentInstall 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.
The js agent generates JavaScript code for two MAX scripting environments: the js object (V8 JavaScript running inline in MAX) and node.script (Node.js via Node for Max / N4M). It handles all code that runs inside MAX's JavaScript engines.
Before any generation:
CLAUDE.md at project root -- follow js and Node for Max (N4M) domain-specific rulesDo NOT load: Object database JSON files -- this agent generates code, not patch structures. If the generated code needs to reference MAX objects (e.g., this.patcher.getnamed), consult the Patch agent for object names.
generate_n4m_script(handlers, dict_access=None) -- generate a complete N4M scriptconst maxAPI = require('max-api')maxAPI.addHandler('name', callback)maxAPI.outlet(value) to send data to MAXmaxAPI.post('message') for MAX console outputmaxAPI.getDict('name'), maxAPI.setDict('name', data)generate_js_script(num_inlets=1, num_outlets=1, handlers=None) -- generate a complete js V8 scriptinlets = N, outlets = Nbang(), msg_int(v), msg_float(v), list(), anything(msg, args)outlet(outlet_index, value) to send datapost('message') for MAX console outputthis.patcher.getnamed('object_name')validate_js(code) -- validate js V8 script structurevalidate_n4m(code) -- validate N4M script structuredetect_js_type(code) -- determine if code is N4M or js V8| Feature | N4M (node.script) | js (V8 object) | |---------|-------------------|----------------| | Module system | CommonJS (require) | None (global scope) | | MAX communication | maxAPI.outlet() | outlet() | | Async support | Full (async/await, Promises) | Limited | | File I/O | fs module | Not available | | Network | http, fetch, etc. | Not available | | Patcher access | Via maxAPI | this.patcher | | Best for | Data processing, I/O, network | UI logic, algorithmic control |
trigger (t) for any control-rate outlet that fans out to 2+ destinations in the .maxpat wiring around js/node.script boxesShared Capabilities: See
.claude/skills/references/shared-capabilities.mdfor Control-Rate Fan-Out Rule, Assistance Comments, Aesthetic Capabilities, Layout Options, Editing Functions, and Edit Workflow reference.
When generating patches with package objects (BEAP, Vizzie, etc.), read .claude/max-objects/PACKAGES.md for:
When scripting interactions with package modules:
this.patcher.getnamed() to find bpatcher boxes and send messages to their inletsObjectDatabase.get_package_objects("BEAP") to programmatically list available modulesDomain focus: Edit js/node.script box configurations; code file edits are direct file writes, not .maxpat edits.
generate_*_script() functionvalidate_n4m() or validate_js()write_js() to project's generated/ directoryread_patch() and patcher.analyze()finalize_patch(patcher, is_new=False) -- regenerates cable midpoints and populates assistance comments without repositioning existing objectsvalidate_patch(patcher)save_patch_roundtrip()data-ai
Design and position UI controls for MAX patches in presentation and patching mode
testing
Analyzes user task descriptions and dispatches to the correct specialist agent(s) for MAX/MSP generation
data-ai
RNBO export-aware patch generation, target validation, and param mapping
data-ai
Generate MAX patches with control flow, message routing, subpatcher organization, and MIDI handling