Intellij

From G1Joshi/Agent-Skills · View interactive version

Intellij is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert IntelliJ IDEA assistance covering Java/Kotlin, project SDKs, debugging, refactoring, run configurations, and plugins. Use when building enterprise JVM applications with maximum productivity.

How to use this skill

Skill file

IntelliJ IDEA

IntelliJ IDEA is the premier IDE for Java and Kotlin. v2025.1 introduces Java 24 support, K2 Mode (Beta/Stable), and a unified AI Assistant.

When to Use

Quick Start

# Run Maven or Gradle build using wrapper
./gradlew bootRun

# Useful keyboard shortcuts:
# Shift+Shift: Search Everywhere
# Ctrl+Alt+L / Cmd+Option+L: Reformat Code
# Shift+F10 / Ctrl+R: Run Application

Core Concepts

Run / Debug Configuration with VM Options

Configuring production-grade local execution:

<!-- .run/ApiApplication.run.xml -->
<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="ApiApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
    <module name="api-service.main" />
    <option name="SPRING_BOOT_MAIN_CLASS" value="com.company.api.ApiApplication" />
    <option name="VM_PARAMETERS" value="-Xms512m -Xmx2048m -XX:+UseG1GC -Dspring.profiles.active=local" />
    <extension name="coverage" />
    <method v="2">
      <option name="Make" enabled="true" />
    </method>
  </configuration>
</component>

Inspecting Memory & Thread Dumps with IntelliJ Profiler

Diagnosing memory leaks and deadlocks:

Structural Search & Replace (SSR)

Finding and modifying patterns across entire codebases:

// Search Template: Catch blocks catching raw generic Exception
catch ($ExceptionType$ $e$) {
    $Statements$;
}
// Constraint: $ExceptionType$ = java.lang.Exception
// Replace Template: Narrow to specific checked domain exceptions

Common Patterns

JVM Memory Profiling and Heap Dump Analysis

Problem: Diagnose memory leaks and high GC overhead in Spring Boot applications.

Solution: Launch app with JVM profiling arguments.

# JVM options for heap profiling
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/var/log/heapdump.hprof
-XX:+UseG1GC
-Xms2g -Xmx4g

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :----------------------------------------------- | :------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------ |

| Cannot resolve symbol '...' in editor | Project SDK not configured or Maven/Gradle dependencies not loaded. | Open Project Structure > SDKs and ensure JDK is selected, then sync Gradle. |

| OutOfMemoryError: Java heap space during build | IntelliJ build process allocated insufficient memory. | Increase memory: Settings > Build, Execution, Deployment > Compiler > Shared build process heap size (2048 MB). |

| Red code everywhere after git pull | Indices corrupted. | Click File > Invalidate Caches... > Invalidate and Restart. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.