mps-baselanguage
Skill1.7k starsChanged 2 months agoApache-2.0View on GitHub
Author and edit MPS `jetbrains.mps.baseLanguage` (Java) nodes — choose between the Java parser and JSON AST blueprints, map Java syntax to baseLanguage concepts/roles, harvest persistent member references, and validate. Use when writing class/method bodies, fields, expressions, statements, or any Java/BaseLanguage code inside MPS models, especially when BaseLanguage extensions (smodel, closures, collections) are involved.
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-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
- mps-aspect-typesystemSkill
- 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
6 rules. About 0 are common, 0 are distinctive, and 6 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.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Node equality: always use :eq: and :ne: (concepts NPEEqualsExpression / NPENotEqualsExpression).
- Very specific: line 21
Inherited methods: use the declaring class ref for baseMethodDeclaration, not the subclass that calls the method.
- Very specific: line 24
Prefer primitives: use string (StringType) over String (ClassifierType) where possible.
- Very specific: line 26
Surgical edits: when a single child changes prefer mps_mcp_update_node over rewriting the whole root — full-root rewrites churn persistent …
- Very specific: line 38
Scope: call mps_mcp_get_current_editor_root_node to know where you are inserting (method body, field initializer, root, …).
- Very specific: line 48
Repair: if a few refs are broken after insert, run mps_mcp_alter_nodes FIX_REFERENCES rather than re-harvesting all of them.
≈ “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 BaseLanguage (Java) Authoring
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.
jetbrains.mps.baseLanguage is MPS's Java-equivalent language. You edit it as an AST, not as text. Two authoring paths exist: the Java parser (mps_mcp_parse_java_and_insert) for plain Java, and JSON AST blueprints (mps_mcp_insert_root_node_from_json / mps_mcp_update_root_node_from_json / mps_mcp_update_node) for everything else — especially code that uses BaseLanguage extensions (jetbrains.mps.lang.smodel, jetbrains.mps.baseLanguage.closures, jetbrains.mps.baseLanguage.collections) or needs stable persistent member references.
Critical Directives
- Node equality: always use
:eq:and:ne:(conceptsNPEEqualsExpression/NPENotEqualsExpression). Never==or.equals()between SNode references. - Constructor return type:
ConstructorDeclaration.returnTypeMUST be aVoidTypenode. Leaving it empty fails validation. ClassCreatorwiring:ClassCreator.baseMethodDeclarationpoints at the constructor declaration, not the class.InstanceMethodCallOperation.baseMethodDeclarationpoints at the method declaration.new …is aGenericNewExpressionplus a creator: theGenericNewExpressionis theExpression; itscreatorchild isClassCreator,ArrayCreator,ArrayCreatorWithInitializer,AnonymousClassCreator, a collections creator, or smodelSNodeCreator(new node<C>()). Creators areAbstractCreators, notExpressions, so none of them can stand alone inReturnStatement.expression, an argument, or an initializer.- Inherited methods: use the declaring class ref for
baseMethodDeclaration, not the subclass that calls the method. E.g.addActionListeneris declared onAbstractButton, so use theAbstractButtonclass ref. - Expressions in statement lists: any
Expressionmust be wrapped inExpressionStatementto be valid inside aStatementList. - Variable declarations: in method bodies wrap
LocalVariableDeclarationinLocalVariableDeclarationStatement. InForStatement.variableuseLocalVariableDeclarationdirectly, no wrapper. - Prefer primitives: use
string(StringType) overString(ClassifierType) where possible; same forint,boolean, etc. - Compatibility: BaseLanguage core is Java 7 (including generics). When building AST directly (JSON blueprints), there is no lambda/record syntax — use the
jetbrains.mps.baseLanguage.closuresextension for closures. The Java parser (mps_mcp_parse_java_and_insert) additionally accepts the Java 8+ syntax MPS recognizes — most notably lambdas, which it maps toclosuresClosureLiterals (auto-imported whenpostProcess.importUsedLanguagesis on); a lambda only type-checks against a matching functional-type target. Constructs the parser does not recognize (e.g. records) still fail to parse. Seereferences/parse-java-tips.md. - Surgical edits: when a single child changes prefer
mps_mcp_update_nodeover rewriting the whole root — full-root rewrites churn persistent IDs and break incoming refs.
Choose Your Path
Pick the right authoring tool before you start:
mps_mcp_parse_java_and_insert— use for plain Java skeletons or bodies (classes, methods, statements, expressions), including the current MPS Console input (insert.mode: "console"to replace the console command, ormode: "child"/"replace"with aparentRef/targetRefinside the current console command for nested edits). Fastest path when no BaseLanguage extension is required.- JSON AST blueprints — use when the parser is unavailable, when the code uses BaseLanguage extensions (smodel, closures, collections), or when stable persistent references to members are required for downstream consumers.
- Mixed — use the parser for the skeleton with placeholders (e.g.
IntegerConstant,StringLiteral,IntegerType,StringType), then JSON-edit the placeholders to swap in extension-specific subtrees.
Common Workflow
- Scope: call
mps_mcp_get_current_editor_root_nodeto know where you are inserting (method body, field initializer, root, …). - Resolve dependencies: confirm the containing model imports the right languages (
jetbrains.mps.baseLanguageplus any extensions). Models for referenced nodes must also be imported. - Skeleton first: for any non-trivial root, insert a placeholder skeleton (
mps_mcp_create_root_node+mps_mcp_update_root_node_from_jsonor the parser) before filling member bodies. - Harvest references: for own members, run
mps_mcp_print_nodeon the skeleton to read persistent refs of constructors, methods, and fields. For JDK / library stubs, derive refs from the class ref using the URL-encoded signature formula (see references). - Apply bodies: edit one subtree at a time with
mps_mcp_update_node, or bulk-rewrite viamps_mcp_update_root_node_from_json. - Auto-resolution: for unambiguous local refs (a parameter, a local variable, a unique method name), pass the plain name as
target— MPS resolves it after insertion. For overloaded or stub members, use a persistent ref. - Validate in three gates:
dryRun: trueon insert tools — catches structural / assignability errors before mutationmps_mcp_check_root_node_problems— semantic checkingmps_mcp_alter_nodes MAKE— generation + compilation
- Repair: if a few refs are broken after insert, run
mps_mcp_alter_nodes FIX_REFERENCESrather than re-harvesting all of them.
Related Skills
mps-node-editing— general node mutation tools (mps_mcp_update_node, etc.). Load first if you have not seen them.mps-aspect-structure-concepts— defines what concepts exist and what roles they expose. Read when authoring a brand-new language whose concepts extend BaseLanguage.mps-quotations— light/quoted SNode literals embedded in BaseLanguage code (e.g. inside behavior or generator bodies).mps-model-manipulation—smodel+collections+closurespatterns layered on top of BaseLanguage; load when manipulating MPS nodes from BaseLanguage.mps-aspect-behavior,mps-aspect-typesystem,mps-aspect-constraints— each owns a language whose function bodies are BaseLanguage; reach for those skills when the surrounding aspect matters.
Reference Index
- Open
references/concept-mapping.mdwhen you need the Java-syntax → MPS-concept lookup table and the key role names (statements, expressions, types, declarations). - Open
references/json-patterns.mdwhen you need ready-to-paste JSON blueprints for common constructs (local variable, node-equality, instance-method call, anonymous class, array creation (sized or with initializer), super-constructor call, empty class template). - Open
references/critical-rules.mdwhen something fails validation and you want the rulebook onExpressionStatement,ClassCreator, anonymous classes, mandatory bodies,FieldReferenceOperation, etc. - Open
references/parse-java-tips.mdwhen usingmps_mcp_parse_java_and_insertand you need binary-expression priority handling, placeholder strategy, or post-insert verification steps. - Open
references/stub-references.mdwhen you need to point abaseMethodDeclarationat a JDK or library member — covers ref derivation, URL encoding, inherited-method handling, and the GET_ASSIGNABLE_REFERENCES fallback. - Open
references/json-ast-workflow.mdwhen authoring a non-trivial BaseLanguage root via JSON AST — covers staged skeleton → harvest → patch → validate, plus theClassCreatorvsInstanceMethodCallOperationref distinction. - Open
references/troubleshooting.mdwhen you hitdryRunerrors, broken-ref symptoms in generated Java (new (),???()), stale-ref errors, or "model checks pass but MAKE fails".
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.

