clanker-discipline

Derive state values from existing data instead of storing redundant flags.

22|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/gbasin/clanker-discipline --skill clanker-discipline
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clanker-discipline
Source: https://github.com/gbasin/clanker-discipline/tree/main
Command: npx skills add https://github.com/gbasin/clanker-discipline --skill clanker-discipline

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

State bloat and mutation ambiguity in AI coding agents cause brittle state management; this skill promotes deriving values from existing data rather than storing redundant flags, reducing the combinatorial explosion of state. It also enforces safer data models and function contracts to prevent accidental mutation and inconsistent types.

Core Features & Use Cases

  • Derive, don't store: derive values from events or existing data instead of caching flags to keep state small and predictable.
  • Make wrong states impossible: use discriminated unions over optional fields, and prefer nulls over sentinels to express absence clearly.
  • Enforce function contracts: keep functions pure where possible and encapsulate side effects to dedicated orchestrators.
  • Data over procedure: convert long if-chains that return similar shapes into declarative data tables for easier reasoning and maintenance.

Quick Start

Start by auditing your state definitions and remove derived flags, convert optional fields into discriminated unions, and replace nested if-chains with a data-driven lookup.

Frequently Asked Questions about clanker-discipline

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

FAQPage Schema
How do I reduce state explosion in my application's state management?

Reduce state explosion by deriving values from existing data rather than storing redundant boolean flags. This keeps your application state small and predictable by eliminating combinatorial state bloat.

When should I use discriminated unions over optional fields?

Use discriminated unions over optional fields to make wrong states impossible and prevent invalid data models. They express clear contracts, whereas optionals often lead to mutation ambiguity and inconsistent types.

What is the best way to enforce pure function contracts and prevent mutation?

The best way to enforce function contracts is keeping functions pure and side-effect-free, while encapsulating side effects in dedicated orchestrators. This prevents accidental mutation and ensures strong data-first contracts.

How do I convert nested if-chains into declarative data-driven lookups?

Convert long if-chains returning similar shapes into declarative data tables for easier reasoning. This data-over-procedure approach replaces complex conditional logic with a straightforward data-driven lookup.

Why prefer nulls over sentinel values for expressing absence in data models?

Prefer nulls over sentinel values to express absence clearly and ensure strong contracts. Sentinels introduce mutation risk and ambiguous types, whereas nulls maintain predictable, data-first patterns across your state.

Does the derive state pattern work for AI coding agents and state machines?

Yes, the derive state pattern works for AI coding agents and state machines by auditing state definitions and removing derived flags. It structures mutable data to prevent invalid states across various scenarios.