mps-aspect-actions
Skill1.7k starsChanged 2 months agoApache-2.0View on GitHub
Use when defining or editing MPS node factories (the "actions" aspect) — `NodeFactories` roots, per-concept `NodeFactory` setup functions that initialize a freshly created node and optionally copy data from a replaced `sampleNode`, plus the actions aspect's `CopyPasteHandlers` and `PasteWrappers` roots. Reach for this skill when a substitution, side transform, completion replacement, or `add new initialized(...)` should preserve fields from the node it is replacing, or when defaults set in a constructor are not enough.
Trending
Quiet since October.thin dataabout the whole repository
Who's talking about JetBrains/MPS
- mbeddr/mps-gradle-plugin“Null pointer exception on generate”GitHub · May 18, 2020 · 1 reactions
- nebojsa-vuksic/skill-atlas“Scan every repository of an organization or user”GitHub · Oct 1, 2026
- modelix/modelix.editor“Implement MPS shortcuts”GitHub · Feb 21, 2023
The biggest 3 of 3 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repository83 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- actionsSkill
- bugfix-workflowSkill
- code-styleSkill
- commitsSkill
- debuggingSkill
- mps-aspect-accessoriesSkill
- mps-aspect-behaviorSkill
- mps-aspect-constraintsSkill
- mps-aspect-dataflowSkill
- mps-aspect-editor-menus-and-keymapsSkill
- mps-aspect-editorSkill
- mps-aspect-generation-planSkill
- mps-aspect-generatorSkill
- mps-aspect-intentionsSkill
- mps-aspect-migrationsSkill
- mps-aspect-structure-conceptsSkill
- mps-aspect-textgenSkill
- mps-aspect-typesystemSkill
- mps-baselanguageSkill
- mps-build-languageSkill
- mps-consoleSkill
- mps-distribution-buildSkill
- mps-dsl-memorySkill
- mps-ide-pluginSkill
- mps-lang-core-xmlSkill
- mps-language-analysisSkill
- mps-language-aspects-overviewSkill
- mps-language-inheritanceSkill
- mps-language-modularitySkill
- mps-mcp-workflowSkill
- mps-model-manipulationSkill
- mps-node-editingSkill
- mps-project-managementSkill
- mps-quotationsSkill
- mps-run-configurationsSkill
- mps-testsSkill
- registrySkill
- skill-optimization-studySkill
- ssrSkill
- teamcity-cliSkill
- actionsSkill
- bugfix-workflowSkill
- code-styleSkill
- commitsSkill
- debuggingSkill
- mps-aspect-accessoriesSkill
- mps-aspect-actionsSkill
- mps-aspect-behaviorSkill
- mps-aspect-constraintsSkill
- mps-aspect-dataflowSkill
- mps-aspect-editor-menus-and-keymapsSkill
- mps-aspect-editorSkill
- mps-aspect-generation-planSkill
- mps-aspect-generatorSkill
- mps-aspect-intentionsSkill
- mps-aspect-migrationsSkill
- mps-aspect-structure-conceptsSkill
- mps-aspect-textgenSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
Use SPropertyAccess (ref property → PropertyDeclaration) for properties.
- Very specific: line 24
After editing, validate with mps_mcp_check_root_node_problems on the NodeFactories root and rebuild the language.
- Very specific: line 28
Ensure an actions model exists (<lang>/models/<lang>.actions.mps.
- Very specific: line 29
Create the NodeFactories root via mps_mcp_insert_root_node_from_json (blueprint in references/json-blueprints.md).
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
MPS Actions Aspect
Loading companion skills
Companion names in this skill are lazy dependencies: load only those relevant to the current task. If this skill came from an MCP server, use the host's skill loader to resolve the companion's unique discovered entry URI on the same host-assigned originating server. If the host has no server-backed skill loader, stop and report that limitation; do not silently fall back to a filesystem copy. If this skill came from a filesystem catalog, load the named sibling from that same catalog at <skills-root>/<skill-name>/SKILL.md, even if remote skill loaders are also available. Do not invent a tool name or server endpoint.
The actions aspect customizes how new nodes of a concept are constructed by the MPS editor — typically during substitution, side transformations, right-transform/<ctrl-space> replacement, or auto-replace. The framework produces an empty instance of the target concept; the setup function then populates it, often copying fields from the node it is replacing (sampleNode). Lives in <lang>/models/<lang>.actions.mps, language jetbrains.mps.lang.actions. The aspect also hosts copy/paste handlers and paste wrappers (see references/copy-paste-and-paste-wrappers.md).
Critical Directives
- One
NodeFactoriesroot per actions model; add per-conceptNodeFactorychildren to it. Do not create one root per concept. - One
NodeFactoryperapplicableConcept. Multiple factories for the same concept are not merged. - The setup function runs before
newNodeis attached to the model.newNode.parent, ancestors, and model-wide queries return null/empty. Use theenclosingNodeimplicit parameter when you need the would-be parent. sampleNodeis typed asnode<BaseConcept>. Always narrow withifInstanceOf (sampleNode is <Concept> original)before accessing fields — direct dereference will NPE or fail to compile.- Use
SPropertyAccess(refproperty→PropertyDeclaration) for properties; useSLinkAccess(reflink→LinkDeclaration) for both containment and reference child roles. - Factories do not fire for quotations
<C()>,model.add root(<C()>),model.add new root(C), or pure rendering. If you need factory-initialised nodes in generator code, usenew node<C>()with explicit property assignments or route creation through an intention that callsadd new initialized. - Edit factories through MPS MCP tools (
mps_mcp_insert_root_node_from_json,mps_mcp_update_node, optionallymps_mcp_parse_java_and_insertwithfeatureKind: "STATEMENTS"for the body). Do not hand-edit.mpsfiles. - After editing, validate with
mps_mcp_check_root_node_problemson theNodeFactoriesroot and rebuild the language.
Common-Path Workflow
- Ensure an actions model exists (
<lang>/models/<lang>.actions.mps; create withmps_mcp_create_model, passingmoduleName: "<lang>"andmodelName: "<lang>.actions"— aspect IDactions, case-sensitive, no@suffix; see aspect-model-stereotypes.md). Used languages:jetbrains.mps.lang.actions,jetbrains.mps.baseLanguage,jetbrains.mps.lang.smodel. Addjetbrains.mps.lang.coreas the base. Import the structure model of your language. - Create the
NodeFactoriesroot viamps_mcp_insert_root_node_from_json(blueprint inreferences/json-blueprints.md). Setname. - For each concept that needs custom initialization, add a
NodeFactorychild viamps_mcp_update_node. SetapplicableConcept; attach aNodeSetupFunctionwith aStatementListbody. - Fill the body. Typical pattern:
ifInstanceOf (sampleNode is <Concept> original) { newNode.<prop> = original.<prop>; ... }. Cross-type narrowing is allowed — seereferences/setup-function-bodies.md. - Validate with
mps_mcp_check_root_node_problems, rebuild the language, exercise in a sandbox.
Implicit Parameters of NodeSetupFunction
| Alias | FQN | Type | Nullable | Notes |
newNode | jetbrains.mps.lang.actions.structure.NodeSetupFunction_NewNode | node<applicableConcept> | no | The freshly created empty node. Populate it. |
sampleNode | jetbrains.mps.lang.actions.structure.NodeSetupFunction_SampleNode | node<BaseConcept> | yes | Node being replaced, if any. Narrow with ifInstanceOf. |
enclosingNode | jetbrains.mps.lang.actions.structure.NodeSetupFunction_EnclosingNode | node<BaseConcept> | yes | Prospective parent container; null during root-node creation or programmatic creation outside the editor. |
index | jetbrains.mps.lang.actions.structure.NodeSetupFunction_Index | int | — | 0-based position in the parent collection, or 0 if not in a collection. |
model | (plain VariableReference in generated Java) | SModel | yes | The SModel newNode will be inserted into. Most factories don't use this. |
Signature surfaced in the editor: (newNode, sampleNode, enclosingNode, index, model) -> void.
Related Skills
mps-aspect-behavior— concept constructors are the place to set defaults that don't depend on the node being replaced. Use a constructor for intrinsic defaults, aNodeFactoryfor context-sensitive carry-over.mps-aspect-intentions— intentions that calladd new initialized(...)route through factories. Load themps-aspect-intentionscompanion skill from the same origin when this applies, then openreferences/factory-initialized.mdin themps-aspect-intentionsskill root for theNF_*family.mps-aspect-generator— generator output bypasses factories (quotations andadd new rootdo not fire factories). Document where the generator must mimic the factory behavior.mps-model-manipulation— full smodel reference:SLinkAccessvsSPropertyAccess,IfInstanceOfStatement,IfInstanceOfVariable, and theNF_*family. For a setup-function body — copying properties and child links ontonewNode— open onlyreferences/property-and-mutation-ops.mdin themps-model-manipulationskill root after loading that companion skill from the same origin.mps-aspect-structure-concepts— when adding the concept thatapplicableConcepttargets.mps-aspect-constraints— forcanBe*rules that gate insertion before a factory ever runs.
Reference Index
Start here — most common case: one NodeFactory that initializes a freshly created node (optionally copying from sampleNode) → read only references/setup-function-bodies.md, plus references/json-blueprints.md if you insert the root through MCP; copy/paste behaviour → only references/copy-paste-and-paste-wrappers.md.
- Open
references/node-factories-and-triggers.mdwhen you need the validated concept ref forNodeFactories/NodeFactory/NodeSetupFunction, the rule that MPS runs every applicable factory up the concept's super-concept and implemented-interface chain (not just the one whoseapplicableConceptexactly matches), and the precise list of triggers that fire / do not fire a factory. - Open
references/setup-function-bodies.mdwhen writing the function body — copying properties vs. child links (SPropertyAccessvsSLinkAccess), cross-type narrowing inifInstanceOf, the verbatim ChemMastery (same-type property copy) and Kaja (cross-type child-link copy) examples, and the JSON shape for anAssignmentExpressionoverSLinkAccess. - Open
references/json-blueprints.mdwhen inserting theNodeFactoriesroot or aNodeFactorychild via MCP — minimal blueprints, the fullIfInstanceOfStatementbody, and the tip on usingmps_mcp_parse_java_and_insertto skip the blueprint. - Open
references/copy-paste-and-paste-wrappers.mdwhen the language needs custom copy pre-processing, paste post-processing, or paste-time wrapping of nodes — these other roots also live in the actions aspect. - Open
references/concept-reference.mdfor the validated FQN/ref table — thejetbrains.mps.lang.actionsconcepts plus the supporting BaseLanguage and smodel concepts used in setup bodies. - Open
references/common-failures.mdwhen a freshly created node always has defaults,sampleNode.<prop>does not compile,enclosingNodeis unexpectedly null, the factory fires twice, or it does not fire from quotations / generator code.
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
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.

