乐于分享
好东西不私藏

五个最适合新手的 OpenClaw Skills 示例

五个最适合新手的 OpenClaw Skills 示例

五个最适合新手的OpenClaw Skills 示例

欢迎来到技术小课堂,每天分享一个技术小知识。

入门就用这五个,保证你立刻上手!

OpenClaw 的强大离不开 Skills(技能)但新手最怕——不会写、不知道从哪开始、写了也不知道能干嘛。

别急。下面这5 个 Skill是最适合新手的:

·好写

·好用

·不容易出错

·实战价值高

学会它们,你就能做一半OpenClaw 能做的事。


1. 读取文件 Skill(read_file)

超适合新手,也最常用。一句话就能让Agent 访问真实文件。

skill 文件(read_file.json)

{

“name”: “read_file”,

“description”: “读取本地文件内容”,

“function”: {

“name”: “read_file”,

“description”: “读取文本文件内容”,

“parameters”: {

“type”: “object”,

“properties”: {

“path”: { “type”: “string” }

},

“required”: [“path”]

}

},

“handler”: “read_file.py”

}

handler(read_file.py)

def read_file(path):

with open(path, “r”, encoding=”utf-8″) as f:

return f.read()

用一句话就能触发:

“帮我读一下 test.txt”


2. 运行 Python Skill(run_python)

Agent 帮你写代码、跑代码、返回结果。 非常香!

skill(run_python.json)

{

“name”: “run_python”,

“description”: “执行Python代码”,

“function”: {

“name”: “run”,

“parameters”: {

“type”: “object”,

“properties”: {

“code”: { “type”: “string” }

},

“required”: [“code”]

}

},

“handler”: “run_python.py”

}

handler(run_python.py)

def run(code):

exec_globals = {}

exec(code, exec_globals)

return exec_globals.get(“result”, “代码已执行,没有返回 result 变量”)

你就可以说:

“写一个计算 1+2+3 的 Python,并执行。”


3. 发送 HTTP 请求 Skill(http_request)

非常实用,可以让AI 接入真实 API。 拿来做自动化简直神器。

skill(http_request.json)

{

“name”: “http_request”,

“description”: “执行HTTP请求”,

“function”: {

“name”: “request”,

“parameters”: {

“type”: “object”,

“properties”: {

“url”: { “type”: “string” },

“method”: { “type”: “string”, “enum”: [“GET”, “POST”] },

“data”: { “type”: “object” }

},

“required”: [“url”, “method”]

}

},

“handler”: “http_request.py”

}

handler(http_request.py)

import requests

def request(url, method, data=None):

if method == “GET”:

return requests.get(url).text

return requests.post(url, json=data).text

一句话触发:

“帮我 GET 一下 https://www.landui.com


4. 运行 Shell 命令 Skill(run_shell)

系统运维、服务器巡检、日志检索都离不开它。

skill(run_shell.json)

{

“name”: “run_shell”,

“description”: “执行系统Shell命令”,

“function”: {

“name”: “shell”,

“parameters”: {

“type”: “object”,

“properties”: {

“cmd”: { “type”: “string” }

},

“required”: [“cmd”]

}

},

“handler”: “run_shell.py”

}

handler(run_shell.py)

import subprocess

def shell(cmd):

res = subprocess.run(cmd, capture_output=True, shell=True, text=True)

return res.stdout or res.stderr

你可以说:

“执行一下 ls -l给我看结果


5. 写入文件 Skill(write_file)

读文件+ 写文件 = 你就能做半个自动化系统了。

skill(write_file.json)

{

“name”: “write_file”,

“description”: “写入文本文件”,

“function”: {

“name”: “write”,

“parameters”: {

“type”: “object”,

“properties”: {

“path”: { “type”: “string” },

“content”: { “type”: “string” }

},

“required”: [“path”, “content”]

}

},

“handler”: “write_file.py”

}

handler(write_file.py)

def write(path, content):

with open(path, “w”, encoding=”utf-8″) as f:

f.write(content)

return “写入成功”

一句话触发:

“帮我把这段话写入 notes.txt。”

掌握这五个,你已经能构建:

·服务器巡检系统

·自动生成日报/周报

·自动数据分析脚本

·自动化API 调度

·文档处理助手

·小型RPA(机器人流程自动化)

入门即实战。