actions

Implement IntelliJ AnAction classes with plugin.xml and message bundle configuration.

20.4k|6.0k|Updated Sep 30, 2011
One-click install
npx skills add https://github.com/JetBrains/intellij-community --skill actions-jetbrains
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: actions
Source: https://github.com/JetBrains/intellij-community/tree/main/.agents/skills/actions
Command: npx skills add https://github.com/JetBrains/intellij-community --skill actions-jetbrains

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guidelines and conventions for implementing IntelliJ actions (AnAction) to ensure consistent, maintainable, and correctly integrated actions within the IntelliJ Platform.

Core Features & Use Cases

  • Clear rules for action class design and lifecycle, guiding when to extend AnAction and how to instantiate it.
  • Best practices for wiring actions in plugin.xml and using the message bundle for text and descriptions.
  • Typical use cases include adding new actions, modifying existing ones, and ensuring consistent UI behavior across plugins.

Quick Start

Implement a new action by extending AnAction, register it in plugin.xml with an id and optional icon, and provide text and description in the message bundle.

Frequently Asked Questions about actions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement an IntelliJ action correctly in plugin development?

To implement an IntelliJ action, extend the AnAction class, register the action in plugin.xml with a unique id and optional icon, and define its text and description in a message bundle to ensure proper lifecycle management.

Why should I avoid setting text in the AnAction constructor?

Avoiding text in the AnAction constructor prevents premature resource loading and ensures text is loaded lazily from message bundles. This maintains consistent UI behavior and allows proper localization across IntelliJ-based projects.

How do I register an IntelliJ action in plugin.xml?

Register an IntelliJ action in plugin.xml by defining an action element with a unique id, specifying the class path, and optionally adding an icon. Text and descriptions should be referenced from the message bundle rather than hardcoded.

Can I use message bundles for IntelliJ action text and descriptions?

Yes, using message bundles for IntelliJ action text and descriptions is a required best practice. It ensures proper localization, lazy loading, and consistent UI behavior across plugins within the IntelliJ Platform.

What is the best way to manage action lifecycle in IntelliJ plugins?

The best way to manage action lifecycle in IntelliJ plugins is to extend AnAction, avoid initializing text in constructors, and wire actions through plugin.xml. This maintains consistent behavior and prevents resource loading issues.