- After editing source files, use brepl to
requirethe changed namespace with:reloadand test interactively, rather than relying solely oncurlorbb test.
- Call handlers directly — Ring handlers are pure functions (request map → response map). Test them in brepl without going through HTTP or middleware:
(handlers/home-handler {}),(handlers/inspect-handler {}). Inspect response structure with(keys resp)before dumping the full body. - Verify routes with Reitit — Use
reitit.core/match-by-pathto check route matching interactively without a browser:(reitit.core/match-by-path (reitit.ring/router app-routes/routes) "/"). Useful for verifying newly added routes before integration testing. - Compose and inspect HoneySQL queries — Build queries incrementally as data and preview the generated SQL with
(honey.sql/format query {:quoted true})before sending to the database. This lets you verify correctness without executing against the DB. - Reflect on Java objects — When interacting with unfamiliar Java objects or Interop, use
(clojure.reflect/reflect obj)to inspect available methods and types instead of guessing. For a cleaner view of public methods, use:(->> (clojure.reflect/reflect obj) :members (filter :exception-types)(map :name) sort) - Debugging — When investigating a bug, start with
(ex-message *e)and(ex-data *e). If state seems stale, use(integrant.repl/reset)to sync the system. Call functions directly to inspect return values, query the DB with(db/exec! ds ...), and check the Integrant system via(keys integrant.repl.state/system).
- Incremental Inspection — Always start with low-token queries: use
(keys ...)to see structure,(count ...)for size, or(take 5 ...)for samples. - Escalation Path — If sampling is insufficient to diagnose the issue, you are encouraged to retrieve specific nested data or full objects, but do so purposefully (e.g.,
(get-in ...)). - State Verification — After modifying code, use brepl to call the affected functions directly. If the output is a massive data structure, summarize the key changes for the session instead of printing the whole thing.