mps-aspect-typesystem
Skill1.7k starsChanged 2 months agoApache-2.0View on GitHub
Use when authoring or debugging MPS typesystem — inference rules (`typeof :==: / :<=: / :>=:`), `SubtypingRule`, `ComparisonRule`, `InequationReplacementRule`, `SubstituteTypeRule`, `WhenConcreteStatement` blocks, `NonTypesystemRule` checking rules, `TypesystemQuickFix`, error/warning/info reports with `messageTarget` highlighting and quick-fix wiring (`helginsIntention`), and shared BaseLanguage helpers in the typesystem model. Reach for this skill whenever the task involves editing `<lang>/languageModels/typesystem.mps`.
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-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
8 rules. About 0 are common, 0 are distinctive, and 8 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.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 33
After edits run mps_mcp_check_root_node_problems, compile the language, and test on sample models.
- Very specific: line 37
Create a typesystem model (mps_mcp_create_model with moduleName: "<lang>" and modelName: "<lang>.typesystem" — aspect ID typesystem, …
- Very specific: line 38
Add used languages: jetbrains.mps.lang.typesystem, and any languages used in bodies (smodel, collections, closures, baseLanguage).
- Very specific: line 39
Add InferenceRule roots for concepts whose types you compute (see references/inference-rules.md).
- Very specific: line 40
Add SubtypingRule / ComparisonRule / InequationReplacementRule / SubstituteTypeRule roots for the type lattice (see …
- Very specific: line 41
Add NonTypesystemRule roots for checks that are not about types (see references/non-typesystem-checking.md).
- Very specific: line 42
Add TypesystemQuickFix roots for any fix you want to attach to reports.
- Very specific: line 43
Write bodies with BaseLanguage + smodel.
≈ “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 Typesystem and Checking 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 typesystem aspect gives nodes types and reports semantic errors. It combines two related sub-aspects:
- Typesystem rules — compute types and constraints on them (
InferenceRule,SubtypingRule,InequationReplacementRule,ComparisonRule,SubstituteTypeRule). - Non-typesystem checking rules — produce errors/warnings/messages without contributing to type inference (
NonTypesystemRule, a.k.a. "checking rule").
Lives in <lang>/languageModels/typesystem.mps, language jetbrains.mps.lang.typesystem. Rule bodies are BaseLanguage + smodel + collections + closures.
Critical Directives
- One
InferenceRule(or other root rule) per concept whose type/check you compute. Multiple rules collectively constrain a node — keep each rule focused. - The
inferprefix makes an inequation soft (the solver tries to satisfy it, will not immediately error). Withoutinfer, violating the inequation reports an error. Choose deliberately. - In equation/inequation JSON, both
leftExpressionandrightExpressionareTypeClauseslots — always wrap the real Expression in aNormalTypeClause(normalTypechild holds the actual Expression). Do not put the Expression directly underleftExpression/rightExpression. - TextGen-style dispatch caveat does not apply here; typesystem rules are inherited via concept hierarchy, but the
overridesproperty on a rule suppresses inherited rules from superconcepts. - TextGen / typesystem error messages: wrap smodel expressions that render types with
<...>presentation:error "Expected " + <expectedType> + " but got " + <actualType> -> node;. Avoid rawtoString. when concrete (typeof(expr) as v) { ... }defers a block until the type is fully resolved — use it before deciding whether to report an error or assign a result type.- Quick fixes (
TypesystemQuickFix) are roots, not executed automatically — the user triggers them via the UI. Wire them into a report through thehelginsIntentionslot (TypesystemIntentionwrapper withquickFixref +actualArguments). Seereferences/quick-fixes.md. - Reusable helper code (utility classes, shared algorithms) can live as a plain BaseLanguage
ClassConceptroot directly in the typesystem model. No separate utility module is required. - For MPS-typed return types (
sequence<node<X>>,list<node<X>>) the Java parser gives backList<SNode>— fix perreferences/variable-declarations.mdin themps-model-manipulationskill root after loading that companion skill from the same origin. - Edit typesystem models through MPS MCP tools (
mps_mcp_insert_root_node_from_json,mps_mcp_update_node,mps_mcp_parse_java_and_insert). Do not hand-edit.mpsfiles. - After edits run
mps_mcp_check_root_node_problems, compile the language, and test on sample models.
Common-Path Workflow
- Create a
typesystemmodel (mps_mcp_create_modelwithmoduleName: "<lang>"andmodelName: "<lang>.typesystem"— aspect IDtypesystem, case-sensitive, no@suffix; see aspect-model-stereotypes.md) if absent. - Add used languages:
jetbrains.mps.lang.typesystem, and any languages used in bodies (smodel,collections,closures,baseLanguage). - Add
InferenceRuleroots for concepts whose types you compute (seereferences/inference-rules.md). - Add
SubtypingRule/ComparisonRule/InequationReplacementRule/SubstituteTypeRuleroots for the type lattice (seereferences/lattice-rules.md). - Add
NonTypesystemRuleroots for checks that are not about types (seereferences/non-typesystem-checking.md). - Add
TypesystemQuickFixroots for any fix you want to attach to reports; wire them via ahelginsIntention/TypesystemIntentionchild of thewarning/error/infostatement (seereferences/quick-fixes.md). - Write bodies with BaseLanguage + smodel. Use
when concrete(references/when-concrete.md) when you need resolved types before checking. For helper code, place aClassConceptroot directly in the typesystem model and call it from rules. - Validate:
mps_mcp_check_root_node_problemsplus compile the language and test on sample models. AhelginsIntention-wired quick fix now surfaces in the check report'squickFixesarray and can be applied withmps_mcp_apply_intention(nodeReference = <problem node>, intentionId = <fix id>); an auto-applicable fix runs underautoApplyQuickFixes=true.
Related Skills
mps-aspect-behavior— behavior methods called from rule bodies vianode.method(); common host forgetType/isAssignableFrom-style helpers callable from typesystem.mps-aspect-constraints— non-type validation often lives in constraints; consider whether a check belongs there before adding aNonTypesystemRule.mps-aspect-intentions— distinct fromTypesystemQuickFix(intentions are user-invoked from caret; quick fixes attach to a report).mps-model-manipulation— full BaseLanguage / smodel / collections reference used inside rule bodies (StatementList,DotExpression, smodel operations, theList<SNode>→sequence<node<X>>return-type fix); for an inference or checking rule body open onlyreferences/dot-expression-basics.mdin themps-model-manipulationskill root after loading that companion skill from the same origin.mps-quotations—<type>literals in rule bodies are heavy quotations;%(expr)%splices use theAntiquotationfamily. The typesystem model usually usesjetbrains.mps.lang.quotationas a used language.mps-aspect-structure-concepts— when introducing the type concept(s) the rules target.
Reference Index
Start here — most common case: one InferenceRule that types a concept → read only references/inference-rules.md, plus references/json-blueprints.md when inserting it through MCP; a checking rule that reports an error → only references/non-typesystem-checking.md; a type that stays undefined → only references/common-failures.md.
- Open
references/inference-rules.mdwhen writing or debugging anInferenceRule— the operator vocabulary (:==:,:<=:,:>=:, softinfer, strong:<<=:/:>>=:), free type variables (var elementType;),join(A | B),%(...)%anti-quotations in<...>literals, and the four worked examples (StringLiteral, ParenthesizedExpression, TernaryOperator, ForEachStatement). - Open
references/when-concrete.mdwhen a rule must wait for a resolved concrete type before deciding —WhenConcreteStatementshape, nestedwhen concreteblocks,operation type(op, leftType, rightType), and the bound-variable plumbing (WhenConcreteVariableDeclaration/WhenConcreteVariableReference). - Open
references/lattice-rules.mdfor the type-lattice rules —SubtypingRule(single supertype ornlist<>of supertypes),InequationReplacementRule(a.k.a. "replacement rule", structural subtyping withisApplicableClause,isWeak,equationInfo.getNodeWithError()),ComparisonRule(booleanbody,weak), andSubstituteTypeRule(attributedNode, return-or-null pattern). - Open
references/non-typesystem-checking.mdwhen adding aNonTypesystemRule("checking rule") —error / warning / info "msg" -> node;,isStrongSubtype(typeof(x) :<< t)for strict-subtype tests, and theCheckExcessTypeCastsexample. - Open
references/quick-fixes.mdwhen authoring aTypesystemQuickFixand wiring it into a report —QuickFixArgumentdeclarations,executeBlock/descriptionBlock, the three sample fixes (RemoveExcessTypeCast,RemoveMisplacedDash,HideCardinalityOne), and the full JSON for thehelginsIntention/TypesystemIntention/TypesystemIntentionArgumentplumbing. - Open
references/messages-and-helpers.mdwhen crafting messages — the<...>type-rendering convention,messageTargetto highlight just a property/reference/child cell,PropertyMessageTargetshape, and shared BaseLanguage helper roots (ElementSummarypattern). - Open
references/json-blueprints.mdwhen inserting nodes via MCP — body-level skeletons for each equation/inequation kind,ReportErrorStatement/WarningStatement/InfoStatementwith optionalhelginsIntention/messageTarget, anti-quotation handling inside quotations, minimal rule-root skeletons, and the full validated concept reference with FQNs and concept refs. - Open
references/common-failures.mdwhen a type isundefined, subtyping isn't applied, error messages render badly, return types fight the Java parser, rules cycle, quick fixes aren't offered,when concretebodies never run, orSubstituteTypeRuleseems ignored.
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.

