clj-refactor

Detect mechanism/policy coupling in Clojure source code and propose refactoring candidates.

31|Updated Mar 8, 2026
One-click install
npx skills add https://github.com/humorless/clj-native-agent --skill clj-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clj-refactor
Source: https://github.com/humorless/clj-native-agent/tree/main/skills/clj-refactor
Command: npx skills add https://github.com/humorless/clj-native-agent --skill clj-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

clj-refactor helps you identify where Clojure code mixes reusable, stable logic with business-specific decisions, so your system stays easier to test, reuse, and evolve.

Core Features & Use Cases

  • Mixed code detection: Flags functions/modules where mechanism and policy are tangled and explains where the boundary should be drawn.
  • Extraction candidates: Recommends specific pieces of logic to move into separate, context-free modules suitable for reuse and isolation.
  • Misplaced policy discovery: Spots business assumptions that have leaked into lower-level infrastructure and specifies where they belong.
  • Concrete refactoring proposals: Suggests before/after structural changes while preserving existing behavior and avoiding premature abstraction.

Quick Start

Use clj-refactor to scan a Clojure directory for mechanism/policy tangling and propose structural extractions that preserve behavior.

Frequently Asked Questions about clj-refactor

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

FAQPage Schema
How do I separate mechanism from policy in Clojure code?

You detect misplaced policy in Clojure by scanning modules for business assumptions that have leaked into lower-level infrastructure, then proposing structural extractions that move them to appropriate higher-level contexts.

How do I refactor tangled Clojure modules without premature abstraction?

You refactor tangled Clojure modules by applying evidence-backed extraction candidates that propose before/after structural changes, ensuring behavior preservation while avoiding premature abstraction during the refactoring process.

What is mechanism and policy coupling in Clojure source code?

Mechanism and policy coupling in Clojure occurs when stable, reusable logic mixes with business-specific decisions, reducing maintainability and making the system harder to test, reuse, and evolve over time.

Can I scan a Clojure directory for refactoring opportunities automatically?

Yes, you can scan a Clojure directory to identify mixed code boundaries and repeated patterns, which produces findings that describe specific extraction candidates and concrete structural refactoring proposals.

When should I not extract logic into separate Clojure modules?

You should avoid extracting logic into separate Clojure modules when it leads to premature abstraction, as the process prioritizes evidence-backed candidates and behavior preservation over unnecessary structural separation.