home / skills / plurigrid / asi / borkdude

borkdude skill

/skills/borkdude

This skill helps you choose the right ClojureScript runtime (Babashka, SCI, Cherry, Squint, Scittle, nbb) for your context.

npx playbooks add skill plurigrid/asi --skill borkdude

Review the files below or copy the command above to add this skill to your agents.

Files (8)
SKILL.md
5.1 KB
---
name: borkdude
description: Babashka and ClojureScript runtime selection guidance by @borkdude
version: 1.0.0
---


<!-- Propagated to amp | Trit: 0 | Source: .ruler/skills/borkdude -->

# Borkdude Skill: ClojureScript Runtime Selection

**Status**: ✅ Production Ready
**Trit**: 0 (ERGODIC - runtime neutral)
**Principle**: Right tool for context
**Author**: Michiel Borkent (@borkdude)

---

## Overview

**Borkdude** provides guidance for selecting the appropriate ClojureScript runtime based on execution context. Named after Michiel Borkent, creator of Babashka, SCI, Cherry, Squint, and other Clojure tools.

## Runtime Matrix

| Runtime | Context | JVM | Node | Browser | REPL |
|---------|---------|-----|------|---------|------|
| **Babashka** | Scripting | ✗ | ✗ | ✗ | ✓ |
| **SCI** | Embedded | ✓ | ✓ | ✓ | ✓ |
| **Cherry** | Compiler | ✗ | ✓ | ✓ | ✓ |
| **Squint** | Compiler | ✗ | ✓ | ✓ | ✓ |
| **Scittle** | Browser | ✗ | ✗ | ✓ | ✓ |
| **nbb** | Node | ✗ | ✓ | ✗ | ✓ |

## Decision Tree

```
Start
  │
  ├── Need fast startup? ─────────► Babashka (bb)
  │
  ├── Browser target?
  │     ├── Minimal bundle? ──────► Squint
  │     ├── Full ClojureScript? ──► Cherry  
  │     └── Script tag? ──────────► Scittle
  │
  ├── Node scripting? ────────────► nbb
  │
  └── Embedded interpreter? ──────► SCI
```

## Commands

```bash
# Babashka (scripting)
bb script.clj

# nbb (Node)
npx nbb script.cljs

# Squint (compile to JS)
npx squint compile src/main.cljs

# Cherry (compile with macros)
npx cherry compile src/main.cljs

# Scittle (browser)
# <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/scittle.js"></script>
```

## SCI (Small Clojure Interpreter)

Embedded interpreter for sandboxed evaluation:

```clojure
(require '[sci.core :as sci])

(def ctx (sci/init {:namespaces {'user {'foo (fn [] "bar")}}}))

(sci/eval-string* ctx "(user/foo)")
;; => "bar"
```

## Cherry vs Squint

| Feature | Cherry | Squint |
|---------|--------|--------|
| ClojureScript compat | High | Medium |
| Bundle size | Larger | Smaller |
| Macros | Full support | Limited |
| Interop | CLJS-style | JS-native |
| Target audience | CLJS developers | JS developers |

## Babashka Pods

Extend Babashka with pods:

```clojure
(require '[babashka.pods :as pods])

(pods/load-pod 'org.babashka/go-sqlite3 "0.1.0")
(require '[pod.babashka.go-sqlite3 :as sqlite])

(sqlite/execute! "test.db" ["CREATE TABLE users (id INTEGER PRIMARY KEY)"])
```

## Integration with Music Topos

```clojure
;; Use Babashka for scripts
(ns ruler.propagate
  (:require [babashka.fs :as fs]))

;; Use SCI for embedded color evaluation
(def color-ctx
  (sci/init {:namespaces 
             {'gay {'color-at (fn [idx] (gay/color-at idx))}}}))
```

## When to Use Each

### Babashka
- Shell scripts
- Build automation
- CLI tools
- Data processing

### SCI
- Sandboxed evaluation
- Plugin systems
- Configuration DSLs
- Interactive REPLs

### Cherry
- Full CLJS features in browser
- Macro-heavy code
- CLJS library compat

### Squint
- Minimal JS output
- JS-first interop
- Small bundles

### Scittle
- Browser scripting
- No build step
- Quick prototypes

### nbb
- Node.js scripting
- npm library access
- Server scripts

## Example: Skill Propagation

```clojure
#!/usr/bin/env bb
;; .ruler/propagate.clj

(require '[babashka.fs :as fs]
         '[clojure.string :as str])

(defn propagate-skill! [skill-name]
  (let [source (str ".ruler/skills/" skill-name "/SKILL.md")
        content (slurp source)]
    (doseq [agent ["codex" "claude" "cursor"]]
      (let [target (str "." agent "/skills/" skill-name "/SKILL.md")]
        (fs/create-dirs (fs/parent target))
        (spit target content)))))

(propagate-skill! "unworld")
```

---

**Skill Name**: borkdude
**Type**: Runtime Selection / ClojureScript Tooling
**Trit**: 0 (ERGODIC)
**Runtimes**: Babashka, SCI, Cherry, Squint, Scittle, nbb



## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [○] via bicomodule
  - Universal graph hub

### Bibliography References

- `general`: 734 citations in bib.duckdb



## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 10. Adventure Game Example

**Concepts**: autonomous agent, game, synthesis

### GF(3) Balanced Triad

```
borkdude (+) + SDF.Ch10 (+) + [balancer] (+) = 0
```

**Skill Trit**: 1 (PLUS - generation)

### Secondary Chapters

- Ch2: Domain-Specific Languages
- Ch5: Evaluation
- Ch7: Propagators

### Connection Pattern

Adventure games synthesize techniques. This skill integrates multiple patterns.
## Cat# Integration

This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:

```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
```

### GF(3) Naturality

The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Overview

This skill gives practical guidance for choosing the right ClojureScript runtime for a given execution context. It distills trade-offs between Babashka, SCI, Cherry, Squint, Scittle, and nbb so you can match goals like startup speed, bundle size, macro support, and sandboxing to the correct runtime. The advice is actionable and oriented toward scripting, embedding, browser builds, and Node workflows.

How this skill works

The skill maps use-cases to a runtime matrix and a simple decision tree: ask about target (browser, Node, REPL), required features (macros, minimal bundle, fast startup), and whether embedding or sandboxing is needed. It also summarizes command-line invocations and examples for each runtime, plus brief comparisons (e.g., Cherry vs Squint) and code snippets for common patterns like embedding SCI or using Babashka pods. The outcome is a concrete recommendation and commands to get started quickly.

When to use it

  • Choose Babashka for fast-start scripting, CLI tools, build automation, and data processing where JVM startup is unacceptable.
  • Use SCI when you need an embedded, sandboxed evaluator for plugins, configuration DSLs, or interactive REPL features.
  • Pick Cherry for full ClojureScript compatibility, macro-heavy code, and when you need strong CLJS library support in the browser.
  • Pick Squint to produce minimal JS bundles with JS-first interop and limited macro needs.
  • Use Scittle for tiny browser scripts and prototypes with no build step; embed a script tag and go.
  • Use nbb for Node-based scripting that needs npm access and server-side automation.

Best practices

  • Start by answering three questions: where will code run (browser/Node/JVM), do you need macros, and is startup time critical.
  • Prefer Babashka for local scripts and CI tasks; add pods for native functionality instead of jumping to JVM tooling.
  • For browser targets, choose Squint for minimal bundles and Cherry when macro/library compatibility matters.
  • Use SCI for sandboxed evaluation; initialize a context with only the namespaces you expose to reduce attack surface.
  • Test small build outputs and runtime interop early—switching from Squint to Cherry is easier than refactoring macro-heavy code later.

Example use cases

  • Automate project builds and release scripts with Babashka and pods for fast CI runs.
  • Embed SCI as a safe plugin evaluator inside a host application for user-defined behavior without JVM overhead.
  • Build a tiny analytics widget with Squint to keep bundle size minimal and integrate with existing JS code.
  • Compile a macro-heavy frontend library with Cherry to retain full ClojureScript semantics and macro support.
  • Run server-side startup scripts and maintenance tasks with nbb to access npm modules from ClojureScript.

FAQ

Which runtime supports full macros?

Cherry provides full macro support; Squint has limited macro capabilities and smaller bundles.

When should I prefer SCI over embedding a full CLJS compiler?

Use SCI when you need a lightweight, sandboxed evaluator with controlled namespaces; use a compiler when you need full ClojureScript semantics or optimized output for production.