You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad5accf
Browse filesBrowse the repository at this point in the historyBrowse files
description: JVM API Explorer & MCP Server that indexes public APIs, visualizes dependency graphs, audits version deprecations, and extracts JVM archive signatures (JAR/AAR) or Maven coordinates for AI context.
3
+
description: JVM API Explorer & MCP Server that indexes public APIs from compiled libraries (JAR/AAR) or local Java/Kotlin source code, enabling API exploration, dependency analysis, migration reports, and AI-ready context generation.
4
4
---
5
5
6
6
# Library Insight Agent Skill
7
7
8
-
Use this skill when you need to understand, inspect, or build AI prompts for external JVM libraries (Java/Kotlin JAR or AAR files) or public Maven dependency coordinates.
8
+
Use this skill when you need to understand, inspect, or build AI prompts for:
9
9
10
-
This tool extracts all classes, interfaces, methods, properties, and Javadoc/KDoc comments from bytecode and sources, creating an indexed database and a split AI-friendly directory structure.
10
+
- External JVM libraries (Java/Kotlin JAR or AAR files)
11
+
- Maven Central dependencies
12
+
- Local Java or Kotlin source code projects
13
+
14
+
Library Insight analyzes both compiled JVM libraries and local source code to build a searchable API index. It extracts public APIs, type information, documentation, source metadata, and Kotlin-specific language features, allowing AI agents to work with the exact code being used instead of relying on outdated documentation or web examples.
11
15
12
16
> [!IMPORTANT]
13
17
> **AI Agent Token Optimization Rule:**
14
-
> **DO NOT** read the entire `build/library-insight-index.json` or `API_REFERENCE.md` files directly using file-viewing tools. They contain massive raw dumps of the entire library surface which will exhaust your context window.
15
-
> Instead, you **MUST** use the CLI query subcommands to interactively look up only the specific information you need:
16
-
> - Use **`library-insight search <query>`** to find packages or classes.
17
-
> - Use **`library-insight explain <class>`** to print the public API signature and Javadocs of a specific class.
18
-
> - Use **`library-insight diff <old> <new>`** to compare versions.
19
-
> - Use **`library-insight audit`** to check project dependency API deprecations recursively.
20
-
> - Use **`library-insight migrate <old> <new>`** to get a migration advisor report with replacement suggestions.
21
-
> - Use **`library-insight search-central <query>`** to search Maven Central.
22
-
> - Use **`library-insight dependency-graph <coord>`** to visualize dependency trees.
23
-
> - Use **`library-insight semver <old> <new>`** to lint Semantic Versioning API compliance.
24
-
> - Use **`library-insight mcp`** to communicate as a Model Context Protocol (MCP) server.
25
-
> - Use **`library-insight dsl-report [--package <pkg>]`** to generate a Kotlin DSL surface report (type aliases, `@DslMarker` scopes, extension functions, lambda receivers, reified functions).
26
-
> - Use **`library-insight examples <class>`** to generate typical usage code examples from bytecode signatures.
27
-
> - Use **`library-insight health`** to generate a Package Health & API Complexity Report.
28
-
> - Use **`library-insight dependency-check`** to audit all transitive classpath dependencies for runtime conflicts.
29
-
> - Use **`library-insight callgraph <class.method>`** to trace internal library method invocation call graphs recursively.
30
18
>
31
-
> **MCP Integration Rule:**
32
-
> If an MCP server is already configured and available (e.g., in Cursor, Claude Desktop, or another IDE with MCP support), **prefer the MCP server over shelling out to the CLI**. The MCP server exposes `scan_library`, `search_symbols`, and `explain_class` tools natively without subprocess overhead.
19
+
> **DO NOT** read the entire `build/library-insight-index.json` or generated `API_REFERENCE.md` files directly using file-viewing tools. These files can be extremely large and will quickly exhaust the available context window.
20
+
>
21
+
> Instead, interact with the indexed database using the CLI query commands so that only the required symbols are loaded into context.
22
+
>
23
+
> **Indexing**
24
+
>
25
+
> - Use **`library-insight scan <jar|aar|directory|maven-coordinate>`** to index compiled JVM libraries.
26
+
> - Use **`library-insight scan-source <directory>`** to index a local Java/Kotlin source project without compilation.
27
+
>
28
+
> **Querying**
29
+
>
30
+
> - Use **`library-insight search <query>`** to locate packages, classes, methods, or properties.
31
+
> - Use **`library-insight explain <class>`** to inspect a class, including signatures, documentation, imports, and source locations when available.
32
+
> - Use **`library-insight examples <class>`** to generate typical usage examples.
33
+
>
34
+
> **Analysis**
35
+
>
36
+
> - Use **`library-insight diff <old> <new>`** to compare two library versions.
37
+
> - Use **`library-insight migrate <old> <new>`** to generate a migration report with replacement suggestions.
38
+
> - Use **`library-insight audit`** to audit project dependency APIs recursively.
39
+
> - Use **`library-insight dependency-check`** to detect runtime linkage and ABI conflicts across transitive dependencies.
40
+
> - Use **`library-insight dependency-graph <coordinate>`** to visualize dependency trees.
41
+
> - Use **`library-insight semver <old> <new>`** to validate Semantic Versioning API compatibility.
42
+
> - Use **`library-insight health`** to generate package health and API complexity reports.
43
+
> - Use **`library-insight dsl-report [--package <pkg>]`** to inspect Kotlin DSL surfaces, including `@DslMarker` scopes, type aliases, extension functions, lambda receivers, and inline reified functions.
44
+
> - Use **`library-insight callgraph <class.method>`** to recursively trace internal library method invocation call graphs.
45
+
>
46
+
> **AI Context**
47
+
>
48
+
> - Use **`library-insight ai-export`** to generate a token-optimized AI context package.
49
+
> - Use **`library-insight export`** to export the indexed API as JSON or Markdown documentation.
50
+
>
51
+
> **Important**
52
+
>
53
+
> Both **`scan`** and **`scan-source`** generate the same API index format. Once an index has been created, existing commands such as **`search`**, **`explain`**, **`export`**, and **`ai-export`** work identically regardless of whether the data originated from compiled bytecode or local source code.
54
+
55
+
> [!NOTE]
56
+
> **What Library Insight extracts**
57
+
>
58
+
> Depending on the input, Library Insight indexes:
59
+
>
60
+
> - Packages
61
+
> - Classes
62
+
> - Interfaces
63
+
> - Enums
64
+
> - Java Records
65
+
> - Kotlin Objects
66
+
> - Companion Objects
67
+
> - Constructors
68
+
> - Methods
69
+
> - Properties and Fields
70
+
> - Generic type parameters
71
+
> - Nullability information
72
+
> - Modifiers
73
+
> - Annotations
74
+
> - Package imports
75
+
> - Source locations (`file:line`)
76
+
> - Javadoc
77
+
> - KDoc
78
+
> - Kotlin metadata (`@Metadata`)
79
+
> - Data classes
80
+
> - Value classes
81
+
> - Sealed classes and interfaces
82
+
> - Extension functions
83
+
> - Kotlin DSL constructs
84
+
85
+
> [!TIP]
86
+
> **MCP Integration Rule**
87
+
>
88
+
> If an MCP server is already configured (for example in Cursor, Claude Desktop, VS Code, Windsurf, or another MCP-compatible IDE), prefer using the MCP server instead of invoking the CLI through subprocesses.
89
+
>
90
+
> The MCP server provides native tools for indexing libraries or source projects, searching indexed symbols, explaining APIs, and serving AI context with lower overhead than repeatedly executing CLI commands.
91
+
92
+
## Typical Workflows
93
+
94
+
### Analyze a compiled library
95
+
96
+
```bash
97
+
library-insight scan my-library.jar
98
+
99
+
library-insight search Retrofit
100
+
101
+
library-insight explain retrofit2.Retrofit
102
+
103
+
library-insight ai-export
104
+
```
105
+
106
+
### Analyze a local source project
107
+
108
+
```bash
109
+
library-insight scan-source app/src/main
110
+
111
+
library-insight search LoginRepository
112
+
113
+
library-insight explain LoginRepository
114
+
115
+
library-insight ai-export
116
+
```
117
+
118
+
### Compare two versions
119
+
120
+
```bash
121
+
library-insight diff old.jar new.jar
122
+
123
+
library-insight migrate old.jar new.jar
124
+
125
+
library-insight semver old.jar new.jar
126
+
```
33
127
34
128
## Command Reference
35
129
36
-
The command line tool `library-insight` can be executed globally by:
37
-
* Installing via installer script: `curl -fsSL https://raw.githubusercontent.com/Coding-Meet/Library-Insight/main/install.sh | bash`
38
-
* Running local build: `~/.library-insight/bin/library-insight` (linked globally as `library-insight`)
130
+
The `library-insight` CLI can be executed globally by:
- private val children: Any (sample/src/main/kotlin/com/meet/sample/SampleLibrary.kt:27)
271
+
272
+
Methods:
273
+
// /** Adds a paragraph element to the HTML output. */
274
+
- public fun p(text: String): Unit (sample/src/main/kotlin/com/meet/sample/SampleLibrary.kt:29)
275
+
// /** Adds a heading element. */
276
+
- public fun h1(text: String): Unit (sample/src/main/kotlin/com/meet/sample/SampleLibrary.kt:32)
277
+
// /** Adds a nested div block. */
278
+
- public fun div(block: HtmlBuilder.() -> Unit): Unit (sample/src/main/kotlin/com/meet/sample/SampleLibrary.kt:35)
279
+
- public fun build(): String (sample/src/main/kotlin/com/meet/sample/SampleLibrary.kt:41)
135
280
```
136
281
137
282
---
@@ -223,17 +368,21 @@ library-insight export json
223
368
```
224
369
225
370
**Positional Arguments:**
371
+
226
372
-`[output-file]`: Optional target output file path to write export content to. If not specified, defaults to `build/API_REFERENCE.md` or `build/library-insight-index.json`. Use `-` to print to stdout.
227
373
228
374
**Optional Parameters:**
375
+
229
376
-`--db <file>`: Index database JSON file path to read from (default: `build/library-insight-index.json`)
0 commit comments