HR AI Assistant Skill
Purpose
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:
- 1. Document Generation: Creating HR policies, forms, job descriptions, performance reviews, etc.
- Professional Q&A: Answering HR-related questions about labor laws, employee rights, compensation, contracts, etc.
- Real-time Streaming: Providing immediate feedback with streaming responses
When to Use This Skill
Use this skill when users ask questions or make requests related to:
- - HR Policy Generation: Creating employee handbooks, attendance policies, leave policies, disciplinary procedures, compensation policies
- HR Form Creation: Generating onboarding forms, resignation forms, leave application forms, performance review forms
- HR Consultation: Asking questions about labor laws, employment contracts, recruitment processes, compensation and benefits
- HR Process Flowcharts: Creating visual representations of HR processes like recruitment workflows, onboarding processes
- HR Documentation: Writing reports, summaries, guidelines, and other HR-related documents
- Professional Q&A: Any HR-related questions requiring professional answers, such as labor law inquiries, employee rights, compensation, contract issues, leave policies, etc.
Key phrases that indicate this skill should be triggered include:
- - "帮我写一个员工手册"
- "生成HR制度"
- "制作入职表单"
- "HR相关问题"
- "劳动法咨询"
- "招聘流程"
- "薪酬制度"
- "离职手续"
- "考勤制度"
- "绩效考核"
- "员工福利"
- "劳动合同"
- "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"
- "三期员工有没有特殊保障?"
- "Generate HR policy"
- "Create HR form"
- "HR consultation"
- "Labor law questions"
How This Skill Works
Direct API Integration
This skill provides a Python script that interacts with the HRrule AI WebSocket API to generate content.
Integration Options:
- 1. Analyze User Request: Parse the user's HR request to identify the content type
- Check API Key: Verify API Key is configured (from env var or config.json)
-
If API Key is missing: Display a friendly prompt to visit https://ai.hrrule.com/ for a free API Key
-
If API Key is valid: Proceed with API call
- 3. Select Parameters: Automatically select appropriate
tag_id and rt based on the request - Call API: The platform may execute the Python script to make the API call:
python ~/.workbuddy/skills/hr-ai-assistant/scripts/call_hrrule_api.py \
--content "用户的问题" \
--tag-id 1 \
--rt "专业问答"
- 5. Stream Response: Stream the generated content back to the user in real-time
- Handle Errors: Gracefully handle connection errors, timeouts, and API errors
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.
⚠️ Important: First-Time User Experience (首次使用体验)
When a user uses this skill for the first time without an API Key configured:
- 1. Display Friendly Prompt:
CODEBLOCK1 bash
运行配置脚本,交互式配置 API Key
python ~/.workbuddy/skills/hr-ai-assistant/scripts/config
apikey.py
CODEBLOCK2
- 2. Then proceed to answer using the platform's general AI model (WorkBuddy/OpenClaw's default model)
Example workflow:
CODEBLOCK3
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:
CODEBLOCK4
Step 3: Call API Using Python Script
Use the bundled script to call the API:
CODEBLOCK5
Step 4: Stream Response to User
Stream the response back to the user in real-time:
CODEBLOCK6
Parameter Selection Logic
Automatic Mapping Rules
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
- - If user mentions "招聘" (recruitment) + specific document type → Tag ID: 4
- If user mentions "制度" (policy/system) → Tag ID: 2
- If user mentions "考核" (assessment) → Tag ID: 3
- If user mentions "培训" (training) → Tag ID: 8
- If user mentions "报告" (report) + time period → Tag ID: 13
- If user asks a question about labor laws, employee rights, compensation → Tag ID: 1 (专业问答)
- If user asks "有没有"、"如何"、"怎样"、"为什么"等疑问句 → Tag ID: 1 (专业问答)
Rule 3: Fallback - Professional Q&A
If no clear match with specific document types (如员工手册、招聘JD、KPI考核表等), use the general Q&A category:
- - Any HR-related question about laws, regulations, policies, employee rights → Tag ID: 1, RT: "专业问答"
- Example: "三期员工有没有特殊保障?", "员工离职需要提前多久通知?"
- Example: "试用期工资规定", "加班费计算方式"
Rule 4: Default Fallback
If still unclear, use the safest default:
- - HR policy/guidance → Tag ID: 2, RT: "其他制度"
- General HR question → Tag ID: 1, RT: "专业问答"
Script Usage
Script Location
IMPORTANT: The script is located at:
INLINECODE2
The platform should dynamically resolve this path using:
CODEBLOCK7
DO NOT use hardcoded paths like C:/Users/jikr/...
Function Signature
CODEBLOCK8
Parameters
- -
api_key: API 密钥(必需) - INLINECODE5 : 用户问题或需求(必需)
- INLINECODE6 : 内容类型 ID(必需)
- INLINECODE7 : 资源类型(必需)
- INLINECODE8 : WebSocket 地址(默认: ws://192.168.112.114:5000)
- INLINECODE9 : 模型名称(默认: deepseek-ai/DeepSeek-R1)
- INLINECODE10 : 收到内容块时的回调函数
- INLINECODE11 : 完成时的回调函数
- INLINECODE12 : 错误时的回调函数
- INLINECODE13 : 是否显示详细日志
Return Value
Returns the complete response content as a string.
Command Line Usage
CODEBLOCK9
Example Workflows
Example 1: Generate Job Description (JD)
User Request:
CODEBLOCK10
Skill Execution:
- 1. Parse Request:
- Identify: "招聘JD" → Tag ID: 4, RT: "招聘JD"
- Extract context: 财务公司, 社保专员
- 2. Construct Content:
CODEBLOCK11
- 3. Call API:
CODEBLOCK12
- 4. Stream Response:
The AI response is streamed back in real-time.
Example 2: Generate Employee Handbook
User Request:
CODEBLOCK13
Skill Execution:
- 1. Parse Request:
- Identify: "员工手册" → Tag ID: 2, RT: "员工手册"
- Extract context: 50人, 科技公司
- 2. Call API:
CODEBLOCK14
Example 3: Create Performance Review Form
User Request:
CODEBLOCK15
Skill Execution:
- 1. Parse Request:
- Identify: "KPI考核表" → Tag ID: 3, RT: "KPI考核表"
- Extract context: 销售部门
- 2. Call API:
CODEBLOCK16
Example 4: Professional Q&A (Labor Law Question)
User Request:
CODEBLOCK17
Skill Execution:
- 1. Parse Request:
- Identify: Question about labor law/employee rights → Tag ID: 1, RT: "专业问答"
- Extract context: 三期员工 (孕期、产期、哺乳期), 特殊保障
- 2. Call API:
CODEBLOCK18
- 3. Stream Response:
CODEBLOCK19
Example 5: General HR Consultation
User Request:
CODEBLOCK20
Skill Execution:
- 1. Parse Request:
- Identify: Question about resignation → Tag ID: 1, RT: "专业问答"
- Extract context: 员工离职, 提前通知时间
- 2. Call API:
CODEBLOCK21
Error Handling
The script handles various error scenarios:
Connection Errors
- - Invalid WebSocket URL
- Network connectivity issues
- Firewall blocking
Authentication Errors
- - Invalid API Key
- API Key expired
- Permission denied
API Errors
- - Invalid parameters
- Server errors
- Timeout (120 seconds)
Error Handling Example
CODEBLOCK22
Best Practices
1. First-Time User Experience (首次使用体验)
Note: 当首次使用此 skill 且未配置 API Key 时,平台(WorkBuddy/OpenClaw)应该:
✅ 推荐做法:
- 1. 检测到没有 API Key
- 先显示友好的提示信息(访问 https://ai.hrrule.com/ 免费申请)
- 然后使用平台的通用大模型回答问题
- 用户手动配置 API Key(通过环境变量、配置文件或配置脚本)
应该显示的提示信息:
CODEBLOCK23
执行顺序:
CODEBLOCK24
注意:用户需要手动配置 API Key(通过环境变量或编辑配置文件),系统不会自动检测或保存。
2. Provide Detailed Context
Always include as much context as possible in the content parameter:
- - Company size and industry
- Specific requirements
- Target audience
- Time constraints
Good:
CODEBLOCK25
Less Good:
CODEBLOCK26
2. Use Streaming for Better UX
Always use the on_chunk callback to stream responses:
CODEBLOCK27
3. Handle Errors Gracefully
Always provide error callbacks:
CODEBLOCK28
4. Set Appropriate Timeout
The script has a 120-second timeout by default. For complex documents, this is usually sufficient.
Configuration
API Key Configuration
The API Key should be configured securely. Options:
- 1. Environment variable: INLINECODE16
- Configuration file
- Direct parameter passing
WebSocket URL Configuration
Default: INLINECODE17
Can be changed via:
- - Command line: INLINECODE18
- Script parameter: INLINECODE19
- Configuration file
Troubleshooting
Issue: Connection Fails
Check:
- - WebSocket URL is correct
- Network connectivity
- Firewall settings
- Server is running
Issue: Authentication Error
Check:
- - API Key is valid
- API Key has not expired
- API Key has proper permissions
Issue: No Response
Check:
- - Content parameter is not empty
- Tag ID and RT are valid
- Network connection is stable
- Server is processing requests
Issue: Timeout
Solution:
- - Increase timeout in script
- Simplify the request
- Check server load
Integration Examples
DingTalk Integration
When receiving HR requests from DingTalk:
CODEBLOCK29
QQ Integration
Similar to DingTalk, parse the QQ message and call the API:
CODEBLOCK30
Summary
This skill provides direct API integration with the HRrule AI platform, enabling WorkBuddy to:
- - Automatically parse HR requests
- Select appropriate parameters (tag_id, rt)
- Call WebSocket API in real-time
- Stream responses back to users
- Handle errors gracefully
The skill is designed for seamless integration with chat platforms like DingTalk and QQ, making it easy to generate HR documents on demand.
Reference Materials
- - API Reference: INLINECODE20
- Example Prompts: INLINECODE21
- Usage Guide: INLINECODE22
- Test Page: INLINECODE23
- Original Test: INLINECODE24
HR AI 助手技能
目的
此技能使 WorkBuddy 能够直接调用 HRrule AI 平台的 WebSocket API,实时生成 HR 相关内容。当用户请求 HR 政策、表单、咨询、专业问答或其他 HR 文档时,此技能会自动使用适当的参数调用 API,并将响应流式返回给用户。该技能支持:
- 1. 文档生成:创建 HR 政策、表单、职位描述、绩效评估等。
- 专业问答:回答与劳动法、员工权益、薪酬、合同等相关的 HR 问题。
- 实时流式传输:通过流式响应提供即时反馈。
何时使用此技能
当用户提出与以下内容相关的问题或请求时,使用此技能:
- - HR 政策生成:创建员工手册、考勤政策、休假政策、纪律处分程序、薪酬政策。
- HR 表单创建:生成入职表单、离职表单、请假申请表、绩效评估表。
- HR 咨询:询问有关劳动法、雇佣合同、招聘流程、薪酬福利的问题。
- HR 流程图:创建 HR 流程的可视化表示,如招聘工作流程、入职流程。
- HR 文档:撰写报告、摘要、指南和其他 HR 相关文档。
- 专业问答:任何需要专业回答的 HR 相关问题,例如劳动法咨询、员工权利、薪酬、合同问题、休假政策等。
表明应触发此技能的关键短语包括:
- - 帮我写一个员工手册
- 生成HR制度
- 制作入职表单
- HR相关问题
- 劳动法咨询
- 招聘流程
- 薪酬制度
- 离职手续
- 考勤制度
- 绩效考核
- 员工福利
- 劳动合同
- 财务公司 需要招聘 社保专员,帮我生成一份 招聘JD
- 三期员工有没有特殊保障?
- Generate HR policy
- Create HR form
- HR consultation
- Labor law questions
此技能的工作原理
直接 API 集成
此技能提供了一个与 HRrule AI WebSocket API 交互以生成内容的 Python 脚本。
集成选项:
- 1. 分析用户请求:解析用户的 HR 请求以识别内容类型。
- 检查 API 密钥:验证 API 密钥是否已配置(来自环境变量或 config.json)。
-
如果缺少 API 密钥:显示友好的提示,引导用户访问 https://ai.hrrule.com/ 获取免费的 API 密钥。
-
如果 API 密钥有效:继续调用 API。
- 3. 选择参数:根据请求自动选择合适的 tag_id 和 rt。
- 调用 API:平台可以执行 Python 脚本进行 API 调用:
bash
python ~/.workbuddy/skills/hr-ai-assistant/scripts/call
hrruleapi.py \
--content 用户的问题 \
--tag-id 1 \
--rt 专业问答
- 5. 流式响应:将生成的内容实时流式返回给用户。
- 处理错误:优雅地处理连接错误、超时和 API 错误。
注意:平台应确保安全的脚本执行环境并验证所有输入。
脚本执行是可选的——平台可以选择自动执行或将其作为选项提供。
⚠️ 重要:首次使用体验
当用户首次使用此技能且未配置 API 密钥时:
- 1. 显示友好提示:
══════════════════════════════════════════════════════════════════════════════
📌 首次使用 HR AI Assistant
══════════════════════════════════════════════════════════════════════════════
✨ 获取免费 API Key 以获得更专业的 HR AI 服务:
- 1. 访问: https://ai.hrrule.com/
- 注册/登录账号
- 在个人中心申请 API Key
- 完全免费,申请后立即可用
📝 配置方式:
方式1: 使用配置脚本(推荐,小白友好)
bash
运行配置脚本,交互式配置 API Key
python ~/.workbuddy/skills/hr-ai-assistant/scripts/config
apikey.py
配置脚本会:
- - 自动检测 API Key 格式
- 支持粘贴完整文本(会自动提取)
- 保存到配置文件
- 显示当前配置状态
方式2: 手动配置
设置环境变量: export HRRULEAPIKEY=your-api-key
或编辑配置文件: ~/.workbuddy/skills/hr-ai-assistant/config.json
内容: {api_key: your-api-key}
══════════════════════════════════════════════════════════════════════════════
- 2. 然后使用平台的通用 AI 模型进行回答(WorkBuddy/OpenClaw 的默认模型)
示例工作流程:
用户: 三期员工有没有特殊保障?
系统检测:
→ 需要 HR AI Assistant 技能
→ 未配置 API Key
→ 显示上述提示信息
系统: [显示上述提示信息]
系统: [使用通用大模型回答问题]
用户: 我申请到了 API Key,怎么配置?
系统: 请运行配置脚本:
python ~/.workbuddy/skills/hr-ai-assistant/scripts/configapikey.py
注意:提示信息应在回答问题之前显示。
标签 ID 和 RT 参数映射
技能会自动将用户请求映射到适当的参数:
标签 ID: 1 (专业问答)
- - 通用 HR 咨询:劳动法问题、员工权益、薪酬福利、劳动合同、离职补偿、加班工资、试用期规定等任何 HR 相关的专业问答。
- 示例问题:
- 三期员工有没有特殊保障?
- 员工离职需要提前多少天通知?
- 试用期工资可以低于转正工资多少?
- 加班费怎么计算?
- 员工旷工怎么处理?
- 未签订劳动合同有什么后果?
- 竞业限制补偿金标准是多少?
标签 ID: 2 (制度类)
- - 员工手册, 招聘管理制度, 入职试用期管理制度, 劳动合同管理制度, 薪酬管理制度, 考勤休假制度, 加班管理制度, 绩效管理制度, 员工培训制度, 离职管理制度, 员工竞聘制度, 病假管理制度, 奖惩制度, 其他制度。
标签 ID: 7 (岗位类)
- - 岗位说明书, 工作饱和度评估表, 任职资格标准, 职位图谱。
标签 ID: 3 (绩效类)
- - 360考核表, BSC考核表, KPI考核表, OKR考核表, 绩效承诺书, 绩效改进计划, 绩效面谈表, 绩效诊断报告。
标签 ID: 4 (招聘类)
- - 人才画像, 面试评估表, 面试题库, 招聘需求表, 招聘JD, 背景调查表, 录用条件说明书, 录用通知书, 入职承诺书, 劳动合同。
标签 ID: 5 (薪酬类)
- - 薪酬等级表, 薪酬面谈表, 薪酬诊断报告, 岗位价值评估表。
标签 ID: 8 (培训类)
标签 ID: 13 (报告类)
标签 ID: 14 (风控类)
使用工作流程
步骤 1:解析用户请求
分析用户的请求以确定:
- - 内容类型:他们需要什么类型的 HR 内容。
- 标签 ID:适当的内容类别。
- RT:特定的资源类型。
- 详细信息:任何特定的要求或约束。
示例请求分析:
请求:财务公司 需要招聘 社保专员,帮我生成一份 招聘JD
分析:
- - 内容类型:招聘JD (职位描述)
- 标签 ID:4 (招聘类)
- RT:招聘JD
- 详细信息:财务公司, 社保专员岗位
步骤 2:选择参数
根据分析,选择参数:
python
tag_id = 4
rt = 招聘JD
content = 财务公司 需要招聘 社保专员,帮我生成一份 招聘JD
步骤 3:使用 Python 脚本调用 API
使用捆绑的脚本调用 API:
python
import sys
import os
获取 skill 目录路径(动态解析)
skill_dir = os.path.join(os.path.expanduser(~), .workbuddy, skills, hr-ai-assistant)
script
dir = os.path.join(skilldir, scripts)
sys.path.insert(0, script_dir)
from callhrruleapi import callhrruleapi
⚠️ 重要:平台必须直接执行 skill 目录下的脚本,不要新建 Python 文件
async def gethrcontent():
# 调用 API 并流式输出
fullresponse = await callhrrule_api(
api_key=your-api-key,
content=财务公司 需要招聘 社保专员,