agent-comms
SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against the agent whitelist, or a…
React + TypeScript component and hook standards. TRIGGER when: creating components, custom hooks, or reviewing React code. SKIP: visual styling and theme tokens (use mui-styling); global store design (use state-management).
$ npx -y skills add komluk/scaffolding --skill react-patterns --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/react-patternsContext preview
The summary Claude sees to decide when to auto-load this skill.
React + TypeScript component and hook standards. TRIGGER when: creating components, custom hooks, or reviewing React code. SKIP: visual styling and theme tokens (use mui-styling); global store design (use state-management).
name: react-patterns description: "React + TypeScript component and hook standards. TRIGGER when: creating components, custom hooks, or reviewing React code. SKIP: visual styling and theme tokens (use mui-styling); global store design (use state-management)."
React + TypeScript standards and best practices.
---
| Rule | Description | |------|-------------| | Functional only | Use function components, no class components | | TypeScript props | Define Props interface for all components | | Single responsibility | One component = one purpose | | Max 200 lines | Split larger components into sub-components |
| Section | Order | |---------|-------| | 1. Imports | Types first, then libraries, then local | | 2. Props interface | Define before component | | 3. Hooks | All hooks at top of function | | 4. Handlers | Event handlers after hooks | | 5. Effects | useEffect after handlers | | 6. Return | JSX at the end |
---
| Hook | Use When | Avoid When | |------|----------|------------| | `useState` | Local component state | Shared state (use Zustand) | | `useEffect` | Side effects, subscriptions | Derived state (use `useMemo`) | | `useMemo` | Expensive calculations | Simple values | | `useCallback` | Callbacks passed to children | Inline handlers | | `useRef` | DOM refs, mutable values | State that triggers renders |
| Guideline | Description | |-----------|-------------| | Prefix with `use` | `useFeatureName`, `useDataFetching` | | Return object | `{ data, loading, error }` | | Single responsibility | One hook = one purpose | | Reusable | Extract when logic repeats 2+ times |
---
| Rule | Example | |------|---------| | Use `import type` | `import type { Props } from './types'` | | Use `export type` | `export type { ButtonProps }` | | Centralize types | All types in `types/index.ts` | | No `any` | Use `unknown` or proper types |
| Standard | Description | |----------|-------------| | Interface for props | `interface Props { ... }` | | Optional with `?` | `title?: string` | | Children explicit | `children: React.ReactNode` | | Events typed | `onClick: (e: React.MouseEvent) => void` |
---
| Technique | When to Use | |-----------|-------------| | `useMemo` | Expensive calculations, derived data | | `useCallback` | Functions passed as props to memoized children | | `React.memo` | Components with same props render same output |
| Cause | Solution | |-------|----------| | New object in props | Memoize with `useMemo` | | New function in props | Memoize with `useCallback` | | Context changes | Split contexts by update frequency | | Parent re-renders | Use `React.memo` on child |
---
| Rule | Description | |------|-------------| | Cleanup required | Return cleanup function for subscriptions | | Dependency array | Include all referenced values | | Avoid objects in deps | Use primitive values or `useMemo` | | No async directly | Define async function inside effect |
| Pattern | Use Case | |---------|----------| | Data fetching | Fetch on mount or dependency change | | Subscription | Event listeners, WebSocket | | DOM measurement | Read layout after render | | Sync external | Sync state with external system |
---
| Pattern | Example | |---------|---------| | Action verb | `handleClick`, `handleSubmit` | | Specific action | `handleDeleteItem`, `handleToggleMenu` | | Props callback | `onAction`, `onChange` |
| Event | Type | |-------|------| | Click | `React.MouseEvent<HTMLButtonElement>` | | Change | `React.ChangeEvent<HTMLInputElement>` | | Submit | `React.FormEvent<HTMLFormElement>` | | Keyboard | `React.KeyboardEvent` |
---
src/
├── components/
│ ├── common/ # Shared/reusable components
│ ├── [feature]/ # Feature-specific components
│ └── layout/ # Layout components
├── hooks/
│ └── use[Name].ts # Custom hooks
├── pages/
│ └── [Page].tsx # Route pages
├── services/
│ └── [name]Service.ts # API services
├── stores/
│ └── [name]Store.ts # Zustand stores
└── types/
└── index.ts # All type definitions---
| Anti-Pattern | Problem | Solution | |--------------|---------|----------| | useEffect for derived state | Extra renders | Use `useMemo` | | Missing dependencies | Stale closures, bugs | Add all deps | | Index as key | Bugs on reorder | Use unique id | | Prop drilling > 2 levels | Hard to maintain | Use Context/Zustand | | Inline object props | New reference each render | Memoize or extract | | State for constants | Unnecessary complexity | Define outside component |
---
Spec-driven multi-agent orchestration for Claude Code — pure markdown, zero backend, runs on the stock runtime. 13 agents, 36 skills, 19 commands, 15 hooks, per-phase model tiers, opt-in lifecycle hooks, optional cross-device semantic memory.
Repo: komluk/scaffolding
SendMessage recipient validation and worktreePath safety (CWE-59). TRIGGER when: validating a SendMessage `to:` recipient against the agent whitelist, or a…
3-tier markdown memory protocol (shared/agent/conversation) for cross-session knowledge. TRIGGER when: reading or writing agent memory files, choosing which…
RESTful API design standards: resource naming, HTTP methods, status codes, pagination, versioning. TRIGGER when: designing new API endpoints, defining error…
Optimize Claude Code context-window usage for accuracy and cost. TRIGGER when: hitting context limits, structuring prompts for an agent, or trimming what gets…
Schema design, index strategy, migration safety, and query analysis. TRIGGER when: designing tables or indexes, writing a migration, or diagnosing a slow…