IntelliJプラグインのAnActionと登録設定を実装・変更し、表示文言やアイコンの定義、非同期処理の起動方法を整えます。
- IDEに新しいアクションを追加したいとき
- アクションの登録やアイコンを変更したいとき
- 表示名と説明文の定義を整理したいとき
IntelliJ向けSwing UIの責務や状態の流れ、EDT上の処理、ライフサイクルを整理し、機能に合った小さなコンポーネント構成を設計するスキルです。
Design IntelliJ Swing UI components, state flow, and EDT work.
実行スコア 未検証
インストール方法を見るIntelliJ向けSwing UIの機能境界と責務を整理し、規模に見合った構成を提案します。Viewはウィジェットの構築や描画、Controllerは入力の検証やサービス呼び出し、サービスはUIに依存しないアプリケーション処理を担うよう分けます。状態が複雑な場合は不変Stateと一方向のデータフローを導入し、非同期処理のキャンセルや古い結果の扱い、EDT(Swingの画面処理用スレッド)での安全な更新、破棄時の後始末も検討します。既存コンポーネントの合成を優先し、不要な抽象化や大規模な作り直しを避ける方針です。
IntelliJプラグインなどのSwing画面を新設・変更・レビューするときに使えます。画面クラスがサービス呼び出しや非同期処理まで抱えている場合や、状態管理、スレッド、破棄処理の責任者が曖昧な場合に、必要最小限の分割を検討できます。
新しい再利用Swingウィジェットや独自描画を導入する場合は、資料上、理由と標準部品で代替できない点を説明し、利用者の明示的な承認を得る必要があります。
この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Design Swing UI as isolated feature components with unidirectional data flow, explicit state, and clear EDT and lifecycle ownership. Introduce the smallest architecture that cleanly separates responsibilities; do not enforce MVC, MVP, MVVM, or MVI by name.
Read the local module instructions and inspect the whole feature boundary, including callers, services, listeners, asynchronous work, and disposal.
Map ownership of rendering, user intent, UI state, application logic, asynchronous work, navigation, and lifecycle.
Choose the lowest architecture level that makes those responsibilities clear.
Keep Swing in the View, coordinate behavior in the Controller when one is needed, and keep application services independent of Swing.
Make data flow one-way where state or workflows are non-trivial:
user -> View --Intent--> Controller --calls--> Services
^ |
'--- render(State)-'
Verify EDT safety, cancellation, disposal, state transitions, and the minimal public API.
Apply the UI accessibility skill when creating, changing, or reviewing the UI itself.
Treat line counts as prompts to inspect complexity, not hard thresholds.
Never add an interface, presenter, reducer, effect layer, event bus, global UI store, or framework merely to satisfy a pattern. Require every abstraction to remove concrete duplication, isolate a dependency, make ownership clear, or make important behavior testable.
Prefer existing IntelliJ Platform, JB UI, Kotlin UI DSL, or standard Swing components. Configure and compose them into a feature View instead of subclassing JComponent, JPanel, or another widget merely to provide layout, defaults, borders, or event wiring. A feature wrapper can own a root JComponent without being a Swing component itself. Subclass a Swing component only when the subtype has a genuine reusable widget contract or a platform integration point requires it.
Before implementing a new reusable Swing widget or any custom painting, stop and ask the user for explicit approval. This gate covers reusable JComponent subclasses, overrides of paint, paintComponent, or paintChildren, Painter implementations, and direct Graphics2D rendering. Explain why existing platform or standard components, composition, icons, borders, renderers, or UI DSL are insufficient, propose the closest standard alternative, and wait for approval. Existing custom components may be reviewed or refactored without retrospective approval; ask when the change introduces a new custom widget or new custom painting.
When a reusable custom widget is approved, give it a proper ComponentUI delegate. Keep reusable rendering, look-and-feel defaults, scaling and theme behavior, and UI-installed listeners in the delegate with symmetric installUI and uninstallUI lifecycle. Keep the widget's semantic state and public behavior in the JComponent subclass; do not put ad hoc painting into a feature View.
Keep Swing types out of public or external APIs wherever possible. Exchange immutable state, domain values, stable IDs, and semantic callbacks. When Swing embedding is unavoidable, expose only the root JComponent at that integration seam and keep child widgets, models, renderers, painters, and raw Swing events private.
Prefer a concrete feature wrapper over a Swing subclass or an interface that consumers do not need:
internal class SearchComponent {
private val searchField = JBTextField()
val component: JComponent = JPanel(BorderLayout()).apply {
add(searchField)
}
fun focusSearch() = searchField.requestFocusInWindow()
fun clear() {
searchField.text = ""
}
}
If an API must be public, keep UI construction behind an internal integration point and expose domain-oriented operations. Do not expose buttons, lists, trees, text fields, models, or other internal widgets for outside manipulation.
Use the component or a nearby composition root to construct the View, Controller, services, and navigator. Prefer constructor injection. Restrict ApplicationManager.getApplication().getService(...) and similar lookups to composition roots or established platform integration points, never arbitrary View code.
Make the View own Swing:
onSaveRequested, onRetryRequested, onSearchRequested(query), or onItemActivated(id).render(state) when the feature has meaningful state.Do not let the View call repositories or services, start network or filesystem work, decide navigation, mutate domain objects, contain business rules, or block the EDT. Do not attach listeners to View widgets from outside the View.
Introduce a Controller when behavior no longer remains simple and local. Make it:
Do not construct Swing layouts or reach into View widgets from the Controller.
Keep application services independent of Swing, JComponent, widget models, and EDT assumptions. Pass domain values or dedicated data objects across the boundary. Inject navigation separately when it is a UI concern.
Introduce immutable state when the feature has multiple visual modes, asynchronous work, or decisions that would otherwise be inferred from widgets:
data class SearchState(
val query: String,
val loading: Boolean,
val results: List<SearchResult>,
val error: String?,
)
Use a sealed state hierarchy instead of combinations of booleans when modes are mutually exclusive. Do not mirror every widget property into state; model values that drive behavior or rendering.
Make render(state) deterministic, idempotent, and complete for the modeled state. Keep listener installation, service calls, navigation, and other effects out of rendering. Prefer one render operation over a sequence such as showSpinner(), hideRetry(), setItems(), and enableButton() that can leave the UI partially updated.
Never use widget properties as application state:
// Wrong: application decisions depend on the current rendering.
if (progressBar.isVisible) return
if (statusLabel.text == "Loading") return
Keep a single source of truth. Update it through one controller path, then render it:
private fun updateState(transform: (SearchState) -> SearchState) {
state = transform(state)
view.render(state)
}
Translate raw Swing events inside the View. Emit domain-relevant values or stable IDs rather than widgets, indices whose meaning can change, or ActionEvent unless the Swing event itself is genuinely required.
Prefer:
view.onSearchRequested { query -> controller.search(query) }
over exposing searchButton, searchField, or resultList. Avoid a new event abstraction when a callback is enough.
Treat the View and its widgets as EDT-confined unless a Swing API explicitly documents otherwise. Construct, read, and mutate Swing state on the EDT.
Inspect every listener and callback for blocking operations, including:
Future.get() or equivalent waitsThread.sleep() and runBlockingCapture required input on the EDT, run expensive work away from it, then return to the EDT before updating state or rendering. Follow the surrounding module's platform coroutine, modality, read/write-action, and dispatcher conventions. Prefer a coroutine scope tied to the feature lifecycle; never use GlobalScope. If using SwingUtilities.invokeLater, verify that platform modality and disposal semantics do not require an IntelliJ scheduling API instead.
Modality rides in the coroutine context and defers on the EDT: capture a ModalityState per operation on the submitting thread (ModalityState.defaultModalityState()) and pass it to the work — launch(modality.asContextElement()) or invokeLater(runnable, modality) — rather than freezing one modality onto a long-lived scope. Work submitted with a modality lower than the currently open modal dialog is deferred until that dialog closes, which reads as a hang; completing with the modality captured at submit time dispatches it inside the originating modal state. ModalityState.any() is the opposite trap — it never defers, so a non-trivial callback can run inside an unrelated modal dialog while your model is mid-transition (reentrancy / inconsistent state); reserve any() for trivial, state-independent bookkeeping.
For concurrent requests, cancel obsolete work or tag requests and ignore stale completion. Preserve coroutine cancellation rather than converting it into a user-visible failure. Re-check lifecycle before applying results.
Prefer a CoroutineScope tied to the feature lifetime as the primary lifecycle mechanism: take a child scope of the enclosing project or service scope, or the scope the platform hands in, rather than constructing a standalone one. Launch asynchronous work, flow subscriptions, and retries in that scope so cancelling it tears everything down in one place.
For event, message-bus, RPC, or Flow subscriptions, use the shortest lifecycle that consumes the updates. Prefer a caller/client scope owned by the UI content, dialog, popup, tool-window panel, or explicit operation over an application- or project-level service scope. Use an app/project service scope only when the collected state is intentionally app/project-owned for that full lifecycle and retaining everything reachable from the stream for that lifetime is acceptable.
Avoid API methods that both start a subscription and expose a synchronous snapshot without an explicit owner. Split them into an owner-taking subscription method, for example one accepting CoroutineScope, and a snapshot accessor that only reads already-collected state. Action update paths and menu builders should read snapshots and must not implicitly start long-lived subscriptions. If a service caches per-project mirrors keyed by ProjectId, remove entries when the owning client scope completes.
Implement Disposable, AutoCloseable, or the lifecycle type already used by the module when a platform integration point requires it, and bridge it to the scope by cancelling the scope on disposal. Ensure teardown:
Register child lifetimes with the IntelliJ Disposer where appropriate. Make repeated disposal safe.
listCellRenderer or textListCellRenderer over renderers based on SimpleColoredComponent when the DSL supports the required presentation.render(state) when several methods can diverge.Do not perform a large architectural rewrite when a small extraction resolves the ownership problem.
Treat these as severity defaults and adjust for actual impact.
ComponentUI; application state inferred from widgets; Controller-built layouts; uncancelled or stale async results; missing lifecycle cleanup; a god panel mixing UI, services, and workflows.A panel over roughly 500 lines is a review signal, not an automatic defect. Judge responsibility count, coupling, asynchronous behavior, and change risk.
When reviewing code, use these exact headings. Cite concrete symbols or file locations, distinguish observed facts from recommendations, and write None when a section has no findings.
State the feature boundary, current complexity, selected architecture level, and whether a refactor is justified.
Map rendering, intents, state, application logic, asynchronous work, navigation, and lifecycle to their current owners.
List Critical, Major, and Minor findings with evidence and impact.
Call out EDT violations, blocking, domain/Swing dependency inversion, unsafe late results, or other correctness risks that require priority.
Show the smallest useful target structure and its public boundary.
Give ordered, behavior-preserving steps. Separate necessary work from optional cleanup.
Provide a focused example or patch shape for the highest-value change; do not rewrite the whole feature unless requested.
Explain added types or state, rejected heavier patterns, testing impact, migration risk, and any manual verification still needed.
Make Views know how the UI looks, Controllers know what the user wants, services know how the application works, and state describe what should be visible. Never let Swing widgets become the application's state or business layer.
まだレビューはありません。使ってみた感想をお寄せください。
ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。
まだコメントはありません。最初のコメントを書いてみませんか。
IntelliJプラグインのAnActionと登録設定を実装・変更し、表示文言やアイコンの定義、非同期処理の起動方法を整えます。
IntelliJのJPSテストモジュールをBazelへ移行し、Bazelだけで起きる失敗を依存関係や実行環境から切り分ける手順を案内します。
IntelliJのKotlin・Javaコードを新規作成やレビューする際に、言語の選び方、書式、型の扱い、例外処理などのプロジェクト規約に沿って整えるスキルです。
IntelliJ向けの変更を適切な単位に分け、チケットの有無に応じた形式で、理由や判断も伝わるコミットメッセージを作成・修正するスキルです。
Pythonコードの型推論や型エラーを複数の型チェッカーで比較し、各ツールの判定と診断内容をまとめたレポートを作成します。
Compose Desktopの画面で状態や副作用をどこに持たせるか整理し、表示と判断の境界、再利用部品やリストの設計を整えます。