Skip to content

Comments

Add npm READMEs, Pro quick-start guide, and llms.txt for LLM discoverability#2466

Open
AbanoubGhadban wants to merge 2 commits intomasterfrom
abanoub/improve-llm-discoverability
Open

Add npm READMEs, Pro quick-start guide, and llms.txt for LLM discoverability#2466
AbanoubGhadban wants to merge 2 commits intomasterfrom
abanoub/improve-llm-discoverability

Conversation

@AbanoubGhadban
Copy link
Collaborator

@AbanoubGhadban AbanoubGhadban commented Feb 21, 2026

Summary

LLMs consistently fail to generate correct React on Rails Pro setup code. After deep analysis (#2465), the root causes are:

  1. npm packages have no READMEs — npm READMEs are the TODO for first version #1 training signal for LLMs
  2. No single quick-start page — correct setup is spread across 4+ doc pages
  3. Incorrect example in Pro gem README — uses old @shakacode-tools/ scoped name and deprecated bundlePath

This PR addresses the low-effort, high-impact recommendations from #2465.

Changes

  • Add README.md to all 3 npm packages (react-on-rails, react-on-rails-pro, react-on-rails-pro-node-renderer) with correct API examples, config option tables, and package relationship docs
  • Fix incorrect example in Pro gem README — old scoped package name @shakacode-tools/react-on-rails-pro-node-rendererreact-on-rails-pro-node-renderer, deprecated bundlePathserverBundleCachePath
  • Add docs/getting-started/pro-quick-start.md — single self-contained guide for Pro setup from scratch using the --pro generator
  • Add llms.txt at repo root — follows the llms.txt convention providing LLMs with correct package relationships, API names, and config keys

What this does NOT include

Test plan

  • Verify npm README content is accurate against current API (TypeScript types in packages/react-on-rails-pro-node-renderer/lib/)
  • Verify Pro quick-start guide steps work with a fresh rails new + rails generate react_on_rails:install --pro
  • Verify llms.txt config examples match the generator templates in lib/generators/react_on_rails/templates/pro/
  • Confirm READMEs will be included in npm publish (no files field excluding them, or files field includes README.md)

Closes #2465

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive Pro quick-start guide covering setup, multi-process dev startup, SSR verification, and troubleshooting.
    • Added/expanded package READMEs and Node Renderer docs with installation, configuration, usage, and deployment guidance.
    • Removed private-package publishing instructions and replaced private-repo references with public equivalents.
    • Updated example configuration and onboarding wording for clearer setup guidance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec95e93 and dd8f302.

📒 Files selected for processing (4)
  • docs/contributor-info/releasing.md
  • react_on_rails_pro/docs/code-splitting-loadable-components.md
  • react_on_rails_pro/docs/ruby-api.md
  • react_on_rails_pro/docs/updating.md
💤 Files with no reviewable changes (1)
  • docs/contributor-info/releasing.md
✅ Files skipped from review due to trivial changes (3)
  • react_on_rails_pro/docs/updating.md
  • react_on_rails_pro/docs/ruby-api.md
  • react_on_rails_pro/docs/code-splitting-loadable-components.md

Walkthrough

Adds comprehensive documentation and READMEs for React on Rails Pro (npm packages and a pro quick-start guide), an llms reference file, and small example edits in the gem README to correct the Node Renderer filename, import path, and rename bundlePathserverBundleCachePath.

Changes

Cohort / File(s) Summary
Package READMEs
packages/react-on-rails/README.md, packages/react-on-rails-pro/README.md, packages/react-on-rails-pro-node-renderer/README.md
New README files added for npm packages with installation, quick-start examples, configuration options, server-renderer instructions, and deployment notes. Verify example imports, API names, and configuration keys for consistency with runtime code.
Quick Start Guide
docs/getting-started/pro-quick-start.md
New end-to-end "React on Rails Pro: Quick Start from Scratch" guide covering prerequisites, Rails scaffolding, gem/npm installs, Shakapacker, node-renderer scaffolding, multi-process dev startup, SSR verification, and troubleshooting. Check commands and file scaffolding for accuracy.
LLM Reference
llms.txt
New LLM-focused reference consolidating package relationships, pairing/version cautions, Node Renderer API examples, Rails-side config keys, Webpack notes, and client/server registration snippets. Review for factual correctness and up-to-date API names.
Gem README update
react_on_rails_pro/README.md
Small edits to example Node Renderer configuration: changed example filename to node-renderer.js, added const path = require('path'), switched require path to react-on-rails-pro-node-renderer, and renamed bundlePathserverBundleCachePath with updated path. Confirm the renamed option matches library API.
Contributor docs
docs/contributor-info/releasing.md
Removed private-package publishing instructions referencing GitHub Packages auth tokens and related steps. Confirm no required publish steps were accidentally deleted.
Documentation tweaks
react_on_rails_pro/docs/...
Removed private-access notes and updated source links to public paths in code-splitting, ruby-api, and updating docs. Ensure referenced links point to correct public locations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

review-needed

Poem

🐇 I nibbled docs beneath the moonlight,

node-renderer snug and tidy, bright.
READMEs bloom and guides unfold,
quick-start trails for young and old.
Hop in — SSR hops into sight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main changes: adding npm READMEs for packages, Pro quick-start guide documentation, and llms.txt file for improved LLM discoverability.
Linked Issues check ✅ Passed All PR changes directly address P0 objectives from issue #2465: npm packages now have public READMEs (react-on-rails, react-on-rails-pro, react-on-rails-pro-node-renderer), Pro quick-start guide created, llms.txt added, and Pro gem README example corrected.
Out of Scope Changes check ✅ Passed All changes are in scope. Documentation updates (removing private repo references, updating links) support the migration to public monorepo and align with PR objectives. No code changes beyond documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch abanoub/improve-llm-discoverability

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link

greptile-apps bot commented Feb 21, 2026

Greptile Summary

Adds npm READMEs, Pro quick-start guide, and llms.txt to improve LLM discoverability and correct setup guidance.

Key improvements:

  • Adds comprehensive READMEs to all 3 npm packages with correct API examples and config tables
  • Fixes Pro gem README example (deprecated @shakacode-tools/ scoped name → react-on-rails-pro-node-renderer, bundlePathserverBundleCachePath)
  • Adds single-page Pro quick-start guide matching --pro generator output
  • Adds llms.txt with accurate package relationships and config examples

Critical issue:

  • READMEs for react-on-rails and react-on-rails-pro packages won't be published to npm due to missing README.md entry in their package.json files field, defeating the primary goal of this PR

Confidence Score: 3/5

  • Safe to merge after fixing critical npm publish configuration that prevents READMEs from being included
  • Documentation is accurate and well-written, but the primary objective (adding npm READMEs for LLM training) will fail because two of the three packages exclude README.md from their npm publish files
  • Check packages/react-on-rails/package.json and packages/react-on-rails-pro/package.json - both need README.md added to files array

Important Files Changed

Filename Overview
packages/react-on-rails/README.md Added comprehensive README for base npm package with API docs and usage examples; missing from files field in package.json
packages/react-on-rails-pro/README.md Added Pro npm package README with RSC exports and package relationship docs; missing from files field in package.json
packages/react-on-rails-pro-node-renderer/README.md Added Node Renderer README with correct API examples, config options table, and advanced usage; no files field so README will publish by default
react_on_rails_pro/README.md Fixed deprecated package name and config key in example (old scoped name → unscoped, bundlePathserverBundleCachePath)
docs/getting-started/pro-quick-start.md Added comprehensive Pro quick-start guide matching generator template output with accurate config examples
llms.txt Added llms.txt with correct package relationships, API names, and config matching generator templates

Last reviewed commit: fdd60ac

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@@ -0,0 +1,106 @@
# react-on-rails
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md won't be published to npm. The "files" field in package.json only includes lib/** files, which excludes README.md. Add "README.md" to the files array in packages/react-on-rails/package.json:

Suggested change
# react-on-rails
"files": [
"README.md",
"lib/**/*.js",

@@ -0,0 +1,97 @@
# react-on-rails-pro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README.md won't be published to npm. The "files" field in package.json only includes lib/** files. Add "README.md" to the files array in packages/react-on-rails-pro/package.json:

Suggested change
# react-on-rails-pro
"files": [
"README.md",
"lib/**/*.js",

@claude
Copy link

claude bot commented Feb 21, 2026

PR Review: Add npm READMEs, Pro quick-start guide, and llms.txt

Overall this is a well-structured PR that addresses a real problem (LLMs generating incorrect setup code). The content is largely accurate and the motivation is sound. I found a few issues worth addressing before merge.

Critical: serverBundleCachePath path is wrong in pro-quick-start.md

The "What the generator configured" section (Node-side example) shows:

serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),

But the actual generator template (lib/generators/react_on_rails/templates/pro/base/client/node-renderer.js) uses:

serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Because the generator places the file at client/node-renderer.js, __dirname resolves to the client/ directory. The '../' prefix is needed to put the cache at the project root (not inside client/.node-renderer-bundles). The quick-start's "What the generator configured" section claims to show what the generator produces, but it shows the wrong path.

Minor: Quick-start node config diverges from actual generator template

The "Node-side" code in pro-quick-start.md omits several options that the real template includes: logLevel, additionalContext: { URL, AbortController }, stubTimers: false, and replayServerAsyncOperationLogs: true. Also, the template uses password: env.RENDERER_PASSWORD || 'devPassword' for a development fallback, while the quick-start omits the fallback. The llms.txt and node-renderer README examples are fine since they show simplified API-reference examples, but the quick-start explicitly frames its code as "what the generator configured", so it should be accurate.

Minor: Confusing sentence about gem rejection in react-on-rails-pro/README.md

"The base gem will reject react-on-rails if the Pro gem is detected."

"The base gem" here is ambiguous — readers may not know which gem is doing the rejecting. A clearer phrasing would be something like: "If the react_on_rails_pro gem is present, the runtime will raise an error if the base react-on-rails npm package is used instead of react-on-rails-pro."\n\n### Minor: Unused import in error reporting example

The advanced error reporting example in react-on-rails-pro-node-renderer/README.md imports setupTracing but never uses it, which may confuse readers copying the snippet.

Minor: Version pins in quick-start will go stale

Pinning gem "react_on_rails", "~> 16.3" and gem "react_on_rails_pro", "~> 16.3" is fine today (current is 16.4.0.rc.3), but these explicit minor-version pins in a guide will need updating with every minor release. Consider using a floor constraint (">= 16.4") or no pin at all — similar to how the gemspec itself only requires shakapacker >= 6.0.

### Node-side (client/node-renderer.js)

```js
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generator places node-renderer.js at client/node-renderer.js (as shown in the table above), so __dirname resolves to client/. The correct path to put the cache at the project root (matching the actual template) is '../.node-renderer-bundles', not './.node-renderer-bundles'.

Suggested change
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

**Important:** When using the `react_on_rails_pro` Ruby gem, you **must** use this package (`react-on-rails-pro`) instead of `react-on-rails`. The base gem will reject `react-on-rails` if the Pro gem is detected.

## Usage

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence "The base gem will reject react-on-rails if the Pro gem is detected" is confusing — "the base gem" is ambiguous and it's the Pro gem that enforces this requirement, not the base gem. Suggested rewrite:

Suggested change
**Important:** When using the `react_on_rails_pro` Ruby gem, you **must** use this package (`react-on-rails-pro`) instead of `react-on-rails`. If the Pro gem detects the base `react-on-rails` npm package at runtime, it will raise an error.


- [Node Renderer Basics](https://www.shakacode.com/react-on-rails-pro/docs/node-renderer/basics/)
- [JavaScript Configuration](https://www.shakacode.com/react-on-rails-pro/docs/node-renderer/js-configuration/)
- [Rails Configuration](https://www.shakacode.com/react-on-rails-pro/docs/configuration/)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setupTracing is imported here but never used in the example. Either add an example usage or remove it from the import to avoid confusing copy-paste.

Suggested change
- [Rails Configuration](https://www.shakacode.com/react-on-rails-pro/docs/configuration/)
import { addNotifier } from 'react-on-rails-pro-node-renderer/integrations/api';

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (2)
packages/react-on-rails-pro/README.md (1)

33-39: RSC example imports RSCRoute and wrapServerComponentRenderer but never uses them

The imports on lines 34–36 include RSCRoute and wrapServerComponentRenderer, but only registerServerComponent is exercised. Consider either removing the unused imports from the snippet or expanding the example to show RSCRoute rendering.

✨ Option A – trim to what the example actually demonstrates
-import { RSCRoute } from 'react-on-rails-pro/RSCRoute';
-import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
-import { wrapServerComponentRenderer } from 'react-on-rails-pro/wrapServerComponentRenderer/client';
-
-// Register a server component for client-side hydration
-registerServerComponent({ MyServerComponent });
+import registerServerComponent from 'react-on-rails-pro/registerServerComponent/client';
+
+// Register a server component for client-side hydration
+registerServerComponent({ MyServerComponent });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro/README.md` around lines 33 - 39, The README
snippet imports RSCRoute and wrapServerComponentRenderer but only uses
registerServerComponent; either remove the unused imports (delete RSCRoute and
wrapServerComponentRenderer from the import lines) or expand the example to
demonstrate their usage by showing RSCRoute rendering and invoking
wrapServerComponentRenderer (e.g., reference RSCRoute and
wrapServerComponentRenderer in the snippet so all imported symbols are exercised
alongside registerServerComponent).
packages/react-on-rails-pro-node-renderer/README.md (1)

138-144: setupTracing is imported but not used in the error-reporting example

Either use setupTracing in the snippet or remove it from the import.

✨ Proposed fix
-import { addNotifier, setupTracing } from 'react-on-rails-pro-node-renderer/integrations/api';
+import { addNotifier } from 'react-on-rails-pro-node-renderer/integrations/api';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro-node-renderer/README.md` around lines 138 - 144,
The example imports setupTracing but never uses it; update the snippet to either
use setupTracing or remove it—simplest fix: change the import to only bring
addNotifier (remove setupTracing) so the sample shows a used import (refer to
addNotifier and setupTracing in the README example).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/getting-started/pro-quick-start.md`:
- Line 149: The markdown entry for the Code Splitting link currently points to a
404 URL; locate the line containing the link text "[Code
Splitting](https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/)"
in pro-quick-start.md and either replace the broken URL with the correct working
URL for the Code Splitting docs or remove the entire bullet (the "[Code
Splitting](...)" link) until the target page is restored, ensuring the
surrounding list formatting remains valid.
- Around line 107-115: The example calling reactOnRailsProNodeRenderer uses
path.resolve but never imports path and uses the wrong env var name for
workersCount; add a require('path') at top so path is defined, and change the
workersCount expression from reading process.env.NODE_RENDERER_CONCURRENCY to
process.env.RENDERER_WORKERS_COUNT (fallback to 3 unchanged) so
serverBundleCachePath and workersCount are correct and consistent with the
README.

In `@packages/react-on-rails-pro-node-renderer/README.md`:
- Around line 114-131: Add a brief note above the Advanced example explaining it
uses ESM syntax so users must either use .mjs or set "type":"module" in
package.json or convert the imports to CommonJS; reference the example's symbols
(masterRun, run, configureFastify, cluster) so readers know the note applies to
that snippet.
- Around line 79-81: The README's fenced code block for the Procfile entry lacks
a language specifier which triggers MD040; update the Procfile code block
surrounding the line "node-renderer: node node-renderer.js" to include a
language identifier (for example use "text" or "procfile") so the block becomes
```text ... ``` (or ```procfile ... ```) to silence the markdownlint warning.

---

Nitpick comments:
In `@packages/react-on-rails-pro-node-renderer/README.md`:
- Around line 138-144: The example imports setupTracing but never uses it;
update the snippet to either use setupTracing or remove it—simplest fix: change
the import to only bring addNotifier (remove setupTracing) so the sample shows a
used import (refer to addNotifier and setupTracing in the README example).

In `@packages/react-on-rails-pro/README.md`:
- Around line 33-39: The README snippet imports RSCRoute and
wrapServerComponentRenderer but only uses registerServerComponent; either remove
the unused imports (delete RSCRoute and wrapServerComponentRenderer from the
import lines) or expand the example to demonstrate their usage by showing
RSCRoute rendering and invoking wrapServerComponentRenderer (e.g., reference
RSCRoute and wrapServerComponentRenderer in the snippet so all imported symbols
are exercised alongside registerServerComponent).

Comment on lines +107 to +115
```js
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

reactOnRailsProNodeRenderer({
serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),
port: Number(process.env.RENDERER_PORT) || 3800,
supportModules: true,
workersCount: Number(process.env.NODE_RENDERER_CONCURRENCY || 3),
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Node-side snippet: missing require('path') and mismatched env variable name

Two issues in the generated node-renderer.js example:

  1. path.resolve(...) is called on line 111 but const path = require('path') is never imported — the snippet as written will throw ReferenceError: path is not defined.
  2. The env variable for worker count is NODE_RENDERER_CONCURRENCY here, but the react-on-rails-pro-node-renderer README (and configuration table) document it as RENDERER_WORKERS_COUNT. These need to be consistent.
🐛 Proposed fix
-```js
+```js
+const path = require('path');
 const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

 reactOnRailsProNodeRenderer({
   serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),
   port: Number(process.env.RENDERER_PORT) || 3800,
   supportModules: true,
-  workersCount: Number(process.env.NODE_RENDERER_CONCURRENCY || 3),
+  workersCount: Number(process.env.RENDERER_WORKERS_COUNT) || 3,
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` around lines 107 - 115, The example
calling reactOnRailsProNodeRenderer uses path.resolve but never imports path and
uses the wrong env var name for workersCount; add a require('path') at top so
path is defined, and change the workersCount expression from reading
process.env.NODE_RENDERER_CONCURRENCY to process.env.RENDERER_WORKERS_COUNT
(fallback to 3 unchanged) so serverBundleCachePath and workersCount are correct
and consistent with the README.

- [Node Renderer Configuration](https://www.shakacode.com/react-on-rails-pro/docs/node-renderer/js-configuration/) — All Node Renderer options
- [Caching Guide](https://www.shakacode.com/react-on-rails-pro/docs/caching/) — Fragment and prerender caching
- [Streaming SSR](https://www.shakacode.com/react-on-rails-pro/docs/streaming-server-rendering/) — Progressive rendering
- [Code Splitting](https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/) — Loadable components with SSR
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Broken link — 404 confirmed by CI

The link https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/ returns 404 (flagged by the GitHub Actions "Check Markdown Links" pipeline). Update it to the correct URL or remove it until the page exists.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` at line 149, The markdown entry for
the Code Splitting link currently points to a 404 URL; locate the line
containing the link text "[Code
Splitting](https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/)"
in pro-quick-start.md and either replace the broken URL with the correct working
URL for the Code Splitting docs or remove the entire bullet (the "[Code
Splitting](...)" link) until the target page is restored, ensuring the
surrounding list formatting remains valid.

Comment on lines +79 to +81
```
node-renderer: node node-renderer.js
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing language specifier on Procfile code block (MD040)

The fenced code block for the Procfile entry has no language identifier, triggering the markdownlint MD040 warning. Use text (or procfile) to silence it.

🛠 Proposed fix
-```
+```text
 node-renderer: node node-renderer.js
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro-node-renderer/README.md` around lines 79 - 81,
The README's fenced code block for the Procfile entry lacks a language specifier
which triggers MD040; update the Procfile code block surrounding the line
"node-renderer: node node-renderer.js" to include a language identifier (for
example use "text" or "procfile") so the block becomes ```text ... ``` (or
```procfile ... ```) to silence the markdownlint warning.

Comment on lines +114 to +131
```js
import masterRun from 'react-on-rails-pro-node-renderer/master';
import run, { configureFastify } from 'react-on-rails-pro-node-renderer/worker';
import cluster from 'cluster';

const config = { /* your config */ };

configureFastify((app) => {
app.get('/health', (request, reply) => {
reply.send({ status: 'ok' });
});
});

if (cluster.isPrimary) {
masterRun(config);
} else {
run(config);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Advanced section uses ESM import while Quick Start uses CommonJS require — add a note

The Quick Start example uses require() (CommonJS) but the Advanced section switches to import (ESM) without explanation. Users who copy the advanced snippet into a plain .js file (the default CJS context) will get a syntax error.

Consider adding a brief note such as: "The following example uses ES Modules. Use .mjs extension or add "type": "module" to your package.json, or convert imports to require() calls."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro-node-renderer/README.md` around lines 114 - 131,
Add a brief note above the Advanced example explaining it uses ESM syntax so
users must either use .mjs or set "type":"module" in package.json or convert the
imports to CommonJS; reference the example's symbols (masterRun, run,
configureFastify, cluster) so readers know the note applies to that snippet.

…ability

LLMs consistently fail to generate correct React on Rails Pro setup code because
the npm packages have no READMEs, there's no single quick-start page, and the
correct API names are not discoverable from training data.

Changes:
- Add README.md to all 3 npm packages (react-on-rails, react-on-rails-pro,
  react-on-rails-pro-node-renderer) with correct API examples, config options,
  and package relationship documentation
- Fix incorrect example in Pro gem README (wrong scoped package name
  @shakacode-tools/... and deprecated bundlePath config key)
- Add docs/getting-started/pro-quick-start.md — a single self-contained guide
  for setting up a Pro app from scratch using the --pro generator
- Add llms.txt at repo root following the llms.txt convention, providing
  LLMs with correct package relationships, API names, and config keys

Addresses #2465

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AbanoubGhadban AbanoubGhadban force-pushed the abanoub/improve-llm-discoverability branch from fdd60ac to ec95e93 Compare February 23, 2026 11:06
@claude
Copy link

claude bot commented Feb 23, 2026

Review Summary

The goal of this PR (improving LLM discoverability by adding npm READMEs) is well-motivated and the content is generally accurate. However, there is one critical defect that completely undermines the main purpose, plus a few inconsistencies worth fixing before merge.

Critical: README files will not be published to npm

Both react-on-rails and react-on-rails-pro packages have explicit files arrays in their package.json that restrict what gets included in the npm tarball:

  • packages/react-on-rails/package.jsonfiles includes only lib/**/*.js, lib/**/*.cjs, lib/**/*.mjs, lib/**/*.d.ts
  • packages/react-on-rails-pro/package.jsonfiles includes only lib/**/*.js, lib/**/*.d.ts

Neither README.md matches these patterns, so the READMEs will be silently excluded from both npm packages. The react-on-rails-pro-node-renderer package has no files field at all, so its README will be included correctly.

Fix: Add "README.md" to the files arrays in both package.json files.

Inconsistency: RENDERER_URL vs REACT_RENDERER_URL

The two new docs disagree on the environment variable name for renderer_url:

File Env var used
docs/getting-started/pro-quick-start.md REACT_RENDERER_URL (matches the generator template)
packages/react-on-rails-pro-node-renderer/README.md RENDERER_URL

The generator template (lib/generators/react_on_rails/templates/pro/base/config/initializers/react_on_rails_pro.rb.tt) uses REACT_RENDERER_URL, so the node-renderer README should be updated to match.

Clarification needed: workersCount env variable

The node-renderer README config table says the env variable for workersCount is RENDERER_WORKERS_COUNT. But the generator template (client/node-renderer.js) reads NODE_RENDERER_CONCURRENCY and passes it manually as workersCount. These are different things — the renderer supports both (via its internal env and via the JS config object), but someone following the node-renderer README while also using the generator-created file will be confused about which env var to set. The table footnote or a note in the README should clarify this.

@@ -0,0 +1,106 @@
# react-on-rails
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This README will not be included in the npm publish. packages/react-on-rails/package.json has a files field that only matches lib/**/*.js, lib/**/*.cjs, lib/**/*.mjs, and lib/**/*.d.tsREADME.md does not match any of these patterns.

Fix: add "README.md" to the files array in packages/react-on-rails/package.json:

Suggested change
# react-on-rails
# react-on-rails

(The README content is fine; the change needed is in package.json, not here.)

"files": [
  "lib/**/*.js",
  "lib/**/*.cjs",
  "lib/**/*.mjs",
  "lib/**/*.d.ts",
  "README.md"
]

@@ -0,0 +1,97 @@
# react-on-rails-pro
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the base package: packages/react-on-rails-pro/package.json has:

"files": [
  "lib/**/*.js",
  "lib/**/*.d.ts"
]

README.md is excluded. Add "README.md" to that files array to ensure it gets published to npm.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 23, 2026

size-limit report 📦

Path Size
react-on-rails/client bundled (gzip) 62.5 KB (0%)
react-on-rails/client bundled (gzip) (time) 62.5 KB (0%)
react-on-rails/client bundled (brotli) 53.71 KB (0%)
react-on-rails/client bundled (brotli) (time) 53.71 KB (0%)
react-on-rails-pro/client bundled (gzip) 63.5 KB (0%)
react-on-rails-pro/client bundled (gzip) (time) 63.5 KB (0%)
react-on-rails-pro/client bundled (brotli) 54.67 KB (0%)
react-on-rails-pro/client bundled (brotli) (time) 54.67 KB (0%)
registerServerComponent/client bundled (gzip) 127.16 KB (0%)
registerServerComponent/client bundled (gzip) (time) 127.16 KB (0%)
registerServerComponent/client bundled (brotli) 61.54 KB (0%)
registerServerComponent/client bundled (brotli) (time) 61.54 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) 121.69 KB (0%)
wrapServerComponentRenderer/client bundled (gzip) (time) 121.69 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) 56.63 KB (0%)
wrapServerComponentRenderer/client bundled (brotli) (time) 56.63 KB (0%)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
docs/getting-started/pro-quick-start.md (2)

149-149: Broken link (404) confirmed by CI pipeline — already noted

This was flagged in a previous review round and confirmed by the GitHub Actions "Check Markdown Links" pipeline failure.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` at line 149, The markdown contains a
broken external link for "Code Splitting" pointing to
https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/; replace the
dead URL with a working target (either the current ShakaCode page for
code-splitting or an alternative authoritative resource) or remove the link if
no replacement exists, ensuring the link text "Code Splitting" remains accurate;
update the link in the pro-quick-start document so the CI "Check Markdown Links"
pipeline no longer reports a 404.

107-115: require('path') is missing and env var name is inconsistent — already noted

This was flagged in a previous review round.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/getting-started/pro-quick-start.md` around lines 107 - 115, Add the
missing require('path') at the top and make the environment variable names
consistent: import path (e.g., const path = require('path')) and ensure you use
the same naming scheme for port and concurrency (either both RENDERER_* or both
NODE_RENDERER_*); update the reactOnRailsProNodeRenderer call
(reactOnRailsProNodeRenderer, serverBundleCachePath, port, workersCount) to
reference the chosen env vars (e.g., process.env.RENDERER_PORT and
process.env.RENDERER_CONCURRENCY or process.env.NODE_RENDERER_PORT and
process.env.NODE_RENDERER_CONCURRENCY) so names are no longer inconsistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/react-on-rails-pro/README.md`:
- Around line 44-47: Update the unlabeled code fence in the README diagram to
include a language specifier (e.g., change the opening ``` to ```text or
```ascii) so the ASCII-art block in the README.md is labeled and satisfies
MD040; ensure the opening fence is updated and the closing ``` remains present
around the block containing "react-on-rails-pro (this package) └──
react-on-rails (base package, automatically installed as dependency)".

---

Duplicate comments:
In `@docs/getting-started/pro-quick-start.md`:
- Line 149: The markdown contains a broken external link for "Code Splitting"
pointing to https://www.shakacode.com/react-on-rails-pro/docs/code-splitting/;
replace the dead URL with a working target (either the current ShakaCode page
for code-splitting or an alternative authoritative resource) or remove the link
if no replacement exists, ensuring the link text "Code Splitting" remains
accurate; update the link in the pro-quick-start document so the CI "Check
Markdown Links" pipeline no longer reports a 404.
- Around line 107-115: Add the missing require('path') at the top and make the
environment variable names consistent: import path (e.g., const path =
require('path')) and ensure you use the same naming scheme for port and
concurrency (either both RENDERER_* or both NODE_RENDERER_*); update the
reactOnRailsProNodeRenderer call (reactOnRailsProNodeRenderer,
serverBundleCachePath, port, workersCount) to reference the chosen env vars
(e.g., process.env.RENDERER_PORT and process.env.RENDERER_CONCURRENCY or
process.env.NODE_RENDERER_PORT and process.env.NODE_RENDERER_CONCURRENCY) so
names are no longer inconsistent.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fdd60ac and ec95e93.

📒 Files selected for processing (6)
  • docs/getting-started/pro-quick-start.md
  • llms.txt
  • packages/react-on-rails-pro-node-renderer/README.md
  • packages/react-on-rails-pro/README.md
  • packages/react-on-rails/README.md
  • react_on_rails_pro/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/react-on-rails-pro-node-renderer/README.md
  • llms.txt

Comment on lines +44 to +47
```
react-on-rails-pro (this package)
└── react-on-rails (base package, automatically installed as dependency)
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language specifier to the unlabeled code fence (MD040)

The ASCII-art diagram block opens with a plain ``` fence, triggering the MD040 lint rule.

🐛 Proposed fix
-```
+```text
 react-on-rails-pro (this package)
 └── react-on-rails (base package, automatically installed as dependency)
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/react-on-rails-pro/README.md` around lines 44 - 47, Update the
unlabeled code fence in the README diagram to include a language specifier
(e.g., change the opening ``` to ```text or ```ascii) so the ASCII-art block in
the README.md is labeled and satisfies MD040; ensure the opening fence is
updated and the closing ``` remains present around the block containing
"react-on-rails-pro (this package) └── react-on-rails (base package,
automatically installed as dependency)".

All React on Rails Pro gems and npm packages are now in the public
monorepo. Remove "you will need access to our private repository"
notes, update GitHub links from the old shakacode/react_on_rails_pro
repo to shakacode/react_on_rails monorepo paths, remove obsolete
GitHub Packages publishing instructions from releasing guide, and
fix tense in the upgrade guide.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link

claude bot commented Feb 23, 2026

Review: Documentation Accuracy Issues

Good effort on centralizing the LLM-discoverability content — the motivation is sound and most of the changes are accurate. However, I found several factual inconsistencies across the new docs that could mislead developers more than the current state of affairs. These should be fixed before merging.

Critical: Wrong env variable name in node-renderer README

In packages/react-on-rails-pro-node-renderer/README.md, the Rails config example uses:

config.renderer_url = ENV["RENDERER_URL"] || "http://localhost:3800"

But the actual generator template (react_on_rails/lib/generators/react_on_rails/templates/pro/base/config/initializers/react_on_rails_pro.rb.tt) uses REACT_RENDERER_URL, not RENDERER_URL. The pro-quick-start.md and llms.txt both correctly use REACT_RENDERER_URL. This inconsistency means a developer following the node-renderer README will configure the wrong env var and the connection will silently use the default URL.

Incorrect serverBundleCachePath in pro-quick-start.md

The "What the generator configured" section shows:

serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),

But the generator creates the file at client/node-renderer.js, and the actual template uses:

serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

The ../ is required to place the cache at the project root rather than inside client/. The simplified example in the quick-start will cache bundles in the wrong directory.

Inconsistent env var for workersCount

The README configuration table documents RENDERER_WORKERS_COUNT as the env var for workersCount, but the actual generator template reads NODE_RENDERER_CONCURRENCY. Developers who rely on the README table to configure workers via env var will find it doesn't work.

"What the generator configured" is misleading

The quick-start guide section titled "What the generator configured" shows a 5-option simplified snippet, but the actual generator template produces a much richer file including ssr_timeout, renderer_request_retry_limit, renderer_use_fallback_exec_js, tracing, CI-specific workersCount override, additionalContext, replayServerAsyncOperationLogs, and stubTimers. A developer will see their generated file and find it doesn't match the docs. Consider labeling this as a "minimal example" or linking directly to the template source.

Mixed module syntax in Advanced section (minor)

The Advanced section uses ESM import statements, while the entire Quick Start and the generator template use CommonJS require(). There's no note explaining this switch or whether the package ships ESM. Needs a clarifying sentence.

Files field does not block README from npm publish

The test plan item about confirming README.md inclusion is correct in outcome but the reasoning is unnecessary: npm always includes README.md in published packages regardless of the files field. This is fine — the READMEs will be published.

Comment on lines +54 to +55
config.renderer_url = ENV["RENDERER_URL"] || "http://localhost:3800"
config.renderer_password = ENV["RENDERER_PASSWORD"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong env variable name — RENDERER_URL should be REACT_RENDERER_URL. The generator template (lib/generators/react_on_rails/templates/pro/base/config/initializers/react_on_rails_pro.rb.tt) and all other docs (pro-quick-start.md, llms.txt) consistently use REACT_RENDERER_URL. Using RENDERER_URL here will silently fall back to the hardcoded default and the env var will have no effect.

Also note the missing default for renderer_password — the generator template uses ENV.fetch("RENDERER_PASSWORD", "devPassword") for development parity.

Suggested change
config.renderer_url = ENV["RENDERER_URL"] || "http://localhost:3800"
config.renderer_password = ENV["RENDERER_PASSWORD"]
config.renderer_url = ENV.fetch("REACT_RENDERER_URL", "http://localhost:3800")
config.renderer_password = ENV.fetch("RENDERER_PASSWORD", "devPassword")

const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');

reactOnRailsProNodeRenderer({
serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong relative path. Since the generator places this file at client/node-renderer.js, __dirname is the client/ directory. Using './.node-renderer-bundles' puts the cache inside client/, not the project root. The actual generator template uses '../.node-renderer-bundles' to resolve to the project root.

Also missing the const path = require('path'); import at the top of this snippet.

Suggested change
serverBundleCachePath: path.resolve(__dirname, './.node-renderer-bundles'),
serverBundleCachePath: path.resolve(__dirname, '../.node-renderer-bundles'),

Comment on lines +92 to +103
## What the generator configured

### Rails-side (config/initializers/react_on_rails_pro.rb)

```ruby
ReactOnRailsPro.configure do |config|
config.server_renderer = "NodeRenderer"
config.renderer_url = ENV.fetch("REACT_RENDERER_URL", "http://localhost:3800")
config.renderer_password = ENV.fetch("RENDERER_PASSWORD", "devPassword")
config.prerender_caching = true
end
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section title "What the generator configured" sets the expectation of accuracy, but the snippet is significantly simplified compared to the actual generated file. The real generator template also includes ssr_timeout, renderer_request_retry_limit, renderer_use_fallback_exec_js, tracing, etc. A developer who looks at their generated file will find it doesn't match.

Consider either:

  1. Renaming this to "Minimal configuration example" and noting the generator produces a fuller version
  2. Showing the complete output that matches the actual template

Otherwise developers opening their generated initializer will be confused by options not shown here.

Comment on lines +114 to +117
```js
import masterRun from 'react-on-rails-pro-node-renderer/master';
import run, { configureFastify } from 'react-on-rails-pro-node-renderer/worker';
import cluster from 'cluster';
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Advanced section switches to ESM import syntax without any note about it, while the entire Quick Start and the actual generator template use CommonJS require(). The package doesn't declare "type": "module" in its package.json, so CJS is the default.

Consider adding a note clarifying this is the ESM usage pattern, or converting to require() to be consistent with the Quick Start above.

| `logHttpLevel` | `RENDERER_LOG_HTTP_LEVEL` | `'error'` | HTTP server log level |
| `serverBundleCachePath` | `RENDERER_SERVER_BUNDLE_CACHE_PATH` | Auto-detected or `/tmp/...` | Directory for cached server bundles |
| `supportModules` | `RENDERER_SUPPORT_MODULES` | `false` | Enable Node.js globals in VM context (`Buffer`, `process`, `setTimeout`, etc.) |
| `workersCount` | `RENDERER_WORKERS_COUNT` | CPU count - 1 | Number of worker processes |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The env variable name here (RENDERER_WORKERS_COUNT) doesn't match what the generator template uses. The actual generator template (lib/generators/react_on_rails/templates/pro/base/client/node-renderer.js) reads NODE_RENDERER_CONCURRENCY:

workersCount: env.NODE_RENDERER_CONCURRENCY != null ? Number(env.NODE_RENDERER_CONCURRENCY) : 3,

If the package itself reads RENDERER_WORKERS_COUNT internally (separate from the generator config), this needs a clarifying note. If not, this documents a non-functional env var name for the most common use case (following the generator).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve LLM discoverability for React on Rails Pro setup

1 participant