Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/web-infra-dev/midscene-skillsnpx agentmods add skills/web-infra-dev/midscene-skills/harmony-automationWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/web-infra-dev/midscene-skills/harmony-automation)<a href="https://agentmods.dev/skills/web-infra-dev/midscene-skills/harmony-automation"><img src="https://agentmods.dev/badge/skills/web-infra-dev/midscene-skills/harmony-automation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/web-infra-dev/midscene-skills/harmony-automation"><img src="https://agentmods.dev/badge/skills/web-infra-dev/midscene-skills/harmony-automation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00164 | $0.04373 |
| Opus 5.5 | $0.00066 | $0.01749 |
| Sonnet 5.5 | $0.00033 | $0.00875 |
| Haiku 4.5 | $0.00016 | $0.00437 |
Grade A, and why
harmonyos-device-automation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 322 lines — stays where its author put it; the contents beside it link to each section on GitHub.
HarmonyOS Device Automation
CRITICAL RULES — VIOLATIONS WILL BREAK THE WORKFLOW:
- Never run midscene commands in the background. Each command must run synchronously so you can read its output (especially screenshots) before deciding the next action. Background execution breaks the screenshot-analyze-act loop.
- Run only one midscene command at a time. Wait for the previous command to finish, read the screenshot, then decide the next action. Never chain multiple commands together.
- Allow enough time for each command to complete. Midscene commands involve AI inference and screen interaction, which can take longer than typical shell commands. A typical command needs about 1 minute; complex
actcommands may need even longer.
Automate HarmonyOS NEXT devices using npx -y @midscene/harmony@1. Each CLI command maps directly to an MCP tool — you (the AI agent) act as the brain, deciding which actions to take based on screenshots.
What act Can Do
Inside a single act call on HarmonyOS, Midscene can tap, double-tap, long-press, type, clear text, scroll, drag items, press keys, and use system navigation such as Back, Home, or recent apps while working from the current visible screen. Two-finger zoom is not available because the underlying HarmonyOS automation layer does not expose multi-touch input.
Prerequisites
Midscene requires models with strong visual grounding capabilities. The following environment variables must be configured — either as system environment variables or in a .env file in the current working directory (Midscene loads .env automatically):
MIDSCENE_MODEL_API_KEY="your-api-key"
MIDSCENE_MODEL_NAME="model-name"
MIDSCENE_MODEL_BASE_URL="https://..."
MIDSCENE_MODEL_FAMILY="family-identifier"
Example: Gemini (Gemini-3-Flash)
MIDSCENE_MODEL_API_KEY="your-google-api-key"
MIDSCENE_MODEL_NAME="gemini-3-flash"
MIDSCENE_MODEL_BASE_URL="https://generativelanguage.googleapis.com/v1beta/openai/"
MIDSCENE_MODEL_FAMILY="gemini"
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 322 lines · 164 tokens per session scan A 80d91a1cad8b
harmonyos-device-automation is a skill published in the GitHub repository web-infra-dev/midscene-skills (319 stars, last pushed yesterday), licensed MIT. It adds 164 tokens to every session and 4,373 once invoked, about $0.0007 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
harmonyos-device-automation compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| harmonyos-device-automationweb-infra-dev/midscene-skills | Skill | 319 | yesterday | MIT | A | 164 | Claude Code |
| android-do-not-mockchromium/chromium | Skill | 25k | yesterday | BSD-3-Clause | A | 96 | Claude Code, Codex |
| android-unit-testchromium/chromium | Skill | 25k | yesterday | BSD-3-Clause | A | 36 | Claude Code, Codex |
| java-memory-leakschromium/chromium | Skill | 25k | yesterday | BSD-3-Clause | A | 22 | Claude Code, Codex |
| android-test-batchingchromium/chromium | Skill | 25k | yesterday | BSD-3-Clause | A | 60 | Claude Code, Codex |
| loadlinechromium/chromium | Skill | 25k | yesterday | BSD-3-Clause | A | 47 | Claude Code, Codex |
| accessibility-cleanupchromium/chromium | Skill | 25k | yesterday | BSD-3-Clause | A | 49 | Claude Code, Codex |