compiler-port

Port React Compiler passes from TypeScript to Rust with test validation.

248k|51.3k|Updated May 24, 2013
One-click install
npx skills add https://github.com/facebook/react --skill compiler-port
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compiler-port
Source: https://github.com/facebook/react/tree/main/compiler/.claude/skills/compiler-port
Command: npx skills add https://github.com/facebook/react --skill compiler-port

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manually porting compiler passes from TypeScript to Rust is error-prone and requires deep knowledge of both codebases, the pipeline structure, and the test infrastructure. This Skill automates the end-to-end porting workflow with validation at each step.

Core Features & Use Cases

  • Pass Validation: Verifies the requested pass exists in Pipeline.ts and checks whether it has already been ported.
  • Context Gathering: Reads architecture guides, pass documentation, TypeScript sources, and Rust crate structures to inform the port.
  • Implementation Planning: Generates a structured plan covering new types, file creation, crate setup, and pipeline wiring.
  • Automated Porting: Launches a subagent to perform the TypeScript-to-Rust translation and runs a test-fix loop until all tests pass.
  • Review Loop: Runs a compiler review on the changes and iterates until the review is clean.

Quick Start

Use the compiler-port skill to port the PruneMaybeThrows pass from TypeScript to Rust.

Frequently Asked Questions about compiler-port

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I port a React Compiler pass from TypeScript to Rust?

Use the compiler-port skill with the pass name as it appears in Pipeline.ts log entries. The skill validates the pass, gathers context, plans the port, and launches a subagent to implement and test the Rust version.

What compiler passes can be ported with this skill?

The skill supports passes with kind 'hir' or 'reactive' as defined in Pipeline.ts log entries. Passes with kind 'ast' are not currently supported and will be rejected during validation.

How does the skill map TypeScript folders to Rust crates?

The skill uses a fixed mapping: src/HIR/ maps to react_compiler_hir, src/ReactiveScopes/ to react_compiler_reactive_scopes, src/Babel/ and src/Entrypoint/ to react_compiler, and other folders follow a 1:1 naming convention like react_compiler_<name>.

What happens if the pass is already ported to Rust?

The skill checks if the corresponding Rust file exists in the target crate and if pipeline.rs already calls it. If both conditions are true, it reports the pass is already ported and stops without making changes.

Why does the porting process run a test-fix loop?

The test-fix loop runs bash compiler/scripts/test-rust-port.sh after implementation to catch regressions and ensure the Rust port produces identical output to the TypeScript version. The loop continues until zero test failures are achieved.