/install hr-ai-assistant
\r \r
HR AI Assistant Skill\r
\r
Purpose\r
\r 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:\r \r
- Document Generation: Creating HR policies, forms, job descriptions, performance reviews, etc.\r
- Professional Q&A: Answering HR-related questions about labor laws, employee rights, compensation, contracts, etc.\r
- Real-time Streaming: Providing immediate feedback with streaming responses\r \r
When to Use This Skill\r
\r Use this skill when users ask questions or make requests related to:\r \r
- HR Policy Generation: Creating employee handbooks, attendance policies, leave policies, disciplinary procedures, compensation policies\r
- HR Form Creation: Generating onboarding forms, resignation forms, leave application forms, performance review forms\r
- HR Consultation: Asking questions about labor laws, employment contracts, recruitment processes, compensation and benefits\r
- HR Process Flowcharts: Creating visual representations of HR processes like recruitment workflows, onboarding processes\r
- HR Documentation: Writing reports, summaries, guidelines, and other HR-related documents\r
- Professional Q&A: Any HR-related questions requiring professional answers, such as labor law inquiries, employee rights, compensation, contract issues, leave policies, etc.\r \r Key phrases that indicate this skill should be triggered include:\r
- "帮我写一个员工手册"\r
- "生成HR制度"\r
- "制作入职表单"\r
- "HR相关问题"\r
- "劳动法咨询"\r
- "招聘流程"\r
- "薪酬制度"\r
- "离职手续"\r
- "考勤制度"\r
- "绩效考核"\r
- "员工福利"\r
- "劳动合同"\r
- "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"\r
- "三期员工有没有特殊保障?"\r
- "Generate HR policy"\r
- "Create HR form"\r
- "HR consultation"\r
- "Labor law questions"\r \r
How This Skill Works\r
\r \r
Direct API Integration\r
\r This skill provides a Python script that interacts with the HRrule AI WebSocket API to generate content.\r \r Integration Options:\r \r
- Analyze User Request: Parse the user's HR request to identify the content type\r
- Check API Key: Verify API Key is configured (from env var or config.json)\r
- If API Key is missing: Display a friendly prompt to visit https://ai.hrrule.com/ for a free API Key\r
- If API Key is valid: Proceed with API call\r
- Select Parameters: Automatically select appropriate
tag_idandrtbased on the request\r - Call API: The platform may execute the Python script to make the API call:\r
python ~/.workbuddy/skills/hr-ai-assistant/scripts/call_hrrule_api.py \\r --content "用户的问题" \\r --tag-id 1 \\r --rt "专业问答"\r ```\r - Stream Response: Stream the generated content back to the user in real-time\r
- Handle Errors: Gracefully handle connection errors, timeouts, and API errors\r \r Note: The platform should ensure safe script execution environments and validate all inputs.\r Script execution is optional - the platform may choose to execute automatically or provide it as an option.\r \r
⚠️ Important: First-Time User Experience (首次使用体验)\r
\r When a user uses this skill for the first time without an API Key configured:\r \r
- Display Friendly Prompt:\r \r
══════════════════════════════════════════════════════════════════════════════\r
📌 首次使用 HR AI Assistant\r
══════════════════════════════════════════════════════════════════════════════\r
\r
✨ 获取免费 API Key 以获得更专业的 HR AI 服务:\r
\r
1. 访问: https://ai.hrrule.com/\r
2. 注册/登录账号\r
3. 在个人中心申请 API Key\r
4. **完全免费**,申请后立即可用\r
\r
📝 配置方式:\r
\r
方式1: 使用配置脚本(推荐,小白友好)\r
```bash\r
# 运行配置脚本,交互式配置 API Key\r
python ~/.workbuddy/skills/hr-ai-assistant/scripts/config_api_key.py\r
```\r
\r
配置脚本会:\r
- 自动检测 API Key 格式\r
- 支持粘贴完整文本(会自动提取)\r
- 保存到配置文件\r
- 显示当前配置状态\r
\r
方式2: 手动配置\r
设置环境变量: export HRRULE_API_KEY='your-api-key'\r
或编辑配置文件: ~/.workbuddy/skills/hr-ai-assistant/config.json\r
内容: {"api_key": "your-api-key"}\r
\r
══════════════════════════════════════════════════════════════════════════════\r
```\r
\r
2. **Then proceed to answer using the platform's general AI model** (WorkBuddy/OpenClaw's default model)\r
\r
**Example workflow**:\r
```\r
User: "三期员工有没有特殊保障?"\r
\r
System detection:\r
→ HR AI Assistant skill needed\r
→ No API Key configured\r
→ DISPLAY THE PROMPT ABOVE\r
\r
System: [显示上述提示信息]\r
\r
System: [使用通用大模型回答问题]\r
\r
User: "我申请到了 API Key,怎么配置?"\r
\r
System: 请运行配置脚本:\r
python ~/.workbuddy/skills/hr-ai-assistant/scripts/config_api_key.py\r
```\r
\r
**NOTE**: The prompt should be displayed BEFORE answering the question.\r
\r
### Tag ID and RT Parameter Mapping\r
\r
The skill automatically maps user requests to the appropriate parameters:\r
\r
**Tag ID: 1 (专业问答 - Professional Q&A)**\r
- **通用 HR 咨询**:劳动法问题、员工权益、薪酬福利、劳动合同、离职补偿、加班工资、试用期规定等任何 HR 相关的专业问答\r
- **示例问题**:\r
- "三期员工有没有特殊保障?"\r
- "员工离职需要提前多少天通知?"\r
- "试用期工资可以低于转正工资多少?"\r
- "加班费怎么计算?"\r
- "员工旷工怎么处理?"\r
- "未签订劳动合同有什么后果?"\r
- "竞业限制补偿金标准是多少?"\r
\r
**Tag ID: 2 (制度类 - HR Policies)**\r
- 员工手册, 招聘管理制度, 入职试用期管理制度, 劳动合同管理制度, 薪酬管理制度, 考勤休假制度, 加班管理制度, 绩效管理制度, 员工培训制度, 离职管理制度, 员工竞聘制度, 病假管理制度, 奖惩制度, 其他制度\r
\r
**Tag ID: 7 (岗位类 - Job Descriptions)**\r
- 岗位说明书, 工作饱和度评估表, 任职资格标准, 职位图谱\r
\r
**Tag ID: 3 (绩效类 - Performance Management)**\r
- 360考核表, BSC考核表, KPI考核表, OKR考核表, 绩效承诺书, 绩效改进计划, 绩效面谈表, 绩效诊断报告\r
\r
**Tag ID: 4 (招聘类 - Recruitment)**\r
- 人才画像, 面试评估表, 面试题库, 招聘需求表, 招聘JD, 背景调查表, 录用条件说明书, 录用通知书, 入职承诺书, 劳动合同\r
\r
**Tag ID: 5 (薪酬类 - Compensation)**\r
- 薪酬等级表, 薪酬面谈表, 薪酬诊断报告, 岗位价值评估表\r
\r
**Tag ID: 8 (培训类 - Training)**\r
- 新员工培训计划, 年度培训计划\r
\r
**Tag ID: 13 (报告类 - Reports)**\r
- 年终总结, 月度报告, 周报, 日报\r
\r
**Tag ID: 14 (风控类 - Risk Management)**\r
- 风险自测\r
\r
## Usage Workflow\r
\r
### Step 1: Parse User Request\r
\r
Analyze the user's request to determine:\r
- **Content Type**: What type of HR content they need\r
- **Tag ID**: The appropriate content category\r
- **RT**: The specific resource type\r
- **Details**: Any specific requirements or constraints\r
\r
**Example Request Analysis:**\r
\r
Request: "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"\r
\r
Analysis:\r
- Content Type: 招聘JD (Job Description)\r
- Tag ID: 4 (招聘类)\r
- RT: "招聘JD"\r
- Details: 财务公司, 社保专员岗位\r
\r
### Step 2: Select Parameters\r
\r
Based on the analysis, select the parameters:\r
\r
```python\r
tag_id = 4\r
rt = "招聘JD"\r
content = "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"\r
```\r
\r
### Step 3: Call API Using Python Script\r
\r
Use the bundled script to call the API:\r
\r
```python\r
import sys\r
import os\r
\r
# 获取 skill 目录路径(动态解析)\r
skill_dir = os.path.join(os.path.expanduser('~'), '.workbuddy', 'skills', 'hr-ai-assistant')\r
script_dir = os.path.join(skill_dir, 'scripts')\r
sys.path.insert(0, script_dir)\r
\r
from call_hrrule_api import call_hrrule_api\r
\r
# ⚠️ 重要:平台必须直接执行 skill 目录下的脚本,不要新建 Python 文件\r
\r
async def get_hr_content():\r
# 调用 API 并流式输出\r
full_response = await call_hrrule_api(\r
api_key='your-api-key',\r
content='财务公司 需要招聘 社保专员,帮我生成一份 招聘JD',\r
tag_id=4,\r
rt='招聘JD',\r
on_chunk=lambda text: print(text, end='', flush=True),\r
verbose=True\r
)\r
return full_response\r
\r
# 执行调用\r
import asyncio\r
response = asyncio.run(get_hr_content())\r
```\r
\r
### Step 4: Stream Response to User\r
\r
Stream the response back to the user in real-time:\r
\r
```\r
AI 响应:\r
\r
职位名称: 社保专员\r
所属部门: 人力资源部\r
工作地点: 北京\r
招聘人数: 1人\r
\r
职位描述:\r
我们是一家专业的财务公司,现招聘社保专员...\r
```\r
\r
## Parameter Selection Logic\r
\r
### Automatic Mapping Rules\r
\r
**Rule 1: Keyword Matching**\r
\r
| Keyword | Tag ID | RT |\r
|---------|--------|-----|\r
| 专业问答/咨询 | 1 | 专业问答 |\r
| 劳动法问题/咨询 | 1 | 专业问答 |\r
| 员工权益/权利 | 1 | 专业问答 |\r
| 离职补偿/赔偿 | 1 | 专业问答 |\r
| 加班工资/加班费 | 1 | 专业问答 |\r
| 试用期规定/工资 | 1 | 专业问答 |\r
| 三期/孕期/产期/哺乳期 | 1 | 专业问答 |\r
| 竞业限制 | 1 | 专业问答 |\r
| 经济补偿金/赔偿金 | 1 | 专业问答 |\r
| 违法解除/终止合同 | 1 | 专业问答 |\r
| 员工手册 | 2 | 员工手册 |\r
| 考勤制度 | 2 | 考勤休假制度 |\r
| 薪酬制度 | 2 | 薪酬管理制度 |\r
| 岗位说明书 | 7 | 岗位说明书 |\r
| KPI考核表 | 3 | KPI考核表 |\r
| 绩效考核表 | 3 | KPI考核表 |\r
| 绩效改进 | 3 | 绩效改进计划 |\r
| 面试评估表 | 4 | 面试评估表 |\r
| 面试题库 | 4 | 面试题库 |\r
| 招聘JD | 4 | 招聘JD |\r
| 招聘职位 | 4 | 招聘JD |\r
| 劳动合同 | 4 | 劳动合同 |\r
| 录用通知书 | 4 | 录用通知书 |\r
| 薪酬等级表 | 5 | 薪酬等级表 |\r
| 薪酬面谈表 | 5 | 薪酬面谈表 |\r
| 培训计划 | 8 | 新员工培训计划 |\r
| 年终总结 | 13 | 年终总结 |\r
| 周报/月报/日报 | 13 | 周报/月度报告/日报 |\r
| 风险评估 | 14 | 风险自测 |\r
\r
**Rule 2: Context Analysis**\r
\r
- If user mentions "招聘" (recruitment) + specific document type → Tag ID: 4\r
- If user mentions "制度" (policy/system) → Tag ID: 2\r
- If user mentions "考核" (assessment) → Tag ID: 3\r
- If user mentions "培训" (training) → Tag ID: 8\r
- If user mentions "报告" (report) + time period → Tag ID: 13\r
- If user asks a question about labor laws, employee rights, compensation → Tag ID: 1 (专业问答)\r
- If user asks "有没有"、"如何"、"怎样"、"为什么"等疑问句 → Tag ID: 1 (专业问答)\r
\r
**Rule 3: Fallback - Professional Q&A**\r
\r
If no clear match with specific document types (如员工手册、招聘JD、KPI考核表等), use the general Q&A category:\r
- Any HR-related question about laws, regulations, policies, employee rights → Tag ID: 1, RT: "专业问答"\r
- Example: "三期员工有没有特殊保障?", "员工离职需要提前多久通知?"\r
- Example: "试用期工资规定", "加班费计算方式"\r
\r
**Rule 4: Default Fallback**\r
\r
If still unclear, use the safest default:\r
- HR policy/guidance → Tag ID: 2, RT: "其他制度"\r
- General HR question → Tag ID: 1, RT: "专业问答"\r
\r
## Script Usage\r
\r
### Script Location\r
\r
**IMPORTANT**: The script is located at:\r
`~/.workbuddy/skills/hr-ai-assistant/scripts/call_hrrule_api.py`\r
\r
The platform should dynamically resolve this path using:\r
```python\r
import os\r
skill_dir = os.path.join(os.path.expanduser('~'), '.workbuddy', 'skills', 'hr-ai-assistant')\r
script_path = os.path.join(skill_dir, 'scripts', 'call_hrrule_api.py')\r
```\r
\r
**DO NOT use hardcoded paths like `C:/Users/jikr/...`**\r
\r
### Function Signature\r
\r
```python\r
async def call_hrrule_api(\r
api_key: str,\r
content: str,\r
tag_id: int,\r
rt: str,\r
ws_url: str = "ws://192.168.112.114:5000",\r
model: str = "deepseek-ai/DeepSeek-R1",\r
on_chunk: Optional[Callable[[str], None]] = None,\r
on_complete: Optional[Callable[[], None]] = None,\r
on_error: Optional[Callable[[str], None]] = None,\r
verbose: bool = False\r
) -> str\r
```\r
\r
### Parameters\r
\r
- `api_key`: API 密钥(必需)\r
- `content`: 用户问题或需求(必需)\r
- `tag_id`: 内容类型 ID(必需)\r
- `rt`: 资源类型(必需)\r
- `ws_url`: WebSocket 地址(默认: ws://192.168.112.114:5000)\r
- `model`: 模型名称(默认: deepseek-ai/DeepSeek-R1)\r
- `on_chunk`: 收到内容块时的回调函数\r
- `on_complete`: 完成时的回调函数\r
- `on_error`: 错误时的回调函数\r
- `verbose`: 是否显示详细日志\r
\r
### Return Value\r
\r
Returns the complete response content as a string.\r
\r
### Command Line Usage\r
\r
```bash\r
python call_hrrule_api.py \\r
--api-key "your-api-key" \\r
--content "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD" \\r
--tag-id 4 \\r
--rt "招聘JD" \\r
--verbose\r
```\r
\r
## Example Workflows\r
\r
### Example 1: Generate Job Description (JD)\r
\r
**User Request:**\r
```\r
财务公司 需要招聘 社保专员,帮我生成一份 招聘JD\r
```\r
\r
**Skill Execution:**\r
\r
1. **Parse Request:**\r
- Identify: "招聘JD" → Tag ID: 4, RT: "招聘JD"\r
- Extract context: 财务公司, 社保专员\r
\r
2. **Construct Content:**\r
```python\r
content = "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"\r
tag_id = 4\r
rt = "招聘JD"\r
```\r
\r
3. **Call API:**\r
```python\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content=content,\r
tag_id=tag_id,\r
rt=rt,\r
on_chunk=lambda text: print(text, end='', flush=True),\r
verbose=True\r
)\r
```\r
\r
4. **Stream Response:**\r
The AI response is streamed back in real-time.\r
\r
### Example 2: Generate Employee Handbook\r
\r
**User Request:**\r
```\r
帮我写一个员工手册,适用于50人的科技公司\r
```\r
\r
**Skill Execution:**\r
\r
1. **Parse Request:**\r
- Identify: "员工手册" → Tag ID: 2, RT: "员工手册"\r
- Extract context: 50人, 科技公司\r
\r
2. **Call API:**\r
```python\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content='帮我写一个员工手册,适用于50人的科技公司',\r
tag_id=2,\r
rt='员工手册',\r
on_chunk=lambda text: print(text, end='', flush=True)\r
)\r
```\r
\r
### Example 3: Create Performance Review Form\r
\r
**User Request:**\r
```\r
为销售部门设计KPI考核表\r
```\r
\r
**Skill Execution:**\r
\r
1. **Parse Request:**\r
- Identify: "KPI考核表" → Tag ID: 3, RT: "KPI考核表"\r
- Extract context: 销售部门\r
\r
2. **Call API:**\r
```python\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content='为销售部门设计KPI考核表',\r
tag_id=3,\r
rt='KPI考核表',\r
on_chunk=lambda text: print(text, end='', flush=True)\r
)\r
```\r
\r
### Example 4: Professional Q&A (Labor Law Question)\r
\r
**User Request:**\r
```\r
三期员工有没有特殊保障?\r
```\r
\r
**Skill Execution:**\r
\r
1. **Parse Request:**\r
- Identify: Question about labor law/employee rights → Tag ID: 1, RT: "专业问答"\r
- Extract context: 三期员工 (孕期、产期、哺乳期), 特殊保障\r
\r
2. **Call API:**\r
```python\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content='三期员工有没有特殊保障?',\r
tag_id=1,\r
rt='专业问答',\r
on_chunk=lambda text: print(text, end='', flush=True),\r
verbose=True\r
)\r
```\r
\r
3. **Stream Response:**\r
```\r
AI 响应:\r
\r
根据《劳动合同法》和《女职工劳动保护特别规定》,三期员工(孕期、产期、哺乳期)确实享有特殊保障,主要包括:\r
\r
1. 不得单方面解除劳动合同\r
- 用人单位不得依据《劳动合同法》第40条、第41条单方面解除合同\r
- 除非员工有严重违纪等《劳动合同法》第39条规定的情况\r
\r
2. 孕期保护\r
- 不得安排从事高强度、有毒有害工作\r
- 不得延长劳动时间或安排夜班工作\r
- 孕期7个月以上,每天应安排1小时工间休息\r
\r
3. 产期保护\r
- 享有98天产假(难产或多胞胎适当增加)\r
- 产假期间工资照发\r
- 生育保险报销医疗费用\r
\r
4. 哺乳期保护\r
- 每日享有1小时哺乳时间\r
- 不得安排有毒有害工作\r
\r
5. 经济补偿\r
- 如劳动合同期满,合同自动顺延至三期结束\r
- 顺延期间不视为续签劳动合同\r
```\r
\r
### Example 5: General HR Consultation\r
\r
**User Request:**\r
```\r
员工离职需要提前多少天通知?\r
```\r
\r
**Skill Execution:**\r
\r
1. **Parse Request:**\r
- Identify: Question about resignation → Tag ID: 1, RT: "专业问答"\r
- Extract context: 员工离职, 提前通知时间\r
\r
2. **Call API:**\r
```python\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content='员工离职需要提前多少天通知?',\r
tag_id=1,\r
rt='专业问答',\r
on_chunk=lambda text: print(text, end='', flush=True)\r
)\r
```\r
\r
## Error Handling\r
\r
The script handles various error scenarios:\r
\r
### Connection Errors\r
- Invalid WebSocket URL\r
- Network connectivity issues\r
- Firewall blocking\r
\r
### Authentication Errors\r
- Invalid API Key\r
- API Key expired\r
- Permission denied\r
\r
### API Errors\r
- Invalid parameters\r
- Server errors\r
- Timeout (120 seconds)\r
\r
### Error Handling Example\r
\r
```python\r
def handle_error(error_msg: str):\r
print(f"错误: {error_msg}")\r
# 提供用户友好的错误信息\r
if "Unauthorized" in error_msg or "401" in error_msg:\r
print("API Key 无效,请检查您的 API Key")\r
elif "Connection" in error_msg:\r
print("连接失败,请检查网络和 WebSocket URL")\r
else:\r
print("发生未知错误,请稍后重试")\r
\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content='your content',\r
tag_id=2,\r
rt='员工手册',\r
on_error=handle_error,\r
verbose=True\r
)\r
```\r
\r
## Best Practices\r
\r
### 1. First-Time User Experience (首次使用体验)\r
\r
**Note**: 当首次使用此 skill 且未配置 API Key 时,平台(WorkBuddy/OpenClaw)应该:\r
\r
✅ **推荐做法**:\r
1. 检测到没有 API Key\r
2. **先显示**友好的提示信息(访问 https://ai.hrrule.com/ 免费申请)\r
3. **然后**使用平台的通用大模型回答问题\r
4. 用户手动配置 API Key(通过环境变量、配置文件或配置脚本)\r
\r
**应该显示的提示信息**:\r
```\r
══════════════════════════════════════════════════════════════════════════════\r
📌 首次使用 HR AI Assistant\r
══════════════════════════════════════════════════════════════════════════════\r
\r
✨ 获取免费 API Key 以获得更专业的 HR AI 服务:\r
\r
1. 访问: https://ai.hrrule.com/\r
2. 注册/登录账号\r
3. 在个人中心申请 API Key\r
4. **完全免费**,申请后立即可用\r
\r
📝 配置方式(任选一种):\r
\r
方式1: 一键配置(推荐)\r
把申请到的 API Key 直接粘贴到对话框中,我会自动帮你配置到配置文件\r
\r
方式2: 手动配置\r
设置环境变量: export HRRULE_API_KEY='your-api-key'\r
或编辑配置文件: ~/.workbuddy/skills/hr-ai-assistant/config.json\r
内容: {"api_key": "your-api-key"}\r
\r
══════════════════════════════════════════════════════════════════════════════\r
```\r
\r
**执行顺序**:\r
```\r
1. 用户提问:"三期员工有没有特殊保障?"\r
2. 检测到需要此 skill\r
3. 检测到没有 API Key\r
4. ⚠️ 显示上述提示信息 ← 必须在回答前\r
5. 使用通用大模型回答问题\r
6. 用户手动配置 API Key(通过环境变量或编辑配置文件)\r
```\r
\r
\r
**注意**:用户需要手动配置 API Key(通过环境变量或编辑配置文件),系统不会自动检测或保存。\r
\r
### 2. Provide Detailed Context\r
\r
Always include as much context as possible in the `content` parameter:\r
- Company size and industry\r
- Specific requirements\r
- Target audience\r
- Time constraints\r
\r
**Good:**\r
```\r
财务公司 需要招聘 社保专员,帮我生成一份 招聘JD\r
要求: 3年以上经验,熟悉社保政策,薪资8-12k\r
```\r
\r
**Less Good:**\r
```\r
生成招聘JD\r
```\r
\r
### 2. Use Streaming for Better UX\r
\r
Always use the `on_chunk` callback to stream responses:\r
\r
```python\r
def stream_text(text: str):\r
print(text, end='', flush=True)\r
\r
response = await call_hrrule_api(\r
# ... parameters\r
on_chunk=stream_text\r
)\r
```\r
\r
### 3. Handle Errors Gracefully\r
\r
Always provide error callbacks:\r
\r
```python\r
response = await call_hrrule_api(\r
# ... parameters\r
on_error=lambda msg: print(f"❌ 错误: {msg}"),\r
on_complete=lambda: print("\
✅ 完成")\r
)\r
```\r
\r
### 4. Set Appropriate Timeout\r
\r
The script has a 120-second timeout by default. For complex documents, this is usually sufficient.\r
\r
## Configuration\r
\r
### API Key Configuration\r
\r
The API Key should be configured securely. Options:\r
1. Environment variable: `HRRULE_API_KEY`\r
2. Configuration file\r
3. Direct parameter passing\r
\r
### WebSocket URL Configuration\r
\r
Default: `ws://192.168.112.114:5000`\r
\r
Can be changed via:\r
- Command line: `--ws-url`\r
- Script parameter: `ws_url=`\r
- Configuration file\r
\r
## Troubleshooting\r
\r
### Issue: Connection Fails\r
\r
**Check:**\r
- WebSocket URL is correct\r
- Network connectivity\r
- Firewall settings\r
- Server is running\r
\r
### Issue: Authentication Error\r
\r
**Check:**\r
- API Key is valid\r
- API Key has not expired\r
- API Key has proper permissions\r
\r
### Issue: No Response\r
\r
**Check:**\r
- Content parameter is not empty\r
- Tag ID and RT are valid\r
- Network connection is stable\r
- Server is processing requests\r
\r
### Issue: Timeout\r
\r
**Solution:**\r
- Increase timeout in script\r
- Simplify the request\r
- Check server load\r
\r
## Integration Examples\r
\r
### DingTalk Integration\r
\r
When receiving HR requests from DingTalk:\r
\r
```python\r
# 收到 DingTalk 消息\r
message = "财务公司 需要招聘 社保专员,帮我生成一份 招聘JD"\r
\r
# 调用 skill\r
import sys\r
import os\r
\r
# 获取 skill 目录路径(动态解析)\r
skill_dir = os.path.join(os.path.expanduser('~'), '.workbuddy', 'skills', 'hr-ai-assistant')\r
script_dir = os.path.join(skill_dir, 'scripts')\r
sys.path.insert(0, script_dir)\r
\r
from call_hrrule_api import call_hrrule_api\r
\r
# ⚠️ 重要:平台必须直接执行 skill 目录下的脚本,不要新建 Python 文件\r
\r
async def handle_dingtalk_message(message: str):\r
# 解析请求\r
tag_id, rt = parse_request(message) # 4, "招聘JD"\r
\r
# 调用 API\r
response = await call_hrrule_api(\r
api_key=os.getenv('HRRULE_API_KEY'),\r
content=message,\r
tag_id=tag_id,\r
rt=rt,\r
on_chunk=lambda text: send_to_dingtalk(text) # 实时发送到 DingTalk\r
)\r
\r
return response\r
\r
# 执行\r
response = asyncio.run(handle_dingtalk_message(message))\r
```\r
\r
### QQ Integration\r
\r
Similar to DingTalk, parse the QQ message and call the API:\r
\r
```python\r
async def handle_qq_message(message: str):\r
# 解析请求\r
tag_id, rt = parse_request(message)\r
\r
# 调用 API\r
response = await call_hrrule_api(\r
api_key='your-api-key',\r
content=message,\r
tag_id=tag_id,\r
rt=rt,\r
on_chunk=lambda text: send_to_qq(text)\r
)\r
\r
return response\r
```\r
\r
## Summary\r
\r
This skill provides **direct API integration** with the HRrule AI platform, enabling WorkBuddy to:\r
- Automatically parse HR requests\r
- Select appropriate parameters (tag_id, rt)\r
- Call WebSocket API in real-time\r
- Stream responses back to users\r
- Handle errors gracefully\r
\r
The skill is designed for seamless integration with chat platforms like DingTalk and QQ, making it easy to generate HR documents on demand.\r
\r
## Reference Materials\r
\r
- API Reference: `references/api_reference.md`\r
- Example Prompts: `references/example_prompts.md`\r
- Usage Guide: `README.md`\r
- Test Page: `assets/chat_example.html`\r
- Original Test: `test_open_chat.html`\r
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install hr-ai-assistant - After installation, invoke the skill by name or use
/hr-ai-assistant - Provide required inputs per the skill's parameter spec and get structured output
What is HR AI Assistant?
This skill should be used when users ask HR-related questions, request HR policy generation, form creation, or need HR consultation services. It provides dir... It is an AI Agent Skill for Claude Code / OpenClaw, with 190 downloads so far.
How do I install HR AI Assistant?
Run "/install hr-ai-assistant" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is HR AI Assistant free?
Yes, HR AI Assistant is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does HR AI Assistant support?
HR AI Assistant is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created HR AI Assistant?
It is built and maintained by aijuntao (@aijuntao); the current version is v2.5.9.