SuperAPI AI Directory

hap-skills-updater

General & other

View repository

Updated 10-15 21:50

About this skill

HAP Skills Collection skill update and maintenance

This skill helps users update and maintain the 4 core skills in the HAP Skills Collection.

📋 Core Skills List

The HAP Skills Collection includes the following 4 core skills (need to be updated from the GitHub repository):

  1. hap-v3-api - HAP V3 API usage skill ✅
  2. hap-view-plugin - HAP view plugin development skill ✅
  3. hap-frontend-project - HAP frontend project setup skill ⚠️ (if it does not exist, it needs to be obtained from the repository)
  4. hap-mcp-usage - HAP MCP usage guide ✅

Note: Some skills may not yet have been created locally, and will be automatically synced from the GitHub repository during update.

📁 Skill Directory Structure

.claude/skills/
├── hap-v3-api/
│   └── SKILL.md
├── hap-view-plugin/
│   └── SKILL.md
├── hap-frontend-project/
│   └── SKILL.md
└── hap-mcp-usage/
    └── SKILL.md

🔄 Update Process

Step 1: Check the current skill version

Before updating skills, first check the current status of the skills:

# 检查技能文件是否存在
ls -la ~/.claude/skills/hap-v3-api/SKILL.md
ls -la ~/.claude/skills/hap-view-plugin/SKILL.md
ls -la ~/.claude/skills/hap-frontend-project/SKILL.md
ls -la ~/.claude/skills/hap-mcp-usage/SKILL.md

# 或者如果是从 GitHub 仓库克隆的
cd /path/to/hap-skills-collection
ls -la .claude/skills/*/SKILL.md

Step 1.5: Check and install the HAP API documentation MCP (new)

Important: When installing/updating skills, you must check whether the user has already installed Application API - API Documentation MCP。

Check whether the MCP is already installed

Check the MCP configuration file according to the platform the user is currently using:

Claude Code:

# 检查是否已配置
claude mcp list | grep "应用 API - API 文档"

Cursor:

# 检查配置文件
cat ~/.cursor/mcp.json | grep "应用 API - API 文档"
# 或项目级
cat .cursor/mcp.json | grep "应用 API - API 文档"

TRAE:

# 检查配置文件
cat ~/.trae/mcp.json | grep "应用 API - API 文档"
# 或项目级
cat .trae/mcp.json | grep "应用 API - API 文档"

Other platforms: Similarly, check the configuration file for the corresponding platform

If not installed, automatically install the API documentation MCP

MCP Configuration Information:

{
  "mcpServers": {
    "应用 API - API 文档": {
      "command": "npx",
      "args": ["-y", "apifox-mcp-server@latest", "--site-id=5442569"]
    }
  }
}

Automatic Installation Steps:

  1. Identify the platform: Determine the AI tool the user is using (Claude Code / Cursor / TRAE, etc.)

  2. Read the existing configuration: Incremental update, preserving the user's existing MCP configuration

  3. Add the API documentation MCP:

    • Claude Code: claude mcp add "应用 API - API 文档" --command npx --args "-y,apifox-mcp-server@latest,--site-id=5442569"
    • Cursor/TRAE, etc.: Edit the mcp.json file to add the configuration
  4. Verify the installation: Check whether the configuration file contains "Application API - API Documentation"

  5. Prompt restart: Inform the user that the tool needs to be restarted for the configuration to take effect

Example - Cursor platform:

# 读取现有配置
EXISTING_CONFIG=$(cat ~/.cursor/mcp.json 2>/dev/null || echo '{"mcpServers":{}}')

# 添加 API 文档 MCP(增量更新)
cat > ~/.cursor/mcp.json <<EOF
{
  "mcpServers": {
    $(echo "$EXISTING_CONFIG" | jq -r '.mcpServers | to_entries | map("\"\(.key)\": \(.value|tojson)") | join(",")'),
    "应用 API - API 文档": {
      "command": "npx",
      "args": ["-y", "apifox-mcp-server@latest", "--site-id=5442569"]
    }
  }
}
EOF

# 验证安装
cat ~/.cursor/mcp.json | grep "应用 API - API 文档"

Inform the user:

✅ HAP API 文档 MCP 已安装

📋 配置信息:
- 平台:Cursor
- MCP 名称:应用 API - API 文档
- 配置文件:~/.cursor/mcp.json
- 已保留其他 MCP 配置

💡 下一步:
- 重启 Cursor 使配置生效
- 现在可以使用 MCP 查询 HAP API 文档了

📖 用途说明:
- 让 AI 读懂 HAP 接口文档(只读,不执行操作)
- 查询 API 文档、学习接口结构、生成 API 调用代码

Step 2: Update skill files

Method 1: Update from the GitHub repository (recommended)

# 1. 克隆或更新仓库
git clone https://github.com/garfield-bb/hap-skills-collection.git
# 或如果已存在
cd hap-skills-collection
git pull origin main

# 2. 确保本地技能目录存在
mkdir -p ~/.claude/skills

# 3. 复制所有技能到本地技能目录(包括缺失的技能)
cp -r .claude/skills/hap-v3-api ~/.claude/skills/ 2>/dev/null || echo "hap-v3-api 已存在或不存在"
cp -r .claude/skills/hap-view-plugin ~/.claude/skills/ 2>/dev/null || echo "hap-view-plugin 已存在或不存在"
cp -r .claude/skills/hap-frontend-project ~/.claude/skills/ 2>/dev/null || echo "hap-frontend-project 已存在或不存在"
cp -r .claude/skills/hap-mcp-usage ~/.claude/skills/ 2>/dev/null || echo "hap-mcp-usage 已存在或不存在"

# 4. 验证更新(检查实际存在的技能)
ls -la ~/.claude/skills/hap-*/SKILL.md 2>/dev/null

Method 2: Manually update a single skill

If you only need to update a specific skill:

# 更新单个技能
cp /path/to/hap-skills-collection/.claude/skills/hap-v3-api/SKILL.md ~/.claude/skills/hap-v3-api/SKILL.md

# 更新所有 4 个技能
for skill in hap-v3-api hap-view-plugin hap-frontend-project hap-mcp-usage; do
  cp /path/to/hap-skills-collection/.claude/skills/$skill/SKILL.md ~/.claude/skills/$skill/SKILL.md
done

Step 3: Verify the update

After updating, verify whether the skill loads correctly:

# 检查文件大小和修改时间
ls -lh ~/.claude/skills/hap-*/SKILL.md

# 检查文件内容(查看前几行)
head -10 ~/.claude/skills/hap-v3-api/SKILL.md

📝 Update Checklist

When updating skills, please check the following:

✅ General Check Items

  • The skill file exists and is readable
  • The SKILL.md file format is correct (includes frontmatter)
  • The skill name and description are correct
  • The file encoding is UTF-8
  • There are no syntax errors
  • HAP API documentation MCP is installed (new)

✅ MCP Configuration Check (new)

  • Check the platform's MCP configuration file
  • Confirm whether "Application API - API Documentation" is installed
  • If not installed, automatically install the API documentation MCP
  • Incremental update, preserving the user's existing MCP configuration
  • Prompt the user to restart the tool for the configuration to take effect

✅ Content check items

  • hap-v3-api:

    • API usage workflow complete
    • Filter syntax correct
    • Authentication configuration instructions clear
    • Example code runnable
  • hap-view-plugin:

    • Development workflow steps complete (7 steps)
    • Template selection instructions clear
    • Field type handling correct
    • API integration instructions complete
  • hap-frontend-project:

    • HAP backend configuration guidance complete
    • Frontend project structure clear
    • API integration best practices correct
    • Data rendering optimization instructions
  • hap-mcp-usage:

    • Two MCP types explained clearly
    • Cursor automated configuration process correct
    • Configuration file location accurate (~/.cursor/mcp.json)
    • Key extraction method correct

🤖 AI Assistant Update Guide

When the user needs to update skills, the AI should:

1. Identify update needs

The user may say:

  • "Update hap-skills"
  • "Update skills"
  • "Sync the latest skill"
  • "Update hap-v3-api skill"

2. Perform update operations

If the user has a local repository:

# 检查仓库位置
cd /path/to/hap-skills-collection

# 拉取最新更新
git pull origin main

# 复制技能文件
cp -r .claude/skills/* ~/.claude/skills/

# 验证更新
ls -la ~/.claude/skills/hap-*/SKILL.md

# ⚠️ 重要:检查并安装 HAP API 文档 MCP
# (见步骤 1.5)

If the user does not have a local repository:

# 克隆仓库
git clone https://github.com/garfield-bb/hap-skills-collection.git /tmp/hap-skills-collection

# 确保本地技能目录存在
mkdir -p ~/.claude/skills

# 复制 4 个核心技能文件(只复制存在的)
for skill in hap-v3-api hap-view-plugin hap-frontend-project hap-mcp-usage; do
  if [ -d "/tmp/hap-skills-collection/.claude/skills/$skill" ]; then
    cp -r /tmp/hap-skills-collection/.claude/skills/$skill ~/.claude/skills/
    echo "✅ 已更新 $skill"
  else
    echo "⚠️  $skill 在仓库中不存在,跳过"
  fi
done

# 验证更新(只显示实际存在的技能)
ls -la ~/.claude/skills/hap-*/SKILL.md 2>/dev/null

# ⚠️ 重要:检查并安装 HAP API 文档 MCP
# (见步骤 1.5)

⚠️ Key reminder:

  • After updating skills,must check whether the HAP API documentation MCP is installed
  • If not installed,automatically help the user install it(see step 1.5)
  • After installation, prompt the user to restart the tool for the configuration to take effect

3. Verify update results

After updating, the AI should:

  • ✅ Check whether all 4 skill files exist
  • ✅ Verify whether the file size is reasonable (should not be 0)
  • ✅ Check whether the file modification time is the latest
  • ✅ Read the first few lines of the file to verify the format is correct
  • ✅ Check whether the HAP API documentation MCP is installed (new)
  • ✅ If not installed, automatically install the API documentation MCP

4. Inform the user

After the update is complete, the AI should inform the user:

  • ✅ List of updated skills (4 core skills)
  • ✅ Update source (GitHub repository)
  • ✅ Skill file location (~/.claude/skills/)
  • ✅ HAP API documentation MCP installation status(installed / skipped / just installed)
  • ⚠️ The AI tool may need to be restarted for the changes to take effect

Complete user feedback example:

✅ HAP Skills 更新完成!

📋 已更新技能:
1. ✅ hap-v3-api - HAP V3 API 使用技能
2. ✅ hap-view-plugin - HAP 视图插件开发技能
3. ✅ hap-frontend-project - HAP 前端项目搭建技能
4. ✅ hap-mcp-usage - HAP MCP 使用指南

📦 MCP 配置:
✅ 应用 API - API 文档 MCP 已安装
   - 平台:Cursor
   - 配置文件:~/.cursor/mcp.json
   - 用途:让 AI 读懂 HAP 接口文档

💡 下一步:
- 重启 Cursor 使所有配置生效
- 现在可以使用最新的 HAP 技能了

📚 技能位置:
~/.claude/skills/
├── hap-v3-api/
├── hap-view-plugin/
├── hap-frontend-project/
└── hap-mcp-usage/

🔍 Skill file format specification

Each skill file (SKILL.md) should follow this format:

---
name: skill-name
description: 技能描述,说明何时使用此技能
license: MIT
---

# 技能标题

技能正文内容...

Frontmatter field descriptions

  • name: Skill name, must match the directory name
  • description: Skill description, explaining use cases and trigger keywords
  • license: License (usually MIT)

📊 Skill update log

Record the content of each update:

2026-01-14

  • ✅ Initial version, including 4 core skills
  • ✅ Establish update process and checklist

🛠️ Troubleshooting

Issue 1: Skill file does not exist

Symptoms: ls: ~/.claude/skills/hap-xxx/SKILL.md: No such file or directory

Solution:

# 创建技能目录
mkdir -p ~/.claude/skills/hap-v3-api
mkdir -p ~/.claude/skills/hap-view-plugin
mkdir -p ~/.claude/skills/hap-frontend-project
mkdir -p ~/.claude/skills/hap-mcp-usage

# 从仓库复制文件
cp /path/to/hap-skills-collection/.claude/skills/*/SKILL.md ~/.claude/skills/*/

Problem 2: Skill file format error

Symptom: AI cannot recognize the skill

Solution:

  1. Check whether the frontmatter format is correct
  2. Ensure the file encoding is UTF-8
  3. Check whether there are syntax errors

Problem 3: Skill does not take effect after update

Symptom: After updating the file, AI still uses the old version

Solution:

  1. Restart the AI tool (Claude Code CLI, Cursor, etc.)
  2. Clear the cache (if the tool supports it)
  3. Verify whether the file modification time is the latest

📚 Related Resources

💡 Best Practices

  1. Regular updates: It is recommended to update the skills once a week or once a month
  2. Version control: Use git to manage skill files for easy rollback
  3. Backup: Back up existing skill files before updating
  4. Verification: Verify whether the skill works properly after updating
  5. Documentation sync: Update README.md in sync when updating skills

🎯 Use Cases

Use this skill when the user mentions the following:

  • "Update hap-skills"
  • "Sync the latest skills"
  • "Update skill"
  • "Maintain skills"
  • "Check skill version"
  • "Update hap-v3-api"
  • "Update view plugin skill"

Note: This skill is only used to update and maintain the 4 core skills in the HAP Skills Collection. If you need to add new skills or modify skill content, please refer to the SKILL.md file for each skill.