Skip to main content

Token-saving Java file reader for AI coding agents. Summarizes Java files compactly using tree-sitter, saving 70-80% of input tokens.

Project description

jskim

PyPI version Python License

Token-saving Java file reader for AI coding agents, optimized for Spring Boot. Summarizes Java files compactly using tree-sitter, saving 70-80% of input tokens compared to reading files directly.

A human counted the tokens. An AI counted the getters. Both decided life's too short.

Installation

pip install jskim

Requires Python 3.10+.

Usage

jskim auto-detects the mode based on whether you pass a file or directory.

Summarize a Java file

jskim <file.java>
jskim <file.java> --grep <pattern>        # filter methods by name/signature
jskim <file.java> --annotation <@Ann>     # filter methods by annotation
jskim A.java B.java C.java                # multiple files

Java simple source files without an explicit type wrapper are summarized as implicit class <FileStem>, and their top-level methods are treated like normal class methods.

Project map

Generates a compact map of all Java files in a directory: packages, classes, annotations, field/method counts, Lombok usage, enum constants.

jskim <src_dir>
jskim <src_dir> --deps                 # import-based dependencies
jskim <src_dir> --endpoints             # REST endpoint map
jskim <src_dir> --beans                 # Spring bean DI graph + @Bean producers + config properties
jskim <src_dir> --package <prefix>      # filter by package
jskim <src_dir> --annotation <@Ann>     # filter by class annotation
jskim <src_dir> --extends <ClassName>   # filter by superclass
jskim <src_dir> --implements <Name>     # filter by implemented interface

Spring Boot flags:

  • --endpoints — lists all REST endpoints: HTTP method, full path (base + method), handler, line number
  • --beans — shows bean DI wiring (via @Autowired and @RequiredArgsConstructor + final fields), @Bean factory method producers, and @ConfigurationProperties with prefix + field details
  • --implements — filter classes by implemented interface name
  • --deps — uses fully-qualified names when simple class names would be ambiguous

Diff mode

Summarizes only the Java files and methods changed in a git diff. Ideal for PR reviews.

jskim --diff HEAD~1                    # changes since last commit
jskim --diff main                      # changes vs main branch
jskim --diff main...feature-branch     # merge-base comparison
jskim src/ --diff HEAD~1               # scoped to directory
git diff main | jskim --diff -         # read diff from stdin

Output marks methods as [NEW], [MODIFIED], or [DELETED]. Getters/setters/boilerplate changes are suppressed. Deleted methods are shown with their previous signature when a base ref is available, so overload removals stay distinguishable.

Extract methods

jskim <file.java> --list                          # list all methods
jskim <file.java> <method_name>                    # extract one method
jskim <file.java> <method1> <method2> <method3>    # extract multiple

Method calls ()

Each method in the skim output shows its direct method invocations:

// methods:
//     L45-L62 ( 18 lines): @PostMapping public Bill createBill(BillDTO dto)
//                → auditLogger.log, billingService.create, notifyStakeholders, validator.validate
//     L64-L80 ( 17 lines): @GetMapping("/{id}") public Bill getBill(Long id)
//                → billingService.findById

Cross-reference the calls with the fields: section to trace call flow across files — if a method calls billingService.create, the fields show BillingService billingService, so skim BillingService.java next. Chained/fluent calls (streams, builders) are excluded to keep output compact.

Usage in Skill-enabled Agents

Any coding agent that can run shell commands can use jskim directly. The repo also includes a SKILL.md definition for environments that support skill-style tool packaging and auto-triggering.

One published install path for skill-enabled environments is the Vercel Skills Registry:

npx skills add garvit-joshi/jskim

In hosts that expose the skill as a slash command, invoke it with /jskim:

/jskim <file.java>              # summarize a file
/jskim <src_dir>                # project map
/jskim <file.java> <method>     # extract a method

Workflow

  1. Explorejskim src/ to understand project structure
  2. Narrowjskim src/ --package com.example.billing to focus on a package
  3. Spring contextjskim src/ --endpoints --beans to see REST API + DI wiring
  4. Understandjskim File.java to see class structure, fields, methods, and calls
  5. Trace — Follow calls by matching field types to find the next class to skim
  6. Filterjskim File.java --grep billing for large classes
  7. Focusjskim File.java methodA methodB to read specific methods
  8. Edit — Read only the specific lines you need from the source file before editing

Dependencies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jskim-0.2.4.tar.gz (76.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jskim-0.2.4-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file jskim-0.2.4.tar.gz.

File metadata

  • Download URL: jskim-0.2.4.tar.gz
  • Upload date:
  • Size: 76.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jskim-0.2.4.tar.gz
Algorithm Hash digest
SHA256 8e971ac391965ad5d54b504602005a8fd8ec7a49f6280f03dae11fe3ae8ac9b3
MD5 42425a15bb31b6993bca98fdc32163f6
BLAKE2b-256 392dc76f8d3f6d73d43f34865d4cb7c99e1c36bee9cc8a8438c602c28d21da84

See more details on using hashes here.

Provenance

The following attestation bundles were made for jskim-0.2.4.tar.gz:

Publisher: publish.yml on garvit-joshi/jskim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jskim-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: jskim-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jskim-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f7303132b17cb5417c9e2f877c8f648fb220729836896ec479318a324f983a03
MD5 54ae9e9233ea3bbf5e276118861434d0
BLAKE2b-256 5cd87d7644d1c5c585933f0f5651b6b6059398dc75220dff3995947d33a0670b

See more details on using hashes here.

Provenance

The following attestation bundles were made for jskim-0.2.4-py3-none-any.whl:

Publisher: publish.yml on garvit-joshi/jskim

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page