Skip to content

格式与约定

llms.txt 目前没有唯一强制标准,但社区逐渐形成了较稳定写法。

推荐结构

  1. 标题与站点说明。
  2. 关键章节索引(优先高价值页面)。
  3. 附加章节(示例、FAQ、更新日志)。
  4. 机器友好约束(如更新时间、语言、范围)。

建议内容块

  • 项目简介(1-3 行)。
  • 面向对象(谁该读)。
  • 快速入口(最多 8-12 个链接)。
  • 深入阅读路径。
  • 更新日期。

示例骨架

txt
# Project Docs for LLMs

> Last updated: 2026-03-08
> Language: zh-CN

## Start Here
- https://example.com/docs/intro
- https://example.com/docs/getting-started

## API
- https://example.com/docs/api/auth
- https://example.com/docs/api/errors

## Advanced
- https://example.com/docs/architecture
- https://example.com/docs/security

完整示例

markdown
# OpenClaw Documentation for LLMs

> Last updated: 2026-03-08
> Language: zh-CN
> Version: 1.2.0
> Scope: Public

## Project Overview

OpenClaw 是一个 AI Agent 运行时平台,提供多渠道接入、工具调用、模型路由等能力。

**核心概念**

- Gateway:AI Agent 的运行时网关
- Channel:消息渠道(Discord、Telegram 等)
- Tool:Agent 可调用的工具
- Skill:可复用的任务能力包

## Quick Start (P0)

> 新用户必读,5 分钟完成首次使用

- https://docs.openclaw.ai/start/getting-started - 快速开始
- https://docs.openclaw.ai/install/index - 安装指南
- https://docs.openclaw.ai/start/quickstart - 第一个任务

## API Reference (P1)

> 开发者集成必读

### 认证与配置

- https://docs.openclaw.ai/gateway/authentication - 认证方式
- https://docs.openclaw.ai/gateway/configuration - 配置详解

### 渠道接入

- https://docs.openclaw.ai/channels/index - 渠道总览
- https://docs.openclaw.ai/channels/discord - Discord 接入
- https://docs.openclaw.ai/channels/telegram - Telegram 接入

### 工具与技能

- https://docs.openclaw.ai/tools/index - 工具系统
- https://docs.openclaw.ai/cli/skills - 技能管理

## Troubleshooting (P1)

> 常见问题解决

- https://docs.openclaw.ai/help/faq - 常见问题
- https://docs.openclaw.ai/gateway/troubleshooting - 故障排查
- https://docs.openclaw.ai/gateway/security/index - 安全模型

## Advanced Topics (P2)

> 深入了解

- https://docs.openclaw.ai/platforms/index - 平台支持
- https://docs.openclaw.ai/providers/index - 模型提供商
- https://docs.openclaw.ai/nodes/index - 节点管理

## Changelog

- 2026-03-08: 新增多 Agent 协作指南
- 2026-03-01: 新增 MCP 协议支持
- 2026-02-15: 新增 Skill 系统

写法建议

  • 使用绝对 URL,减少解析歧义。
  • 描述短而具体,避免营销文案。
  • 保持链接稳定,避免频繁失效。

格式规范

文件命名

txt
/llms.txt          # 索引文件
/llms-full.txt     # 完整内容(可选)

元信息字段

字段必填说明示例
last_updated最后更新日期2026-03-08
language文档语言zh-CN
version文档版本1.2.0
scope适用范围public / internal
contact联系方式docs@example.com

章节命名规范

markdown
## Start Here # 必需:快速入口

## API Reference # 推荐:API 参考

## Troubleshooting # 推荐:故障排查

## Advanced Topics # 可选:高级主题

## Changelog # 可选:更新日志

链接格式

txt
# 推荐:URL + 简短描述

- https://docs.example.com/api/auth - 认证方式

# 不推荐:只有 URL

- https://docs.example.com/api/auth

# 不推荐:过长描述

- https://docs.example.com/api/auth - 这里的认证方式支持多种方法包括 API Key、OAuth2、JWT 等(太长)

验证工具

在线验证

bash
# 使用 llms.txt 验证工具
npx llms-txt-validator https://example.com/llms.txt

本地验证

bash
# 安装验证工具
npm install -g llms-txt-validator

# 验证文件
llms-txt validate ./public/llms.txt

# 检查链接
llms-txt check-links ./public/llms.txt

与 robots.txt 和 sitemap.xml 的关系

文件目标用途
robots.txt爬虫控制爬取权限
sitemap.xml搜索引擎索引所有页面
llms.txtLLM高价值内容入口

最佳实践:三者配合使用,互为补充。

xml
<!-- sitemap.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://docs.example.com/</loc>
    <lastmod>2026-03-08</lastmod>
  </url>
</urlset>
txt
# robots.txt
User-agent: *
Allow: /

Sitemap: https://example.com/sitemap.xml

# LLM-friendly entry point
# See: https://example.com/llms.txt