When working on Rust code in compiler/crates/:
- Follow patterns from
compiler/docs/rust-port/rust-port-architecture.md - Use arenas + copyable IDs instead of shared references:
IdentifierId,ScopeId,FunctionId,TypeId - Pass
env: &mut Environmentseparately fromfunc: &mut HirFunction - Use two-phase collect/apply when you can't mutate through stored references
- Run
bash compiler/scripts/test-babel-ast.shto test AST round-tripping - Use
/port-pass <name>when porting a new compiler pass - Use
/compiler-verifybefore committing to run both Rust and TS tests - Keep Rust code structurally close to the TypeScript (~85-95% correspondence)
Before declaring work complete on a plan doc:
- Re-read the original user prompt to ensure all requested steps are done
- Check the plan doc for any "Remaining Work" items
- Verify test-babel-ast.sh passes with the expected fixture count
- Update the plan doc's status section