skills/arkts-sta-playground/SKILL.md
Execute ArkTS-Sta code snippets and files via the Playground HTTP API. Use this for testing ArkTS syntax, learning ArkTS features, verifying code logic, or demonstrating code execution results.
npx skillsauth add openharmonyinsight/openharmony-skills arkts-sta-playgroundInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill runs ArkTS-Sta code using the ArkTS-Sta Playground HTTP API, providing fast and reliable code execution without browser automation.
Run an ArkTS-Sta file:
python3 scripts/run_playground.py path/to/code.ets
Run code directly as a string:
python3 scripts/run_playground.py --code "let x: number = 42; console.log(x);"
Get JSON output for programmatic parsing:
python3 scripts/run_playground.py --json --code "console.log('Hello');"
Install Python dependencies:
pip install -r scripts/requirements.txt
Required package: requests>=2.31.0
When testing ArkTS-Sta syntax or verifying code logic:
python3 scripts/run_playground.py --code "
enum Numbers {
A = 10,
B = 2.57,
C = 0x2B7F,
D = -1.5,
E = 12
}
"
For testing multiple files:
for file in test/*.ets; do
python3 scripts/run_playground.py --json "$file" > "results/$(basename $file .ets).json"
done
The script uses the HTTP API endpoint:
https://arkts-play.cn.bz-openlab.ru:10443/compileBase URL: https://arkts-play.cn.bz-openlab.ru:10443/compile
Method: POST
Request:
{
"code": "your ArkTS-Sta code here"
}
Response:
{
"output": "execution output or empty",
"error": "error message if compilation failed, null otherwise"
}
If you get connection errors:
# Test connectivity
curl -X POST https://arkts-play.cn.bz-openlab.ru:10443/compile \
-H "Content-Type: application/json" \
-d '{"code":"let x: number = 42;"}'
Increase timeout if the API is slow:
python3 scripts/run_playground.py --timeout 60 path/to/code.ets
If you encounter SSL certificate issues, you may need to:
Test and explore ArkTS language features:
python3 scripts/run_playground.py --code "
// Test union types
let value: string | number = 'hello';
value = 42;
console.log(value);
"
Verify code logic before integrating into your project:
python3 scripts/run_playground.py --code "
function calculateSum(a: number, b: number): number {
return a + b;
}
console.log('Sum:', calculateSum(10, 20));
"
Find compilation errors in your code:
# Run with JSON output for programmatic checking
python3 scripts/run_playground.py --json problem.ets
# Check exit status
if python3 scripts/run_playground.py code.ets; then
echo "Compilation successful"
else
echo "Compilation failed"
fi
The script returns a JSON structure (with --json flag):
{
"success": true,
"output": "Execution result here...",
"error": null,
"has_error": false
}
Fields:
success: Boolean indicating if the API request succeededoutput: Code output or compilation outputerror: Error message if compilation failed, null otherwisehas_error: Boolean indicating if the code has compilation errorsTest if enum with non-integer values causes errors:
python3 scripts/run_playground.py --code "
enum Numbers {
A = 10,
B = 2.57,
C = 0x2B7F,
D = -1.5,
E = 12
}
"
Expected result: Should fail with an error about enum values needing to be integers.
--json)development
Run local code quality checks covering a subset of OpenHarmony gate CI (copyright, CodeArts C/C++) plus additional local checks (pylint/flake8, shellcheck/bashate, gn format). Use before committing to reduce gate failures. Triggers on: /oh-precommit-codecheck, "门禁检查", "门禁预检", "检查代码", "run codecheck", "check code quality", "lint my code", "代码检查", or after completing code implementation. WHEN to use: before git commit, before creating PR, after modifying C/C++/Python/Shell/GN files, when gate CI fails with codecheck defects, or when you want to preview what gate will flag.
development
OpenHarmony PR full lifecycle workflow. Five modes: - Commit: standardized commit with DCO sign-off and Issue linking - Create PR: commit + push to fork + create Issue + create PR on upstream - Fix Codecheck: fetch gate CI codecheck defects from a PR and auto-fix them - Review PR: fetch a PR's changes to local for code review - Fix Review: fetch unresolved review comments from a PR and auto-fix them Triggers on: /oh-pr-workflow, "提交代码", "创建PR", "提个PR", "commit", "修复告警", "修复门禁", "修复codecheck", "fix codecheck", "review pr", "review这个pr", "看下这个pr", "检视pr", "修复review", "修复检视意见", "fix review", or a GitCode PR URL with fix/review intent.
testing
分析 HM Desktop PRD 文档,提取需求信息、验证完整性、检查章节顺序(需求来源→需求背景→需求价值分析→竞品分析→需求描述)、检查 KEP 定义、检测需求冲突并生成结构化分析报告。适用于用户请求:(1) 分析或审查 PRD 文档, (2) 从需求中提取 KEP 列表, (3) 检查 PRD 完整性或一致性, (4) 将需求映射到模块架构, (5) 验证 PRD 格式合规性, (6) 验证竞品分析章节完整性。关键词:PRD分析, requirement extraction, KEP验证, completeness check, chapter order validation, 竞品分析检查, analyze PRD, 需求提取, 完整性检查, 章节顺序验证
development
基于 PRD 文档自动生成鸿蒙系统设计文档,包括架构设计文档和功能设计文档。生成前会分析 OpenHarmony 存量代码结构,确保与现有架构兼容。架构设计文档第2章必须为竞品方案分析,位于需求背景之后。适用于用户请求:(1) 生成架构设计文档, (2) 生成功能设计文档, (3) 从 PRD 生成设计文档, (4) 创建系统架构设计, (5) 编写功能规格说明, (6) 分析 OH 代码结构。关键词:architecture design, functional design, design doc, 竞品方案分析, OpenHarmony code analysis, 架构设计, 功能设计, 设计文档生成, OH代码分析, analyze codebase, competitor analysis