Arkuix module adapter

From openharmonyinsight/openharmony-skills · View interactive version

Arkuix module adapter is an AI agent skill from the GitHub repository openharmonyinsight/openharmony-skills. Guide OHOS modules cross-platform adaptation with automated architecture analysis, code sync, and configuration generation. Use for adapting OHOS subsystem modules (@ohos.data.preferences, @ohos.intl, @ohos.multimedia.image, etc.) to Android/iOS. Provides 6-phase workflow: info collection → code syn

How to use this skill

Skill file

ArkUIX Module Adapter Skill

Overview

Guide OHOS modules through cross-platform adaptation with automated analysis and code generation. This skill transforms Claude into a specialized adaptation assistant with domain expertise in OHOS/ArkUI-X architecture.

Quick Start

User: "I need to adapt @ohos.data.preferences module"

The skill automatically guides through all 6 phases of adaptation.

6-Phase Workflow

Phase 1: Information Collection

Collects minimal information upfront (module name), then lazily collects additional details (repository name, storage path) only when needed.

Output: Module identification information

Phase 2: Code Existence Check & Sync

Intelligently checks if OHOS code already exists before syncing. Avoids redundant operations.

Decision Tree:

  1. Check .repo/manifests/openharmony-master.xml
  2. Check plugins/ directory
  3. Only sync if both checks fail (with repository verification on GitCode)

Output: Sync status or repository verification results

Phase 3: API Interface Analysis

Analyzes .d.ts file to determine @crossplatform coverage.

Metrics:

Output: Comprehensive API statistics with coverage progress bar

Automation: scripts/dts_analyzer.py interface/sdk-js/api/@ohos.{module}.d.ts

Phase 4: Architecture Analysis

Analyzes OHOS module code composition and platform dependencies.

Analysis Dimensions:

Key Rule: C/C++ Cross-Platform Native Support

Output: Detailed code composition and dependency analysis

Automation: scripts/architecture_analyzer.py foundation/{module_path}

Phase 5: Architecture Recommendation

Recommends adaptation mode based on analysis: OHOS Reuse / Independent / Hybrid

Decision Matrix:

| Mode | Code Reuse | New Code | Time | Best For |

|------|------------|----------|------|----------|

| OHOS Reuse | 90-95% | 500-800 lines | 4-6 weeks | Data-focused (preferences, kv_store) |

| Hybrid | 60-80% | 1,500-2,500 lines | 6-10 weeks | Mixed (location, sensor) |

| Independent | 10-30% | 4,000-6,000 lines | 10-16 weeks | Platform-heavy (BLE, pasteboard) |

Output: Recommended mode with rationale and effort estimates

Phase 6: Implementation Guidance

Provides actual implementation code with complete examples for:

Output: Production-ready code with comprehensive error handling

Automation: scripts/code_generator.py {module} {repo} --api-version {ver}

Key Features

🤖 Automated Scripts

All scripts are in scripts/ directory:

# Analyze .d.ts coverage
python3 scripts/dts_analyzer.py interface/sdk-js/api/@ohos.data.preferences.d.ts

# Analyze module architecture
python3 scripts/architecture_analyzer.py foundation/distributeddatamgr/preferences

# Generate configuration files (dry-run)
python3 scripts/code_generator.py data/preferences distributeddatamgr_preferences --api-version 23 --dry-run

# Apply changes
python3 scripts/code_generator.py data/preferences distributeddatamgr_preferences --api-version 23

📚 Progressive Disclosure

Core workflow in SKILL.md (this file), detailed content in references:

🎯 Three Architecture Modes

OHOS Reuse Mode (90-95% reuse)

For data-focused modules with minimal platform dependencies.

Characteristics:

Example Modules: preferences, kv_store, http

Independent Implementation Mode (10-30% reuse)

For modules with heavy platform API dependencies.

Characteristics:

Example Modules: bluetooth, pasteboard, camera

Hybrid Mode (60-80% reuse)

For mixed data/platform logic modules.

Characteristics:

Example Modules: geolocation, sensor, request

Implementation Checklist

Use this checklist to track adaptation progress:

Phase 1: Information Collection

Phase 2: Code Sync

Phase 3: API Analysis

Phase 4: Architecture Analysis

Phase 5: Architecture Recommendation

Phase 6: Implementation

Mandatory Configuration Files

After code generation, ensure all 4 files are updated:

Troubleshooting

Repository not found on GitCode?

Validation failed?

Build errors?

Related Skills

Tips

  1. Start Small: Try with a simple module first (e.g., preferences)
  2. Use Dry-Run: Always use --dry-run flag before applying changes
  3. Verify Repository: Always verify repository exists before syncing
  4. Read References: Consult detailed references for complex phases
  5. Run Tests: Always run tests after implementation
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.