π CLI tool to fetch llms.txt files for your npm dependencies
Install it globally
npm install -g get-llmsor just run it with npx
npx get-llmsFetch llms.txt files for all dependencies in your package.json:
get-llmsYou can fetch specific packages without needing a package.json:
get-llms zod react-nativeSpecify a custom path to package.json (default: ./package.json)
get-llms --package ./packages/core/package.jsonFilter which dependency types to include. Comma-separated list of:
prod- dependenciesdev- devDependenciespeer- peerDependenciesoptional- optionalDependenciesall- all dependencies (default)
get-llms --deps prod,dev # Only production and dev dependencies
get-llms --deps prod # Only production dependenciesSpecify packages directly to fetch:
get-llms react @types/reactCustom output directory (default: docs/llms)
get-llms --output ./context/dependenciesFilename pattern for output files. Use {name} as a placeholder for the package name (default: {name})
get-llms --filename "llms-{name}"File extension for output files (default: txt)
get-llms --extension mdPreview what would be done without writing any files
get-llms --dry-runStrategy when llms.txt is not found:
none(default) - Skip packages withoutllms.txtreadme- Fall back to README.md from GitHubempty- Create an empty file with a placeholder messageskip- Same asnone
get-llms --fallback readme # Use README.md as fallback
get-llms --fallback empty # Create empty filesWith readme fallback:
get-llms --fallback readmeResults in:
β
package-name: Using readme fallback -> package-name.txt
With empty fallback:
get-llms --fallback emptyCreates files containing:
# package-name
No llms.txt found for this package.
Only show errors (minimal output)
get-llms --quietShow detailed output including:
- Network requests being made
- URLs being checked
- Debug information
get-llms --verboseNote: If both -q and -v are specified, the last one wins.
Customize how special characters in package names are sanitized:
Character to replace spaces in filenames (default: _)
get-llms --space-replace "_"Character to replace slashes in filenames (default: -)
get-llms --slash-replace "-"Character to replace @ in scoped package names (default: empty string)
get-llms --at-replace ""Example: @types/node becomes types-node.txt with default settings
get-llms \
--fallback readme \
--extension md \
--output ./docs/handbookget-llms \
--deps prod \
--filename "{name}-reference" \
--extension txt \
--output ./context/prodget-llms @types/node @types/react \
--space-replace "_" \
--slash-replace "_" \
--at-replace "at_"This might create:
at_types_node.txtat_types_react.txt
get-llms \
--deps all \
--dry-run \
--verboseget-llms \
--deps prod \
--fallback empty \
--output ./docs/llms-production \
--quietBy default, files are saved to:
docs/llms/
βββ zod.txt
βββ react-native.txt
βββ [package-name].txt
With --fallback readme, successful files may include fallback indicators in the summary.
The tool searches for llms.txt files in this order:
- Check the package's
package.jsonfor anllmsorllmsFullfield - Try standard URLs:
{homepage}/llms.txtand{homepage}/docs/llms.txt - If GitHub repository, search README for links containing "docs"
- Apply fallback strategy if specified
flowchart TD
A([package]) --> B{is there an 'llms' key in the 'package.json'?}
B -- yes --> FOUND([we've found it])
B -- no --> C{is the package homepage a github link?}
C -- yes --> D{does the github 'readme.txt' mention the word 'docs' in a hyperlink?}
C -- no --> E{does 'link/llms.txt' return a txt file?}
D -- yes --> E
D -- no --> NOFILE([there likely isn't a 'llms.txt' for that package Either use the 'README.txt', or use an external service like context7])
E -- yes --> FOUND
E -- no --> F{does 'link/docs/llms.txt' return a txt file?}
F -- yes --> FOUND
F -- no --> NOFILE
0- Success1- Package.json not found or cannot be parsed
Issues and contributions welcome! Report bugs at: https://github.com/balazshevesi/get-llms/issues, or contact me on twitter @balazs_hevesi
The llms.txt spec is still young and un-opinionated. Some packages and some documentation-sites already ship an llms.txt file, others donβt, and the ones that do sometimes invent their own markdown dialect.
As adoption grows we expect the format to stabilise, turning βantigenic-codingβ into a first-class workflow.
Today the cleanest way to publish documentation with an llms.txt is to add an "llms" key to package.json:
"llms": "./README.txt"When the registry starts indexing that field weβll be able to fetch the exact documentation that and feed it into the coding-agent's context. (this will also require the URLs for fetching documentation versions to be standardized)
Example: zod
Because the format is still fluid, treat llms.txt as best-effort documentation:
- 90 % of the time an agent can slurp the file directly.
- If itβs 25k tokens or more, you might want to fall back to a cache, a RAG layer, or a service such as Context7. (AI-agents such have a limit on the file sizes they're willing to read, and will truncate the file to fit their context window)
Vibe-coded apps are about to become legacy and enter a maintenance phase. When that happens, ai coding-agents will need the docs for old versions of the packages. llms.txt is the lowest-friction way to provide the ai with the correct documentation.
External services (like Context7) are great, but bundling the required context is simpler, cheaper.