- docs/agent/external: Vercel react-best-practices and composition-patterns (MIT), Addy Osmani accessibility (MIT), Anthropic frontend-design (Apache-2.0), official Payload skill at v3.92.1 (MIT) — text only, each with its licence, SOURCE.md (repo, commit) and an override note in front of the SKILL.md (ipal-kit first, Payload fetching over swr, DESIGN.md tokens, Payload 3 not 4); manifest.json with sha256 per file - scripts/vendor-external-skills.mjs (maintainer, not shipped): fetches by full commit SHA only, rejects non-text or executable files, regenerates the manifest; --check verifies it - ipal-skills --external [names]: copies ext-* after checking every file against the manifest, downloads nothing, never touches ext-* folders without ipal-kit's SOURCE.md, removes only retired ones it installed; an unknown name stops the run before anything is copied - AGENT.md §14, ipal-setup stage 2 (optional step), README: usage, overrides, how to update the pins - test/externalSkills.test.ts: pins are SHAs, no branch fetch, checksums, text only, licences, override note, installer leaves other folders alone Co-Authored-By: Claude Opus 5.5 <[email protected]>
101 lines
2.2 KiB
Markdown
101 lines
2.2 KiB
Markdown
---
|
|
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.
|