Claude-skill-registry bb80-invariant-construction

Extract invariants from specification, encode in types/structure, enable single-pass construction.

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/bb80-invariant-construction" ~/.claude/skills/majiayu000-claude-skill-registry-bb80-invariant-construction && rm -rf "$T"
manifest: skills/data/bb80-invariant-construction/SKILL.md
source content

Big Bang 80/20: Invariant Construction

Core Concept

Big Bang 80/20 means single-pass construction in low-entropy domains.

Key: Extract invariants from specification, encode in types, never violate.

What Are Invariants?

Invariants are properties that must always be true:

DomainInvariantRust Type
Error handlingAll errors Result<T,E>
Result<T, Error>
File pathsNo traversal
SafePath
wrapper
Age0 ≤ age ≤ 150
newtype Age(u8)
Cache size≤ 10,000 entries
BoundedCache<T>

Type-Safe Design

// ✅ Invariant encoded in type
pub struct Age(u8);  // 0-255 enforced by type

impl Age {
    pub fn new(value: u8) -> Result<Self, Error> {
        if value > 150 {
            Err(Error::InvalidAge)
        } else {
            Ok(Age(value))
        }
    }
}

Reference

See CLAUDE.md sections:

  • Constitutional Rules (Type-First)
  • Automatic (Type-safe design)
  • Holographic Factory Metaphor (Corollary)