Skip to main content
rule CX Codex

architecture-avoid-boolean-props — Claude Code rule

The architecture-avoid-boolean-props rule keeps component variants out of boolean props and moves them into composition. Use it when conditional UI branches start spreading across a component.

MIT ★ 7,191 updated 2026-10-24

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/rules/architecture-avoid-boolean-props.md
Open on GitHub

What architecture-avoid-boolean-props does

The rule advises against props such as isThread, isEditing, and isDMThread as switches for component behavior. Every added boolean expands the state space and makes the conditions harder to maintain. Separate compositions make each variant explicit instead of hiding several modes inside one parent.

The example keeps shared pieces in Composer.Frame, Composer.Header, Composer.Input, and Composer.Footer. ChannelComposer, ThreadComposer, and EditComposer then choose their own children and actions. Shared internals remain reusable, while the rendered structure is visible in each variant.

A component built around conflicting flags will accumulate branching logic, so this rule is a direct warning against that architecture choice.

What it helps with

  • remove boolean switches from components
  • split UI variants into explicit compositions
  • replace nested conditional branches
  • show each component state through its structure

Example prompts for the agent

  • Review Composer and replace isThread, isEditing, and isDMThread with composition.
  • Refactor ChannelComposer, ThreadComposer, and EditComposer so each one declares its own parts.
  • Find conflicting boolean props in this component and suggest a structure without mode switches.

How to install architecture-avoid-boolean-props

Manually: put the files in place

.claude/rules/architecture-avoid-boolean-props.md

The paths frontmatter field limits the files

Step by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use

Questions about architecture-avoid-boolean-props

How do I install architecture-avoid-boolean-props in Claude Code?

Copy the rule to .claude/rules/architecture-avoid-boolean-props.md.

What does architecture-avoid-boolean-props do?

It guides Claude Code away from boolean props that select component modes. The rule favors separate compositions built from shared pieces.

Why avoid boolean props in a component?

Each boolean adds more possible states, and conditional branches become harder to maintain as flags accumulate. Composition keeps each variant explicit.

Source text

architecture-avoid-boolean-props.md · MIT
---
title: Avoid Boolean Prop Proliferation
impact: CRITICAL
impactDescription: prevents unmaintainable component variants
tags: composition, props, architecture
---

## Avoid Boolean Prop Proliferation

Don't add boolean props like `isThread`, `isEditing`, `isDMThread` to customize
component behavior. Each boolean doubles possible states and creates
unmaintainable conditional logic. Use composition instead.

**Incorrect (boolean props create exponential complexity):**

```tsx
function Composer({
  onSubmit,
  isThread,
  channelId,
  isDMThread,
  dmId,
  isEditing,
  isForwarding,
}: Props) {
  return (
    <form>
      <Header />
      <Input />
      {isDMThread ? (
        <AlsoSendToDMField id={dmId} />
      ) : isThread ? (
        <AlsoSendToChannelField id={channelId} />
      ) : null}
      {isEditing ? (
        <EditActions />
      ) : isForwarding ? (
        <ForwardActions />
      ) : (
        <DefaultActions />
      )}
      <Footer onSubmit={onSubmit} />
    </form>
  )
}
```

**Correct (composition eliminates conditionals):**

```tsx
// Channel composer
function ChannelComposer() {
  return (
    <Composer.Frame>
      <Composer.Header />
      <Composer.Input />
      <Composer.Footer>
        <Composer.Attachments />
        <Composer.Formatting />
        <Composer.Emojis />
        <Composer.Submit />
      </Composer.Footer>
    </Composer.Frame>
  )
}

// Thread composer - adds "also send to channel" field
function ThreadComposer({ channelId }: { channelId: string }) {
  return (
    <Composer.Frame>
      <Composer.Header />
      <Composer.Input />
      <AlsoSendToChannelField id={channelId} />
      <Composer.Footer>
        <Composer.Formatting />
        <Composer.Emojis />
        <Composer.Submit />
      </Composer.Footer>
    </Composer.Frame>
  )
}

// Edit composer - different footer actions
function EditComposer() {
  return (
    <Composer.Frame>
      <Composer.Input />
      <Composer.Footer>
        <Composer.Formatting />
        <Composer.Emojis />
        <Composer.CancelEdit />
        <Composer.SaveEdit />
      </Composer.Footer>
    </Composer.Frame>
  )
}
```

Each variant is explicit about what it renders. We can share internals without
sharing a single monolithic parent.

© tech-leads-club · MIT · tech-leads-club/agent-skills

Similar IDE rules

All IDE rules for Frontend and UI →
render-props-pattern patterns.dev Walks through the render props pattern in React and tells you when a hook is the better call. Useful when rendering logic has to be shared across components. CX Codex +1 1,100installs avoid-ai-design ungspirit avoid-ai-design — a skill that audits frontend code for the patterns that make a UI look AI-generated, then rewrites it around one deliberate design direction. Useful when a Claude or Codex build looks like everyone else's. CX Codex +1 998installs props_generator Claude Design Skillstack Executes the props_generator.py script to generate props for animated UI components. Collects missing configuration through an interactive prompt mode. CX Codex +1 ★ 1,428repo stars MaBoSS Boolean Network Simulator marcorusc MaBoSS Boolean Network Simulator runs stochastic Boolean network simulations and attractor analysis directly through your agent. Useful for systems biologists testing mechanistic models without standalone tool setups. CX Codex +1 ★ 20repo stars PredictionMarketsPicks — NFL Props, Kalshi & Polymarket predictionmarketspicks PredictionMarketsPicks — NFL Props, Kalshi & Polymarket is an MCP server for Claude Code that reads Kalshi and Polymarket data, including NFL prices, probabilities, and cross-market gaps. CX Codex +1 1,794installs avoid-ai-writing Conor Bronsdon avoid-ai-writing is a Claude Code skill that audits prose for AI-generated patterns and rewrites phrasing. It supports editing drafts and documentation. CX Codex +1 5,300installs

From the same set130

The whole set →
async-defer-await async-defer-await — a rule that moves await operations into code branches where they're actually needed, preventing blockage of execution paths that may exit early. CX Codex +1 ★ 7,191repo stars server-dedup-props server-dedup-props — a rule for Claude Code about React Server Components: RSC-to-client serialization deduplicates by reference, not value. Server-side transforms like toSorted or filter create new references and double the payload. CX Codex +1 ★ 7,191repo stars rendering-usetransition-loading rendering-usetransition-loading — a rule that swaps hand-rolled loading flags in React components for useTransition. Useful when a spinner runs on its own useState. CX Codex +1 ★ 7,191repo stars server-cache-react server-cache-react instructs the assistant to deduplicate server-side operations with React.cache() and prevent cache misses from inline object arguments. CX Codex +1 ★ 7,191repo stars rendering-hydration-no-flicker rendering-hydration-no-flicker prevents server render failures and interface flickering when displaying content tied to browser storage. CX Codex +1 ★ 7,191repo stars bundle-barrel-imports The bundle-barrel-imports rule steers imports away from barrel files and toward source modules. It helps when a package exposes many re-exports and slows loading. CX Codex +1 ★ 7,191repo stars patterns-explicit-variants patterns-explicit-variants — a rule that pushes one component per mode instead of a single component buried under boolean props. The call site then says what renders. CX Codex +1 ★ 7,191repo stars async-suspense-boundaries async-suspense-boundaries guides Claude Code to place data fetching behind Suspense boundaries so headers, sidebars, and layout shells render without blocking. CX Codex +1 ★ 7,191repo stars

Project sponsors

Companies that keep this analytics open