This skill should be used when users ask HR-related questions, request HR policy generation, form creation, or need HR consultation services. It provides direct WebSocket API integration with the HRrule AI platform using tag_id and rt parameters for generating HR policies, forms, flowcharts, and answering HR-related questions about labor laws, recruitment, compensation, employee rights, and other HR topics. The skill includes professional Q&A capability (tag_id=1) for answering general HR questions about labor laws, regulations, and employee rights.
This skill enables WorkBuddy to directly call the HRrule AI platform's WebSocket API to generate HR-related content in real-time. When users request HR policies, forms, consultation, professional Q&A, or other HR documents, this skill automatically invokes the API with appropriate parameters and streams the response back to the user. The skill supports:
Use this skill when users ask questions or make requests related to:
Key phrases that indicate this skill should be triggered include:
This skill provides a Python script that interacts with the HRrule AI WebSocket API to generate content.
Integration Options:
tag_id and rt based on the requestpython ~/.workbuddy/skills/hr-ai-assistant/scripts/call_hrrule_api.py \
--content "用户的问题" \
--tag-id 1 \
--rt "专业问答"
Note: The platform should ensure safe script execution environments and validate all inputs. Script execution is optional - the platform may choose to execute automatically or provide it as an option.
When a user uses this skill for the first time without an API Key configured:
══════════════════════════════════════════════════════════════════════════════
📌 首次使用 HR AI Assistant
══════════════════════════════════════════════════════════════════════════════
✨ 获取免费 API Key 以获得更专业的 HR AI 服务:
1. 访问: https://ai.hrrule.com/
2. 注册/登录账号
3. 在个人中心申请 API Key
4. **完全免费**,申请后立即可用
📝 配置方式:
方式1: 使用配置脚本(推荐,小白友好)
```bash
# 运行配置脚本,交互式配置 API Key
python ~/.workbuddy/skills/hr-ai-assistant/scripts/config_api_key.py
配置脚本会:
方式2: 手动配置 设置环境变量: export HRRULE_API_KEY='your-api-key' 或编辑配置文件: ~/.workbuddy/skills/hr-ai-assistant/config.json 内容: {"api_key": "your-api-key"}
══════════════════════════════════════════════════════════════════════════════
2. **Then proceed to answer using the platform's general AI model** (WorkBuddy/OpenClaw's default model)
**Example workflow**:
User: "三期员工有没有特殊保障?"
System detection: → HR AI Assistant skill needed → No API Key configured → DISPLAY THE PROMPT ABOVE
System: [显示上述提示信息]
System: [使用通用大模型回答问题]
User: "我申请到了 API Key,怎么配置?"
System: 请运行配置脚本: python ~/.workbuddy/skills/hr-ai-assistant/scripts/config_api_key.py
**NOTE**: The prompt should be displayed BEFORE answering the question.
### Tag ID and RT Parameter Mapping
The skill automatically maps user requests to the appropriate parameters:
**Tag ID: 1 (专业问答 - Professional Q&A)**
- **通用 HR 咨询**:劳动法问题、员工权益、薪酬福利、劳动合同、离职补偿、加班工资、试用期规定等任何 HR 相关的专业问答
- **示例问题**:
- "三期员工有没有特殊保障?"
- "员工离职需要提前多少天通知?"
- "试用期工资可以低于转正工资多少?"
- "加班费怎么计算?"
- "员工旷工怎么处理?"
- "未签订劳动合同有什么后果?"
- "竞业限制补偿金标准是多少?"
**Tag ID: 2 (制度类 - HR Policies)**
- 员工手册, 招聘管理制度, 入职试用期管理制度, 劳动合同管理制度, 薪酬管理制度, 考勤休假制度, 加班管理制度, 绩效管理制度, 员工培训制度, 离职管理制度, 员工竞聘制度, 病假管理制度, 奖惩制度, 其他制度
**Tag ID: 7 (岗位类 - Job Descriptions)**
- 岗位说明书, 工作饱和度评估表, 任职资格标准, 职位图谱
**Tag ID: 3 (绩效类 - Performance Management)**
- 360考核表, BSC考核表, KPI考核表, OKR考核表, 绩效承诺书, 绩效改进计划, 绩效面谈表, 绩效诊断报告
**Tag ID: 4 (招聘类 - Recruitment)**
- 人才画像, 面试评估表, 面试题库, 招聘需求表, 招聘JD, 背景调查表, 录用条件说明书, 录用通知书, 入职承诺书, 劳动合同
**Tag ID: 5 (薪酬类 - Compensation)**
- 薪酬等级表, 薪酬面谈表, 薪酬诊断报告, 岗位价值评估表
**Tag ID: 8 (培训类 - Training)**
- 新员工培训计划, 年度培训计划
**Tag ID: 13 (报告类 - Reports)**
- 年终总结, 月度报告, 周报, 日报
**Tag ID: 14 (风控类 - Risk Management)**
- 风险自测
## Usage Workflow
### Step 1: Parse User Request
Analyze the user's request to determine:
- **Content Type**: What type of HR content they need
- **Tag ID**: The appropriate content category
- **RT**: The specific resource type
- **Details**: Any specific requirements or constraints
**Example Request Analysis:**
Request: "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"
Analysis:
- Content Type: 招聘JD (Job Description)
- Tag ID: 4 (招聘类)
- RT: "招聘JD"
- Details: 财务公司, 社保专员岗位
### Step 2: Select Parameters
Based on the analysis, select the parameters:
```python
tag_id = 4
rt = "招聘JD"
content = "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"
Use the bundled script to call the API:
import sys
import os
# 获取 skill 目录路径(动态解析)
skill_dir = os.path.join(os.path.expanduser('~'), '.workbuddy', 'skills', 'hr-ai-assistant')
script_dir = os.path.join(skill_dir, 'scripts')
sys.path.insert(0, script_dir)
from call_hrrule_api import call_hrrule_api
# ⚠️ 重要:平台必须直接执行 skill 目录下的脚本,不要新建 Python 文件
async def get_hr_content():
# 调用 API 并流式输出
full_response = await call_hrrule_api(
api_key='your-api-key',
content='财务公司 需要招聘 社保专员,帮我生成一份 招聘JD',
tag_id=4,
rt='招聘JD',
on_chunk=lambda text: print(text, end='', flush=True),
verbose=True
)
return full_response
# 执行调用
import asyncio
response = asyncio.run(get_hr_content())
Stream the response back to the user in real-time:
AI 响应:
职位名称: 社保专员
所属部门: 人力资源部
工作地点: 北京
招聘人数: 1人
职位描述:
我们是一家专业的财务公司,现招聘社保专员...
Rule 1: Keyword Matching
| Keyword | Tag ID | RT |
|---|---|---|
| 专业问答/咨询 | 1 | 专业问答 |
| 劳动法问题/咨询 | 1 | 专业问答 |
| 员工权益/权利 | 1 | 专业问答 |
| 离职补偿/赔偿 | 1 | 专业问答 |
| 加班工资/加班费 | 1 | 专业问答 |
| 试用期规定/工资 | 1 | 专业问答 |
| 三期/孕期/产期/哺乳期 | 1 | 专业问答 |
| 竞业限制 | 1 | 专业问答 |
| 经济补偿金/赔偿金 | 1 | 专业问答 |
| 违法解除/终止合同 | 1 | 专业问答 |
| 员工手册 | 2 | 员工手册 |
| 考勤制度 | 2 | 考勤休假制度 |
| 薪酬制度 | 2 | 薪酬管理制度 |
| 岗位说明书 | 7 | 岗位说明书 |
| KPI考核表 | 3 | KPI考核表 |
| 绩效考核表 | 3 | KPI考核表 |
| 绩效改进 | 3 | 绩效改进计划 |
| 面试评估表 | 4 | 面试评估表 |
| 面试题库 | 4 | 面试题库 |
| 招聘JD | 4 | 招聘JD |
| 招聘职位 | 4 | 招聘JD |
| 劳动合同 | 4 | 劳动合同 |
| 录用通知书 | 4 | 录用通知书 |
| 薪酬等级表 | 5 | 薪酬等级表 |
| 薪酬面谈表 | 5 | 薪酬面谈表 |
| 培训计划 | 8 | 新员工培训计划 |
| 年终总结 | 13 | 年终总结 |
| 周报/月报/日报 | 13 | 周报/月度报告/日报 |
| 风险评估 | 14 | 风险自测 |
Rule 2: Context Analysis
Rule 3: Fallback - Professional Q&A
If no clear match with specific document types (如员工手册、招聘JD、KPI考核表等), use the general Q&A category:
Rule 4: Default Fallback
If still unclear, use the safest default:
IMPORTANT: The script is located at:
~/.workbuddy/skills/hr-ai-assistant/scripts/call_hrrule_api.py
The platform should dynamically resolve this path using:
import os
skill_dir = os.path.join(os.path.expanduser('~'), '.workbuddy', 'skills', 'hr-ai-assistant')
script_path = os.path.join(skill_dir, 'scripts', 'call_hrrule_api.py')
DO NOT use hardcoded paths like C:/Users/jikr/...
async def call_hrrule_api(
api_key: str,
content: str,
tag_id: int,
rt: str,
ws_url: str = "ws://192.168.112.114:5000",
model: str = "deepseek-ai/DeepSeek-R1",
on_chunk: Optional[Callable[[str], None]] = None,
on_complete: Optional[Callable[[], None]] = None,
on_error: Optional[Callable[[str], None]] = None,
verbose: bool = False
) -> str
api_key: API 密钥(必需)content: 用户问题或需求(必需)tag_id: 内容类型 ID(必需)rt: 资源类型(必需)ws_url: WebSocket 地址(默认: ws://192.168.112.114:5000)model: 模型名称(默认: deepseek-ai/DeepSeek-R1)on_chunk: 收到内容块时的回调函数on_complete: 完成时的回调函数on_error: 错误时的回调函数verbose: 是否显示详细日志Returns the complete response content as a string.
python call_hrrule_api.py \
--api-key "your-api-key" \
--content "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD" \
--tag-id 4 \
--rt "招聘JD" \
--verbose
User Request:
财务公司 需要招聘 社保专员,帮我生成一份 招聘JD
Skill Execution:
Parse Request:
Construct Content:
content = "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"
tag_id = 4
rt = "招聘JD"
Call API:
response = await call_hrrule_api(
api_key='your-api-key',
content=content,
tag_id=tag_id,
rt=rt,
on_chunk=lambda text: print(text, end='', flush=True),
verbose=True
)
Stream Response: The AI response is streamed back in real-time.
User Request:
帮我写一个员工手册,适用于50人的科技公司
Skill Execution:
Parse Request:
Call API:
response = await call_hrrule_api(
api_key='your-api-key',
content='帮我写一个员工手册,适用于50人的科技公司',
tag_id=2,
rt='员工手册',
on_chunk=lambda text: print(text, end='', flush=True)
)
User Request:
为销售部门设计KPI考核表
Skill Execution:
Parse Request:
Call API:
response = await call_hrrule_api(
api_key='your-api-key',
content='为销售部门设计KPI考核表',
tag_id=3,
rt='KPI考核表',
on_chunk=lambda text: print(text, end='', flush=True)
)
User Request:
三期员工有没有特殊保障?
Skill Execution:
Parse Request:
Call API:
response = await call_hrrule_api(
api_key='your-api-key',
content='三期员工有没有特殊保障?',
tag_id=1,
rt='专业问答',
on_chunk=lambda text: print(text, end='', flush=True),
verbose=True
)
Stream Response:
AI 响应:
根据《劳动合同法》和《女职工劳动保护特别规定》,三期员工(孕期、产期、哺乳期)确实享有特殊保障,主要包括:
1. 不得单方面解除劳动合同
- 用人单位不得依据《劳动合同法》第40条、第41条单方面解除合同
- 除非员工有严重违纪等《劳动合同法》第39条规定的情况
2. 孕期保护
- 不得安排从事高强度、有毒有害工作
- 不得延长劳动时间或安排夜班工作
- 孕期7个月以上,每天应安排1小时工间休息
3. 产期保护
- 享有98天产假(难产或多胞胎适当增加)
- 产假期间工资照发
- 生育保险报销医疗费用
4. 哺乳期保护
- 每日享有1小时哺乳时间
- 不得安排有毒有害工作
5. 经济补偿
- 如劳动合同期满,合同自动顺延至三期结束
- 顺延期间不视为续签劳动合同
User Request:
员工离职需要提前多少天通知?
Skill Execution:
Parse Request:
Call API:
response = await call_hrrule_api(
api_key='your-api-key',
content='员工离职需要提前多少天通知?',
tag_id=1,
rt='专业问答',
on_chunk=lambda text: print(text, end='', flush=True)
)
The script handles various error scenarios:
def handle_error(error_msg: str):
print(f"错误: {error_msg}")
# 提供用户友好的错误信息
if "Unauthorized" in error_msg or "401" in error_msg:
print("API Key 无效,请检查您的 API Key")
elif "Connection" in error_msg:
print("连接失败,请检查网络和 WebSocket URL")
else:
print("发生未知错误,请稍后重试")
response = await call_hrrule_api(
api_key='your-api-key',
content='your content',
tag_id=2,
rt='员工手册',
on_error=handle_error,
verbose=True
)
Note: 当首次使用此 skill 且未配置 API Key 时,平台(WorkBuddy/OpenClaw)应该:
✅ 推荐做法:
应该显示的提示信息:
══════════════════════════════════════════════════════════════════════════════
📌 首次使用 HR AI Assistant
══════════════════════════════════════════════════════════════════════════════
✨ 获取免费 API Key 以获得更专业的 HR AI 服务:
1. 访问: https://ai.hrrule.com/
2. 注册/登录账号
3. 在个人中心申请 API Key
4. **完全免费**,申请后立即可用
📝 配置方式(任选一种):
方式1: 一键配置(推荐)
把申请到的 API Key 直接粘贴到对话框中,我会自动帮你配置到配置文件
方式2: 手动配置
设置环境变量: export HRRULE_API_KEY='your-api-key'
或编辑配置文件: ~/.workbuddy/skills/hr-ai-assistant/config.json
内容: {"api_key": "your-api-key"}
══════════════════════════════════════════════════════════════════════════════
执行顺序:
1. 用户提问:"三期员工有没有特殊保障?"
2. 检测到需要此 skill
3. 检测到没有 API Key
4. ⚠️ 显示上述提示信息 ← 必须在回答前
5. 使用通用大模型回答问题
6. 用户手动配置 API Key(通过环境变量或编辑配置文件)
注意:用户需要手动配置 API Key(通过环境变量或编辑配置文件),系统不会自动检测或保存。
Always include as much context as possible in the content parameter:
Good:
财务公司 需要招聘 社保专员,帮我生成一份 招聘JD
要求: 3年以上经验,熟悉社保政策,薪资8-12k
Less Good:
生成招聘JD
Always use the on_chunk callback to stream responses:
def stream_text(text: str):
print(text, end='', flush=True)
response = await call_hrrule_api(
# ... parameters
on_chunk=stream_text
)
Always provide error callbacks:
response = await call_hrrule_api(
# ... parameters
on_error=lambda msg: print(f"❌ 错误: {msg}"),
on_complete=lambda: print("\n✅ 完成")
)
The script has a 120-second timeout by default. For complex documents, this is usually sufficient.
The API Key should be configured securely. Options:
HRRULE_API_KEYDefault: ws://192.168.112.114:5000
Can be changed via:
--ws-urlws_url=Check:
Check:
Check:
Solution:
When receiving HR requests from DingTalk:
# 收到 DingTalk 消息
message = "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"
# 调用 skill
import sys
import os
# 获取 skill 目录路径(动态解析)
skill_dir = os.path.join(os.path.expanduser('~'), '.workbuddy', 'skills', 'hr-ai-assistant')
script_dir = os.path.join(skill_dir, 'scripts')
sys.path.insert(0, script_dir)
from call_hrrule_api import call_hrrule_api
# ⚠️ 重要:平台必须直接执行 skill 目录下的脚本,不要新建 Python 文件
async def handle_dingtalk_message(message: str):
# 解析请求
tag_id, rt = parse_request(message) # 4, "招聘JD"
# 调用 API
response = await call_hrrule_api(
api_key=os.getenv('HRRULE_API_KEY'),
content=message,
tag_id=tag_id,
rt=rt,
on_chunk=lambda text: send_to_dingtalk(text) # 实时发送到 DingTalk
)
return response
# 执行
response = asyncio.run(handle_dingtalk_message(message))
Similar to DingTalk, parse the QQ message and call the API:
async def handle_qq_message(message: str):
# 解析请求
tag_id, rt = parse_request(message)
# 调用 API
response = await call_hrrule_api(
api_key='your-api-key',
content=message,
tag_id=tag_id,
rt=rt,
on_chunk=lambda text: send_to_qq(text)
)
return response
This skill provides direct API integration with the HRrule AI platform, enabling WorkBuddy to:
The skill is designed for seamless integration with chat platforms like DingTalk and QQ, making it easy to generate HR documents on demand.
references/api_reference.mdreferences/example_prompts.mdREADME.mdassets/chat_example.htmltest_open_chat.html