Skip to content

Commit 172c970

Browse files
authored
Docs: add LLM-assisted migration prompt callout (#1394)
* docs: promote llm-assisted react_on_rails migration * docs: harden llm migration prompt with safety checks * Address review feedback on LLM migration prompt docs
1 parent 8c2b44a commit 172c970

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Why? React on Rails code receives much more active development and testing. For
2222

2323
You can find [migration to React on Rails steps here](https://github.com/reactjs/react-rails/blob/main/docs/migrating-from-react-rails-to-react_on_rails.md).
2424

25+
For the fastest path, try the [LLM-assisted migration prompt](https://github.com/reactjs/react-rails/blob/main/docs/migrating-from-react-rails-to-react_on_rails.md#llm-assisted-migration-prompt).
26+
2527
---
2628
## ShakaCode Support
2729

docs/migrating-from-react-rails-to-react_on_rails.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
- [Why migrate?](#why-migrate)
77
- [Steps to migrate](#steps-to-migrate)
8+
- [LLM-assisted migration prompt](#llm-assisted-migration-prompt)
89

910
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1011

@@ -61,3 +62,43 @@ In this guide, it is assumed that you have upgraded the `react-rails` project to
6162

6263
You can also check [react-rails-to-react-on-rails](https://github.com/shakacode/react-rails-example-app/tree/react-rails-to-react-on-rails) branch on [react-rails example app](https://github.com/shakacode/react-rails-example-app) for an example of migration from `react-rails` v3 to `react_on_rails` v13.4.
6364

65+
## LLM-assisted migration prompt
66+
67+
You can usually do a safe first-pass migration quickly with a coding assistant. Give it this prompt:
68+
69+
If your assistant cannot browse URLs, paste this migration guide content directly into the prompt context before running the template.
70+
71+
```text
72+
You are a senior Rails + React engineer. Migrate this app from react-rails to react_on_rails.
73+
74+
Before starting, ask me for the relevant files (at minimum: Gemfile, package.json, JS entrypoints, config/initializers, and representative react_component usages).
75+
76+
Use this guide as the source of truth:
77+
https://github.com/reactjs/react-rails/blob/main/docs/migrating-from-react-rails-to-react_on_rails.md
78+
79+
Requirements:
80+
1. Keep changes minimal and production-safe.
81+
2. Work in clear phases:
82+
- dependencies
83+
- installer changes
84+
- bundle entry points
85+
- view helper updates
86+
- cleanup
87+
3. At each phase:
88+
- explain what changed and why
89+
- show commands run
90+
- show exact files changed
91+
4. Do not remove behavior unless you explain the replacement.
92+
5. After each phase, tell me the exact test/lint commands to run and wait for my output before continuing.
93+
6. End with:
94+
- a migration checklist
95+
- rollback steps
96+
- a PR summary with risk level
97+
7. Add safety checks:
98+
- if `rails g react_on_rails:install` fails to install JS deps, run the install commands shown by the generator
99+
- remove leftover `react_ujs` / `ReactRailsUJS` references
100+
- remove or replace stale `server_rendering.js` entries if present
101+
- if using Shakapacker, run `bundle exec rails shakapacker:compile` and fix compile errors before finalizing
102+
```
103+
104+
Review all generated diffs before merging.

0 commit comments

Comments
 (0)