brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
ast-grep-typescript-reactUse this skill when writing, debugging, or reviewing ast-grep patterns, YAML rules, or codemods against TypeScript or React (.ts/.tsx) code — searching for JSX elements, props, hooks, imports, or type constructs, and rewriting them. Covers the TS/React-specific traps — the tsx-vs-typescript language split, JSX and TypeScript node kinds, fragment matching, r…
Independent GitHub snapshot · Automated classification · Original documentation governs
The wrong defaults a capable model hits when pointing ast-grep at .ts/.tsx code — mostly cases where a rule silently matches nothing because the language or a node kind was guessed wrong. This skill assumes you already know ast-grep's rule mechanics (patterns, meta-variables, all/any/has/inside, constraints); it corrects only what TypeScript and React add on top.
For general ast-grep rule-writing mechanics, use the companion ast-grep skill.
.ts or .tsx codeReact.FC, migrate imports)@ast-grep/napitsx, never typescript. This is the single most common cause of silent no-match. See lang-tsx-for-jsx.ast-grep run --pattern '<your pattern>' --lang tsx --debug-query=ast on a real snippet shows the node kinds and reveals ERROR nodes. Trust this over guessed kind names.context + selector. See ctx-fragment-context-selector.| # | Category | Prefix | Covers |
|---|---|---|---|
| 1 | Language Selection | lang | tsx-vs-typescript split, scanning .ts + .tsx, languageGlobs |
| 2 | Fragment Matching | ctx | context/selector for JSX attrs, props, type annotations |
| 3 | JSX Node Kinds | jsx | self-closing vs paired elements, attribute-value metavariables |
| 4 | TypeScript Constructs | ts | type-only imports, as casts, React.FC generics |
| 5 | Rewrites & Codemods | fix | re-emitting JSX metavars so children/props aren't dropped |
| 6 | Programmatic Use | napi | @ast-grep/napi Lang.Tsx, NapiConfig shape |
lang-tsx-for-jsx — Use tsx for any JSX; typescript parses JSX as ERROR and matches nothinglang-scan-ts-and-tsx — Cover both .ts and .tsx; languageGlobs for reuse (+ the <T>-cast caveat)ctx-fragment-context-selector — Wrap fragments (attrs, props, type annotations) in context/selectorjsx-self-closing-vs-paired — <X/> and <X></X> are different kinds; match both with anyjsx-attribute-metavars — Metavariables must sit in a valid attribute-value positionts-type-only-imports — Distinguish import type and inline type from value importsts-as-expression-casts — Match casts as as_expression, not angle bracketsts-generic-react-fc — Strip React.FC by targeting the type annotationfix-jsx-rewrite-completeness — Re-emit $$PROPS/$$CHILDREN or they're deletednapi-lang-tsx-findall — Parse with Lang.Tsx; findAll takes a NapiConfigRead the individual reference file for the decision you're making — each is self-contained with a canonical example. references/_sections.md defines the categories; AGENTS.md is the full compiled index.
ast-grep — general ast-grep rule-writing mechanics (patterns, composition, constraints, testing). This skill layers TS/React specifics on top of it.