Skip to content

Commit ba01ca5

Browse files
authored
chore: add triage skill for GitHub issue review (#314)
Adds a /triage skill that walks through reproducing and verifying Nativewind and react-native-css GitHub issues. Reads the issue, determines the version/repo, creates a test-based reproduction, verifies against both latest published and local HEAD, and drafts a comment response for review before posting.
1 parent 99859a4 commit ba01ca5

File tree

1 file changed

+278
-0
lines changed

1 file changed

+278
-0
lines changed

.claude/skills/triage/SKILL.md

Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
---
2+
name: triage
3+
description: Triage a Nativewind or react-native-css GitHub issue. Reads the issue, determines version/repo, creates a reproduction, tests against latest published and local HEAD, then drafts a comment.
4+
argument-hint: <issue-number-or-url>
5+
allowed-tools: Read, Grep, Glob, Bash, Write, Edit, Agent, WebFetch
6+
---
7+
8+
You are triaging a GitHub issue for either **nativewind/nativewind** or **nativewind/react-native-css**. Your goal is to understand the issue, reproduce it, verify it against the latest releases and local HEAD, and draft a response.
9+
10+
## Project context
11+
12+
Before diving in, read the relevant project docs for architecture and conventions:
13+
14+
- **Nativewind v5**: Read `CLAUDE.md` and `DEVELOPMENT.md` in `/Users/dan/Developer/nativewind/nativewind/`
15+
- **react-native-css**: Read `CLAUDE.md` and `DEVELOPMENT.md` in `/Users/dan/Developer/nativewind/react-native-css/`
16+
- **Nativewind v4**: Read `CONTRIBUTING.md` and check test structure in `/Users/dan/Developer/nativewind/nativewind-v4/`
17+
18+
These docs describe the architecture, test conventions, commands, and common pitfalls for each project. Use them to inform your reproduction strategy and root cause analysis.
19+
20+
## Step 0: Parse the issue reference
21+
22+
Extract the issue number and repo from `$ARGUMENTS`. Accept formats like:
23+
- `123` or `#123` (defaults to `nativewind/react-native-css`)
24+
- `nativewind/nativewind#123`
25+
- `nativewind/react-native-css#123`
26+
- A full GitHub URL like `https://github.com/nativewind/react-native-css/issues/45`
27+
28+
## Step 1: Read the issue
29+
30+
```bash
31+
gh issue view <number> --repo <owner/repo> --json title,body,labels,state,comments,createdAt,author
32+
```
33+
34+
Read the full output carefully. Pay attention to:
35+
- **Title and description**: What is the reported problem?
36+
- **Comments**: Any additional context, workarounds, or clarifications from the reporter or maintainers?
37+
- **Labels**: Any existing version or area labels?
38+
- **Code snippets, config files, or error messages** included in the issue
39+
40+
## Step 2: Determine repo and version context
41+
42+
### If filed on `nativewind/react-native-css`
43+
44+
react-native-css is a standalone CSS polyfill for React Native. It provides the CSS compiler (lightningcss-based), babel plugin (import rewriting), Metro transformer, and native runtime styling engine. It functions independently of Tailwind CSS but is the engine behind Nativewind v5. There is no v4 equivalent in this repo (v4's runtime was `react-native-css-interop`, which lives in the nativewind-v4 monorepo).
45+
46+
Read `DEVELOPMENT.md` in the react-native-css repo for the full architecture diagram and key directories. The issue likely involves one of these layers:
47+
- **Compiler** (`src/compiler/`) if CSS parses/compiles incorrectly
48+
- **Native runtime** (`src/native/`) if styles resolve incorrectly at runtime
49+
- **Babel plugin** (`src/babel/`) if import rewriting fails
50+
- **Metro transformer** (`src/metro/`) if bundling/transformation fails
51+
52+
| | react-native-css |
53+
|---|---|
54+
| Branch | `main` |
55+
| npm package | `react-native-css` |
56+
| npm tag | `@latest` |
57+
| Local repo path | `/Users/dan/Developer/nativewind/react-native-css` |
58+
59+
### If filed on `nativewind/nativewind`
60+
61+
Figure out whether this is a **v4** or **v5** issue. Clues:
62+
- `nativewind` version in their `package.json` (v4.x = v4, v5.x = v5)
63+
- Presence of `tailwind.config.js` = v4 (v5 uses Tailwind CSS v4's `@tailwindcss/postcss`)
64+
- Presence of `react-native-css-interop` = v4; `react-native-css` = v5
65+
- Mention of `@import "nativewind/theme"` = v5
66+
- If unclear, assume v5 (the active development branch) but note the ambiguity
67+
68+
| | Nativewind v4 (stable) | Nativewind v5 (preview) |
69+
|---|---|---|
70+
| Branch | `v4` | `main` |
71+
| Tailwind | v3 | v4 |
72+
| Runtime | `react-native-css-interop` | `react-native-css` |
73+
| npm tag | `@latest` | `@preview` |
74+
| Repro template | `npx rn-new@latest --nativewind` | `npx rn-new@next --nativewind` |
75+
| Local repo path | `/Users/dan/Developer/nativewind/nativewind-v4` | `/Users/dan/Developer/nativewind/nativewind` |
76+
77+
## Step 3: Assess reproducibility
78+
79+
Before creating a reproduction, check if there is enough information:
80+
- Is the problem clearly described?
81+
- Are there code snippets showing the failing className, component, CSS, or config?
82+
- Is there an error message or screenshot?
83+
84+
If the issue lacks critical details needed for reproduction, skip to Step 6 and draft a comment requesting more information. Tailor the ask to the repo:
85+
86+
**For nativewind issues:**
87+
> Thanks for reporting this. To investigate, we need a minimal reproduction. Could you provide:
88+
> - Your `package.json` dependencies (nativewind, react-native-css/react-native-css-interop, tailwindcss versions)
89+
> - The specific className(s) or config causing the issue
90+
> - A reproduction using `npx rn-new@latest --nativewind` (v4) or `npx rn-new@next --nativewind` (v5)
91+
92+
**For react-native-css issues:**
93+
> Thanks for reporting this. To investigate, we need a minimal reproduction. Could you provide:
94+
> - Your `react-native-css` version
95+
> - The CSS and component code that triggers the issue
96+
> - Expected vs. actual behavior
97+
98+
## Step 4: Create a reproduction
99+
100+
Create a minimal reproduction. The approach depends on the repo and what's being tested.
101+
102+
---
103+
104+
### react-native-css issues
105+
106+
Tests are organized by domain in `src/__tests__/` with three subdirectories: `native/`, `compiler/`, `babel/`. Before writing a test, read a few existing tests in the relevant subdirectory to match the conventions exactly.
107+
108+
**For native styling issues** (most common, e.g., wrong style output, className not working):
109+
110+
```typescript
111+
// Create: src/__tests__/native/triage-<issue-number>.test.tsx
112+
import { render, screen } from "@testing-library/react-native";
113+
import { View } from "react-native-css/components/View";
114+
import { registerCSS, testID } from "react-native-css/jest";
115+
116+
describe("Issue #<number>", () => {
117+
test("description of the problem", () => {
118+
registerCSS(`.my-class { /* the CSS from the issue */ }`);
119+
120+
render(<View testID={testID} className="my-class" />);
121+
const component = screen.getByTestId(testID);
122+
123+
// Log what we actually get
124+
console.log(JSON.stringify(component.props, null, 2));
125+
126+
// Assert expected behavior
127+
expect(component.props).toStrictEqual({
128+
children: undefined,
129+
style: { /* expected styles */ },
130+
testID,
131+
});
132+
});
133+
});
134+
```
135+
136+
Run with: `cd /Users/dan/Developer/nativewind/react-native-css && yarn test src/__tests__/native/triage-<issue-number>.test.tsx`
137+
138+
**For compiler issues** (CSS parses wrong, wrong JSON output):
139+
140+
Read existing tests in `src/__tests__/compiler/` (e.g., `compiler.test.tsx`, `declarations.test.tsx`) to match the pattern. Compiler tests verify the JSON output structure from `compile()`.
141+
142+
Run with: `cd /Users/dan/Developer/nativewind/react-native-css && yarn test compiler`
143+
144+
**For babel issues** (import rewriting broken):
145+
146+
Read existing tests in `src/__tests__/babel/` which use `babel-plugin-tester`.
147+
148+
Run with: `cd /Users/dan/Developer/nativewind/react-native-css && yarn test babel`
149+
150+
**For runtime issues that need a full app:**
151+
```bash
152+
cd /Users/dan/Developer/nativewind/react-native-css/example
153+
yarn example start:build # Rebuilds library + starts Metro
154+
```
155+
156+
---
157+
158+
### Nativewind v5 issues
159+
160+
**For CSS/styling issues** (in `/Users/dan/Developer/nativewind/nativewind`):
161+
162+
```typescript
163+
// Create: src/__tests__/triage-<issue-number>.test.ts
164+
import { renderCurrentTest, renderSimple } from "../test-utils";
165+
166+
describe("Issue #<number>", () => {
167+
test("<the-failing-classname>", async () => {
168+
// Use renderCurrentTest() if testing a single className (test name = className)
169+
const result = await renderCurrentTest();
170+
console.log(JSON.stringify(result, null, 2));
171+
});
172+
173+
// Or use renderSimple() for more complex scenarios
174+
test("complex case", async () => {
175+
const result = await renderSimple({
176+
className: "<multiple classes here>",
177+
// css: "custom CSS if needed",
178+
// extraCss: "additional CSS",
179+
});
180+
console.log(JSON.stringify(result, null, 2));
181+
});
182+
});
183+
```
184+
185+
Run with: `yarn test src/__tests__/triage-<issue-number>.test.ts`
186+
187+
---
188+
189+
### Nativewind v4 issues
190+
191+
(in `/Users/dan/Developer/nativewind/nativewind-v4`):
192+
Check the v4 test conventions first:
193+
```bash
194+
ls /Users/dan/Developer/nativewind/nativewind-v4/packages/nativewind/src/__tests__/
195+
```
196+
Then write a similar test following v4's patterns.
197+
198+
---
199+
200+
### For runtime/Metro/babel issues (any repo)
201+
202+
These are harder to reproduce with unit tests. Create a standalone project:
203+
204+
**v5 / react-native-css**: `npx rn-new@next --nativewind` in a temp directory
205+
**v4**: `npx rn-new@latest --nativewind` in a temp directory
206+
207+
Then replicate the reporter's setup and config.
208+
209+
## Step 5: Verify against versions
210+
211+
Run the reproduction in two contexts:
212+
213+
### 5a. Latest published version
214+
215+
For test-based reproductions, this is what `yarn test` already does (uses installed dependencies).
216+
217+
For app-based reproductions, ensure the project uses the latest published version:
218+
- react-native-css: `react-native-css@latest`
219+
- Nativewind v4: `nativewind@latest`
220+
- Nativewind v5: `nativewind@preview`
221+
222+
Record the result: does the issue reproduce? What's the actual vs. expected behavior?
223+
224+
### 5b. Local HEAD of the respective branch
225+
226+
For test-based reproductions in the repo itself, the tests already run against local source.
227+
228+
But consider whether the bug crosses repo boundaries:
229+
- A Nativewind styling issue might actually be a `react-native-css` compiler bug
230+
- A react-native-css issue might only surface when used with Nativewind's `@map` variant
231+
232+
Check recent commits for relevant changes:
233+
```bash
234+
# In the appropriate repo
235+
git log --oneline -20
236+
```
237+
238+
If the issue might be in a different repo than where it was filed, note that in your findings.
239+
240+
## Step 6: Draft a comment
241+
242+
Based on your findings, draft a GitHub issue comment. The tone should be helpful and direct. Include:
243+
244+
1. **Reproduction status**: Did you reproduce it? On which version(s)?
245+
2. **Root cause** (if identified): Where the bug lives and why
246+
3. **Scope**: Is this a Nativewind issue or a react-native-css issue? If filed in the wrong repo, say so.
247+
4. **Workaround** (if any): A temporary fix the reporter can use
248+
5. **Next steps**: What needs to happen to fix this (PR, upstream fix, config change)
249+
250+
If the issue is **not reproducible**, say so clearly and ask for more details.
251+
252+
If the issue is **already fixed** on HEAD but not published, mention that and suggest the user try the latest version or a canary build.
253+
254+
Format the comment as a markdown blockquote so Dan can review it before posting:
255+
256+
> **Reproduction result**
257+
>
258+
> [Your findings here]
259+
260+
## Step 7: Clean up
261+
262+
Remove any temporary test files you created:
263+
```bash
264+
# In whichever repo you created the test
265+
rm src/__tests__/triage-<issue-number>.test.ts
266+
rm src/__tests__/native/triage-<issue-number>.test.tsx
267+
rm src/__tests__/compiler/triage-<issue-number>.test.tsx
268+
```
269+
270+
Do NOT leave triage test files in either repo.
271+
272+
## Important notes
273+
274+
- **Never post the comment automatically.** Always present it to Dan for review.
275+
- If the issue is clearly a duplicate, mention the original issue number.
276+
- If the issue is filed in the wrong repo (e.g., a react-native-css bug filed on nativewind), note that and suggest transferring it.
277+
- Be honest about what you can and cannot determine from the reproduction.
278+
- When the issue spans both repos, test in both and note which repo owns the fix.

0 commit comments

Comments
 (0)