This skill helps you debug HarmonyOS ArkWeb apps by automating DevTools setup, port forwarding, and webview inspection.
npx playbooks add skill openharmonyinsight/openharmony-skills --skill arkweb-app-debug
Use this skill when the user needs to debug HarmonyOS ArkWeb (webview) applications:
Start an ArkWeb debugging session:
# Using the debug script (auto-configures environment)
$SKILL_DIR/scripts/start-debug.sh
# Or with explicit package name
$SKILL_DIR/scripts/start-debug.sh --package com.example.app
This skill includes debugging scripts in scripts/:
| Script | Purpose |
|--------|---------|
| start-debug.sh | Start debugging session (macOS/Linux, auto-configures environment) |
| start-debug.py | Start debugging session (cross-platform Python) |
| start-debug.bat | Start debugging session (Windows, auto-configures environment) |
All scripts automatically:
For detailed documentation, see [references/](references/).
# Run the debug script from your HarmonyOS project directory
cd /path/to/harmonyos/project
$SKILL_DIR/scripts/start-debug.sh
# The script automatically:
# - Detects project configuration (package name, HAP path)
# - Connects to device
# - Creates port forwarding to webview_devtools socket
# - Opens Chrome DevTools
For complete development workflow:
# 1. Build and install app (using ohos-app-build-debug skill)
$OHOS_SKILL_DIR/scripts/build.py
$OHOS_SKILL_DIR/scripts/install.py -f entry/build/default/outputs/default/entry-default-signed.hap
$OHOS_SKILL_DIR/scripts/launch.py
# 2. Start debugging (this skill)
$SKILL_DIR/scripts/start-debug.sh
When Chrome DevTools MCP is configured, Claude can automatically test webview functionality:
User: Please test the login functionality in my webview
Claude: (Automatically uses Chrome DevTools MCP)
- Opens DevTools connection
- Navigates to login page
- Fills out form
- Submits and verifies results
See [references/mcp-guide.md](references/mcp-guide.md) for MCP setup and available tools.
The debug scripts automatically:
AppScope/app.json5Based on real debugging experience:
The scripts handle these timings automatically.
When helping users with ArkWeb debugging:
hdc list targetssetWebDebuggingAccess(true) in aboutToAppear()scripts/ directory$SKILL_DIR with actual skill installation path$OHOS_SKILL_DIR with ohos-app-build-debug skill pathhdc fport listArkWeb applications must enable debugging in aboutToAppear():
import { webview } from '@kit.ArkWeb';
@Entry
@Component
struct Index {
controller: webview.WebviewController = new webview.WebviewController();
aboutToAppear() {
// CRITICAL: Enable debugging BEFORE Web component renders
webview.WebviewController.setWebDebuggingAccess(true);
}
build() {
Web({ src: this.currentUrl, controller: this.controller })
}
}
If DevEco Studio/hdc is not detected:
If device is not connected:
If socket is not found:
setWebDebuggingAccess(true) in codehdc shell ps -A | grep <package>For detailed troubleshooting, see [references/troubleshooting.md](references/troubleshooting.md).
setWebDebuggingAccess(true) enabledOptional: Chrome DevTools MCP for AI automated testing
Download DevEco Studio: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-download
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.