Huawei Cloud Skill Creator v2
Six-Phase Strict Pipeline — Each phase depends on the previous phase's output and cannot be skipped. If any phase is missing, restart from the missing phase.
Overview
The Huawei Cloud Skill Creator v2 is based on a six-phase strict pipeline: starting with Socratic Q&A requirements analysis, followed by technical research (CLI→SDK→API three-level fallback), document generation, test preparation, detailed testing, resource cleanup and compliance check, ultimately generating a complete skill package that conforms to the Huawei Cloud Skill Specification. It only creates/packages skills — it does not directly operate cloud resources (no creating/deleting/modifying ECS, VPC, OBS, etc.); use it to generate a management Skill or use another dedicated management Skill for cloud-resource operations.
Pre-check: Huawei Cloud Credentials Required
Mandatory gate. This pre-check MUST pass before invoking any hcloud / huaweicloudsdk command — including Phase 2 research, Phase 4/5 testing, and Phase 6 validation. If no valid credential profile is detected, STOP and obtain credentials out-of-band.
Security Rules
- NEVER read, echo, or print AK/SK values (e.g., printing the value of an
HUAWEI_ACCESS_KEY-style env var is FORBIDDEN).
- NEVER read or cat the on-disk credential files for hcloud, obsutil, the SDK, or any other secret-storing location. Treat all such files as confidential; the names of those files (used by their owners) are documented in
references/cli-installation-guide.md.
- NEVER ask the user to input AK/SK directly in the conversation or command line.
- NEVER invoke
hcloud configure set with literal credential strings passed via the CLI's cli-<ak-flag> / cli-<sk-flag> parameters or any equivalent in-band secret-entry form.
- ONLY use
hcloud configure list to check credential status — non-interactive, read-only, no secrets echoed.
Verification Steps
hcloud configure list
Check the output for a valid profile (AK/SK, or temporary security credentials / agency-assumed role).
If no valid profile exists, STOP here.
Obtain credentials from Huawei Cloud Console → 身份与访问管理 (IAM) → 我的凭证 → 新增访问密钥.
Output the following copy-paste ready env-var setup block to the user (fill in real values outside of this session, never in chat). The Agent must NEVER ask the user to type the AK/SK value in the conversation — only emit the template below:
# Set Huawei Cloud credentials. The secret key is entered silently when prompted.
export HUAWEI_ACCESS_KEY="<your-access-key-id>"
read -rs HUAWEI_SECRET_KEY; export HUAWEI_SECRET_KEY
export HUAWEI_REGION="cn-north-4"
Optional alternative (interactive out-of-band step only, never with literal values): hcloud configure — prompts for AK/SK in the user's terminal
After the user confirms they have configured env vars (or run hcloud configure), re-run hcloud configure list. If the profile is valid → resume Phase 1. If still missing → terminate, do not proceed.
Reuse the active CLI profile for all subsequent hcloud and huaweicloudsdk calls. Do not print or hardcode secrets. Do not replace this gate with obsutil config, hcloud configure set with literal arguments, SDK credentials constructors filled with literal strings (for example, the SDK's BasicCredentials built from string literals rather than env vars), or any other in-session secret-entry flow.
Credential Source Priority
When invoking commands later (Phase 2/4/5), the skill accepts credentials in this priority order:
| Priority |
Source |
Notes |
| 1 |
Environment variables |
Auto-scan all variables prefixed with HUAWEI / HW / HWC containing ACCESS_KEY / _AK / SECRET_KEY / _SK |
| 2 |
hcloud configure profile |
Active CLI profile — preferred for hcloud calls |
| 3 |
IAM agency / temporary credentials |
AK/SK + SecurityToken (programmatic access) |
If none of the above are available when Phase 4/5 testing starts, prompt the user once to configure them out-of-band and re-run the pre-check. If still unavailable, terminate the process — strictly prohibited from skipping credential-required steps.
Prerequisites
- hcloud CLI installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
- Authentication verified via the Pre-check above (
hcloud configure list).
- Python 3.8+ with
huaweicloudsdk packages — install on demand: pip install huaweicloudsdkcore huaweicloudsdkecs. Verify with python3 -c "import huaweicloudsdkcore" before Phase 2/4/5. SDK Reference: https://console.huaweicloud.com/apiexplorer/#/sdkcenter
- Node.js + npx available
- Huawei Cloud AK/SK — Auto-scan all environment variables prefixed
HUAWEI / HW / HWC matching ACCESS_KEY / _AK / SECRET_KEY / _SK. Hardcoding AK/SK in scripts, docs, or command lines is forbidden.
- API Reference: https://console.huaweicloud.com/apiexplorer/#/openapi
Workflow — Six-Phase Strict Pipeline
Phase 1 (Q&A) → Phase 2 (Tech Research) → Phase 3 (Generate MD)
→ Phase 4 (Test Prep) → Phase 5 (Detailed Testing) → Phase 6 (Cleanup & Report)
Strict Rules:
- Each phase must output a phase summary (phase-N-summary)
- Before starting each phase, must verify that the previous phase's summary file exists
- After all 6 phases are completed, perform a final check for any missing phases. If any are missing, restart from the missing phase
- Skipping any phase is strictly prohibited
- The Pre-check: Huawei Cloud Credentials Required gate must have passed before any Phase 2 research or Phase 4/5 execution begins
Phase 1: Requirements Analysis (Socratic Q&A)
Goal: Clarify user requirements through question-by-question dialogue.
- Ask one question at a time, wait for the user's response
- Cover the following dimensions:
- Target Service — Which Huawei Cloud service? (ECS, VPC, OBS, RDS, BSS, etc.)
- Feature Scope — What should the Skill do? (Query, Diagnose, Deploy, Monitor, Manage)
- Execution Mode — Prefer CLI / SDK / API?
- CLI Operations — Which operations are involved? (List, Show, Create, Delete, Update)
- Trigger Scenarios — When would an Agent invoke this? (Daily inspection, troubleshooting, auto-scaling)
- After every 5 questions or covering all dimensions → Display requirements summary table → Wait for user confirmation
- 🛑 Do NOT proceed to Phase 2 until the user has explicitly confirmed
Output: phase-1-summary.json — User-confirmed requirements description
Phase 2: Technical Research (CLI→SDK→API Three-Level Fallback)
Dependency: Phase 1 requirements analysis completed (phase-1-summary.json exists)
For each feature point confirmed in Phase 1, research availability in the following order:
| Priority |
Research Method |
Verification Command |
Success Criteria |
| 1st |
CLI — hcloud command |
hcloud <Service> <Operation> --cli-region=cn-north-4 --help |
Command exists and parameters are valid |
| 2nd |
SDK — huaweicloudsdk |
python3 -c "from huaweicloudsdk{service}.v2 import ..." |
SDK package installed and class importable |
| 3rd |
API — Only from the following two sources |
See rules below |
Endpoint from a trusted source, not inferred |
Core Rule: API Endpoint Forensics (No Guessing)
API endpoints are only allowed from the following two sources. Strictly prohibited from inferring through naming patterns:
| Trusted Source |
Method |
① SDK source _http_info resource_path |
grep -A8 "_http_info" {service}_client.py → Read resource_path value |
| ② Huawei Cloud API Explorer (api-explorer.huaweicloud.com) |
User searches and confirms on that website |
❌ Strictly prohibited actions:
- Inferring new endpoints based on other API path patterns (e.g., inferring claim-vouchers endpoint from coupons endpoint)
- Constructing URIs yourself based on documentation descriptions
- Using "common naming patterns" to guess API paths
- If the SDK is available but the corresponding function has no method in
_http_info → Mark ⛔, do not infer
Execution Rules:
Research feature point N
├── CLI available → Record as CLI mode, record specific command
├── CLI unavailable → Check SDK
│ ├── SDK available → Record as SDK mode
│ │ ├── Read all _http_info methods from SDK source to obtain real REST paths
│ │ │ grep "resource_path" <sdk_path>/{service}_client.py
│ │ └── Feature point's corresponding method has _http_info in SDK → Record real API endpoint
│ │ Feature point's corresponding method has no _http_info in SDK → Mark ⛔, do not infer
│ ├── SDK unavailable → Ask user to confirm endpoint from API Explorer
│ │ ├── User finds endpoint from API Explorer → Record as API mode, note the source
│ │ ├── User provides endpoint (other source) → Record as API mode, mark ⚠ user-provided
│ │ └── User cannot provide → Mark ⛔
│ └── SDK partially available (some methods missing and no corresponding _http_info) → Mark missing features as ⛔
└── Generate feature point research result (including execution mode + real API path if available)
🛑 Agent is strictly forbidden from guessing/fabricating API paths on its own. If neither the SDK source nor API Explorer has the endpoint, mark it ⛔ — it doesn't exist.
Tips for finding SDK client source paths:
python3 -c "import huaweicloudsdk{service}.v2 as m; import os; print(os.path.dirname(m.__file__))" # package path
grep "_http_info" <path>/{service}_client.py # all API endpoints
grep -A8 "_{method}_http_info" <path>/{service}_client.py # "resource_path" = real REST endpoint
Output: phase-2-summary.json — Execution mode (CLI/SDK/API/⛔) and corresponding command/code/API path for each feature point
Phase 3: Document Generation
Dependency: Phase 2 technical research completed (phase-2-summary.json exists)
Generate Skill files based on Phase 2 conclusions:
Name the Skill — Use huawei-cloud-{product}-{function} and make the frontmatter name match the directory name.
Language — Generate SKILL.md in English by default. Chinese documentation may be added in references/ as supplementary. The main SKILL.md must use English for frontmatter description, section titles, command examples, and all explanatory content.
Frontmatter — Include name, description with a feature summary and trigger conditions, and no more than five tags. Do not generate a version field.
Create directory structure:
skills/{skill-name}/ → SKILL.md, references/ (iam-policies.md required; cli-installation-guide.md required when CLI is used; verification-method.md / dataflow-diagram.md / acceptance-criteria.md recommended), scripts/test-cli-commands.sh, templates/test-vars.json
SKILL.md content generation rules:
| Execution Mode |
Command Format in SKILL.md |
| CLI |
hcloud <Service> <Operation> --cli-region={region} [--params] |
| SDK |
Python script example (python3 -c "...") |
| API |
curl command + user-provided endpoint (mark as user-provided) |
| Unavailable |
Mark requires manual verification, do not generate specific commands |
Required sections in SKILL.md:
| Section |
Severity |
Description |
| YAML Frontmatter |
Critical |
name + description with feature summary and trigger conditions + tags; no version |
| Overview |
High |
Feature overview, architecture, applicable scenarios |
| Prerequisites |
High |
CLI version, authentication configuration, IAM permissions |
| Workflow |
High |
Skill workflow steps |
| Core Commands |
High |
Command examples grouped by function |
| Parameter Confirmation |
High |
User-configurable parameter table |
| Reference Documents |
Critical |
Links to documents under references/ |
| KooCLI Command Format Standard |
Low |
Required when CLI is involved; service, operation, region, and parameter syntax |
Generate Mermaid data flow diagram → references/dataflow-diagram.md.
Generate IAM policies → references/iam-policies.md using least privilege.
Record API references — Keep verified API paths in phase-2-summary.json. If a generated Skill needs reusable API documentation, add a reference file under references/ using an allowed kebab-case filename.
Package limits — Total file content size ≤ 40 MB, total files ≤ 30, and SKILL.md ≤ 500 lines. Split oversized SKILL.md content into references/.
File extension allowlist — Every file must have one of these 46 extensions:
.md, .mdx, .txt, .json, .json5, .yaml, .yml, .toml, .js, .cjs, .mjs, .ts, .tsx, .jsx, .py, .sh, .ps1, .psm1, .psd1, .r, .rb, .go, .rs, .swift, .kt, .java, .cs, .cpp, .c, .h, .hpp, .sql, .csv, .tsv, .ini, .cfg, .conf, .env, .properties, .dat, .xml, .html, .css, .scss, .sass, .svg.
Files without an extension or outside this allowlist must be removed or renamed.
Change scope — A pull request must change only one Skill directory. Use bash scripts/validate-skill.sh -s {skill-path} -b <base-ref> to validate the PR diff when a base ref is available.
🛑 Strictly prohibited from generating hallucinated URIs / fabricated API paths. Feature points not verified in Phase 2 must not have specific commands written.
Output: phase-3-summary.json — List of generated files and structure validation results
Phase 4: Test Preparation
Dependency: Phase 3 document generation completed (phase-3-summary.json exists)
Generate test cases — Split test cases based on Phase 2/3 feature points
| Case Type |
Coverage Requirement |
Example |
| CLI cases |
One case per hcloud command |
hcloud ECS ListServers --cli-region=cn-north-4 --limit=1 |
| SDK cases |
One case per SDK call |
list_sub_customer_coupons(limit=1) |
| API cases |
One case per user-provided endpoint |
curl -X GET {endpoint} |
Save test cases as JSON → templates/test-vars.json:
{"test_cases": [{"id": "TC-01", "name": "...", "command": "...", "expected": "..."}]}
Show all test cases to the user for confirmation
Run tests:
- Read AK/SK from environment variables: 自动扫描所有以
HUAWEI / HW / HWC 开头的环境变量,匹配其中含 ACCESS_KEY / _AK / SECRET_KEY / _SK 的键值对
- If no valid AK/SK env var or CLI profile is detected, re-run the Pre-check env-var setup template (see Pre-check → Verification Steps) and STOP — never ask the user to type AK/SK in chat. If the user cannot / will not provide env vars, terminate the process. Strictly prohibited from skipping credential-required steps.
- Execute test cases one by one
- Before executing mutating commands (Create/Update/Delete), must prompt the user and wait for confirmation
Test verification flow:
Each case → Try CLI execution
├── ✅ Success → Record PASS
└── ❌ Failure → Check syntax issues
├── ✅ Syntax issue → Fix and retry
└── ❌ Non-syntax issue → Fallback to SDK
├── ✅ Success → Record PASS (SDK)
└── ❌ Failure → Fallback to API (user-provided endpoint)
├── ✅ Success → Record PASS (API)
└── ❌ Failure → Record FAIL ⛔ requires manual verification
Output: phase-4-summary.json — Test case list + per-case execution results
Phase 5: Detailed Testing
Dependency: Phase 4 test preparation completed (phase-4-summary.json exists)
- Full regression: Execute all test cases generated in Phase 4
- Resource lifecycle testing (Skills involving resource creation/modification/deletion):
- Create resource → verify creation succeeded (query to confirm) → runtime query → destroy resource → verify release
- Test report outputs information on created/modified/deleted resources
- Prompt the user and wait for confirmation before each step
- Management-type Skills: CRUD → end-to-end full testing; query-only → output query results to test report
- Report generation: Test results aggregated by case; detailed resource-change records; detailed error info for failed cases
Output: phase-5-summary.json — Detailed test results + resource operation records
Phase 6: Resource Cleanup and Compliance Check
Dependency: Phase 5 detailed testing completed (phase-5-summary.json exists)
Resource Cleanup:
- Check whether all resources created in Phase 5 have been released
- Unreleased resources → Prompt user and attempt cleanup
- Record cleanup results
Huawei Cloud Skill Specification Compliance Check (against 华为云Skill检查规范):
| Check Item |
Level |
Verification Method |
| SKILL.md exists |
Critical |
File existence check |
| Skill directory under skills/ |
Low |
Path format: skills/{category}/{subcategory}/{skill-name}/ |
| Skill package naming convention |
High |
Directory name matches huawei-cloud-{product}-{function} |
| One PR submits only one Skill |
Critical |
git diff checks that PR changes only affect a single Skill directory |
| YAML Frontmatter exists |
Critical |
grep '^---$' |
| name field exists |
Critical |
Frontmatter name field exists and matches directory name |
| description field exists |
Critical |
Frontmatter description field exists and contains feature summary + trigger words |
| description includes trigger words |
Medium |
Accept Triggers include:, Use when, or equivalent trigger conditions |
| Should not contain version field |
Low |
No version field in frontmatter |
| Overview section |
High |
Match Overview or 概述 |
| Prerequisites section |
High |
Match Prerequisites or 前置条件 |
| Workflow section |
High |
Match Workflow or 工作流 |
| Core Commands section |
High |
Match Core Commands or 核心命令 |
| Parameter Confirmation section |
High |
Match Parameter Confirmation or 参数确认 |
| Reference Documents section |
Critical |
Match Reference Documents, References, or 参考文档 |
| KooCLI Command Format Standard section |
Low |
Required when CLI is involved; match the English or Chinese heading |
| references/cli-installation-guide.md |
High |
Required when CLI is involved, file existence |
| references/iam-policies.md |
Critical |
File existence |
| references/verification-method.md |
Medium |
Recommended file existence |
| references/acceptance-criteria.md |
Low |
Recommended file existence |
| Reference document kebab-case naming |
Low |
File names under references/ are all lowercase kebab-case |
| Credential hardcoding |
Critical |
grep for credential hardcoding patterns and CLI credential config |
| Cross-Skill direct calls |
Critical |
grep other Skill names |
| CLI write operations require confirmation |
Low |
Check whether user confirmation is prompted |
| Service name requirement |
Medium |
Every concrete hcloud service matches a KooCLI Service name and starts with uppercase/title case, such as ECS, CloudPond, or IAMAccessAnalyzer |
| Operation name PascalCase |
Medium |
Every concrete operation name uses PascalCase |
Includes --cli-region |
Medium |
Every concrete CLI command includes the region parameter |
| Total skill size ≤ 40 MB |
Medium |
Sum all file content sizes under the Skill directory |
| Total file count ≤ 30 |
Medium |
Count SKILL.md and every file in all subdirectories |
| SKILL.md line count ≤ 500 |
Medium |
Split excess content into references/ |
| File extensions in allowlist |
Medium |
Reject extensionless files and extensions outside the 46-type allowlist |
- Security Audit:
Have the Agent orchestrate the five-tool audit described in references/security-audit-guide.md. Do not invoke another named Skill or call scripts from another Skill directory directly.
The gate combines skillcheck, markdownlint-cli2, cisco-ai-skill-scanner, the Huawei Cloud specification check, and gitleaks. It must explicitly cover these Critical specification checks:
| Check |
Required coverage |
| Secret leak detection |
AK/SK hardcoding, hcloud configure set, and report-output masking |
| Vulnerability pattern detection |
Known command injection, reverse shell, dangerous function, and prompt injection patterns |
| Dependency security detection |
Known unsafe dependency versions via pip audit, safety check, or an equivalent tool |
| Insecure configuration detection |
Insecure protocols, weak passwords, and unsafe defaults |
ERROR or CRITICAL findings must be fixed and re-audited. WARNING-only results require explicit user acceptance. Record the report path, verdict, findings, and accepted warnings in phase-6-summary.json.
Final report:
- Merge Phase 1-6 phase summaries
- Include key conclusions from the security audit report (skill-gate-report)
- Output complete creation report
- Mark all incomplete items
Final six-phase completeness check:
Check phase-1-summary.json exists → If missing, restart from Phase 1
Check phase-2-summary.json exists → If missing, restart from Phase 2
Check phase-3-summary.json exists → If missing, restart from Phase 3
Check phase-4-summary.json exists → If missing, restart from Phase 4
Check phase-5-summary.json exists → If missing, restart from Phase 5
Check phase-6-summary.json exists → If missing, restart from Phase 6
All phases complete → Creation done. Missing phases → Restart from the missing phase.
Report skill creation via the common reporting SDK (Mandatory): After the completeness check fully passes, report this creator usage through the common skill reporting SDK (huawei-cloud-skill-reporter). This call is what counts the creator's usage statistics.
bash scripts/report-skill-created.sh {skill-name} "{skill-path}"
- The script delegates to the huawei-cloud-skill-reporter standalone CLI (
report.mjs) — the single source of truth for URL / IP / payload logic (same SDK integrated by skill-auto-test-pr/run-pipeline.sh).
- Fire-and-forget: the report never blocks or fails the creation flow. If the SDK is not installed or the network is unreachable, the script prints a WARNING and still exits 0.
- This step is mandatory and cannot be skipped — the SDK statistics for the creator depend on it.
Clean up phase summary files: After completeness check passes, delete all phase-*-summary.json files under the skill directory
# Execute after final completeness check passes
# Safety check: ensure skill-path is a legitimate directory under the expected path
[ -d "{skill-path}" ] && [ -f "{skill-path}/SKILL.md" ] && rm -f {skill-path}/phase-*.json
echo "✅ phase-1~6-summary.json cleanup complete"
Note: Only perform cleanup after the completeness check fully passes. If there are missing phases, do not clean up; restart from the missing phase.
Output: phase-6-summary.json — Final creation report + compliance check results + security audit conclusion
Skill Usage Reporting (通用上报 SDK)
The creator reports its own usage through the common skill reporting SDK (huawei-cloud-skill-reporter) every time a skill creation completes. This telemetry is used to count creator usage statistics.
- SDK entry point: the
huawei-cloud-skill-reporter standalone CLI (report.mjs, run via node report.mjs <skill> <status> [request] [result]), resolved by scripts/report-skill-created.sh
- Reported skill: always
huawei-cloud-skill-creator (this skill), status=success, request="created skill: <skill-name>", result=<skill-path>
- Integration point: mandatory Phase 6 step 6 —
bash scripts/report-skill-created.sh {skill-name} "{skill-path}"
- Failure handling: fire-and-forget; a missing SDK or network error is logged as a WARNING and never blocks the six-phase pipeline
- Overrides:
HUAWEI_CLOUD_SKILL_REPORT_URL overrides the report endpoint (forwarded to report.mjs)
KooCLI Command Format Standard
hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]
| Feature |
Description |
Example |
| Service name |
Exact KooCLI Service name beginning with uppercase/title case |
ECS, VPC, CloudPond, IAMAccessAnalyzer |
| Operation name |
PascalCase |
ListServers, ShowServer |
| Region parameter |
--cli-region=<value> |
--cli-region=cn-north-4 |
| Simple parameter |
--key=value |
--server_id=xxx |
| Indexed parameter |
--key.1=value1 |
--servers.1.id=xxx |
Core Commands
| Command |
Purpose |
bash scripts/validate-skill.sh -s {path} |
Phase 3/6: Structure and Huawei Cloud specification validation |
bash scripts/test-cli-commands.sh -s {path} -e {cli|sdk|api} |
Phase 4/5: Functional testing |
bash scripts/report-skill-created.sh {skill-name} "{skill-path}" |
Phase 6: Report creator usage via the common skill reporting SDK (huawei-cloud-skill-reporter) |
test-cli-commands.sh 仅执行白名单命令(hcloud/python3/curl/bash 开头),其他命令被拒绝且不会执行。validate-skill.sh 对不存在的 skill 目录会明确报错(exit 1)。
Parameter Confirmation
| Parameter |
Required |
Description |
Example |
{skill-path} |
Yes |
Target Skill directory path |
e.g., huawei-cloud-ecs-manage |
{region} |
No |
Huawei Cloud region |
cn-north-4 |
{executor} |
No |
Execution mode (cli/sdk/api) |
cli |
Edge Cases
| Scenario |
Handling |
| User skips questions and says "start" directly |
Remind: requirements analysis must be completed first, start from Phase 1 questions |
| AK/SK environment variables not set |
Re-run the Pre-check above. Output the env-var setup template (export HUAWEI_ACCESS_KEY=... / export HUAWEI_SECRET_KEY=...) and let the user fill it out-of-band. NEVER ask the user to paste AK/SK into chat. If user does not configure, terminate process, strictly prohibited from skipping |
| Target service not supported by hcloud CLI |
Phase 2 fallback to SDK → Read SDK source _http_info → If still not found, mark ⛔ |
| SDK package does not exist |
Check package name variants, if still not found, inform user, do not infer API |
| User is unsure of API endpoint |
Mark ⛔ requires manual verification, do not fabricate endpoints. If SDK has the method, read _http_info for the real path |
| SDK has method but _http_info has no resource_path |
Mark ⛔, this API does not exist in the SDK, do not infer |
| Attempting to infer API via path pattern (e.g., inferring claim-vouchers from coupons) |
❌ Strictly prohibited. It doesn't exist |
| Resource creation test fails |
Analyze error cause (permissions/quota/parameters) → Fix and retry |
| Resource release fails |
Retry 3 times, if still failing, inform user to clean up manually |
| templates/test-vars.json missing when running tests |
test-cli-commands.sh reports FATAL and exits 1 (no tests executed). Re-run Phase 4 to generate templates/test-vars.json before testing |
| User refuses resource lifecycle testing |
Inform user: resource lifecycle testing is a required step and cannot be skipped; if user still refuses, terminate process |
| Phase 6 finds missing phases |
Restart from the missing phase until all 6 phases are complete |
| SDK has method but actual API path unknown |
Read SDK source grep _http_info {service}_client.py to get real path |
| BSS service SDK initialization fails (GlobalCredentials) |
BSS is global and must use GlobalCredentials with with_endpoints, not BasicCredentials with with_region |
| list_sub_customer_coupons query returns 400 |
BSS limit parameter maximum is 100, not the default 200 |
| Phase 6 security audit FAIL |
Fix issues from the audit report, then have the Agent rerun the audit until it passes |
| Reporter SDK not installed (report.mjs missing) |
report-skill-created.sh prints a WARNING and exits 0 — creation flow continues; do not skip the six-phase pipeline over a telemetry failure |
| skill-scanner false positive |
Use <!-- skill-scanner:ignore --> comment annotation, or exclude in .secrets.baseline |
| gitleaks false positive |
Add to .gitleaksignore file |
Verification Method
Specification Compliance Verification
bash scripts/validate-skill.sh -s {skill-path}
# Check against 华为云Skill检查规范 item by item
Functional Testing
bash scripts/test-cli-commands.sh -s {skill-path} -e cli # CLI priority
bash scripts/test-cli-commands.sh -s {skill-path} -e sdk # SDK fallback
bash scripts/test-cli-commands.sh -s {skill-path} -e api # API fallback
Six-Phase Completeness Check
Final verification: Check whether phase-1-summary.json ~ phase-6-summary.json exist
All exist ✅ → Creation complete
Missing any ❌ → Restart from the missing phase
Security Audit (Phase 6)
Have the Agent orchestrate the tools listed in references/security-audit-guide.md, collect their findings into the Phase 6 report, fix every ERROR/CRITICAL issue, and repeat until the gate passes. Do not call another Skill's scripts directly.
Reference Documents
references/cli-installation-guide.md — CLI installation and configuration
references/iam-policies.md — Least-privilege IAM policies
references/verification-method.md — Verification method details
references/dataflow-diagram.md — Mermaid data flow diagram
references/acceptance-criteria.md — Acceptance criteria
references/related-commands.md — Command quick reference
references/security-audit-guide.md — Phase 6 five-tool security audit and remediation guide
Notes & Design Principles
- Six-phase strict pipeline — phases are chain-dependent, sequential, and cannot be skipped
- Phase 2 No API Inference — endpoints only from SDK
_http_info or API Explorer; never guess via naming patterns
- Phase 3 Generate Based on Facts — commands/scripts/endpoints per Phase 2 conclusions; no endpoint → mark ⛔
- Phase 4/5 Real Execution — every command actually executed and verified; mutating operations (Create/Update/Delete) require user confirmation first
- Phase 6 Double Check — resource cleanup + specification compliance + six-phase completeness; fix failures first, then re-verify
- Credential Security — no hardcoded AK/SK; read from env vars (
HUAWEI_*/HW_*/HWC_* with ACCESS_KEY/_AK/SECRET_KEY/_SK) or active CLI profile; never entered via hcloud configure set with literal values
- Credentials Mandatory — if AK/SK missing after the Pre-check, output the env-var setup template for out-of-band fill; never ask the user to paste AK/SK into chat; if still unconfigured, terminate
- BSS SDK must use GlobalCredentials + with_endpoints, not BasicCredentials with with_region
- Cleanup — resources created during lifecycle testing must be released in Phase 6
- Security audit — CRITICAL/ERROR findings fixed and re-audited; skill-scanner only detects known cloud API key formats, so gitleaks supplements for common passwords/Chinese credentials
- Least privilege — iam-policies.md provides least-privilege policy JSON; the skillPath in skills-lock.json is
skills/devtools/common/huawei-cloud-skill-creator/SKILL.md
1---
2name: huawei-cloud-skill-creator
3version: 2.1.3
4description: |
5 1. Six-phase pipeline for creating Huawei Cloud skills — Socratic requirements gathering, CLI→SDK→API research, MD generation, test preparation, detailed testing, and final cleanup & compliance check
6 2. Phase-chained dependency: each phase builds on the previous phase's output, no phase may be skipped
7 3. Supports CLI, SDK, and REST API execution modes with automatic fallback detection
8 4. Generates complete skill directory structure with SKILL.md, references/, scripts/, templates/
9 5. Validates against the Huawei Cloud Skill Specification (华为云Skill检查规范)
10 Triggers include: "创建华为云Skill","新建华为云Skill","华为云skill创建器","创建 Skill","新建 Skill","skill 创建器","create skill","build skill","new skill","skill creator","scaffold a Huawei Cloud skill","wrap CLI or OpenAPI into a skill","package cloud operations into a skill","帮我创建华为云Skill","帮我新建一个Skill","封装华为云CLI为Skill","华为云Skill脚手架","帮我创建一个skill","我需要一个skill","建一个skill","生成skill","帮我建一个华为云skill".
11tags: [huawei-cloud, skill-creator, cli, sdk, devops]
12---
13
14# Huawei Cloud Skill Creator v2
15
16> **Six-Phase Strict Pipeline** — Each phase depends on the previous phase's output and cannot be skipped. If any phase is missing, restart from the missing phase.
17
18## Overview
19
20The Huawei Cloud Skill Creator v2 is based on a six-phase strict pipeline: starting with Socratic Q&A requirements analysis, followed by technical research (CLI→SDK→API three-level fallback), document generation, test preparation, detailed testing, resource cleanup and compliance check, ultimately generating a complete skill package that conforms to the Huawei Cloud Skill Specification. It only creates/packages skills — it does not directly operate cloud resources (no creating/deleting/modifying ECS, VPC, OBS, etc.); use it to generate a management Skill or use another dedicated management Skill for cloud-resource operations.
21
22## Pre-check: Huawei Cloud Credentials Required
23
24> **Mandatory gate.** This pre-check MUST pass before invoking any hcloud / huaweicloudsdk command — including Phase 2 research, Phase 4/5 testing, and Phase 6 validation. If no valid credential profile is detected, STOP and obtain credentials **out-of-band**.
25
26### Security Rules
27
28- **NEVER** read, echo, or print AK/SK values (e.g., printing the value of an `HUAWEI_ACCESS_KEY`-style env var is **FORBIDDEN**).
29- **NEVER** read or cat the on-disk credential files for hcloud, obsutil, the SDK, or any other secret-storing location. Treat all such files as confidential; the *names* of those files (used by their owners) are documented in `references/cli-installation-guide.md`.
30- **NEVER** ask the user to input AK/SK directly in the conversation or command line.
31- **NEVER** invoke `hcloud configure set` with literal credential strings passed via the CLI's `cli-<ak-flag>` / `cli-<sk-flag>` parameters or any equivalent in-band secret-entry form.
32- **ONLY** use `hcloud configure list` to check credential status — non-interactive, read-only, no secrets echoed.
33
34### Verification Steps
35
36```bash
37hcloud configure list
38```
39
40Check the output for a valid profile (AK/SK, or temporary security credentials / agency-assumed role).
41
42If no valid profile exists, **STOP** here.
43
441. Obtain credentials from **Huawei Cloud Console** → 身份与访问管理 (IAM) → 我的凭证 → 新增访问密钥.
452. **Output** the following copy-paste ready env-var setup block to the user (fill in real values **outside** of this session, never in chat). The Agent must **NEVER** ask the user to type the AK/SK value in the conversation — only emit the template below:
46
47 ```bash
48 # Set Huawei Cloud credentials. The secret key is entered silently when prompted.
49 export HUAWEI_ACCESS_KEY="<your-access-key-id>"
50 read -rs HUAWEI_SECRET_KEY; export HUAWEI_SECRET_KEY
51 export HUAWEI_REGION="cn-north-4"
52 ```
53
54 Optional alternative (interactive out-of-band step only, never with literal values): `hcloud configure` — prompts for AK/SK in the user's terminal
553. After the user confirms they have configured env vars (or run `hcloud configure`), re-run `hcloud configure list`. If the profile is valid → resume Phase 1. If still missing → terminate, do not proceed.
56
57> **Reuse the active CLI profile for all subsequent `hcloud` and `huaweicloudsdk` calls.** Do not print or hardcode secrets. Do not replace this gate with `obsutil config`, `hcloud configure set` with literal arguments, SDK credentials constructors filled with literal strings (for example, the SDK's `BasicCredentials` built from string literals rather than env vars), or any other in-session secret-entry flow.
58
59### Credential Source Priority
60
61When invoking commands later (Phase 2/4/5), the skill accepts credentials in this priority order:
62
63| Priority | Source | Notes |
64|----------|--------|-------|
65| 1 | Environment variables | Auto-scan all variables prefixed with `HUAWEI` / `HW` / `HWC` containing `ACCESS_KEY` / `_AK` / `SECRET_KEY` / `_SK` |
66| 2 | `hcloud configure` profile | Active CLI profile — preferred for hcloud calls |
67| 3 | IAM agency / temporary credentials | AK/SK + SecurityToken (programmatic access) |
68
69If **none** of the above are available when Phase 4/5 testing starts, prompt the user once to configure them out-of-band and re-run the pre-check. If still unavailable, **terminate the process** — strictly prohibited from skipping credential-required steps.
70
71## Prerequisites
72
731. **hcloud CLI** installed and authenticated — Reference: https://support.huaweicloud.com/qs-hcli/hcli_02_003.html
74 - Authentication verified via the **Pre-check** above (`hcloud configure list`).
752. **Python 3.8+** with `huaweicloudsdk` packages — install on demand: `pip install huaweicloudsdkcore huaweicloudsdkecs`. Verify with `python3 -c "import huaweicloudsdkcore"` before Phase 2/4/5. SDK Reference: https://console.huaweicloud.com/apiexplorer/#/sdkcenter
763. **Node.js + npx** available
774. **Huawei Cloud AK/SK** — Auto-scan all environment variables prefixed `HUAWEI` / `HW` / `HWC` matching `ACCESS_KEY` / `_AK` / `SECRET_KEY` / `_SK`. Hardcoding AK/SK in scripts, docs, or command lines is **forbidden**.
785. **API Reference**: https://console.huaweicloud.com/apiexplorer/#/openapi
79
80## Workflow — Six-Phase Strict Pipeline
81
82```
83Phase 1 (Q&A) → Phase 2 (Tech Research) → Phase 3 (Generate MD)
84 → Phase 4 (Test Prep) → Phase 5 (Detailed Testing) → Phase 6 (Cleanup & Report)
85```
86
87**Strict Rules:**
88- Each phase **must** output a phase summary (phase-N-summary)
89- Before starting each phase, **must** verify that the previous phase's summary file exists
90- After all 6 phases are completed, perform a **final check** for any missing phases. If any are missing, restart from the missing phase
91- Skipping any phase is strictly prohibited
92- The **Pre-check: Huawei Cloud Credentials Required** gate must have passed before any Phase 2 research or Phase 4/5 execution begins
93
94### Phase 1: Requirements Analysis (Socratic Q&A)
95
96**Goal:** Clarify user requirements through question-by-question dialogue.
97
98- Ask **one question** at a time, wait for the user's response
99- Cover the following dimensions:
100 1. **Target Service** — Which Huawei Cloud service? (ECS, VPC, OBS, RDS, BSS, etc.)
101 2. **Feature Scope** — What should the Skill do? (Query, Diagnose, Deploy, Monitor, Manage)
102 3. **Execution Mode** — Prefer CLI / SDK / API?
103 4. **CLI Operations** — Which operations are involved? (List, Show, Create, Delete, Update)
104 5. **Trigger Scenarios** — When would an Agent invoke this? (Daily inspection, troubleshooting, auto-scaling)
105- After every 5 questions or covering all dimensions → Display requirements summary table → Wait for user confirmation
106- **🛑 Do NOT proceed to Phase 2 until the user has explicitly confirmed**
107
108**Output:** `phase-1-summary.json` — User-confirmed requirements description
109
110### Phase 2: Technical Research (CLI→SDK→API Three-Level Fallback)
111
112**Dependency:** Phase 1 requirements analysis completed (phase-1-summary.json exists)
113
114For each feature point confirmed in Phase 1, research availability in the following order:
115
116| Priority | Research Method | Verification Command | Success Criteria |
117|----------|----------------|---------------------|-----------------|
118| 1st | **CLI** — hcloud command | `hcloud <Service> <Operation> --cli-region=cn-north-4 --help` | Command exists and parameters are valid |
119| 2nd | **SDK** — huaweicloudsdk | `python3 -c "from huaweicloudsdk{service}.v2 import ..."` | SDK package installed and class importable |
120| 3rd | **API** — **Only from the following two sources** | See rules below | Endpoint from a trusted source, not inferred |
121
122**Core Rule: API Endpoint Forensics (No Guessing)**
123
124API endpoints are **only allowed** from the following two sources. **Strictly prohibited from inferring through naming patterns**:
125
126| Trusted Source | Method |
127|----------------|--------|
128| ① **SDK source `_http_info` `resource_path`** | `grep -A8 "_http_info" {service}_client.py` → Read `resource_path` value |
129| ② **Huawei Cloud API Explorer** (api-explorer.huaweicloud.com) | User searches and confirms on that website |
130
131**❌ Strictly prohibited actions:**
132- Inferring new endpoints based on other API path patterns (e.g., inferring **claim-vouchers** endpoint from **coupons** endpoint)
133- Constructing URIs yourself based on documentation descriptions
134- Using "common naming patterns" to guess API paths
135- If the SDK is available but the corresponding function has no method in `_http_info` → Mark ⛔, do not infer
136
137**Execution Rules:**
138
139```
140Research feature point N
141 ├── CLI available → Record as CLI mode, record specific command
142 ├── CLI unavailable → Check SDK
143 │ ├── SDK available → Record as SDK mode
144 │ │ ├── Read all _http_info methods from SDK source to obtain real REST paths
145 │ │ │ grep "resource_path" <sdk_path>/{service}_client.py
146 │ │ └── Feature point's corresponding method has _http_info in SDK → Record real API endpoint
147 │ │ Feature point's corresponding method has no _http_info in SDK → Mark ⛔, do not infer
148 │ ├── SDK unavailable → Ask user to confirm endpoint from API Explorer
149 │ │ ├── User finds endpoint from API Explorer → Record as API mode, note the source
150 │ │ ├── User provides endpoint (other source) → Record as API mode, mark ⚠ user-provided
151 │ │ └── User cannot provide → Mark ⛔
152 │ └── SDK partially available (some methods missing and no corresponding _http_info) → Mark missing features as ⛔
153 └── Generate feature point research result (including execution mode + real API path if available)
154```
155
156**🛑 Agent is strictly forbidden from guessing/fabricating API paths on its own. If neither the SDK source nor API Explorer has the endpoint, mark it ⛔ — it doesn't exist.**
157
158**Tips for finding SDK client source paths:**
159```bash
160python3 -c "import huaweicloudsdk{service}.v2 as m; import os; print(os.path.dirname(m.__file__))" # package path
161grep "_http_info" <path>/{service}_client.py # all API endpoints
162grep -A8 "_{method}_http_info" <path>/{service}_client.py # "resource_path" = real REST endpoint
163```
164
165**Output:** `phase-2-summary.json` — Execution mode (CLI/SDK/API/⛔) and corresponding command/code/API path for each feature point
166
167### Phase 3: Document Generation
168
169**Dependency:** Phase 2 technical research completed (phase-2-summary.json exists)
170
171Generate Skill files based on Phase 2 conclusions:
172
1731. **Name the Skill** — Use `huawei-cloud-{product}-{function}` and make the frontmatter `name` match the directory name.
1742. **Language** — Generate SKILL.md in **English** by default. Chinese documentation may be added in `references/` as supplementary. The main SKILL.md must use English for frontmatter description, section titles, command examples, and all explanatory content.
1753. **Frontmatter** — Include `name`, `description` with a feature summary and trigger conditions, and no more than five `tags`. Do not generate a `version` field.
1764. **Create directory structure:**
177 ```text
178 skills/{skill-name}/ → SKILL.md, references/ (iam-policies.md required; cli-installation-guide.md required when CLI is used; verification-method.md / dataflow-diagram.md / acceptance-criteria.md recommended), scripts/test-cli-commands.sh, templates/test-vars.json
179 ```
1805. **SKILL.md content generation rules:**
181
182 | Execution Mode | Command Format in SKILL.md |
183 |---------------|---------------------------|
184 | **CLI** | `hcloud <Service> <Operation> --cli-region={region} [--params]` |
185 | **SDK** | Python script example (`python3 -c "..."`) |
186 | **API** | curl command + user-provided endpoint (mark as user-provided) |
187 | **Unavailable** | Mark `requires manual verification`, do not generate specific commands |
188
1896. **Required sections in SKILL.md:**
190
191 | Section | Severity | Description |
192 |---------|----------|-------------|
193 | YAML Frontmatter | Critical | `name` + `description` with feature summary and trigger conditions + `tags`; no `version` |
194 | Overview | High | Feature overview, architecture, applicable scenarios |
195 | Prerequisites | High | CLI version, authentication configuration, IAM permissions |
196 | Workflow | High | Skill workflow steps |
197 | Core Commands | High | Command examples grouped by function |
198 | Parameter Confirmation | High | User-configurable parameter table |
199 | Reference Documents | Critical | Links to documents under `references/` |
200 | KooCLI Command Format Standard | Low | Required when CLI is involved; service, operation, region, and parameter syntax |
201
2027. **Generate Mermaid data flow diagram** → `references/dataflow-diagram.md`.
2038. **Generate IAM policies** → `references/iam-policies.md` using least privilege.
2049. **Record API references** — Keep verified API paths in `phase-2-summary.json`. If a generated Skill needs reusable API documentation, add a reference file under `references/` using an allowed kebab-case filename.
20510. **Package limits** — Total file content size ≤ 40 MB, total files ≤ 30, and SKILL.md ≤ 500 lines. Split oversized SKILL.md content into `references/`.
20611. **File extension allowlist** — Every file must have one of these 46 extensions:
207 `.md`, `.mdx`, `.txt`, `.json`, `.json5`, `.yaml`, `.yml`, `.toml`, `.js`, `.cjs`, `.mjs`, `.ts`, `.tsx`, `.jsx`, `.py`, `.sh`, `.ps1`, `.psm1`, `.psd1`, `.r`, `.rb`, `.go`, `.rs`, `.swift`, `.kt`, `.java`, `.cs`, `.cpp`, `.c`, `.h`, `.hpp`, `.sql`, `.csv`, `.tsv`, `.ini`, `.cfg`, `.conf`, `.env`, `.properties`, `.dat`, `.xml`, `.html`, `.css`, `.scss`, `.sass`, `.svg`.
208 Files without an extension or outside this allowlist must be removed or renamed.
20912. **Change scope** — A pull request must change only one Skill directory. Use `bash scripts/validate-skill.sh -s {skill-path} -b <base-ref>` to validate the PR diff when a base ref is available.
210
211**🛑 Strictly prohibited from generating hallucinated URIs / fabricated API paths. Feature points not verified in Phase 2 must not have specific commands written.**
212
213**Output:** `phase-3-summary.json` — List of generated files and structure validation results
214
215### Phase 4: Test Preparation
216
217**Dependency:** Phase 3 document generation completed (phase-3-summary.json exists)
218
2191. **Generate test cases** — Split test cases based on Phase 2/3 feature points
220
221 | Case Type | Coverage Requirement | Example |
222 |-----------|---------------------|---------|
223 | CLI cases | One case per hcloud command | `hcloud ECS ListServers --cli-region=cn-north-4 --limit=1` |
224 | SDK cases | One case per SDK call | `list_sub_customer_coupons(limit=1)` |
225 | API cases | One case per user-provided endpoint | `curl -X GET {endpoint}` |
226
2272. **Save test cases as JSON** → `templates/test-vars.json`:
228 ```json
229 {"test_cases": [{"id": "TC-01", "name": "...", "command": "...", "expected": "..."}]}
230 ```
231
2323. **Show all test cases to the user for confirmation**
233
2344. **Run tests:**
235 - Read AK/SK from environment variables: 自动扫描所有以 `HUAWEI` / `HW` / `HWC` 开头的环境变量,匹配其中含 `ACCESS_KEY` / `_AK` / `SECRET_KEY` / `_SK` 的键值对
236 - **If no valid AK/SK env var or CLI profile is detected, re-run the Pre-check env-var setup template (see Pre-check → Verification Steps) and STOP — never ask the user to type AK/SK in chat.** If the user cannot / will not provide env vars, **terminate the process**. Strictly prohibited from skipping credential-required steps.
237 - Execute test cases one by one
238 - **Before executing mutating commands (Create/Update/Delete), must prompt the user and wait for confirmation**
239
2405. **Test verification flow:**
241
242 ```
243 Each case → Try CLI execution
244 ├── ✅ Success → Record PASS
245 └── ❌ Failure → Check syntax issues
246 ├── ✅ Syntax issue → Fix and retry
247 └── ❌ Non-syntax issue → Fallback to SDK
248 ├── ✅ Success → Record PASS (SDK)
249 └── ❌ Failure → Fallback to API (user-provided endpoint)
250 ├── ✅ Success → Record PASS (API)
251 └── ❌ Failure → Record FAIL ⛔ requires manual verification
252 ```
253
254**Output:** `phase-4-summary.json` — Test case list + per-case execution results
255
256### Phase 5: Detailed Testing
257
258**Dependency:** Phase 4 test preparation completed (phase-4-summary.json exists)
259
2601. **Full regression:** Execute all test cases generated in Phase 4
2612. **Resource lifecycle testing** (Skills involving resource creation/modification/deletion):
262 - Create resource → verify creation succeeded (query to confirm) → runtime query → destroy resource → verify release
263 - Test report outputs information on created/modified/deleted resources
264 - **Prompt the user and wait for confirmation before each step**
2653. **Management-type Skills**: CRUD → end-to-end full testing; query-only → output query results to test report
2664. **Report generation:** Test results aggregated by case; detailed resource-change records; detailed error info for failed cases
267
268**Output:** `phase-5-summary.json` — Detailed test results + resource operation records
269
270### Phase 6: Resource Cleanup and Compliance Check
271
272**Dependency:** Phase 5 detailed testing completed (phase-5-summary.json exists)
273
2741. **Resource Cleanup:**
275 - Check whether all resources created in Phase 5 have been released
276 - Unreleased resources → Prompt user and attempt cleanup
277 - Record cleanup results
278
2792. **Huawei Cloud Skill Specification Compliance Check** (against 华为云Skill检查规范):
280
281 | Check Item | Level | Verification Method |
282 |-----------|-------|-------------------|
283 | SKILL.md exists | Critical | File existence check |
284 | Skill directory under skills/ | Low | Path format: skills/{category}/{subcategory}/{skill-name}/ |
285 | Skill package naming convention | High | Directory name matches huawei-cloud-{product}-{function} |
286 | One PR submits only one Skill | Critical | git diff checks that PR changes only affect a single Skill directory |
287 | YAML Frontmatter exists | Critical | `grep '^---$'` |
288 | name field exists | Critical | Frontmatter name field exists and matches directory name |
289 | description field exists | Critical | Frontmatter description field exists and contains feature summary + trigger words |
290 | description includes trigger words | Medium | Accept `Triggers include:`, `Use when`, or equivalent trigger conditions |
291 | Should not contain version field | Low | No `version` field in frontmatter |
292 | Overview section | High | Match `Overview` or `概述` |
293 | Prerequisites section | High | Match `Prerequisites` or `前置条件` |
294 | Workflow section | High | Match `Workflow` or `工作流` |
295 | Core Commands section | High | Match `Core Commands` or `核心命令` |
296 | Parameter Confirmation section | High | Match `Parameter Confirmation` or `参数确认` |
297 | Reference Documents section | Critical | Match `Reference Documents`, `References`, or `参考文档` |
298 | KooCLI Command Format Standard section | Low | Required when CLI is involved; match the English or Chinese heading |
299 | references/cli-installation-guide.md | High | Required when CLI is involved, file existence |
300 | references/iam-policies.md | Critical | File existence |
301 | references/verification-method.md | Medium | Recommended file existence |
302 | references/acceptance-criteria.md | Low | Recommended file existence |
303 | Reference document kebab-case naming | Low | File names under references/ are all lowercase kebab-case |
304 | Credential hardcoding | Critical | grep for credential hardcoding patterns and CLI credential config |
305 | Cross-Skill direct calls | Critical | grep other Skill names |
306 | CLI write operations require confirmation | Low | Check whether user confirmation is prompted |
307 | Service name requirement | Medium | Every concrete hcloud service matches a KooCLI Service name and starts with uppercase/title case, such as `ECS`, `CloudPond`, or `IAMAccessAnalyzer` |
308 | Operation name PascalCase | Medium | Every concrete operation name uses PascalCase |
309 | Includes `--cli-region` | Medium | Every concrete CLI command includes the region parameter |
310 | Total skill size ≤ 40 MB | Medium | Sum all file content sizes under the Skill directory |
311 | Total file count ≤ 30 | Medium | Count SKILL.md and every file in all subdirectories |
312 | SKILL.md line count ≤ 500 | Medium | Split excess content into `references/` |
313 | File extensions in allowlist | Medium | Reject extensionless files and extensions outside the 46-type allowlist |
314
315 3. **Security Audit:**
316
317 Have the Agent orchestrate the five-tool audit described in `references/security-audit-guide.md`. Do not invoke another named Skill or call scripts from another Skill directory directly.
318
319 The gate combines skillcheck, markdownlint-cli2, cisco-ai-skill-scanner, the Huawei Cloud specification check, and gitleaks. It must explicitly cover these Critical specification checks:
320
321 | Check | Required coverage |
322 |-------|-------------------|
323 | Secret leak detection | AK/SK hardcoding, `hcloud configure set`, and report-output masking |
324 | Vulnerability pattern detection | Known command injection, reverse shell, dangerous function, and prompt injection patterns |
325 | Dependency security detection | Known unsafe dependency versions via `pip audit`, `safety check`, or an equivalent tool |
326 | Insecure configuration detection | Insecure protocols, weak passwords, and unsafe defaults |
327
328 ERROR or CRITICAL findings must be fixed and re-audited. WARNING-only results require explicit user acceptance. Record the report path, verdict, findings, and accepted warnings in `phase-6-summary.json`.
329
3304. **Final report:**
331 - Merge Phase 1-6 phase summaries
332 - Include key conclusions from the security audit report (skill-gate-report)
333 - Output complete creation report
334 - Mark all incomplete items
335
3365. **Final six-phase completeness check:**
337
338 ```
339 Check phase-1-summary.json exists → If missing, restart from Phase 1
340 Check phase-2-summary.json exists → If missing, restart from Phase 2
341 Check phase-3-summary.json exists → If missing, restart from Phase 3
342 Check phase-4-summary.json exists → If missing, restart from Phase 4
343 Check phase-5-summary.json exists → If missing, restart from Phase 5
344 Check phase-6-summary.json exists → If missing, restart from Phase 6
345 ```
346
347 **All phases complete → Creation done. Missing phases → Restart from the missing phase.**
348
3496. **Report skill creation via the common reporting SDK (Mandatory):** After the completeness check fully passes, report this creator usage through the common skill reporting SDK (huawei-cloud-skill-reporter). This call is what counts the creator's usage statistics.
350
351 ```bash
352 bash scripts/report-skill-created.sh {skill-name} "{skill-path}"
353 ```
354
355 - The script delegates to the huawei-cloud-skill-reporter standalone CLI (`report.mjs`) — the single source of truth for URL / IP / payload logic (same SDK integrated by `skill-auto-test-pr/run-pipeline.sh`).
356 - **Fire-and-forget:** the report never blocks or fails the creation flow. If the SDK is not installed or the network is unreachable, the script prints a WARNING and still exits 0.
357 - This step is mandatory and cannot be skipped — the SDK statistics for the creator depend on it.
358
3597. **Clean up phase summary files:** After completeness check passes, delete all `phase-*-summary.json` files under the skill directory
360
361 ```bash
362 # Execute after final completeness check passes
363 # Safety check: ensure skill-path is a legitimate directory under the expected path
364 [ -d "{skill-path}" ] && [ -f "{skill-path}/SKILL.md" ] && rm -f {skill-path}/phase-*.json
365 echo "✅ phase-1~6-summary.json cleanup complete"
366 ```
367
368 **Note:** Only perform cleanup after the completeness check **fully passes**. If there are missing phases, do not clean up; restart from the missing phase.
369
370**Output:** `phase-6-summary.json` — Final creation report + compliance check results + security audit conclusion
371
372## Skill Usage Reporting (通用上报 SDK)
373
374The creator reports its own usage through the common skill reporting SDK (`huawei-cloud-skill-reporter`) every time a skill creation completes. This telemetry is used to count creator usage statistics.
375
376- **SDK entry point:** the `huawei-cloud-skill-reporter` standalone CLI (`report.mjs`, run via `node report.mjs <skill> <status> [request] [result]`), resolved by `scripts/report-skill-created.sh`
377- **Reported skill:** always `huawei-cloud-skill-creator` (this skill), `status=success`, `request="created skill: <skill-name>"`, `result=<skill-path>`
378- **Integration point:** mandatory Phase 6 step 6 — `bash scripts/report-skill-created.sh {skill-name} "{skill-path}"`
379- **Failure handling:** fire-and-forget; a missing SDK or network error is logged as a WARNING and never blocks the six-phase pipeline
380- **Overrides:** `HUAWEI_CLOUD_SKILL_REPORT_URL` overrides the report endpoint (forwarded to `report.mjs`)
381
382## KooCLI Command Format Standard
383
384```bash
385hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]
386```
387
388| Feature | Description | Example |
389|---------|-------------|---------|
390| Service name | Exact KooCLI Service name beginning with uppercase/title case | `ECS`, `VPC`, `CloudPond`, `IAMAccessAnalyzer` |
391| Operation name | PascalCase | `ListServers`, `ShowServer` |
392| Region parameter | `--cli-region=<value>` | `--cli-region=cn-north-4` |
393| Simple parameter | `--key=value` | `--server_id=xxx` |
394| Indexed parameter | `--key.1=value1` | `--servers.1.id=xxx` |
395
396## Core Commands
397
398| Command | Purpose |
399|---------|---------|
400| `bash scripts/validate-skill.sh -s {path}` | Phase 3/6: Structure and Huawei Cloud specification validation |
401| `bash scripts/test-cli-commands.sh -s {path} -e {cli\|sdk\|api}` | Phase 4/5: Functional testing |
402| `bash scripts/report-skill-created.sh {skill-name} "{skill-path}"` | Phase 6: Report creator usage via the common skill reporting SDK (huawei-cloud-skill-reporter) |
403
404> test-cli-commands.sh 仅执行白名单命令(hcloud/python3/curl/bash 开头),其他命令被拒绝且不会执行。validate-skill.sh 对不存在的 skill 目录会明确报错(exit 1)。
405
406## Parameter Confirmation
407
408| Parameter | Required | Description | Example |
409|-----------|----------|-------------|---------|
410| `{skill-path}` | Yes | Target Skill directory path | e.g., huawei-cloud-ecs-manage |
411| `{region}` | No | Huawei Cloud region | `cn-north-4` |
412| `{executor}` | No | Execution mode (cli/sdk/api) | `cli` |
413
414## Edge Cases
415
416| Scenario | Handling |
417|----------|----------|
418| User skips questions and says "start" directly | Remind: requirements analysis must be completed first, start from Phase 1 questions |
419| AK/SK environment variables not set | Re-run the **Pre-check** above. Output the env-var setup template (`export HUAWEI_ACCESS_KEY=...` / `export HUAWEI_SECRET_KEY=...`) and let the user fill it out-of-band. **NEVER** ask the user to paste AK/SK into chat. If user does not configure, terminate process, strictly prohibited from skipping |
420| Target service not supported by hcloud CLI | Phase 2 fallback to SDK → Read SDK source _http_info → If still not found, mark ⛔ |
421| SDK package does not exist | Check package name variants, if still not found, inform user, do not infer API |
422| User is unsure of API endpoint | Mark ⛔ requires manual verification, do not fabricate endpoints. If SDK has the method, read _http_info for the real path |
423| SDK has method but _http_info has no resource_path | Mark ⛔, this API does not exist in the SDK, do not infer |
424| Attempting to infer API via path pattern (e.g., inferring claim-vouchers from coupons) | ❌ Strictly prohibited. It doesn't exist |
425| Resource creation test fails | Analyze error cause (permissions/quota/parameters) → Fix and retry |
426| Resource release fails | Retry 3 times, if still failing, inform user to clean up manually |
427| templates/test-vars.json missing when running tests | test-cli-commands.sh reports FATAL and exits 1 (no tests executed). Re-run Phase 4 to generate templates/test-vars.json before testing |
428| User refuses resource lifecycle testing | Inform user: resource lifecycle testing is a required step and cannot be skipped; if user still refuses, terminate process |
429| Phase 6 finds missing phases | Restart from the missing phase until all 6 phases are complete |
430| SDK has method but actual API path unknown | Read SDK source `grep _http_info {service}_client.py` to get real path |
431| BSS service SDK initialization fails (GlobalCredentials) | BSS is global and must use `GlobalCredentials` with `with_endpoints`, not `BasicCredentials` with `with_region` |
432| list_sub_customer_coupons query returns 400 | BSS limit parameter maximum is 100, not the default 200 |
433| Phase 6 security audit FAIL | Fix issues from the audit report, then have the Agent rerun the audit until it passes |
434| Reporter SDK not installed (report.mjs missing) | `report-skill-created.sh` prints a WARNING and exits 0 — creation flow continues; do not skip the six-phase pipeline over a telemetry failure |
435| skill-scanner false positive | Use `<!-- skill-scanner:ignore -->` comment annotation, or exclude in .secrets.baseline |
436| gitleaks false positive | Add to `.gitleaksignore` file |
437
438## Verification Method
439
440### Specification Compliance Verification
441```bash
442bash scripts/validate-skill.sh -s {skill-path}
443# Check against 华为云Skill检查规范 item by item
444```
445
446### Functional Testing
447```bash
448bash scripts/test-cli-commands.sh -s {skill-path} -e cli # CLI priority
449bash scripts/test-cli-commands.sh -s {skill-path} -e sdk # SDK fallback
450bash scripts/test-cli-commands.sh -s {skill-path} -e api # API fallback
451```
452
453### Six-Phase Completeness Check
454```
455Final verification: Check whether phase-1-summary.json ~ phase-6-summary.json exist
456All exist ✅ → Creation complete
457Missing any ❌ → Restart from the missing phase
458```
459
460### Security Audit (Phase 6)
461
462Have the Agent orchestrate the tools listed in `references/security-audit-guide.md`, collect their findings into the Phase 6 report, fix every ERROR/CRITICAL issue, and repeat until the gate passes. Do not call another Skill's scripts directly.
463
464## Reference Documents
465
466- `references/cli-installation-guide.md` — CLI installation and configuration
467- `references/iam-policies.md` — Least-privilege IAM policies
468- `references/verification-method.md` — Verification method details
469- `references/dataflow-diagram.md` — Mermaid data flow diagram
470- `references/acceptance-criteria.md` — Acceptance criteria
471- `references/related-commands.md` — Command quick reference
472- `references/security-audit-guide.md` — Phase 6 five-tool security audit and remediation guide
473
474## Notes & Design Principles
475
476- **Six-phase strict pipeline** — phases are chain-dependent, sequential, and cannot be skipped
477- **Phase 2 No API Inference** — endpoints only from SDK `_http_info` or API Explorer; never guess via naming patterns
478- **Phase 3 Generate Based on Facts** — commands/scripts/endpoints per Phase 2 conclusions; no endpoint → mark ⛔
479- **Phase 4/5 Real Execution** — every command actually executed and verified; mutating operations (Create/Update/Delete) require user confirmation first
480- **Phase 6 Double Check** — resource cleanup + specification compliance + six-phase completeness; fix failures first, then re-verify
481- **Credential Security** — no hardcoded AK/SK; read from env vars (`HUAWEI_*/HW_*/HWC_*` with `ACCESS_KEY`/`_AK`/`SECRET_KEY`/`_SK`) or active CLI profile; never entered via `hcloud configure set` with literal values
482- **Credentials Mandatory** — if AK/SK missing after the Pre-check, output the env-var setup template for out-of-band fill; never ask the user to paste AK/SK into chat; if still unconfigured, terminate
483- **BSS SDK** must use GlobalCredentials + with_endpoints, not BasicCredentials with with_region
484- **Cleanup** — resources created during lifecycle testing must be released in Phase 6
485- **Security audit** — CRITICAL/ERROR findings fixed and re-audited; skill-scanner only detects known cloud API key formats, so gitleaks supplements for common passwords/Chinese credentials
486- **Least privilege** — iam-policies.md provides least-privilege policy JSON; the skillPath in skills-lock.json is `skills/devtools/common/huawei-cloud-skill-creator/SKILL.md`