实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。
- 为 IDE 菜单添加操作
- 修改操作注册或图标
- 整理操作名称和说明
查找可能承担相同职责的现有代码,并列出疑似未使用的声明和图片资源。可在规划变更前核对已有实现,也可在评审时检查重复候选,辅助判断是否删除。
Find semantic copies and dead code before a plan or a review.
实测评分 未实测
查看安装方法在规划变更前,此技能会查找可能已经承担拟新增工作的代码。它根据行为和任务内容搜索可能的代码负责人,并沿着调用关系和引用继续检查。评审时,它会运行复制检查,找出语法或含义相似的函数,并从报告中筛选出与变更文件相关的候选项。它还可以列出疑似未使用的声明和图片,并说明删除前的确认步骤。
如果您想避免在不同位置重复实现同一职责、在评审变更时检查重复候选,或调查疑似未使用的代码和图片,可以使用此技能。检测结果只是线索,并不能证明代码可以删除;请先阅读相关代码,再作判断。
此技能使用 accio 和 jscpd。如果 accio 不在 PATH 中,请使用 ./community/tools/accio.cmd;运行 jscpd 时须通过指定的包装脚本。首次进行语义分析需要一个 548 MB 的模型。
本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。
AI 根据 SKILL.md 的内容检查了需要注意的操作和使用前提。评分只依据实际运行的结果(实测对比)。
不计入评分。 由 AI(OpenAI Codex)于 2026年10月29日 评估。仅供参考,安装前请同时查看原文。
安装前可以查看交给 AI 代理的指令内容。
The exact copy-paste gate finds a copied text only. This skill finds one responsibility in two pieces of different code, and dead code. Each tool gives candidates, not a proof. Read each candidate before you act on it.
| Tool | What it finds | Use |
|---|---|---|
jscpd exact, --exit-code 1 | a copied text (Type-1) | the gate of an area |
jscpd --ignore-identifiers --kind renamed | a copy with renamed names (Type-2) | burn-down |
jscpd --similarity 0.9 --kind ast | two functions with one syntax tree (Type-3) | the copy lint |
jscpd --semantic --kind semantic | two functions that do one thing (Type-4) | the copy lint |
jscpd --compare <a>/ <b>/ | the functions of <a> with no counterpart in <b> | a port or two implementations |
accio locate '<question>' --mode semantic, accio context '<task>' | the code of a behaviour or a task | the owner check |
accio trace <Name> --direction callers, accio references <Name> | the callers and every use of a name | the owner check, dead code |
accio unused --scope <dir>/ | declarations, bundle keys and image variants used nowhere | dead code |
Without accio on the PATH, run ./community/tools/accio.cmd. Run jscpd only through
./community/tools/jscpd.cmd -c <config>. <config> is the .jscpd.json of the area, for example
plugins/air/.jscpd.json. An area without a .jscpd.json runs the commands without -c and has no exact gate. Write
each JSON report to a temporary directory of your session. The jscpd_test target of the area runs the gate too, for
example //plugins/air:air-duplicate-code_test.
Do this for each responsibility that the plan adds: a mapping, a policy, a parser, a cache, a lifecycle step.
accio locate '<a full question about the behaviour>' --mode semantic --scope <area>/. On a miss, ask again in
other words.accio context '<the task in words>' --scope <area>/. Name the task by the nouns of the domain, not by a role word
such as "mapper".accio references <ResultType> --scope <area>/ --no-tests --files. A private function that builds the type is an
owner too.accio files '<Prefix>V1*', accio files '<Prefix>V2*'.accio trace <Name> --direction callers for each candidate, then read it. A call site marked ? (:57?) fits
more than one overload: read it.The plan then has an Existing owners line. It names each owner and the decision: extend it, move it, or write new code with the reason why the owner does not fit. When the check finds nothing, the line names the queries.
The copy lint is a report, not a gate. Run it after the exact gate of the area passes, when the area has one. Give the touched directories and the directories of their owners: the scan compares only the files under the paths it gets.
./community/tools/jscpd.cmd -c <config> --similarity 0.9 --kind ast --absolute \
--reporters json --output <temp-dir>/ast <touched-dir>...
./community/tools/jscpd.cmd -c <config> --semantic --semantic-scope same --kind semantic \
--semantic-same-threshold 0.9 --ignore '**/testSrc/**,**/test/**,**/tests/**,**/testFramework/**' \
--absolute --reporters json --output <temp-dir>/semantic <touched-dir>...
Then keep the pairs that touch a file of the change. Run this from the repository root:
{ git diff --name-only <base>; git ls-files --others --exclude-standard; } | sed "s|^|$PWD/|" \
| jq -R . | jq -s . > <temp-dir>/changed.json
jq -r --slurpfile c <temp-dir>/changed.json '.duplicates[]
| select(.firstFile.name as $a | .secondFile.name as $b | $c[0] | index($a) or index($b))
| "\(.similarity) \(.firstFile.name):\(.firstFile.start)-\(.firstFile.end) ~ \(.secondFile.name):\(.secondFile.start)-\(.secondFile.end)"' \
<temp-dir>/ast/jscpd-report.json <temp-dir>/semantic/jscpd-report.json
Filter the report by file, not by kind. An --kind ast pair has "kind": "similar".
--changed or --baseline-from-ref. Each makes a git worktree of the base revision with 1.4 million
files.--semantic run on a machine needs --semantic-download (a model of 548 MB). The first run on a
directory takes minutes. A later run takes below 1 s.accio unused --scope <dir>/ --limit 1000 gives the candidates. Each candidate is a lead. The note of the answer
explains each mark, and accio unused --help says what the scan leaves out and cannot see.
(generated) icon field: delete its SVG and generate the icon class again with the icon-resources skill. First
search the SVG file name over the whole repository. A SKILL.md can name it as an icon, and then the fix is an
icon-robots.txt skip.(published) candidate is a published API. Keep it unless its owner decides otherwise.plugins/air/docs/guides/dead-code-guide.md. Read
it before the triage, and add each candidate that you keep.To delete a candidate, prove it with accio locate '<name>' without --scope. Then delete it, the tests that test
only it, the imports that only it needed, and the KDoc links to it. Delete a dead key from the English bundle only.
The translations under localization/ belong to the localization team. Run the tests of the area, and run
accio unused again.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
实现或修改 IntelliJ `AnAction`,并在 `plugin.xml` 中注册。将显示名称和说明写入消息资源文件,按需设置图标,并通过事件协程作用域启动挂起任务,避免同步处理阻塞 IDE。
将 IntelliJ JPS 测试模块迁移到 Bazel,并排查仅在 Bazel 中出现的失败。根据症状检查依赖、插件、测试数据和 runfiles,重新生成并验证目标。
按 IntelliJ 项目规范编写或审查 Kotlin 和 Java 代码,涵盖语言选择、格式、密封类型、线程注解及控制流异常处理。
本指南帮助您按 IntelliJ 项目规则拆分更改并撰写提交信息:有工单时使用编号和变更说明,无工单时使用标签与子系统名,并在需要时说明原因和决定。
使用多个 Python 类型检查器比较代码片段或文件的类型推断和报错判断,并汇总各工具的结论、耗时与诊断信息,可保存为 Markdown 报告。
整理 Compose Desktop 界面中的状态和副作用,让可组合函数负责绘制,由展示器或协调器处理应用决策。了解状态归属、Effect、可复用组件接口、延迟列表键、动画和性能,适用于单项界面修改。