Files
tsl-devkit/skills/thirdparty/ui-ux-pro-max/data/stacks/react.csv
T
csh 3d83740f88 Squashed 'docs/standards/playbook/' changes from c3f8137..25d895d
25d895d 🐛 fix(gitea_workflow): clean up temp repos after job steps
2bc3b11 🐛 fix(gitea_workflow): clean up temporary repo dirs in workflows
98c3f30 📝 docs(agent_rules): allow plan execution on current branch
16c7230 📝 docs(prompts): define custom verify layering
8efc4dd 🐛 fix(skills): quote commit-message description
bc8498f 🐛 fix(ci): install tomli for gitea tests
55cda3b 🐛 fix(tests): report missing toml parser clearly
c0729c7 🐛 fix(playbook): import Optional for cli compatibility
63e24bf 📦 deps(skills): sync thirdparty skills
d2f9356 🐛 fix(ci): isolate gitea workflow repos
588b81d 🐛 fix(ci): inline gitea workflow bootstrap
e0b1c3a ♻️ refactor(skills): standardize first-party skill contracts
2c5050d ♻️ refactor(skills): rename repo skills source dir
f049dfb 📦 deps(skills): drop duplicate first-party superpowers skills
234b335  feat(workflow): add superpowers planning and execution state tracking
c1702a6 📝 docs(markdown): format tracked markdown and drop stale templates
2325409 📝 docs(markdown): clarify optional markdownlint usage
214c44e 🔧 chore(markdown): add markdownlint baseline and lint fixes
a22b324 📝 docs(templates): add execution and memory-bank prompt templates
223a797 📝 docs(templates): update README for Claude Code and current features
4ac8672 📝 docs: simplify README + platform-agnostic tools + auto-create local rules
2431c9d 📝 docs: add claude_md config and use cross-platform paths
d64b248 📝 docs: fix README.md inaccuracies and add Claude Code info
c8d6bf2 🐛 fix(playbook): use relative paths in CLAUDE.md when not at project root
6518f0f  feat(playbook): auto-create CLAUDE.md with path discovery
6ec9a45  feat(skills): add skill_link symlink support + platform-agnostic prompt
9f8b6b5 📝 docs: update README and config example for Claude Code support
79cff6c 📝 docs(skills): add Claude Code platform support
452c6f5  feat(playbook): auto-inject AGENTS.md into CLAUDE.md
e1dbf3c 🐛 fix(skills): remove dual-path from commit-message skill
f3a7259 🔧 chore(ci): use prepare_repo.sh in both workflows
da08212 🔧 chore(ci): extract prepare_repo.sh and clean up workflows
7ade85e 🗑️ remove(tsl): drop syntax_book/, data/ source and build script
f94dba0 ♻️ refactor(skills): update playbook.py and tests for thirdparty/ layout
b3df412 ♻️ refactor(skills): separate thirdparty skills into thirdparty/ subdirectory
64950e7 📦 deps(skills): sync thirdparty skills
a2e3cb0  feat(playbook): add no_backup deploy controls
8609d59 🐛 fix(docs): repair reference catalog source links
956da11 🐛 fix(playbook): publish hidden ci test fixes
3f67754 📦 deps(skills): sync thirdparty skills
08ca87b 📦 deps(skills): add karpathy thirdparty sync
96b705b 📝 docs(tsl): rebuild canonical syntax and routing manual
3ed5052 📦 deps(skills): sync thirdparty skills
60108dd 📦 deps(skills): sync thirdparty skills
da85d4e 🐛 fix(thirdparty): prune nested project snapshots
a2a697e 📦 deps(skills): sync thirdparty skills
9df610a 🐛 fix(thirdparty): exclude duplicated superpowers skills
33dd5bb 🐛 fix(thirdparty): preserve optional manifest fields
91b0ea7 🐛 fix(thirdparty): preserve manifest during snapshot update
2e26f98 🔧 chore(thirdparty): generalize skills sync pipeline
5b9c1e3 📦 deps(skills): sync superpowers
2f2d34a 📝 docs(readme): normalize subtree command spacing
62db7db 🐛 fix(ci): serialize superpowers update and sync
3463223 🐛 fix(ci): use literal superpowers sync paths
48f6de8 📦 deps(skills): sync superpowers
4b23529 🔧 chore(ci): merge superpowers update and sync workflow
a56d75b 📦 deps(skills): sync superpowers
84bcefa 🔧 chore(ci): use ci[bot] commit author name
00a07e5 📦 deps(skills): sync superpowers
7b84daf 🐛 fix(templates): enforce main loop progress tracking
51373d7 🔧 chore(ci): automate superpowers sync workflow
eaaa39c 🐛 fix(ci): prevent stale superpowers sync from restoring skills block
79755c6 📦 deps(skills): sync superpowers
836d878 📦 deps(skills): sync superpowers
8216c9f 📦 deps(skills): sync superpowers
9439505 🐛 fix(playbook): address reported repo issues

git-subtree-dir: docs/standards/playbook
git-subtree-split: 25d895d8b3f56624ccfe99ad7289e9eb49e0f316
2026-05-24 13:04:14 +08:00

13 KiB

1NoCategoryGuidelineDescriptionDoDon'tCode GoodCode BadSeverityDocs URL
21StateUse useState for local stateSimple component state should use useState hookuseState for form inputs toggles countersClass components this.stateconst [count, setCount] = useState(0)this.state = { count: 0 }Mediumhttps://react.dev/reference/react/useState
32StateLift state up when neededShare state between siblings by lifting to parentLift shared state to common ancestorProp drilling through many levelsParent holds state passes downDeep prop chainsMediumhttps://react.dev/learn/sharing-state-between-components
43StateUse useReducer for complex stateComplex state logic benefits from reducer patternuseReducer for state with multiple sub-valuesMultiple useState for related valuesuseReducer with action types5+ useState calls that update togetherMediumhttps://react.dev/reference/react/useReducer
54StateAvoid unnecessary stateDerive values from existing state when possibleCompute derived values in renderStore derivable values in stateconst total = items.reduce(...)const [total, setTotal] = useState(0)Highhttps://react.dev/learn/choosing-the-state-structure
65StateInitialize state lazilyUse function form for expensive initial stateuseState(() => computeExpensive())useState(computeExpensive())useState(() => JSON.parse(data))useState(JSON.parse(data))Mediumhttps://react.dev/reference/react/useState#avoiding-recreating-the-initial-state
76EffectsClean up effectsReturn cleanup function for subscriptions timersReturn cleanup function in useEffectNo cleanup for subscriptionsuseEffect(() => { sub(); return unsub; })useEffect(() => { subscribe(); })Highhttps://react.dev/reference/react/useEffect#connecting-to-an-external-system
87EffectsSpecify dependencies correctlyInclude all values used inside effect in deps arrayAll referenced values in dependency arrayEmpty deps with external references[value] when using value in effect[] when using props/state in effectHighhttps://react.dev/reference/react/useEffect#specifying-reactive-dependencies
98EffectsAvoid unnecessary effectsDon't use effects for transforming data or eventsTransform data during render handle events directlyuseEffect for derived state or event handlingconst filtered = items.filter(...)useEffect(() => setFiltered(items.filter(...)))Highhttps://react.dev/learn/you-might-not-need-an-effect
109EffectsUse refs for non-reactive valuesStore values that don't trigger re-renders in refsuseRef for interval IDs DOM elementsuseState for values that don't need renderconst intervalRef = useRef(null)const [intervalId, setIntervalId] = useState()Mediumhttps://react.dev/reference/react/useRef
1110RenderingUse keys properlyStable unique keys for list itemsUse stable IDs as keysArray index as key for dynamic listskey={item.id}key={index}Highhttps://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key
1211RenderingMemoize expensive calculationsUse useMemo for costly computationsuseMemo for expensive filtering/sortingRecalculate every renderuseMemo(() => expensive(), [deps])const result = expensiveCalc()Mediumhttps://react.dev/reference/react/useMemo
1312RenderingMemoize callbacks passed to childrenUse useCallback for functions passed as propsuseCallback for handlers passed to memoized childrenNew function reference every renderuseCallback(() => {}, [deps])const handler = () => {}Mediumhttps://react.dev/reference/react/useCallback
1413RenderingUse React.memo wiselyWrap components that render often with same propsmemo for pure components with stable propsmemo everything or nothingmemo(ExpensiveList)memo(SimpleButton)Lowhttps://react.dev/reference/react/memo
1514RenderingAvoid inline object/array creation in JSXCreate objects outside render or memoizeDefine style objects outside componentInline objects in props<div style={styles.container}><div style={{ margin: 10 }}>Medium
1615ComponentsKeep components small and focusedSingle responsibility for each componentOne concern per componentLarge multi-purpose components<UserAvatar /><UserName /><UserCard /> with 500 linesMedium
1716ComponentsUse composition over inheritanceCompose components using children and propsUse children prop for flexibilityInheritance hierarchies<Card>{content}</Card>class SpecialCard extends CardMediumhttps://react.dev/learn/thinking-in-react
1817ComponentsColocate related codeKeep related components and hooks togetherRelated files in same directoryFlat structure with many filescomponents/User/UserCard.tsxcomponents/UserCard.tsx + hooks/useUser.tsLow
1918ComponentsUse fragments to avoid extra DOMFragment or <> for multiple elements without wrapper<> for grouping without DOM nodeExtra div wrappers<>{items.map(...)}</><div>{items.map(...)}</div>Lowhttps://react.dev/reference/react/Fragment
2019PropsDestructure propsDestructure props for cleaner component codeDestructure in function signatureprops.name props.value throughoutfunction User({ name, age })function User(props)Low
2120PropsProvide default props valuesUse default parameters or defaultPropsDefault values in destructuringUndefined checks throughoutfunction Button({ size = 'md' })if (size === undefined) size = 'md'Low
2221PropsAvoid prop drillingUse context or composition for deeply nested dataContext for global data composition for UIPassing props through 5+ levels<UserContext.Provider><A user={u}><B user={u}><C user={u}>Mediumhttps://react.dev/learn/passing-data-deeply-with-context
2322PropsValidate props with TypeScriptUse TypeScript interfaces for prop typesinterface Props { name: string }PropTypes or no validationinterface ButtonProps { onClick: () => void }Button.propTypes = {}Medium
2423EventsUse synthetic events correctlyReact normalizes events across browserse.preventDefault() e.stopPropagation()Access native event unnecessarilyonClick={(e) => e.preventDefault()}onClick={(e) => e.nativeEvent.preventDefault()}Lowhttps://react.dev/reference/react-dom/components/common#react-event-object
2524EventsAvoid binding in renderUse arrow functions in class or hooksArrow functions in functional componentsbind in render or constructorconst handleClick = () => {}this.handleClick.bind(this)Medium
2625EventsPass event handlers not call resultsPass function reference not invocationonClick={handleClick}onClick={handleClick()} causing immediate callonClick={handleClick}onClick={handleClick()}High
2726FormsControlled components for formsUse state to control form inputsvalue + onChange for inputsUncontrolled inputs with refs<input value={val} onChange={setVal}><input ref={inputRef}>Mediumhttps://react.dev/reference/react-dom/components/input#controlling-an-input-with-a-state-variable
2827FormsHandle form submission properlyPrevent default and handle in submit handleronSubmit with preventDefaultonClick on submit button only<form onSubmit={handleSubmit}><button onClick={handleSubmit}>Medium
2928FormsDebounce rapid input changesDebounce search/filter inputsuseDeferredValue or debounce for searchFilter on every keystrokeuseDeferredValue(searchTerm)useEffect filtering on every changeMediumhttps://react.dev/reference/react/useDeferredValue
3029HooksFollow rules of hooksOnly call hooks at top level and in React functionsHooks at component top levelHooks in conditions loops or callbacksconst [x, setX] = useState()if (cond) { const [x, setX] = useState() }Highhttps://react.dev/reference/rules/rules-of-hooks
3130HooksCustom hooks for reusable logicExtract shared stateful logic to custom hooksuseCustomHook for reusable patternsDuplicate hook logic across componentsconst { data } = useFetch(url)Duplicate useEffect/useState in componentsMediumhttps://react.dev/learn/reusing-logic-with-custom-hooks
3231HooksName custom hooks with use prefixCustom hooks must start with useuseFetch useForm useAuthfetchData or getData for hookfunction useFetch(url)function fetchData(url)High
3332ContextUse context for global dataContext for theme auth localeContext for app-wide stateContext for frequently changing data<ThemeContext.Provider>Context for form field valuesMediumhttps://react.dev/learn/passing-data-deeply-with-context
3433ContextSplit contexts by concernSeparate contexts for different domainsThemeContext + AuthContextOne giant AppContext<ThemeProvider><AuthProvider><AppProvider value={{theme user...}}>Medium
3534ContextMemoize context valuesPrevent unnecessary re-renders with useMemouseMemo for context value objectNew object reference every rendervalue={useMemo(() => ({...}), [])}value={{ user, theme }}High
3635PerformanceUse React DevTools ProfilerProfile to identify performance bottlenecksProfile before optimizingOptimize without measuringReact DevTools ProfilerGuessing at bottlenecksMediumhttps://react.dev/learn/react-developer-tools
3736PerformanceLazy load componentsUse React.lazy for code splittinglazy() for routes and heavy componentsImport everything upfrontconst Page = lazy(() => import('./Page'))import Page from './Page'Mediumhttps://react.dev/reference/react/lazy
3837PerformanceVirtualize long listsUse windowing for lists over 100 itemsreact-window or react-virtualRender thousands of DOM nodes<VirtualizedList items={items}/>{items.map(i => <Item />)}High
3938PerformanceBatch state updatesReact 18 auto-batches but be awareLet React batch related updatesManual batching with flushSyncsetA(1); setB(2); // batchedflushSync(() => setA(1))Lowhttps://react.dev/learn/queueing-a-series-of-state-updates
4039ErrorHandlingUse error boundariesCatch JavaScript errors in component treeErrorBoundary wrapping sectionsLet errors crash entire app<ErrorBoundary><App/></ErrorBoundary>No error handlingHighhttps://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary
4140ErrorHandlingHandle async errorsCatch errors in async operationstry/catch in async handlersUnhandled promise rejectionstry { await fetch() } catch(e) {}await fetch() // no catchHigh
4241TestingTest behavior not implementationTest what user sees and doesTest renders and interactionsTest internal state or methodsexpect(screen.getByText('Hello'))expect(component.state.name)Mediumhttps://testing-library.com/docs/react-testing-library/intro/
4342TestingUse testing-library queriesUse accessible queriesgetByRole getByLabelTextgetByTestId for everythinggetByRole('button')getByTestId('submit-btn')Mediumhttps://testing-library.com/docs/queries/about#priority
4443AccessibilityUse semantic HTMLProper HTML elements for their purposebutton for clicks nav for navigationdiv with onClick for buttons<button onClick={...}><div onClick={...}>Highhttps://react.dev/reference/react-dom/components#all-html-components
4544AccessibilityManage focus properlyHandle focus for modals dialogsFocus trap in modals return focus on closeNo focus managementuseEffect to focus inputModal without focus trapHigh
4645AccessibilityAnnounce dynamic contentUse ARIA live regions for updatesaria-live for dynamic updatesSilent updates to screen readers<div aria-live="polite">{msg}</div><div>{msg}</div>Medium
4746AccessibilityLabel form controlsAssociate labels with inputshtmlFor matching input idPlaceholder as only label<label htmlFor="email">Email</label><input placeholder="Email"/>High
4847TypeScriptType component propsDefine interfaces for all propsinterface Props with all prop typesany or missing typesinterface Props { name: string }function Component(props: any)High
4948TypeScriptType state properlyProvide types for useStateuseState<Type>() for complex stateInferred any typesuseState<User | null>(null)useState(null)Medium
5049TypeScriptType event handlersUse React event typesReact.ChangeEvent<HTMLInputElement>Generic Event typeonChange: React.ChangeEvent<HTMLInputElement>onChange: EventMedium
5150TypeScriptUse generics for reusable componentsGeneric components for flexible typingGeneric props for list componentsUnion types for flexibility<List<T> items={T[]}><List items={any[]}>Medium
5251PatternsContainer/Presentational splitSeparate data logic from UIContainer fetches presentational rendersMixed data and UI in one<UserContainer><UserView/></UserContainer><User /> with fetch and renderLow
5352PatternsRender props for flexibilityShare code via render prop patternRender prop for customizable renderingDuplicate logic across components<DataFetcher render={data => ...}/>Copy paste fetch logicLowhttps://react.dev/reference/react/cloneElement#passing-data-with-a-render-prop
5453PatternsCompound componentsRelated components sharing stateTab + TabPanel sharing contextProp drilling between related<Tabs><Tab/><TabPanel/></Tabs><Tabs tabs={[]} panels={[...]}/>Low