Skip to content

Commit 02bac92

Browse files
committed
chore: add Claude Code skills for architecture and testing
1 parent ed4e5b3 commit 02bac92

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

.claude/skills/add-test/SKILL.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: add-test
3+
description: Scaffold a test for a react-native-css feature following the project's testing conventions.
4+
argument-hint: [feature-or-css-property]
5+
allowed-tools: Read, Grep, Glob, Edit, Write
6+
---
7+
8+
## Context
9+
10+
react-native-css has three test domains in `src/__tests__/`:
11+
12+
- `babel/` — Babel plugin tests using `babel-plugin-tester`
13+
- `compiler/` — CSS compilation tests verifying JSON output
14+
- `native/` — Runtime tests for style application
15+
16+
## Conventions by domain
17+
18+
### Babel tests (`src/__tests__/babel/`)
19+
20+
Use `babel-plugin-tester`:
21+
22+
```typescript
23+
import { pluginTester } from "babel-plugin-tester";
24+
25+
pluginTester({
26+
plugin,
27+
tests: {
28+
"test name": {
29+
code: `import { View } from 'react-native';`,
30+
output: `import { View } from 'react-native-css/components';`,
31+
},
32+
},
33+
});
34+
```
35+
36+
### Compiler tests (`src/__tests__/compiler/`)
37+
38+
Verify CSS → JSON compilation output structure.
39+
40+
### Native tests (`src/__tests__/native/`)
41+
42+
Test runtime style application on native platform.
43+
44+
## Steps
45+
46+
1. **Identify the feature**: What needs testing? Use `$ARGUMENTS` as the starting point.
47+
48+
2. **Determine the domain**: Is this a babel transform, compiler output, or runtime behavior?
49+
50+
3. **Find existing tests**: Search the appropriate `src/__tests__/` subdirectory for similar tests.
51+
52+
4. **Write the test**: Follow the conventions of the domain.
53+
54+
5. **Run the test**: Execute `yarn test`. Note: ignore `ExperimentalWarning: VM Modules` warnings — they're expected.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: architecture
3+
description: Explain the react-native-css architecture, compiler pipeline, and key files. Use when a contributor wants to understand how the codebase works.
4+
allowed-tools: Read, Grep, Glob
5+
---
6+
7+
You are explaining the architecture of **react-native-css** to a contributor.
8+
9+
Start by reading `DEVELOPMENT.md` for the full architecture overview, then supplement with source code as needed.
10+
11+
## How to explain
12+
13+
1. **Start with the big picture**: react-native-css is a standalone CSS polyfill for React Native. It works independently of Tailwind — any `.css` file can be used. Nativewind v5 depends on this as its core engine.
14+
15+
2. **Show the compiler pipeline**: Walk through how a CSS rule becomes a React Native style:
16+
- Metro transformer intercepts `.css` files (`src/metro/metro-transformer.ts`)
17+
- lightningcss parses the CSS AST
18+
- `compile()` processes rules, media queries, keyframes, variables (`src/compiler/compiler.ts`)
19+
- Output is a `ReactNativeCssStyleSheet` (JSON)
20+
- Injection code registers styles with the native runtime (`src/metro/injection-code.ts`)
21+
22+
3. **Explain the babel plugin**: It rewrites React Native imports so components get `className` support:
23+
- `import { View } from 'react-native'``import { View } from 'react-native-css/components'`
24+
25+
4. **Explain the runtime**:
26+
- Reactive style system (`src/native/reactivity.ts`) — observables for media queries, color scheme
27+
- StyleCollection singleton (`src/native-internal/`) — isolated to avoid circular deps
28+
- Platform-aware: different outputs for native (JSON) vs web (browser CSS)
29+
30+
5. **Show relevant code**: Read source files to illustrate. The compiler and runtime are the most complex parts.
31+
32+
6. **Clarify the boundary**: This repo owns compilation, runtime, babel, and Metro integration. Nativewind adds Tailwind-specific theming on top.

0 commit comments

Comments
 (0)