mcpField
C
clj-discover

clj-discover

github.com/humorlessDevelopment4459 installsUpdated 22w ago
Repository

About clj-discover

clj-discover is a skill for Clojure developers investigating unfamiliar Java APIs and macros. It guides discovery through Java reflection and macro expansion before code is written.

Key features

  1. 01Search for Clojure wrappers before Java interop
  2. 02Inspect Java classes with brepl reflection
  3. 03Record constructors, methods, and return types
  4. 04Expand macros one level or fully

Use cases

  1. 01Exploring an unfamiliar Java class from Clojure
  2. 02Checking a macro’s generated code
  3. 03Finding hidden calls or side effects in a macro

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/humorless/clj-native-agent --skill clj-discover

After installing, type/clj-discoverin Claude Code to confirm it loaded.

Bundled filesCHANGELOG.mdevals/evals.json

Details

From the project README

Clojure Code Discovery

When writing Clojure code with unfamiliar APIs, gather context before writing. This skill focuses on Java interop and macros.

When to Use This Skill

Automatically use this skill whenever you encounter:

  • A Java class that needs to be used from Clojure
  • A macro whose behavior is unclear (need to see what it expands to)

Workflow: Java Interop

1. Search for Clojure Wrappers First

Before exploring the Java class directly, ask:

"I see you're working with java.time.LocalDateTime. Would you like me to search for a Clojure wrapper library? Wrappers often provide simpler, more idiomatic APIs."

  • "Search for wrapper" → Use WebSearch to find clojure wrapper for <library-name>
  • "Use Java directly" → Skip to Java exploration below
2. Explore the Java Class

If using Java directly, use brepl to reflect on the class:

brepl <<'EOF'
(require '[clojure.reflect :as r])

; Get all public methods
(->> (r/reflect java.time.LocalDateTime)
     :members
     (filter #(instance? clojure.reflect.Method %))
     (map :name)
     sort)
EOF

Document findings:

  • Available constructors or factory methods (e.g., now(), of())
  • Key methods and their return types
  • Common patterns in your codebase

Workflow: Macro Exploration

When working with macros, expand them to understand what code they generate:

brepl <<'EOF'
(macroexpand-1 '(your-macro args))     ; expand one level
(macroexpand '(your-macro args))       ; fully expand
EOF

Macro expansion reveals:

  • What actual code runs when you use the macro
  • Hidden function calls or side effects
  • Whether the macro does what you think it does

Comments

Markdown supported