state-first-design

Enforce explicit state and invariant definitions before coding.

Updated Mar 15, 2026
One-click install
npx skills add https://github.com/yAtomtom/dotfiles --skill state-first-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: state-first-design
Source: https://github.com/yAtomtom/dotfiles/tree/main/.claude/skills/state-first-design
Command: npx skills add https://github.com/yAtomtom/dotfiles --skill state-first-design

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

State-first design helps software teams avoid brittle, operation-centric solutions by forcing explicit definitions of state, properties, and invariants before implementation.

Core Features & Use Cases

  • Establish state and immutable properties before coding to clarify design choices.
  • Provide templates and guidelines that guide feature addition, refactoring, and code reviews.
  • Serve as a reference during design documents to ensure contract-like safety and predictable behavior.

Quick Start

Draft a clear State & Property definition using the provided template and begin implementation only after formalizing invariants.

Frequently Asked Questions about state-first-design

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

FAQPage Schema
How do I define state invariants before writing code?

To enforce state-first design, you explicitly define state, properties, and invariants before implementation using provided templates. This separates state from operations and establishes pre and post conditions to guide safer, predictable code.

What is state-first design and how does it prevent brittle code?

State-first design is an approach that forces explicit definitions of state, properties, and invariants before implementation. By shifting focus from operation-centric logic to formalized state contracts, it prevents brittle solutions and ensures predictable software behavior.

How do I use preconditions and postconditions in code reviews?

Using preconditions and postconditions in code reviews involves checking that state and invariant definitions are explicitly established before operations. You apply state-first design templates to verify contract-like safety and predictable behavior across modified features.

Does state-first design work for refactoring existing operation-centric implementations?

Yes, state-first design works for refactoring existing operation-centric implementations. It provides templates and guidelines to separate state from operations, allowing you to retrofit explicit invariants and pre or post conditions into modified code for safer behavior.

When should I not use design by contract principles?

You should avoid design by contract principles when your project lacks the overhead for explicit state and invariant definitions. State-first design requires formalizing immutable properties before coding, which may not suit rapid prototypes or operation-centric tasks needing immediate, unstructured implementation.