Crispen

From beep-effect/beep-effect · View interactive version

Crispen is an AI agent skill from the GitHub repository beep-effect/beep-effect. Refactoring operator: "crispen", "crisp this up", "reduce helpers", "colocate behavior", "helper-wall cleanup", "schema is truth" as a refactor request. Absorbs invariants from existing business logic into existing schemas — decode/guard-wall deletion, *Defaults removal, literal-family collapse, Opt

How to use this skill

Skill file

Crispen

The schema is truth; behavior precipitates. Crispening is a *refactoring

operator*: it pushes invariants and pure behavior already living in business

logic into the schema and onto the data, so business-logic files shrink to

intent. Win condition: **the first ~200 lines of any business-logic module read

as pure intent** — no decode/guard helper wall, no *Defaults spreads, no

imperative let/for/push loops.

This is lazy-minimalism aimed at existing schema-shaped code. It is a

lens, not a law source: the schema laws live in schema-first-development

(and effect-first-development for anything broader). When crispening instinct

conflicts with those laws, the laws win. Authoring new schemas or domain

models is schema-first-development's lane, not this skill's.

Persistence

ACTIVE EVERY RESPONSE while engaged. No drift back to helper-wall habits. Still

active if unsure. Off only: "stop crispen" / "normal mode". Default: full.

Switch: /crispen lite|full|ultra. Level persists until changed or session end.

The crispening ladder

Before you keep a helper, climb. **Stop at the first rung that removes the

noise** — but only after you understand the module and trace the real flow.

Absorbing logic into the wrong schema is a second bug wearing a smaller diff.

  1. Can the schema carry this invariant instead of code? (default, refinement,

brand, Option field)

  1. Does a schema/combinator/primitive already exist? Check upstream

effect/Schema first, then search @beep/schema and @beep/identity before

inventing — see schema-first-development →

references/local-primitives.md. Where upstream covers a

foundation/modeling concept's intent, its covered facets retire in the same

PR that migrates their consumers, with no alias; the whole concept retires

unless the lines reading its uncovered members outnumber the lines using its

covered facets (ADAPT, per the facet census in

standards/architecture/DECISIONS.md "Upstream-First Foundation/Modeling").

  1. Absence/nullish → Option in the schema, not a null-check.
  2. Constant/bool default → the schema, not a *Defaults spread.
  3. Decode/guard wall → colocated statics on the schema const/class.
  4. Repeated literal/variant family → one node + a kit (LiteralKit /

MappedLiteralKit for a named domain; S.Literals for an anonymous inline

union never referenced by name).

  1. Branching → a fold; passthrough → point-free.
  2. Split roles: .model.ts / .behavior.ts / .codec.ts / .render.ts /

.escape.ts — specialize per package, no package needs all five.

For every rung, the exact combinator, its signature, and a real usage site are in

references/crispening.md (this skill). The governing rules for which

pattern is lawful are in schema-first-development: references/repo-laws.md

(enforced laws), references/pattern-catalog.md (pattern selection +

anti-patterns), references/local-primitives.md (shared @beep/schema

primitives), references/examples.md (real exemplars). Load those, don't

re-derive them here.

Output discipline

Code first. Then at most three short lines: **what invariant moved into the

schema, what helper wall was deleted, what was deliberately left.** No essays.

If the explanation is longer than the deletion, delete the explanation.

Deliberately un-absorbed logic gets no comment: free prose comments are banned

(Effect law 15). Name why and the upgrade path in the "deliberately left"

line of the output. When the reason must live with the code, record it under

<package>/decisions/ and point at it with the one allowed line comment:

// decision: cross-field-refinement-helper

Intensity

| Level | What changes |

|-------|--------------|

| lite | Build/leave what's asked, but name the crispening opportunity in one line — the schema or combinator that would absorb it. User picks. |

| full | The ladder enforced. Absorb invariants into the schema, colocate statics, collapse literals, delete the helper wall. Shortest diff. Default. |

| ultra | Absorption extremist. Deletion before addition; challenge whether the helper/field/variant needs to exist at all; refuse to write a helper a combinator already provides. |

When NOT to crispen

design) → schema-first-development.

stay explicit and property-tested. Behavior parity over cleverness.

for S.suspend mutual recursion. Verbosity there is correct, not debt.

exhaustive-match arm per real variant is the feature, not the noise.

that fails if the moved invariant breaks.

Verify

bun run beep laws terse-effect --check
bun run beep laws effect-fn --check
bun run beep laws native-runtime --check
bun run beep laws effect-imports --check
bun run beep lint schema-first
bun run beep lint schema-topology
bun run beep yeet verify                    # full proof

Smell-checks before you start — the walls to demolish:

rg -n 'const (is|decode)\w+ = S\.(is|decodeUnknown)' path/   # decode/guard wall
rg -n '\.\.\.\w*Defaults\b' path/                            # *Defaults spreads
rg -n ' as [A-Z]| as unknown|![.)\]]' path/                  # assertions / non-null

Do not run manual turbo/docgen/vitest while a background yeet verify is

in flight — daemon contention emits spurious failures; use read-only probes.

Reference & escalation

every combinator, its signature, the noise it kills, a real usage site; plus

the before→after moves catalog from the @beep/md / @beep/lexical-schema

refactor.

references/pattern-catalog.md, references/local-primitives.md,

references/examples.md.

errors, concurrency).

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.