Helps developers create and manage Structural Search and Replace (SSR) patterns within IntelliJ IDEA.

Install

mkdir -p .claude/skills/ssr && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11849" && unzip -o skill.zip -d .claude/skills/ssr && rm skill.zip

Installs to .claude/skills/ssr

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guide for using Structural Search and Replace in IntelliJ. Use when creating or modifying SSR inspections or search patterns.
125 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Create Structural Search and Replace inspections.
  • Define Structural Search inspections.
  • Configure the scope of inspections.
  • Modify inspection profiles in XML.
  • Locate inspection configurations within the project.

How it works

The skill guides the creation and modification of Structural Search and Replace inspections in IntelliJ IDEA by providing XML examples and instructions for configuring search patterns, replacement templates, and inspection scopes within the project's inspection profiles.

Inputs & outputs

You give it
XML configuration for search/replace patterns
You get back
Modified IntelliJ inspection profile

When to use ssr

  • Create a new code inspection
  • Define a custom structural search pattern
  • Update project-wide code style rules

About this skill

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

When not to use it

  • When not working with IntelliJ IDEA's Structural Search and Replace feature.
  • When modifying files outside of the `.idea` directory.
  • When not using Java or Kotlin for the search patterns.

Limitations

  • Inspections are configured in `.idea/inspectionProfiles/idea_default.xml`.
  • Requires running `InspectionProfileConsistencyTest` after changing XML files.
  • Search patterns are defined for Java or Kotlin.

How it compares

This skill provides specific guidance and XML examples for IntelliJ's SSR feature, enabling the creation of custom code inspections and refactoring patterns directly within the IDE's configuration files, which is more targeted than manual c

Compared to similar skills

ssr side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
ssr (this skill)02moNo flagsAdvanced
clarity-over-cleverness03moNo flagsIntermediate
breach-encapsulation-naming05moNo flagsBeginner
unit-testing33moNo flagsBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry