Official agent skill

Mps Collections And Closures

by JetBrains in JetBrains/MPS

A skill your agent uses when writing or editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods, typesystem and checking rules, generator…

OfficialApache-2.0Auto-check passed

Install Mps Collections And Closures

skills CLI
$ npx skills add JetBrains/MPS --skill mps-collections-and-closures -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install JetBrains/MPS mps-collections-and-closures --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/JetBrains/MPS.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/mps-collections-and-closures .claude/skills/mps-collections-and-closures && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mps-collections-and-closures
GitHub stars
1.7k
Token cost
~2.2k tokens
SKILL.md length
852 words
Files
16 (incl. references)
Skills in repo
41
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when writing or editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods, typesystem and checking rules, generator…

  • Works in 4 steps: Get the receiver — a node sequence… → Wrap it in the operation — the… → Declare collection-typed locals and… → …
  • Editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods
  • SKILL.md covers Loading companion skills, Minimum reading set, Critical Directives and Common-path workflow, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Mps Collections And Closures is an agent skill from JetBrains/MPS, published by the product's own GitHub organization. Use when writing or editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods, typesystem and checking rules, generator queries, constraints, intentions, plugin or console code, with or without nodes. Covers collection types (sequence<T, list<T, set<T, map<K,V, sorted variants), creators, sequence operations (.where, .select, .translate, .any, .sortBy, .toList, …), list/set/map mutators, the collections foreach vs the BaseLanguage foreach, closure literals ({…

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 17 other files, including reference files (for example `references/closures-catalog.md`, `references/collections-catalog.md` and `references/collections-catalog/concept-ids.md`).

It works with Java and JetBrains IDEs. The repository describes itself as: JetBrains Meta programming System. The licence is Apache-2.0.

When your agent uses it

  • Editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods
  • Typesystem and checking rules
  • Generator queries

Example prompts

  • “/mps-collections-and-closures”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Get the receiver — a node sequence (node.children, .descendants) is built from references/dot-expression-basics.md in the…
  2. Wrap it in the operation — the DotExpression + *Operation + ClosureLiteral blueprint from references/sequence-operation-blueprints.md.
  3. Declare collection-typed locals and return types explicitly — the Java parser produces a wrong ClassifierType for them. Node-element types…
  4. Validate with mps_mcp_check_root_node_problems(nodeReference, onlyNodesWithProblems=true); on a confusing error, open…

What it can do on your machine

Read from SKILL.md and the folder at commit 3e9cfcd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mps Collections And Closures loads about 2.2k tokens when it runs, and up to ~12k if it reads all its reference files. Until then it costs about 233 tokens; SKILL.md has 852 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~233
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~12k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from JetBrains/MPS at commit 3e9cfcd, republished under its Apache-2.0 licence (© JetBrains). 852 words, ~2,162 tokens.

Download SKILL.mdSave it as .claude/skills/mps-collections-and-closures/SKILL.md (or your agent's skills folder). This skill also uses 15 other files; get the full folder from GitHub.
name
mps-collections-and-closures
description
Use when writing or editing MPS BaseLanguage code that uses the `collections` and `closures` language extensions — in behavior methods, typesystem and checking rules, generator queries, constraints, intentions, plugin or console code, with or without nodes. Covers collection types (`sequence<T>`, `list<T>`, `set<T>`, `map<K,V>`, sorted variants), creators, sequence operations (`.where`, `.select`, `.translate`, `.any`, `.sortBy`, `.toList`, …), list/set/map mutators, the collections `foreach` vs the BaseLanguage `foreach`, closure literals (`{ it => ... }`, `ClosureLiteral`, `InferredClosureParameterDeclaration`, `FunctionType`), `yield`, `skip`, `stop`, recursion with `invoke`, SAM conversion, and `downcast` to a Java interface. The node receivers (`node.descendants<C>`, `nlist<C>`, `sequence<node<C>>`) come from the companion skill `mps-model-manipulation`; most smodel bodies need both.
type
reference

Writing MPS BaseLanguage with collections / closures

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.

Use this skill when a body filters, maps, sorts or iterates a sequence, or passes a closure — to a collection operation, a Java API (SAM conversion), or a variable of function type. A collection operation is a DotExpression whose operation is a collections *Operation concept with a single ClosureLiteral in the closure role. The mps_mcp_parse_java_and_insert parser maps Java lambdas to closures but cannot produce collection types or operations, so these shapes are hand-built from the blueprints here.

Minimum reading set

references/ is a lookup catalog. One file is enough to write the body.

Body you are writingRead only
filters or maps a sequence (.where, .any, .translate, list.add)references/sequence-operation-blueprints.md
a closure that does not type-checkreferences/closures-catalog.md
an iteration that fails (foreach)references/foreach-statements.md
crosses into a Java interface (Iterable.iterator(), Map.computeIfAbsent())references/downcast-expression.md
an operation whose name or shape you do not knowreferences/collections-catalog.md

Stopping rule. After an error you cannot explain, open references/golden-rules-and-pitfalls.md before any catalog.

Critical Directives

  • Every InferredClosureParameterDeclaration needs a type child, even though MPS infers the type. Use jetbrains.mps.baseLanguage.structure.UndefinedType as placeholder. Omitting it cascades into misleading "different parameter numbers" / "out of search scope" / "operation is not applicable to null" errors. See references/closures-catalog.md.
  • Operations taking a predicate/selector take a single closure argument in the closure role (not parameter). See references/sequence-operation-blueprints.md.
  • foreach has two concepts: collections ForEachStatement for sequence/list/set, BaseLanguage ForeachStatement for Java arrays/iterables. Wrong choice → type error. See references/foreach-statements.md.
  • A sequence is not a list: list<T> and set<T> are subtypes of sequence<T>, and lazy operations return sequence<T>; materialize with .toList where a list is required. See references/collections-catalog/core-concepts-types-null-semantics.md.
  • isEmpty / isNotEmpty have two concepts each: collections for sequence/list/set/map, BaseLanguage for string. Pick the FQN by the receiver's type. See references/collections-catalog/sequence-operations.md.
  • A closure body uses either return or yield, never both; a yield closure returns sequence<T>. See references/closures-catalog.md.
  • skip / stop only inside enumerating closures (selectMany / translate / forEach / sequence initializer); elsewhere they are a typesystem error. See references/collections-catalog/control-flow-in-closures.md.
  • Runtime solutions: generated closures code needs jetbrains.mps.baseLanguage.closures.runtime, collections code the collections.runtime solution. A missing closures runtime shows up as NoClassDefFoundError for _FunctionTypes$... at load time. See references/closures-catalog.md.
  • Ask the running typesystem, not its rules: use mps_mcp_query_types OPERATION_TYPE for the result type of an operation or expression, and IS_SUBTYPE for assignability (list<T> vs sequence<T>, a closure against a FunctionType or SAM target). See mps-mcp-workflow/references/analysis-tools/type-queries.md.
Show full SKILL.md (366 more words)Show less

Common-path workflow

  1. Get the receiver — a node sequence (node.children, .descendants<C>) is built from references/dot-expression-basics.md in the mps-model-manipulation skill root after loading that companion skill from the same origin.
  2. Wrap it in the operation — the DotExpression + *Operation + ClosureLiteral blueprint from references/sequence-operation-blueprints.md.
  3. Declare collection-typed locals and return types explicitly — the Java parser produces a wrong ClassifierType for them. Node-element types are in references/variable-declarations.md in the mps-model-manipulation skill root after loading that companion skill from the same origin.
  4. Validate with mps_mcp_check_root_node_problems(nodeReference, onlyNodesWithProblems=true); on a confusing error, open references/golden-rules-and-pitfalls.md.

If MPS MCP tools are unavailable, do not hand-edit serialized .mps files unless explicitly requested — inspect only and report.

  • mps-model-manipulation — the smodel side: the receivers (node.descendants<C>, nlist<C>, sequence<node<C>>), node casts, property/link access and mutation that the closure bodies call. Load it whenever a body touches nodes.
  • mps-baselanguage — host BaseLanguage statements, expressions, classes, and the Java parser; this skill is the collections/closures overlay.
  • mps-console — #instances(C).where { … } and other jetbrains.mps.lang.smodel.query results compose with the operations here.
  • mps-quotations — node literals that closures and sequence operations often build or consume.

Reference Index

One line per file, keyed by the symptom that should send you there.

  • Open references/golden-rules-and-pitfalls.md when a collections or closures error makes no sense — the symptom→cause→fix table (closure type child, two isEmpty concepts, sequence vs list, lazy re-evaluation, yield/return, skip/stop, missing runtime).
  • Open references/sequence-operation-blueprints.md when building .where, .any, .translate (with yield) or list.add — the full DotExpression + ClosureLiteral JSON.
  • Open references/collections-catalog.md when you need an operation whose name or shape you are unsure of (select, take, sortBy, reduceLeft, toList, …), creators, mutators, set/map operations, sorted variants, iterator vs modifying_iterator, or concept IDs — the hub table names one file per section.
  • Open references/closures-catalog.md when a closure does not type-check — "different parameter numbers", a parameter whose type stayed null, recursion (InvokeFunctionOperation vs InvokeExpression), yield vs return, SAM conversion, result-type inference, the generated-Java form, or the missing closures runtime jar. Holds the ClosureLiteral / InferredClosureParameterDeclaration / FunctionType shapes.
  • Open references/foreach-statements.md when iterating produces a typesystem error, or the loop variable will not resolve — collections ForEachStatement + ForEachVariable / ForEachVariableReference vs BaseLanguage ForeachStatement + LocalVariableDeclaration / VariableReference.
  • Open references/downcast-expression.md when a collection-typed value must call a Java interface method (Iterable.iterator(), Map.computeIfAbsent()) — the DowncastExpression (downcast expr) blueprint and two verified examples.

© JetBrains, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 15 other files (references) in .agents/skills/mps-collections-and-closures of JetBrains/MPS.

  • SKILL.md
  • references/closures-catalog.md
  • references/collections-catalog.md
  • references/collections-catalog/concept-ids.md
  • references/collections-catalog/control-flow-in-closures.md
  • references/collections-catalog/core-concepts-types-null-semantics.md
  • references/collections-catalog/creators.md
  • references/collections-catalog/iterators.md
  • references/collections-catalog/list-mutators.md
  • references/collections-catalog/sequence-operations.md
  • references/collections-catalog/set-and-map-operations.md
  • references/collections-catalog/sorted-collections.md
  • references/downcast-expression.md
  • references/foreach-statements.md
  • references/golden-rules-and-pitfalls.md
  • references/sequence-operation-blueprints.md

Open the folder on GitHubat commit 3e9cfcd

Compare with similar skills

Mps Collections And Closures next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mps Collections And Closures compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mps Collections And Closures this skillJetBrains/MPS1.7k—~2.2kAutomated safety check: PassApache-2.0
Release Pluginflutter/flutter-intellij2k—~1kAutomated safety check: PassBSD-3-Clause
Code StyleJetBrains/intellij-community21k—~795Automated safety check: PassCustom licence
Jugg Android Dev Loopniki914/zafiro241—~2kAutomated safety check: PassMIT
Doc View Contract Designliuzhihang/doc-view207—~539Automated safety check: PassMIT
Amplicode InstallAmplicode/spring-skills128—~2.6kAutomated safety check: PassNone

Similar skills

  • Release Plugin

    flutter/flutter-intellij

    Prepare and execute a new release for the flutter-intellij plugin, including updating dependencies, compatibility bounds, changelogs, and verification.

    2k GitHub stars~1k tokensUpdated yesterday
    MobileAuto-check passed
  • Code Style

    JetBrains/intellij-community

    Official

    Apply IntelliJ Kotlin and Java code style when writing or reviewing.

    21k GitHub stars~795 tokensUpdated today
    MobileAuto-check passed
  • Jugg Android Dev Loop

    niki914/zafiro

    A skill your agent uses when editing source files (Java/Kotlin/XML/layout/AndroidManifest/Gradle) in a Android project, or when user asks to build/deploy/verify an Android app.

    241 GitHub stars~2k tokensUpdated today
    MobileAuto-check passed
  • Doc View Contract Design

    liuzhihang/doc-view

    A skill your agent uses when defining or reviewing Doc View behavior contracts before changing PSI parsing, DTOs, Markdown output, uploads, exports, settings, UI-visible behavior, or IntelliJ…

    207 GitHub stars~539 tokensUpdated 24 days ago
    Documents & OfficeAuto-check passed
  • Amplicode Install

    Amplicode/spring-skills

    Installs the Amplicode IntelliJ plugin into IntelliJ IDEA (Ultimate/Community) and GigaIDE on the user's machine.

    128 GitHub stars~2.6k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed
  • Idea MCP

    dtprj/dongting

    IntelliJ IDEA MCP for Java code analysis, testing, refactoring, and project navigation.

    208 GitHub stars~698 tokensUpdated yesterday
    DevelopmentAuto-check passed

More from JetBrains/MPS

All 41 skills in this repo
  • Official

    Analyze an MPS language by name — discover concepts, properties, references, children, aspects (editor/constraints/behavior), metadata, and answer type questions (is A a subtype of B, common…

    1.7k GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Mps Node Editing

    JetBrains/MPS

    Official

    Add, update, or delete MPS nodes using JSON blueprints — covers the unified blueprint format, staged construction for large subtrees, validation, and reference repair.

    1.7k GitHub stars~5.1k tokensUpdated yesterday
    Auto-check passed
  • Official

    Open an MPS project in a running or freshly started MPS instance when MCP tools fail because no project is open (welcome screen), close an open project with mpsmcpcloseproject, or create a new empty…

    1.7k GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed
  • Mps MCP Workflow

    JetBrains/MPS

    Official

    Complete JetBrains MPS workflow guide for DSL projects — models, languages, generators, node JSON blueprints, type queries, validation, MPS MCP tool usage, and the index of companion skills.

    1.7k GitHub stars~6.6k tokensUpdated yesterday
    Auto-check passed
  • Bugfix Workflow

    JetBrains/MPS

    Official

    Structured MPS bugfix workflow driven by a YouTrack issue ID — preflight tool checks, version/branch derivation, parallel-agent problem analysis, solution design, branch creation, implementation…

    1.7k GitHub stars~4.4k tokensUpdated yesterday
    Auto-check passed
  • Official

    Define concepts, interface concepts, enumerations, and constrained data types in an MPS language's structure aspect.

    1.7k GitHub stars~2.8k tokensUpdated yesterday
    Auto-check passed

Questions about Mps Collections And Closures

What does Mps Collections And Closures do?

A skill your agent uses when writing or editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods, typesystem and checking rules, generator…. Mps Collections And Closures is an agent skill from JetBrains/MPS, published by the product's own GitHub organization. Use when writing or editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods, typesystem and checking rules, generator queries, constraints, intentions, plugin or console code, with or without nodes.

When should I use Mps Collections And Closures?

Mps Collections And Closures fits situations like: editing MPS BaseLanguage code that uses the collections and closures language extensions — in behavior methods; typesystem and checking rules; generator queries.

How do I install Mps Collections And Closures in Claude Code?

Run `npx skills add JetBrains/MPS --skill mps-collections-and-closures -a claude-code`. Or copy the skill folder (.agents/skills/mps-collections-and-closures in JetBrains/MPS) into .claude/skills/mps-collections-and-closures in your project. Claude Code loads it when a task matches its description.

How do I install Mps Collections And Closures in Codex?

Run `npx skills add JetBrains/MPS --skill mps-collections-and-closures -a codex`. Or copy the skill folder (.agents/skills/mps-collections-and-closures in JetBrains/MPS) into .agents/skills/mps-collections-and-closures in your project. Codex loads it when a task matches its description.

Can I use Mps Collections And Closures in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add JetBrains/MPS --skill mps-collections-and-closures -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mps-collections-and-closures, .gemini/skills/mps-collections-and-closures, .github/skills/mps-collections-and-closures and .opencode/skills/mps-collections-and-closures in your project.

What does Mps Collections And Closures need to run?

SKILL.md names no scripts, command-line tools or credentials: Mps Collections And Closures is instructions for the agent only.

Does Mps Collections And Closures access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mps Collections And Closures safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Mps Collections And Closures use?

Mps Collections And Closures is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mps Collections And Closures use?

About 2.2k tokens (SKILL.md is roughly 8.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 10k tokens, read only when the agent opens those files.

What are the alternatives to Mps Collections And Closures?

Skills that share tags, products or a category with Mps Collections And Closures: Release Plugin (flutter/flutter-intellij, 2k stars), Code Style (JetBrains/intellij-community, 21k stars), Jugg Android Dev Loop (niki914/zafiro, 241 stars) and Doc View Contract Design (liuzhihang/doc-view, 207 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mps Collections And Closures?

JetBrains (a GitHub organization, an official publisher) maintains it in JetBrains/MPS, which has 1,661 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on October 9, 2026.

Source: JetBrains/MPS on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.