翻篇收录说明
翻篇网页快照

How to help LLMs understand your nbdev project - llms-txt

https://llmstxt.org/nbdev.html

最近抓取:2026-12-04 17:26:10(北京时间)

最近内容变化:2026-12-02 04:24:36(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

A practical guide to making your nbdev library agent-friendly using llms.txt, with automation techniques and implementation examples.

正文摘录

Overview This tutorial demonstrates how to add llms.txt to your nbdev project, creating a clear interface between your code and the agents that use it. nbdev already publishes markdown versions of every documentation page by default, so the resources your llms.txt links to are ready-made. While this guide focuses on nbdev, the underlying principles and tools are framework-agnostic and can help make any codebase more accessible to agents. Let's explore how to implement this. The key ingredient: llms.txt The foundation of LLM-friendly documentation is the llms.txt file. At its core, it is just a Markdown file with information about your library found at a specific URL (root of your site followed by /llms.txt). However, it needs to follow a certain structure as outlined in the llms.txt format. Do not be intimidated by the specification, though. In reality, it offers a lot of flexibility and by conforming to it you'll gain access to several very helpful tools that we will look at in a second. First, let's start working on our llms.txt file. If you would like to, you can open your favorite editor and start working on an llms.txt for your library as we go along. Here is how the llms.txt file could begin: # FastHTML > FastHTML is a python library which... When writing FastHTML apps remember to: - Thing to remember Copy The required elements are: the H1 header (FastHTML) a blockquote with a short summary of the project (FastHTML is a python library which…) And they can optionally be followed by zero or more paragraphs and lists. Usually, this is the place where you would add a short description of your library. The description can be as simple as this (this is an excerpt from the llms.txt for fastcore): Here are some tips on using fastcore: - **Liberal imports**: Utilize `from fastcore.module import *` freely. The library is designed for safe wildcard imports. - **Enhanced list operations**: Substitute `list` with `L`. This provides advanced indexing, method chaining, and additional functionality while maintaining list-like behavior. - **Extend existing classes**: Apply the `@patch` decorator to add methods to classes, including built-ins, without subclassing. This enables more flexible code organization. Copy Below are a few ideas on how to make writing the description feel even more seamless: Consider the content you already have that can be used as a starting point (e.g. your project's README, blog posts and articles, social media discussions, etc.) Think of how you would describe your library to a new team member — this often yields the right balance of precision and comprehension. Use an LLM to help you synthetize content from multiple sources into cohesive prose (though you might need to do some post-processing to combat the LLM's tendency to be verbose). Adding resource sections After the optional description, you can include zero or more sections starting with an H2 heading, an optional short summary paragraph, and links to supplementary resources. Markdown files are strongly recommended here as they offer a good balance of structure and readability. You could attempt linking to other formats, but your results may vary. For instance, HTML tends to be verbose, and formats like CSV rarely contain information that lends itself well to documenting functionality. Here's an example of what this section might look like: ## Docs - [Surreal](https://host/README.md): Tiny jQuery alternative with Locality of Behavior - [FastHTML quick start](https://host/quickstart.md): An overview of FastHTML features ## Examples - [Todo app](https://host/adv_app.py) Copy Your llms.txt file is now complete! Let's configure nbdev to serve it alongside your docs. Configuration Place llms.txt in your nbs directory and ensure Quarto copies .txt files into the published site in nbs/_quarto.yml: project: type: website resources: - "*.txt" Copy Because nbdev publishes .md versions of every notebook and Quarto page alongside HTML by default, links to your module and guide pages in llms.txt work automatically once you commit these changes and rebuild your docs. Learning from examples It is often useful to study how others went about implementing the thing we are working on. The fastcore and FastHTML projects offer a good reference, and you can find additional examples in the llmstxt.site and llmstxt.cloud directories. Providing the right context opens up new possibilities for AI-assisted development and exploring topics you might want to learn more about. We hope this guide helps you and the users of your library take advantage of these exciting new tools.