Skills 系统——让 AI 秒变专家
2026/4/6 0:28:13 网站建设 项目流程
1. 技能的本质提示词工程在 nanobot 中一个技能就是一个文件夹核心是里面的SKILL.md。nanobot内置的skills放在project_path/nanobot/skills目录下用户自定义的skills放在workspace/.nanobot/skills目录下以weather技能为例路径nanobot/skills/weather/SKILL.md内容它并不包含复杂的 Python 逻辑而是直接告诉 AI“如果你想查天气可以运行curl wttr.in/城市名”。这种设计非常聪明既然大模型已经非常擅长理解文档和编写代码为什么不直接给它一份文档让它自己去执行命令呢2. 核心机制渐进式加载Progressive Loading如果把所有技能的详细说明都塞进 PromptAI 的上下文窗口很快就会爆掉。nanobot 采用了渐进式加载策略第一阶段技能索引当 Agent 启动时SkillsLoader会扫描所有技能提取SKILL.md顶部的 YAML 元数据前后两个---包裹其中下面两个字段最重要name: 技能名description: 技能描述简要说明技能是做什么的将workspace与built-in skills所有的元数据进行合并生成一个技能索引xml语法添加到大模型的system prompt中(... 系统提示词中的其它内容身份、角色、记忆等) # Skills The following skills extend your capabilities. To use a skill, read its SKILL.md file using the read_file tool. Skills with availablefalse need dependencies installed first - you can try installing them with apt/brew. skills skill availabletrue namebaoyu-xhs-images/name descriptionGenerates Xiaohongshu (Little Red Book) infographic series with 11 visual styles and 8 layouts. Breaks content into 1-10 cartoon-style images optimized for XHS engagement. Use when user mentions 小红书图片, XHS images, RedNote infographics, 小红书种草, or wants social media infographics for Chinese platforms./description location.nanobot/skills/baoyu-xhs-images/SKILL.md/location /skill skill availabletrue namememory/name descriptionTwo-layer memory system with grep-based recall./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/memory/SKILL.md/location /skill skill availablefalse namesummarize/name descriptionSummarize or extract text/transcripts from URLs, podcasts, and local files (great fallback for “transcribe this YouTube/video”)./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/summarize/SKILL.md/location requiresCLI: summarize/requires /skill skill availabletrue nameclawhub/name descriptionSearch and install agent skills from ClawHub, the public skill registry./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/clawhub/SKILL.md/location /skill skill availabletrue nameskill-creator/name descriptionCreate or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/skill-creator/SKILL.md/location /skill skill availablefalse namegithub/name descriptionInteract with GitHub using the gh CLI. Use gh issue, gh pr, gh run, and gh api for issues, PRs, CI runs, and advanced queries./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/github/SKILL.md/location requiresCLI: gh/requires /skill skill availablefalse nametmux/name descriptionRemote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/tmux/SKILL.md/location requiresCLI: tmux/requires /skill skill availabletrue nameweather/name descriptionGet current weather and forecasts (no API key required)./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/weather/SKILL.md/location /skill skill availabletrue namecron/name descriptionSchedule reminders and recurring tasks./description location/Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/cron/SKILL.md/location /skill /skills第二阶段按需读取我们结合代码来梳理skills的加载和运行逻辑主 Agent 在思考时只会看到这个索引。如果它发现用户问了天气问题它会意识到“哦我有一个weather技能可以用”。此时它会调用read_file工具去读取那个SKILL.md的完整内容。读完之后它就学会了如何使用curl去查天气然后立即执行。2026-03-17 15:06:44.196 | INFO | nanobot.agent.loop:_process_message:357 - Processing message from cli:user: 上海今天天气 2026-03-17 15:14:27.222 | INFO | nanobot.agent.loop:_run_agent_loop:230 - Tool call: list_dir({path: /Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/weather}) 2026-03-17 15:18:53.296 | INFO | nanobot.agent.loop:_run_agent_loop:230 - Tool call: read_file({path: /Users/chaoxu.ren/PycharmProjects/nanobot/nanobot/skills/weather/SKILL.md}) 2026-03-17 15:22:42.715 | INFO | nanobot.agent.loop:_run_agent_loop:230 - Tool call: exec({command: curl -s \wttr.in/Shanghai?format3\}) 2026-03-17 15:27:02.195 | INFO | nanobot.agent.loop:_run_agent_loop:230 - Tool call: exec({command: curl -s \https://api.open-meteo.com/v1/forecast?latitude31.23longitude121.47current_weathertrue\}) 2026-03-17 15:36:59.862 | INFO | nanobot.agent.loop:_process_message:449 - Response to cli:user: 上海今天的天气目前气温约为 10.6°C天气状况显示为小雨WMO 代码 61。风速约为 10.8 km/h。3. 技能的“门槛”依赖检查有些技能需要特定的环境比如github技能需要安装gh命令行工具。nanobot 在元数据中定义了这些依赖# SKILL.md 顶部 metadata: {nanobot:{requires:{bins:[curl]}}}SkillsLoader会在加载前自动检查系统路径中是否存在curl。如果不存在这个技能就会被标记为“不可用”并告诉 AI 缺少什么。这种自愈式的设计大大降低了配置出错的概率。当然有些 agent 可以自己执行命令去下载对应的依赖。4. skills的这种设计真的很高级极低的学习成本任何会写 Markdown 和简单脚本的人都能为 nanobot 开发新技能。极致的灵活性你可以随时在~/.nanobot/workspace/skills下新建一个文件夹丢进一个SKILL.mdAgent 瞬间就获得了新能力无需重启。跨语言能力因为技能本质上是教 AI 运行命令所以你可以教它运行 Python、Node.js、Go 甚至一段复杂的 Shell 脚本。5. 开发者视角如何创造一个新技能如果你想让 nanobot 学会某个新本事只需三步在skills目录下建个文件夹。写个SKILL.md顶部写好name和description。在正文中用 Markdown 告诉 AI 怎么操作最好带上代码示例。⚠️ 可以使用 skill-creator这种skill帮助写新skill**6. 获取和分享技能Skills 社区与资源如果你不想从零开始写也可以直接从社区获取现成的技能或者寻找灵感ClawHub这是主要的公开 Agent 技能注册中心Registry。它支持自然语言搜索可以让你非常轻松地为你的 Agent 找到并安装各种实用工具。SkillsMP这是一个技能市场平台提供了丰富的技能供用户选择和使用。GitHubGitHub 上有很多开源的技能项目你可以根据自己的需求进行选择和使用。总结nanobot 的 Skills 系统再次体现了其“以文档为中心”的设计哲学。它充分信任大模型的理解能力将复杂的逻辑抽象为简单的文档阅读与命令执行。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询