Kiro steering for React with TypeScript: typed props, labelled controls, derived values instead of effects, hook choices and when memoization is worth it.
.kiro/steering/kiro-react-development.md. Downloaded files need to be placed in that repository path.---
inclusion: fileMatch
fileMatchPattern: "**/*"
---
Apply these rules to React components in this workspace.
## Component structure
```tsx
import { useId, useState } from 'react';
interface Item {
id: string;
name: string;
}
interface ItemListProps {
title: string;
items: Item[];
onSelect: (item: Item) => void;
}
export function ItemList({ title, items, onSelect }: ItemListProps) {
const [filter, setFilter] = useState('');
const filterId = useId();
const query = filter.trim().toLowerCase();
const filtered = query ? items.filter((i) => i.name.toLowerCase().includes(query)) : items;
return (
<section>
<h2>{title}</h2>
<label htmlFor={filterId}>Filter items</label>
<input id={filterId} type="search" value={filter} onChange={(e) => setFilter(e.target.value)} />
{filtered.length === 0 ? (
<p>No items match “{filter}”.</p>
) : (
<ul>
{filtered.map((item) => (
<li key={item.id}>
<button type="button" onClick={() => onSelect(item)}>{item.name}</button>
</li>
))}
</ul>
)}
</section>
);
}
```
- Every input has a visible label (a placeholder is not a label); buttons have `type`.
- Render the empty state, not just an empty list.
- Use stable `key`s from data, never array indexes for lists that can change order.
## Hooks
- `useState` for simple local state; `useReducer` when several values change together through named actions.
- Extract reusable stateful logic into custom hooks (`useSomething`).
- Compute derived values during render (like `filtered` above). Add `useMemo` only when profiling shows the computation is expensive for realistic data, or when a memoized child needs a stable reference; skip it if React Compiler is enabled.
- Do not use effects to sync state with props; use effects only for external systems (subscriptions, timers, DOM APIs) and clean them up.
Cursor rules for Tailwind CSS v4: automatic class sorting, mobile-first breakpoints, CVA variants with merging, class-based dark mode via @custom-variant, and CSS-first @theme configuration.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.
CLAUDE.md rules for React 19 with TypeScript covering typed components, derived state, compiler-aware memoization, useId-based accessibility and review checks.
Kiro
frontend
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A Kiro spec adds a searchable item picker; the existing component uses a placeholder as the only label and wraps a cheap filter in useMemo.
Build the ItemPicker from the spec's task 3 following the React steering file: filter by name, empty state, select an item.
A typed component with a labelled search input (useId), derived filtered list, an explicit empty state, buttons with type="button" and stable keys, and no useMemo unless a measured reason is given.
Kiro, built and operated by AWS, uses steering files: Markdown documents in .kiro/steering/ that give the agent persistent project knowledge. Front matter controls when each file is included: always, when matching files are in context, manually by #name, or automatically by description. Kiro also includes AGENTS.md files.
.kiro/steering/kiro-react-development.mdStarting point, not a tested configuration for your repository. Included when files matching fileMatchPattern are in context. Review the instructions, adapt the file paths and run your project's existing checks.
---
inclusion: fileMatch
fileMatchPattern: "**/*"
---
Apply these rules to React components in this workspace.
## Component structure
```tsx
import { useId, useState } from 'react';
interface Item {
id: string;
name: string;
}
interface ItemListProps {
title: string;
items: Item[];
onSelect: (item: Item) => void;
}
export function ItemList({ title, items, onSelect }: ItemListProps) {
const [filter, setFilter] = useState('');
const filterId = useId();
const query = filter.trim().toLowerCase();
const filtered = query ? items.filter((i) => i.name.toLowerCase().includes(query)) : items;
return (
<section>
<h2>{title}</h2>
<label htmlFor={filterId}>Filter items</label>
<input id={filterId} type="search" value={filter} onChange={(e) => setFilter(e.target.value)} />
{filtered.length === 0 ? (
<p>No items match “{filter}”.</p>
) : (
<ul>
{filtered.map((item) => (
<li key={item.id}>
<button type="button" onClick={() => onSelect(item)}>{item.name}</button>
</li>
))}
</ul>
)}
</section>
);
}
```
- Every input has a visible label (a placeholder is not a label); buttons have `type`.
- Render the empty state, not just an empty list.
- Use stable `key`s from data, never array indexes for lists that can change order.
## Hooks
- `useState` for simple local state; `useReducer` when several values change together through named actions.
- Extract reusable stateful logic into custom hooks (`useSomething`).
- Compute derived values during render (like `filtered` above). Add `useMemo` only when profiling shows the computation is expensive for realistic data, or when a memoized child needs a stable reference; skip it if React Compiler is enabled.
- Do not use effects to sync state with props; use effects only for external systems (subscriptions, timers, DOM APIs) and clean them up.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Front matter must be at the very beginning of a steering file to be recognized. Kiro supports AGENTS.md. According to the steering docs, AGENTS.md files do not support inclusion modes and are always included, so keep scoped guidance in .kiro/steering/ files instead.
Documentation checked 2026-11-05: Kiro docs: SteeringKiro home page
Cursor rules for Tailwind CSS v4: automatic class sorting, mobile-first breakpoints, CVA variants with merging, class-based dark mode via @custom-variant, and CSS-first @theme configuration.
Cursor rules for React with TypeScript: typed function components, React 19 ref-as-prop, hooks discipline, state ownership, error boundaries and measured performance work.
CLAUDE.md rules for React 19 with TypeScript covering typed components, derived state, compiler-aware memoization, useId-based accessibility and review checks.