Agent Skills
› DetachHead/rebased
› actions
actions
GitHub提供 IntelliJ IDEA 插件中 AnAction 的实现指南,涵盖架构文档、最佳实践及代码规范。指导开发者正确定义动作类、配置 plugin.xml 及资源文件,避免构造函数实例化等常见错误,确保 IDE 响应性能。
Trigger Scenarios
需要创建或修改 IntelliJ IDEA 插件菜单/工具栏动作
实现 AnAction 接口时遇到规范疑问
优化插件动作的性能与结构
Install
npx skills add DetachHead/rebased --skill actions -g -y
SKILL.md
Frontmatter
{
"name": "actions",
"description": "Guidelines for implementing IntelliJ actions (AnAction). Use those rules when you need to create or change an action in the intellij platform."
}
Actions
Guidelines for implementing IntelliJ actions (AnAction).
Documentation
- Action System - Architecture and usage of the action system
Best Practices
- NEVER instantiate Presentation in action constructors - Use no-argument constructors
- Define text, description, and icon in plugin.xml - Not in constructor parameters
- Use AnActionEvent#getCoroutineScope for launching suspending computations - actionPerformed runs synchronously with event invocation and may freeze the IDE.
- Follow the convention:
- Set the
idattribute for the action in plugin.xml - Optionally set the
iconattribute if an icon is needed - Set text and description in the message bundle (e.g., GitBundle.properties):
action.<action-id>.text=Translated Action Textaction.<action-id>.description=Translated Action Description
- Set the
Good example:
Kotlin:
class MyAction : AnAction()
plugin.xml:
<action id="My.Action.Id"
class="my.package.MyAction"
icon="my.package.MyIcons.ICON"/>
Bundle.properties:
action.My.Action.Id.text=My Action
action.My.Action.Id.description=Description of my action
Version History
- 1f8708d Current 2026-08-16 15:38


