piyushkr001/piyushkumar/java-lsp-tools

Claude Code and agent skill by piyushkr001/piyushkumar

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Compiler-accurate Java code intelligence tools powered by the Java Language Server. ALWAYS load this skill when the workspace contains Java, Maven (pom.xml), or Gradle (build.gradle) projects. Use these tools to find symbol definitions, get type/call hierarchies, resolve types, inspect file outlines, and check imports in Java source files. Prefer over grep_search or read_file for any Java code navigation, understanding, debugging, or refactoring task.

Install

npx vskill@latest install piyushkr001/piyushkumar/java-lsp-tools

SKILL.md

The same SKILL.md was published earlier as piyushkr001/piyushkumar/java-lsp-tools.

Java LSP Tools

Compiler-accurate Java code intelligence via the Java Language Server (jdtls). These 6 tools provide structured, low-token answers that are more precise than grep_search or read_file for Java code.

Activation

These tools are deferred and must be discovered before first use. Activate all 6 tools at once with tool_search_tool_regex using pattern:

lsp_java_findSymbol|lsp_java_getFileStructure|lsp_java_getCallHierarchy|lsp_java_getTypeHierarchy|lsp_java_getTypeAtPosition|lsp_java_getFileImports

You only need to do this once per session.

When to Replace grep_search

For Java source files, always prefer these tools over generic alternatives:

You're doing...Use insteadWhy
Find where a class/method is definedlsp_java_findSymbol~60 tokens vs ~500 for grep (no comment/import noise)
Find all callers of a methodlsp_java_getCallHierarchy("incoming")~80 tokens vs ~3000 for grep (precise call sites only)
Find all implementations of an interfacelsp_java_getTypeHierarchy("subtypes")~60 tokens vs ~1000 for grep
Check a var/lambda/generic typelsp_java_getTypeAtPosition~20 tokens vs guessing wrong
Search in non-Java files (xml, yaml, gradle)Keep using grep_searchlsp_java_* tools only work on Java source
Search for string literals or commentsKeep using grep_searchlsp_java_* tools return symbol definitions only

Rule of thumb: If you're searching for a Java symbol name in .java files, there is almost always a lsp_java_* tool that returns more precise results with fewer tokens than grep_search.

Anti-patterns (Avoid these)

❌ Don't: Use grep_search("decodeLbs") to find who calls decodeLbs()

  • Returns 8+ matches including declaration, comments, imports → ~3000 output tokens

✅ Do: Use lsp_java_getCallHierarchy(uri, line, char, "incoming")

  • Returns only actual call sites → ~80 output tokens

❌ Don't: Use grep_search("class.*extends BaseDecoder") to find subclasses ✅ Do: Use lsp_java_getTypeHierarchy(uri, line, char, "subtypes")

❌ Don't: Read entire 1000+ line file to understand its structure ✅ Do: Use lsp_java_getFileStructure(uri) first, then read_file on specific line ranges

Tools

All tools accept workspace-relative paths (e.g. src/main/java/com/example/MyClass.java) or full file URIs. All return structured JSON, each response < 200 tokens.

lsp_java_getFileStructure

Get hierarchical outline (classes, methods, fields) with line ranges. Input: { uri } → Output: symbol tree with [L start-end] ranges (~100 tokens)

lsp_java_findSymbol

Search for symbol definitions by name across the workspace. Supports partial/fuzzy matching. Input: { query } → Output: up to 20 results with { name, kind, location } (~60 tokens)

lsp_java_getFileImports

Get all imports classified by source (jdk/project/external). Input: { uri } → Output: classified import list (~80 tokens)

lsp_java_getTypeAtPosition

Get compiler-resolved type signature at a specific position. Input: { uri, line, character } (0-based) → Output: fully resolved type (~20 tokens)

lsp_java_getCallHierarchy

Find all callers (incoming) or callees (outgoing) of a method. Input: { uri, line, character, direction } (0-based, direction: "incoming" | "outgoing") → Output: list of { name, detail, location } (~80 tokens)

lsp_java_getTypeHierarchy

Find supertypes or subtypes/implementors of a type. Input: { uri, line, character, direction } (0-based, direction: "supertypes" | "subtypes") → Output: list of { name, kind, location } (~60 tokens)

Common Workflows

Most tasks follow the pattern: findSymbol → getFileStructure → targeted tool.

ScenarioWorkflowTrigger
Debug a bugfindSymbol → getFileStructure → read_file (buggy method) → `getCallHierarchy("incoming")` → read_file (caller context)When you found the buggy method and need to know ALL callers
Analyze impactfindSymbol → getFileStructure → getCallHierarchy("incoming")Before editing a method, check who depends on it
Understand inheritancefindSymbol → getTypeHierarchy("subtypes")When you see a base class and need all implementations
Check dependenciesgetFileImports → findSymbol (dependency) → getFileStructureWhen understanding external library usage
Resolve type ambiguitygetFileStructure → getTypeAtPositionWhen you see var, generics, or lambda and need exact type

Fallback

  • `lsp_java_findSymbol` returns empty:
  • Symbol may not exist yet → switch to read_file + grep_search to confirm, then create it
  • Spelling/query too specific → retry once with a shorter keyword (e.g. "UserSvc" instead of "UserServiceImpl")
  • Path error (e.g. "Unable to resolve nonexistent file"): Use lsp_java_findSymbol to discover the correct file path first, then retry.
  • Tool error / empty result (jdtls not ready, file not in project): Fall back to read_file + grep_search. Don't retry more than once.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/piyushkr001/piyushkumar/java-lsp-tools/badge)](https://verified-skill.com/skills/piyushkr001/piyushkumar/java-lsp-tools)

Something wrong with this skill or its page? Tell us.