Coding & Development✨gemini⌨️cursor🌐universal
HarmonyOS 开发规则生成器
🎯 基于AI技术自动提取华为HarmonyOS官方最佳实践,生成专业的CursorRules规则文件。解决主流AI模型缺乏HarmonyOS语料的痛点,为开发者提供准确的智能代码提示。
Quick Start
Install this Skill
npx skills add skindhu/harmony-cursor-rules# HarmonyOS 开发规则生成器
## 📖 项目背景
HarmonyOS作为新兴的移动操作系统,由于发展历史相对较短,主流AI模型在预训练阶段缺乏充足的HarmonyOS开发语料。这导致Cursor等AI开发工具在生成HarmonyOS相关代码时效果不佳,开发者难以获得准确的开发建议。
本项目旨在解决这一痛点,通过智能爬取华为官方HarmonyOS开发文档,自动提取最佳实践并生成符合Cursor IDE规范的开发规则文件,为开发者提供专业、准确的HarmonyOS开发指导。
详细讲解请阅读文章:https://mp.weixin.qq.com/s/gLgP7gGU0pmGc2x1hS-0UQ
## 🚀 核心功能
- **📋 智能文档爬取**: 自动爬取华为官方HarmonyOS最佳实践文档,支持SPA页面解析
- **📝 UI开发规范生成**: 基于Gemini AI智能提取界面开发最佳实践,生成结构化的开发规范
- **🔧 ArkTS迁移规则**: 自动提取TypeScript到ArkTS迁移过程中的Lint规则和语法约束
## 📁 harmony_cursor_rules 说明
项目运行后会生成 `harmony_cursor_rules` 目录,包含按模块分类的开发规范文件。具体涉及的模块配置可查看 `harmony_modules_config.json` 文件:
### 目录结构
```
harmony_cursor_rules/
├── component_encapsulation_reuse/ # 组件封装与复用
├── layout_dialog/ # 布局与弹窗
├── animation_transition/ # 动画与转场
├── performance_optimization/ # 性能优化
├── ... # 其他模块
└── final_cursor_rules/ # 最终整合的规则文件
├── component_encapsulation_reuse.cursorrules.md
├── layout_dialog.cursorrules.md
├── arkts-lint-rules.md # ArkTS迁移规则
└── ...
```
> 💡 **快速使用**: 开发者只需将 `final_cursor_rules` 目录下的规则文件配置到Cursor IDE中即可获得专业的HarmonyOS开发提示。如果需要生成更多的规则文件,可在`harmony_modules_config.json`追加配置。
### 参考文档
生成的开发规则均基于华为官方权威文档:
- **界面开发最佳实践**: [HarmonyOS 最佳实践 - 界面开发](https://developer.huawei.com/consumer/cn/doc/best-practices/bpta-ui-dynamic-operations)
- **ArkTS迁移指南**: [TypeScript到ArkTS迁移指南](https://developer.huawei.com/consumer/en/doc/harmonyos-guides-V14/typescript-to-arkts-migration-guide-V14)
## 🛠️ 使用方式
### 环境准备
1. **安装依赖**
```bash
pip install -r Requirements.txt
```
2. **配置API密钥**
```bash
# 设置Gemini API密钥
export GEMINI_API_KEY="your-gemini-api-key"
# 可选:设置自定义API端点(如使用代理或自定义服务)
export GEMINI_BASE_URL="https://your-custom-api-endpoint.com"
```
### 运行程序
```bash
# 标准运行
python main.py
# 调试模式(保存HTML文件)
python main.py --debug
```
### 使用生成的规则
1. 在你的HarmonyOS项目根目录创建 `.cursorrules` 文件
2. 将 `final_cursor_rules` 目录中相关 `.md` 文件的内容复制到 `.cursorrules` 文件中
## 📊 输出示例
生成的开发规则文件结构完整,包含:
- **核心原则**: HarmonyOS开发的基础设计理念和架构原则
- **推荐做法**: 经过验证的最佳实践和标准代码模式
- **禁止做法**: 需要避免的错误写法和反模式
- **代码示例**: 正确与错误写法的对比演示
- **注意事项**: 关键的开发要点和性能优化建议
---
*本项目基于AI技术自动化提取华为官方权威文档,为HarmonyOS开发者提供专业、标准的开发规范指导*
Repository
92stars
19forks
Details
Related Skills
More coding & development skills you might like
Reticle
Coding & DevelopmentAI agents can generate code, but still struggle to understand what they build. Reticle brings Jev-style machine-native runtime perception to web & desktop applications.
🤖claude🌐universal
1.2k
190
View
agentscope-java
Coding & DevelopmentExpert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or Java agent development. Specializes in non-blocking code, tool integration, hooks, pipelines, and production-ready agent applications.
🌐universal
6.0k
1.5k
View
ospec
Coding & DevelopmentDocument-driven OSpec workflow for initialization, change/goal routing, validation, archiving, and durable project knowledge.
✨gemini🤖claude💬gpt🌐universal
524
34
View
misakanet-failure-memory
Coding & Development📚 A zero-dependency, git-backed micro-lesson library for AI Agents to asynchronously share and search verified debugging experience. Python stdlib only. | https://misakanet.org
🤖claude⌨️cursor🌐universal
424
158
View