📦 robots-txt — 爬虫规则配置

v1.1.1

一键生成、审计与优化 robots.txt,智能识别误封路径,为不同用户代理定制允许/禁止规则,无需安装与凭证,守护站点 SEO 与安全。

0· 55·0 当前·0 累计
kostja94 头像by @kostja94 (Kostja Zhang)
下载技能包
最后更新
2026/4/7
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill is an instruction-only, coherent robots.txt auditor/editor: it asks for no installs, no credentials, and its runtime instructions match the stated purpose.
评估建议
This skill is internally consistent and low-risk: it only contains prose instructions and needs no installs or credentials. Before installing, note that at runtime it may read project-context files (.claude/project-context.md or .cursor/project-context.md) if present to learn the site URL and indexing goals — remove or sanitize those files if they contain sensitive data you don't want shared. If you plan to audit a live site, the skill does not gain host credentials or make changes itself; provi...
详细分析 ▾
用途与能力
名称/描述(robots.txt 审计/配置)与指令一致:生成推荐文件、审计误封路径并提供分用户代理规则,不请求无关凭证或工具。
指令范围
指令严格限定于 robots.txt 指导与审计。会读取 .claude/project-context.md 或 .cursor/project-context.md(若存在)获取站点 URL 与索引目标——合理获取上下文,但代理将读取本地项目文件,用户需知悉这些文件内容会被使用。
安装机制
无安装规范且无代码文件——仅含指令的技能。安装期间不会写入磁盘或下载任何内容。
凭证需求
技能无需环境变量、密钥或外部凭证。请求的访问(本地 project-context 文件)与其声明目的相称。
持久化与权限
always 为 false,技能不请求提升/系统级权限。允许自主调用(平台默认),但本身无风险。
安全有层次,运行前请审查代码。

运行时依赖

无特殊依赖

版本

latestv1.1.12026/4/7

Automated batch sync

无害

安装命令

点击复制
官方npx clawhub@latest install robots-txt
镜像加速npx clawhub@latest install robots-txt --registry https://cn.longxiaskill.com

技能文档

指导如何为搜索引擎和 AI 爬虫配置并审计 robots.txt。

首次调用时,如有助于理解,先用 1–2 句话说明本技能覆盖范围及其重要性,再给出主体输出。 后续调用或用户要求跳过时,直接进入主体输出。

范围(技术 SEO)

  • robots.txt:配置 Disallow/Allow、Sitemap、Clean-param;审计意外屏蔽
  • 爬虫访问:路径级抓取控制;AI 爬虫允许/屏蔽策略
  • 区分:robots.txt = 抓取控制(谁访问哪些路径);noindex = 索引控制(哪些内容被索引)。页面级排除请参见 indexing

初始评估

优先检查项目上下文:若存在 .claude/project-context.md.cursor/project-context.md,先读取其中的站点 URL 与索引目标。识别:
  • 站点 URL:基础域名(如 https://example.com
  • 索引范围:整站、部分或需排除的特定路径
  • AI 爬虫策略:允许搜索/索引 vs 屏蔽训练数据爬虫

最佳实践

目的与限制

| 要点 | 说明 | |------|------| | 目的 | 控制爬虫访问;不能阻止索引(被屏蔽的 URL 仍可能出现在搜索结果但无摘要) | | 声明性 | 规则仅为建议;恶意爬虫可忽略 | | 公开 | robots.txt 可被公开读取;敏感内容请用 noindex 或鉴权。参见 indexing |

抓取 vs 索引 vs 链接权重(速查)

| 工具 | 控制 | 阻止索引? | |------|----------|-------------------| | robots.txt | 抓取(路径级) | 否——被屏蔽 URL 仍可能出现在 SERP | | noindex(meta / X-Robots-Tag) | 索引(页面级) | 是。参见 indexing | | nofollow | 仅链接权重 | 否——不控制索引 |

何时用 robots.txt vs noindex

| 场景 | 工具 | 示例 | |-----|------|---------| | 路径级(整个目录) | robots.txt | Disallow: /admin/, Disallow: /api/, Disallow: /staging/ | | 页面级(特定页) | noindex meta / X-Robots-Tag | 登录、注册、感谢页、404、法律页。完整列表参见 indexing | | 关键 | 勿在 robots.txt 屏蔽 | 使用 noindex 的页面——爬虫必须访问页面才能读取指令 |

应在 robots.txt 屏蔽的路径:/admin/、/api/、/staging/、临时文件。 应使用 noindex(允许抓取):/login/、/signup/、/thank-you/ 等——参见 indexing

位置与格式

| 项目 | 要求 | |------|-------------| | 路径 | 站点根目录:https://example.com/robots.txt | | 编码 | UTF-8 纯文本 | | 标准 | RFC 9309(Robots Exclusion Protocol) |

核心指令

| 指令 | 目的 | 示例 | |-----------|---------|---------| | User-agent: | 目标爬虫 | User-agent: Googlebot, User-agent: * | | Disallow: | 屏蔽路径前缀 | Disallow: /admin/ | | Allow: | 允许路径(可覆盖 Disallow) | Allow: /public/ | | Sitemap: | 声明 sitemap 绝对地址 | Sitemap: https://example.com/sitemap.xml | | Clean-param: | 去除查询参数(Yandex) | 见下方 |

关键:切勿屏蔽

| 切勿屏蔽 | 原因 | |--------------|--------| | CSS、JS、图片 | Google 需要它们渲染页面;屏蔽会破坏索引 | | /_next/(Next.js) | 会中断 CSS/JS 加载;GSC 中“已抓取 - 未索引”对静态资源属正常现象。参见 indexing | | 使用 noindex 的页面 | 爬虫必须访问页面才能读取 noindex 指令;在 robots.txt 屏蔽会阻止这一过程 |

仅屏蔽:无需抓取的路径:/admin/、/api/、/staging/、临时文件。

AI 爬虫策略

robots.txt 对所有已测 AI 爬虫均有效(Vercel/MERJ 研究,2024)。按 user-agent 设置规则;查阅各厂商文档获取最新令牌。

| User-agent | 目的 | 常见 | |------------|---------|---------| | OAI-SearchBot | ChatGPT 搜索 | Allow | | GPTBot | OpenAI 训练 | Disallow | | Claude-SearchBot | Claude 搜索 | Allow | | ClaudeBot | Anthropic 训练 | Disallow | | PerplexityBot | Perplexity 搜索 | Allow | | Google-Extended | Gemini 训练 | Disallow | | CCBot | Common Crawl(LLM 训练) | Disallow | | Bytespider | ByteDance | Disallow | | Meta-ExternalAgent | Meta | Disallow | | AppleBot | Apple(Siri、Spotlight);可渲染 JS | 为索引可 Allow |

Allow vs Disallow:允许搜索/索引机器人(OAI-SearchBot、Claude-SearchBot、PerplexityBot);若不希望内容被用于模型训练,则屏蔽纯训练机器人(GPTBot、ClaudeBot、CCBot)。AI 爬虫优化(SSR、URL 管理)参见 site-crawlability

Clean-param(Yandex)

`` Clean-param: utm_source&utm_medium&utm_campaign&utm_term&utm_content&ref&fbclid&gclid ``

输出格式

  • 当前状态(如为审计)
  • 推荐 robots.txt(完整文件)
  • 合规检查清单
  • 参考资料Google robots.txt

相关技能

  • indexing:完整 noindex 页面类型列表;何时用 noindex vs robots.txt;GSC 索引诊断
  • page-metadata:Meta robots(noindex、nofollow)实现
  • xml-sitemap:在 robots.txt 中引用的 sitemap URL
  • site-crawlability:更广的抓取与结构指导;AI 爬虫优化
  • rendering-strategies:SSR、SSG、CSR;确保爬虫可获取初始 HTML 内容
数据来源ClawHub ↗ · 中文优化:龙虾技能库