writing-clj-kondo-hooks

Create custom clj-kondo lint hooks for user-defined macros using clj-kondo.hooks-api and RNL.

10|3|Updated Feb 21, 2015
One-click install
npx skills add https://github.com/SevereOverfl0w/.files --skill writing-clj-kondo-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-clj-kondo-hooks
Source: https://github.com/SevereOverfl0w/.files/tree/main/dotfiles/.agents/skills/writing-clj-kondo-hooks
Command: npx skills add https://github.com/SevereOverfl0w/.files --skill writing-clj-kondo-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developers need to extend clj-kondo linting for custom macros but lack guidance and ready-to-use hooks, making linting incomplete and error‑prone.

Core Features & Use Cases

  • Hook Types: Provides guidance for creating both analyze-call hooks (precise transformation) and macroexpand hooks (simpler macro expansion).
  • API Reference: Details the clj-kondo.hooks-api functions for node construction, lint registration, and analysis utilities.
  • Workflow Steps: Shows how to read configuration, write the hook code, register it, and test with clj-kondo.
  • Use Case: Ideal for library authors who define new macros and want clj‑kondo to understand them without manual lint suppression.

Quick Start

Use the writing-clj-kondo-hooks skill to create a clj‑kondo hook that rewrites a custom macro call into a let expression.

Frequently Asked Questions about writing-clj-kondo-hooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write custom clj-kondo hooks for my Clojure macros?

Clj-kondo hooks work by using rewrite-clj node structures and the clj-kondo.hooks-api to transform custom macro calls into standard expressions, allowing the linter to analyze them without manual suppression.

What is the difference between analyze-call and macroexpand hooks in clj-kondo?

Creating a clj-kondo hook involves reading your configuration, writing hook code using the clj-kondo.hooks-api for node construction, registering the hook, and testing the linting results with clj-kondo.

Do I need to know rewrite-clj node structures to create clj-kondo lint hooks?

You need to know rewrite-clj node structures and the clj-kondo.hooks-api to construct nodes, transform macro calls, and register findings when writing custom lint hooks.

Can I use clj-kondo hooks to lint custom macros without manual suppression?

Yes, custom clj-kondo hooks allow your macros to be understood by the linter, enabling static analysis without manual suppression in your Clojure projects.

What are the limitations of using macroexpand hooks for clj-kondo static analysis?

Macroexpand hooks offer simpler expansion compared to analyze-call hooks, which may limit the precision of static analysis for complex macros requiring detailed node-level transformation.