mirror of
https://github.com/facebook/react.git
synced 2026-02-26 02:54:59 +00:00
## Overview Adds a claude setup that works with the nested /compiler setup. The constraints are: - when working in the root repo, don't use the compiler configs (easy) - when working in the compiler/ don't use the parent contigs (hard) The first one is easy: there's a claude.md and .claude directory in /compiler that is only loaded when you start a session from /compuler. The second one is hard, because if you start a session from /compiler, the parent claude files and skills are loaded. I was able to deny the permissions to the parent skills in settings.json, but the descriptions are still loaded into context and I don't think that's avoidable. To keep the parent claude file out of context, I created a hook hack: I moved all the non-compiler claude file context to instructions.md and added a SessionStart hook to cat the file into context if the cwd isn't the /compiler. Works well, but won't show it as part of the `/context` slash command. ## Skills I also added a number of skills specific to the React repo: | Skill | Description | |-------|-------------| | `/extract-errors` | `yarn extract-errors` | | `/feature-flags` | how feature flags work and `@gate` | | `/fix` | linc and prettier | | `/flags` | `yarn flags` | | `/flow` | `yarn flow <variant>` | | `/test` | `yarn test-*` | | `/verify` | `run all the lints/tests/flow to verify` | ### Example: Flow | before | after | |-----|-----| | <img width="1076" height="442" alt="flow-before" src="https://github.com/user-attachments/assets/73eec143-d0af-4771-b501-c9dc29cc09ac" /> | <img width="1076" height="273" alt="flow-after" src="https://github.com/user-attachments/assets/292d33af-1d98-4252-9c08-744b33e88b86" /> | ### Example: Tests | before | after | |-----|-----| | <img width="1048" height="607" alt="test-before" src="https://github.com/user-attachments/assets/aa558ccf-2cee-4d22-b1f1-e4221c5a59dd" /> | <img width="1075" height="359" alt="test-after" src="https://github.com/user-attachments/assets/eb795392-6f46-403f-b9bb-8851ed790165" /> |
1.2 KiB
1.2 KiB
React
Scope: All code EXCEPT /compiler/ (compiler has its own instructions).
Project Structure
| Directory | Purpose |
|---|---|
/packages/ |
Publishable packages (react, react-dom, scheduler, etc.) |
/scripts/ |
Build, test, and development scripts |
/fixtures/ |
Test applications for manual testing |
/compiler/ |
React Compiler (separate sub-project) |
Key Packages
| Package | Purpose |
|---|---|
react |
Core React library |
react-dom |
DOM renderer |
react-reconciler |
Core reconciliation algorithm |
scheduler |
Cooperative scheduling |
react-server-dom-* |
Server Components |
react-devtools-* |
Developer Tools |
react-refresh |
Fast Refresh runtime |
Requirements
- Node: Must be installed. Stop and prompt user if missing.
- Package Manager: Use
yarnonly.
Verification
IMPORTANT: Use /verify to validate all changes before committing.
Commands
| Command | Purpose |
|---|---|
/fix |
Lint and format code |
/test |
Run tests |
/flow |
Type check with Flow |
/flags |
Check feature flags |
Building
Builds are handled by CI. Do not run locally unless instructed.