ssr

GitHub

指导在 IntelliJ 中使用结构搜索与替换(SSR)功能,用于创建或修改代码检查规则及搜索模式。

.claude/skills/ssr/SKILL.md DetachHead/rebased

Trigger Scenarios

需要创建新的 SSR 检查规则 需要修改现有的 SSR 搜索模式

Install

npx skills add DetachHead/rebased --skill ssr -g -y
More Options

Non-standard path

npx skills add https://github.com/DetachHead/rebased/tree/master/.claude/skills/ssr -g -y

Use without installing

npx skills use DetachHead/rebased@ssr

指定 Agent (Claude Code)

npx skills add DetachHead/rebased --skill ssr -a claude-code -g -y

安装 repo 全部 skill

npx skills add DetachHead/rebased --all -g -y

预览 repo 内 skill

npx skills add DetachHead/rebased --list

SKILL.md

Frontmatter
{
    "name": "ssr",
    "description": "Guide for using Structural Search and Replace in IntelliJ. Use when creating or modifying SSR inspections or search patterns."
}

Structural Search and Replace

  • You must use terminal search (ls, cat and grep) to read directory .idea. Do not use IDE search.

  • The contents of structural search inspections is located in .idea/inspectionProfiles/idea_default.xml

  • Here is an example of a Structural Search and Replace inspection:


<replaceConfiguration name="Use Strings.areSameInstance instead of =="
                      description="Comparing Strings by references usually indicate a mistake, if you really need to do this (for performance reeasons or to implement &quot;Sentinel&quot; pattern), use Strings.areSameInstance method to make the intention explicit and get rid of warning."
                      suppressId="StringEqualitySSR"
                      problemDescriptor="Use !Strings.areSameInstance instead of '!=' if you really need to compare strings by reference"
                      text="$s1$ == $s2$" recursive="false" caseInsensitive="false" type="JAVA" pattern_context="default"
                      search_injected="false" reformatAccordingToStyle="false" shortenFQN="true"
                      replacement="com.intellij.openapi.util.text.Strings.areSameInstance($s1$, $s2$)">
  <constraint name="__context__" within="" contains=""/>
  <constraint name="s1" nameOfExprType="java\.lang\.String" within="" contains=""/>
  <constraint name="s2" nameOfExprType="java\.lang\.String" within="" contains=""/>
</replaceConfiguration>

This node should be located under <inspection_tool class="SSBasedInspection" tag.

  • Here is an example of a Structural Search inspection:

<searchConfiguration name="Raw coroutine scope creation" uuid="e11e9d2f-7cc2-3359-a78a-24f67cbe0850"
                     description="Coroutine scope should be created:&#10;&lt;ul&gt;&#10;&lt;li&gt;by a coroutine builder (&lt;code&gt;launch&lt;/code&gt;, &lt;code&gt;async&lt;/code&gt;, &lt;code&gt;runBlockingCancellable&lt;/code&gt;);&lt;/li&gt;&#10;&lt;li&gt;by a scoping function (&lt;code&gt;withContext&lt;/code&gt;, &lt;code&gt;coroutineScope&lt;/code&gt;, &lt;code&gt;supervisorScope&lt;/code&gt;);&lt;/li&gt;&#10;&lt;li&gt;by injecting it into a service constructor;&lt;/li&gt;&#10;&lt;li&gt;by explicitly creating a child scope (&lt;code&gt;childScope&lt;/code&gt;, &lt;code&gt;namedChildScope&lt;/code&gt;)&lt;/li&gt;&#10;&lt;/ul&gt; "
                     suppressId="RAW_SCOPE_CREATION"
                     problemDescriptor="Raw scope might not be linked to any parent unintentionally (if passed context does not have any &lt;code&gt;Job&lt;/code&gt;, or if passed &lt;code&gt;Job&lt;/code&gt; does not have any parent). Use &lt;code&gt;namedChildScope()&lt;/code&gt; on some existing scope instead. If no parent is actually intended, use &lt;code&gt;GlobalScope.namedScope()&lt;/code&gt;."
                     text="CoroutineScope($args$)" recursive="true" caseInsensitive="true" type="Kotlin" pattern_context="default"
                     search_injected="false">
  <constraint name="__context__" within="" contains=""/>
  <constraint name="args" within="" contains=""/>
</searchConfiguration>

This node should be located under <inspection_tool class="SSBasedInspection" tag.

  • To configure the scope of inspection, you need to make changes similar to this pattern, where class is UUID of the created replace configuration.

<inspection_tool class="e5d3c6f8-12ab-4cc9-8e51-8a8f1bd1c3e2" enabled="true" level="WARNING" enabled_by_default="false">
  <scope name="IDE Testing Framework" level="WARNING" enabled="true"/>
  <scope name="Tests" level="WARNING" enabled="true"/>
  <scope name="test-framework" level="WARNING" enabled="true"/>
</inspection_tool>
  • You must run InspectionProfileConsistencyTest after changing xml files

Version History

  • 1f8708d Current 2026-08-16 15:39

Same Skill Collection

.agents/skills/actions/SKILL.md
.agents/skills/code-style/SKILL.md
.agents/skills/commits/SKILL.md
.agents/skills/debugging/SKILL.md
.agents/skills/driver-ui-tests/SKILL.md
.agents/skills/eel/SKILL.md
.agents/skills/extract-module/SKILL.md
.agents/skills/module-dependencies/SKILL.md
.agents/skills/module-set-pluginization/SKILL.md
.agents/skills/notebook-for-experiment/SKILL.md
.agents/skills/pseudo-kmp/SKILL.md
.agents/skills/registry/SKILL.md
.agents/skills/remote-dev/SKILL.md
.agents/skills/safe-push/SKILL.md
.agents/skills/ssr/SKILL.md
.agents/skills/testing-internals/SKILL.md
.agents/skills/testing/SKILL.md
.agents/skills/ui-accessibility/SKILL.md
.agents/skills/writing-tests/SKILL.md
.claude/skills/actions/SKILL.md
.claude/skills/code-style/SKILL.md
.claude/skills/commits/SKILL.md
.claude/skills/debugging/SKILL.md
.claude/skills/driver-ui-tests/SKILL.md
.claude/skills/eel/SKILL.md
.claude/skills/extract-module/SKILL.md
.claude/skills/jewel-pr-preparer/SKILL.md
.claude/skills/jewel-release-helper/SKILL.md
.claude/skills/managing-youtrack/SKILL.md
.claude/skills/module-dependencies/SKILL.md
.claude/skills/module-set-pluginization/SKILL.md
.claude/skills/notebook-for-experiment/SKILL.md
.claude/skills/pseudo-kmp/SKILL.md
.claude/skills/registry/SKILL.md
.claude/skills/remote-dev/SKILL.md
.claude/skills/safe-push/SKILL.md
.claude/skills/testing-internals/SKILL.md
.claude/skills/testing/SKILL.md
.claude/skills/ui-accessibility/SKILL.md
.claude/skills/writing-tests/SKILL.md

Metadata

Files
0
Version
1f8708d
Hash
8e0d8bcc
Indexed
2026-08-16 15:39

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 17:32
浙ICP备14020137号-1 $mapa de visitantes$