Skip to content

Add a script to generate llms.txt#2004

Merged
Simek merged 15 commits intoreact-native-community:mainfrom
amandeepmittal:@amandeepmittal/add-llms-txt
Nov 19, 2025
Merged

Add a script to generate llms.txt#2004
Simek merged 15 commits intoreact-native-community:mainfrom
amandeepmittal:@amandeepmittal/add-llms-txt

Conversation

@amandeepmittal
Copy link
Copy Markdown
Contributor

@amandeepmittal amandeepmittal commented Nov 19, 2025

📝 Why & how

@kadikraman requested that a script be added to reactnative.directory to generate an llms.txt file. Once hosted, this file can be reused in AI integration tools and AI docs integrations such as Expo documentation.

  • This PR adds a new script (bun run llms:generate) to generate the llms.txt` file.
  • It uses the curated dataset from react-native-libraries.json plus the cached GitHub metadata from assets/data.json.
  • The output lists each library with name, repo link, description, supported platforms, and New Architecture status.
  • Updates README.md with a " How do I generate llms.txt?" that provides instructions on how to generate this file.

Example:

CleanShot 2025-11-19 at 19 38 40@2x

Test plan

@kadikraman kadikraman requested a review from Simek November 19, 2025 13:37
@kadikraman
Copy link
Copy Markdown
Collaborator

Hi @Simek! The purpose of this PR is to make React Native libraries easier to discover via LLMs, including the docs AI search. The RN Directory is not easily scannable with LLMs so we were finding that our docs search was giving incorrect information regarding RN libraries, or not even knowing they exist. With this, we can have more accurate and up to date information as well as be able to link back to RN Directory as the source of the info.

What do you think?

Copy link
Copy Markdown
Member

@Simek Simek left a comment

Choose a reason for hiding this comment

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

Hey Aman, hey Kadi! 👋

I think that this is a good idea and should help some users!

Left few suggestions below, but let's me summarize them also in the comment:

  • I would base the generation fully on assets/data.json, this way we would have access to broader dataset (download counts, latest release data etc.) and could simplify the logic in few places,
  • I would retain the split in term between platform and compatibility, so AI responses does not confuse people or add to the layer of misunderstanding the difference,
  • more helpers/code we could reuse with website/API, the easier and less demanding the maintenance will be, when we apply changes to the app

One more thing which this PR misses is hooking this up into (or after) build process during the deployment. This can be done by updating the build script, and adding llms:generate after data:update call.

In the future it would be nice to add some more dat to entries, besides mentioned earlier ones topics/tags would be nice, some popularity stats, like downloads, stars or trending score, listing package website (if available) could also be handy, but definitely this can be done in a separate, follow-up PR. 🙂

Comment thread README.md Outdated
Comment thread package.json Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
Comment thread scripts/generate-llms.ts Outdated
@amandeepmittal
Copy link
Copy Markdown
Contributor Author

amandeepmittal commented Nov 19, 2025

Hi @Simek 👋

Thank you for your thorough feedback (as always!)!

I've reused the helper functions/utilities that already exist in the codebase and removed duplicated/redundant code from this script. Also, added the generation script to the build script.

Since we are now relying on assets/data.json completely, I've included more fields as you can see below, to help LLMs understand/analyze data:

CleanShot 2025-11-19 at 22 42 52@2x

@amandeepmittal amandeepmittal requested a review from Simek November 19, 2025 17:15
Comment thread README.md Outdated
Comment thread scripts/generate-llms.ts Outdated
@amandeepmittal amandeepmittal requested a review from Simek November 19, 2025 17:35
Copy link
Copy Markdown
Member

@Simek Simek left a comment

Choose a reason for hiding this comment

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

Great work on that feature, thanks for all review follow-ups, let's ship it! 🚀

@Simek Simek merged commit e1ca792 into react-native-community:main Nov 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants