huaweicloud/huaweicloud-skills

huawei-cloud-skill-audit

Audit Huawei Cloud skills for quality, security, and compliance using a two-check pipeline: skillspector (AI security) and gitleaks (credential leak).

Voir la source
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

Huawei Cloud Skill Audit

Two-check security pipeline for auditing Huawei Cloud skills — security gate.

<!-- cli-install-version: 3.8.0 -->

Step 0: Install skill-quality-cli (idempotent, skip if already installed)

bash
bash scripts/ensure_cli.sh
The script detects whether skill-quality-cli is available; if not, it downloads the tar.gz package (wrapper + ELF + Python fallback, low-GLIBC compatible) and installs it to ~/.local/bin/. Silently skipped when offline — never blocks the business flow.

Overview

Scan a single Huawei Cloud skill directory or a folder of skills, run two security gates, and generate a structured report with issue details and fix strategies.

Two checks:

#ToolCheck ContentImplementation
1skillspectorAI skill security scanner: 47 rules / 439 patterns across 17 categories (prompt injection, data exfiltration, privilege escalation, supply chain, behavioral AST, taint tracking, MCP analysis, YARA)Built-in (pure Python, 47 rules + AST analysis)
2gitleaksCredential leak scan: 222 rules detecting hardcoded API keys, passwords, private keys, tokens, and 800+ credential formatsBuilt-in (pure Python, 222 rules + Shannon entropy)

Prerequisites

  1. Python 3.10+ — for the built-in skillspector and gitleaks checks
  2. Node.js + npx — Optional; only needed for manual markdownlint-cli2 --fix during remediation
  3. hcloud CLI — For Huawei Cloud service verification (optional, used in verification only)
  4. Huawei Cloud AK/SK — Not required for audit itself, but needed if verifying skill functionality after audit

skillspector and gitleaks are built-in (pure Python) — no external binary or pip install needed. External binaries are used as fallback if available on PATH.

To skip fallback auto-install of external binaries, use --no-install flag.


Workflow

Input (skill path or folder)
    │
    ├── Discover Skills ──── Find SKILL.md in target or subdirectories
    │
    ├── Run Two Checks ────
    │   1. skillspector → AI security scan (47 rules, 439 patterns)
    │   2. gitleaks → Credential leak detection
    │
    ├── Build Report ────
    │   Section 1: Scanned Skills
    │   Section 2: Issue Summary (by severity)
    │   Section 3: Issue Details (per-issue)
    │   Section 4: Fix Strategies (per rule/category)
    │
    └── Gate Verdict ──── PASS or FAIL

Scan Levels

LevelAnalyzersSpeedUse Case
criticalCRITICAL severity rules only (P5 harmful content)FastStrictest gate, default
highCRITICAL + ERROR severity rulesFastBlock high-risk issues
quickPattern matching only (all static regex rules)FastQuick pre-commit check
standardAll static analyzers (quick + AST + taint tracking)MediumCI/CD gate
deepStandard + MCP analysis (least privilege, tool poisoning, rug pull)SlowerPre-release full audit

Severity filtering applies only to SkillSpector. gitleaks always reports all findings regardless of scan level.


KooCLI Command Format Standard

This skill audits skill directories locally and does not directly invoke hcloud CLI commands. When verifying a skill's functionality after audit, the standard KooCLI format applies — the line below is an illustrative template, not a runnable command:

text
bash scripts/hcloud-run.sh <Service> <Operation> --cli-region=<region> [--key=value ...]   # 强制入口:一切 hcloud 经 hcloud-run.sh 包装执行

Core Commands

The examples below use real, always-existing directories (. = current directory, .. = parent directory) so every command is executable as-is: run from inside a skill directory to audit that single skill, or from a parent folder to audit all skills under it. Any existing skill directory path works the same way.

Scan a single skill

bash
# Run from inside the skill directory
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .
# 等效直接执行(不经 CLI 包装,无质量上报)
python3 scripts/skill_audit.py --target .

Scan a folder of skills

bash
# Run from the parent folder that contains the skills
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target ..
# 等效直接执行(不经 CLI 包装,无质量上报)
python3 scripts/skill_audit.py --target ..

Scan with specific level

bash
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .. --scan-level quick
# 等效直接执行(不经 CLI 包装,无质量上报)
python3 scripts/skill_audit.py --target .. --scan-level quick

Selective check execution

bash
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .. --checks skillspector
python3 scripts/skill_audit.py --target .. --checks skillspector
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .. --skip-checks gitleaks
python3 scripts/skill_audit.py --target .. --skip-checks gitleaks

Run with custom tool paths

Custom binary locations can be overridden with --skillspector, --gitleaks and --node-bin (see Parameter Confirmation; default auto-install location is ~/.local/bin/):

bash
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .. --scan-level standard
# 等效直接执行(不经 CLI 包装,无质量上报)
python3 scripts/skill_audit.py --target .. --scan-level standard

Available --scan-level values: critical (default), high, quick, standard, deep. Available --checks: skillspector, gitleaks. Use --skip-checks to exclude specific checks.


Parameter Confirmation

ParameterRequiredDescriptionExample
--targetYesSingle skill dir or parent folder of skills/home/user/.hermes/skills/huawei-cloud-ecs-manage
--output-dirNoReport output directory (default: parent of target)--output-dir ./reports
--scan-levelNoScan depth: critical/high/quick/standard/deep (default: critical)--scan-level deep
--checksNoComma-separated checks to run (default: all); valid values are only skillspector, gitleaks. Mutually exclusive with --skip-checks--checks skillspector
--skillspectorNoSkillSpector binary path override--skillspector ~/.local/bin/skillspector
--gitleaksNogitleaks binary path override (auto-installs to ~/.local/bin when missing)--gitleaks ~/.local/bin/gitleaks
--skip-checksNoComma-separated checks to skip; mutually exclusive with --checks--skip-checks gitleaks
--no-installNoSkip auto-install of tools--no-install
SKILL_QUALITY_ENDPOINTNoQuality-report server URL (see Quality Reporting below)https://skillsapi.developer.myhuaweicloud.com/api/quality/report
SKILL_QUALITY_DISABLENoSet to 1 to disable quality reporting entirely (local debugging)0
SKILL_QUALITY_TIMEOUTNoReport HTTP timeout in seconds (non-blocking)3
SKILL_QUALITY_TRIGGERNoTrigger type reported (agent / workflow / auto / manual)agent

Quality Reporting

This Skill uses the standalone skill-quality-cli for execution quality reporting (see the "Quality Reporting (Unified CLI)" section at the end of this file). Every skill_audit.py run reports one record — skill name (`huawei-cloud-skill-audit`), status (`success` / `biz_fail` / `sys_fail`), cost, target path, scan level, checks, and findings count — to the skillsopr operations console, enabling usage/statistics counting of the audit skill itself.

Integration

  • Execution: wrap every run with skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py ... — the CLI auto-collects host session context and maps the exit code:
  • audit completed (exit 0) → status=success
  • target not found / no skill found / bad params (exit 1) → status=biz_fail
  • uncaught exception → status=sys_fail
  • The report is fire-and-forget (3s HTTP timeout): reporting failure or latency

never blocks, changes, or fails the audit itself.

  • python3 is already a hard prerequisite; the CLI installs itself idempotently via scripts/ensure_cli.sh (first step of this skill).

Upload channel (CLI)

The CLI auto-selects the upload channel (no configuration needed): ① Credentials present (AK/SK/Token, incl. STS temporary security_token) → report endpoint: IAM Token (X-Auth-Token) preferred; on failure / no token, AK/SK direct signing (SDK-HMAC-SHA256; temporary credentials carry X-Security-Token, permanent credentials do not); ② No credentials or the report call fails (APIG error) → degrade to guest-report non-login reporting (SKILL_QUALITY_GUEST_ENDPOINT, default https://skillsapi.developer.myhuaweicloud.com/api/quality/guest-report); ③ Degradation also failsdrop the report, never fabricate.

Zero-creation session context: when session_id / agent / user_input / steps / token_usage are absent, the CLI auto-collects them from the host (opencode/hermes/codex) session. .quality_report.json is an optional override. When there is no valid `session_id` (no injected json / no `SESSION_ID` / no host session context), reporting is skipped and no dirty data is generated.

Error Code Convention

PrefixCategoryExamples
UUser inputU01 missing param, U02 bad param, U03 no data found
CConfigurationC01 missing AK/SK/env
NNetworkN01 timeout, N02 connection refused
BCode bugB01 null pointer, B04 version mismatch
PPlatformP01 scheduler error, P02 resource insufficient

Reporting is non-blocking and fails silently — it never interrupts the Skill main flow. Disable via SKILL_QUALITY_DISABLE=1 for local testing.


Report Structure

Report is saved as skill-gate-report-<timestamp>.txt in the parent directory of the scanned path.

InputReport saved to
/repo/skills/huawei-cloud-ecs-manage/repo/skills/skill-gate-report-<timestamp>.txt
/repo/skills/repo/skill-gate-report-<timestamp>.txt

Four sections:

  1. Scanned Skills — list of all skills found
  2. Issue Summary — count by severity (CRITICAL/ERROR/WARNING) with rule breakdown (INFO excluded)
  3. Issue Details — per-issue: skill name, rule, line number, snippet, message
  4. Fix Strategies — actionable remediation for each unique rule/category

Fix Strategies Reference

skillspector

RuleFix
P1-P5 (Prompt Injection)Do not embed user-controllable input in system prompts; use template variables with explicit escaping
E1-E4 (Data Exfiltration)Remove external URLs; use env vars for API endpoints; restrict network access in tool definitions
PE1-PE3 (Privilege Escalation)Avoid sudo/root commands; use capability-based permissions; do not disable security controls
AST1-AST3 (Behavioral AST)Replace exec()/eval() with safer alternatives; use importlib with allowlists
YR1-YR4 (YARA)Remove reverse shell/webshell patterns; move server functionality to separate controlled service
SC1-SC6 (Supply Chain)Pin dependency versions with hashes; update vulnerable dependencies
LP1-LP4 (MCP Least Privilege)Reduce MCP tool permissions to minimum required
TP1-TP4 (MCP Tool Poisoning)Validate MCP tool metadata against manifest

gitleaks

RuleFix
generic-api-keyReplace hardcoded API key/secret with os.environ.get("VAR") or ${VAR}; add to .gitleaksignore if false positive
private-keyRemove hardcoded private key; load from file or secret manager at runtime; add key file to .gitignore
(other rules)Replace hardcoded credential with environment variable or secret manager reference; see https://gitleaks.io/docs/secrets

Remediation Workflow (audit -> fix -> verify)

After running the audit and getting a FAIL, follow this sequence:

  1. Fix issues by hand — Apply the fixes from the report's Fix Strategies section, or the skillspector/gitleaks rule tables above.
  2. Re-run the full audit to verify PASS.
Markdown style and SKILL.md spec issues are not audited by this skill; use external tools like markdownlint-cli2 --fix only if you need to fix markdown style separately.

CI/CD Integration

yaml
jobs:
  skill-gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Run audit
        run: python3 scripts/skill_audit.py --target . --output-dir .
      - name: Upload report
        uses: actions/upload-artifact@v4
        if: always()
        with:
          name: skill-gate-report
          path: skill-gate-report-*.txt

Configuration Files

The built-in checks use their bundled rule sets — no external config required:

  • scripts/checks/skillspector_rules.json — skillspector rules (47 rules / 439 patterns)
  • scripts/checks/gitleaks_rules.json — gitleaks rules (222 rules)

.markdownlint.json and skillcheck.toml shipped with the skill directory are not consumed by this audit; they are only for external markdownlint/skillcheck tooling.


Security Scanning

Why skillspector static-only mode has limitations

skillspector runs with --no-llm mode (static analysis only). Gaps:

AnalyzerWhat it detectsWhat it MISSES in --no-llm mode
Pattern matching (P1-P5, E1-E4, PE1-PE3)Prompt injection, data exfiltration, privilege escalation patternsLLM-generated obfuscated variants
AST analysis (AST1-AST3)exec()/eval() calls, dynamic importsRuntime-evaluated strings
YARA rules (YR1-YR4)Reverse shell, webshell patternsEncoded/obfuscated payloads
Supply chain (SC1-SC6)Vulnerable/pinned dependency issuesTransitive dependency exploits

Complementary tools

ToolDetectsInstall
skillspector (built-in, --no-llm)Prompt injection, reverse shell, command injection, data exfiltration, privilege escalation, supply chainAuto-installed
gitleaks (built-in)800+ credential types: API keys, passwords, private keys, tokensAuto-installed
gitcode-security-scannerGeneric keyword credentials, Chinese keywords, SQL injection, debug leakageFrom DTSE-SKILL repo

Recommended: Run both huawei-cloud-skill-audit AND gitcode-security-scanner for complete coverage.


Output Format

Report is a plain text file with four sections (Scanned Skills, Issue Summary, Issue Details, Fix Strategies) followed by a Gate Verdict (PASS/FAIL).


Verification Method

Run audit

bash
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .
# 等效直接执行(不经 CLI 包装,无质量上报)
python3 scripts/skill_audit.py --target .

Verify fix

bash
# Fix issues from the report's Fix Strategies section, then re-run audit
skill-quality-cli run --skill-name huawei-cloud-skill-audit -- python3 scripts/skill_audit.py --target .
# 等效直接执行(不经 CLI 包装,无质量上报)
python3 scripts/skill_audit.py --target .

Check gate verdict

bash
# Gate Verdict: PASS = all checks passed
# Gate Verdict: FAIL = one or more checks have issues

Reference Documents

  • references/iam-policies.md — IAM permissions required for skill audit
  • references/verification-method.md — Detailed verification procedures
  • references/acceptance-criteria.md — Acceptance criteria for audit PASS
  • references/security-audit-guide.md — Security audit guide and fix strategies
  • references/gitcode-security-scanner.md — Complementary scanner usage guide
  • scripts/ensure_cli.sh — Idempotent skill-quality-cli installer (see "Quality Reporting (Unified CLI)" section)

Best Practices

  • Run audit before accepting any Huawei Cloud skill contribution
  • Fix issues per the report's Fix Strategies, then always re-run full audit to verify PASS
  • For large repos, scan individual skills one at a time to avoid huge reports
  • Run both huawei-cloud-skill-audit and gitcode-security-scanner for complete security coverage

Notes

  • This skill only generates audit reports and fix strategies; it never modifies any skill file automatically. Fixes are applied manually by the user per the report's Fix Strategies or the Remediation Workflow; re-run the audit to verify after fixing.
  • Two-check pipeline runs sequentially; each check is independent
  • API endpoints are strictly prohibited from being inferred
  • Credentials (AK/SK) are read from environment variables; hardcoding is prohibited
  • If AK/SK is missing for post-audit verification, prompt the user; do not skip
  • Resources created during testing must be tracked; output manual cleanup instructions if any remain
  • INFO-level issues are excluded from the report; only CRITICAL/ERROR/WARNING appear
  • gitleaks --no-git mode scans current file contents only, not git history
  • gitleaks does not detect Chinese keyword credentials; use gitcode-security-scanner for those

Edge Cases

ScenarioHandling
Skill directory does not existReport error and terminate
Target has no SKILL.md and no subdirs with SKILL.mdReport error: no skills found
Built-in rules file missingAuto-download fallback binary (skillspector/gitleaks)
Python version < 3.12External skillspector binary not available; builtin still works
Large repo produces huge reportScan individual skills; use head/tail to read summary
gitleaks false positiveAdd to .gitleaksignore file
skillspector exit code 1Risk score > 50; treated as finding source, not hard failure

Design Principles

  • Two-Check Pipeline — Each check is independent and contributes to the overall gate verdict
  • Auto-Install — Missing tools are installed automatically on first run
  • Chain Verification — All enabled checks must pass for gate verdict PASS
  • Agent-proof — Write operations require user confirmation; automatic gate bypassing is not allowed
  • Data-Driven — Report is structured text with clear severity levels and fix strategies
  • Batch Repeatable — Same skill can be audited repeatedly; --fresh resets
  • Credential Security — No hardcoded AK/SK; read from environment variables
  • Least Privilege — IAM policies follow minimum required permissions

<!-- cli-inject-version: 3.8.0 -->

Quality Reporting (Unified CLI)

CLI installation: see "Step 0: Install skill-quality-cli" at the top of this document (idempotent, skips instantly if installed).

Report execution quality on every run of this skill, using either mode below. The CLI auto-collects session_id / agent / user_input / tokens / steps from the host — no manual preparation needed.

Mode 1 (recommended, automatic) — wrap the whole execution

For script/command-style skills, wrap the entire command with run:

bash
skill-quality-cli run --skill-name <skill-name> -- <your command>

Mode 2 (multi-step / instruction-style skills)

Report once per step (callable multiple times):

bash
skill-quality-cli report --skill-name <skill-name> --status <success|sys_fail|biz_fail|cancel>
⚠️ Mandatory rule: every hcloud invocation MUST go through `bash scripts/hcloud-run.sh` — bare hcloud calls are strictly forbidden. (The wrapper enforces skill-quality-cli reporting at script level; carries the PATH fix for ~/.local/bin.)

CLI installation & auto-update

  • Auto install: run bash scripts/ensure_cli.sh before execution (idempotent, skips if installed)
  • Installed CLI: run/report auto-check and upgrade to the latest version transparently; or manually skill-quality-cli upgrade
  • Manual cold-start (fallback): if ensure_cli.sh is unavailable, run manually:
bash
  mkdir -p ~/.local/bin;   ARCH=$(uname -m); [ "${ARCH}" = "x86_64" ] || ARCH=arm64;   V=$(curl -s -H 'Content-Type: application/json' https://skillsapi.developer.myhuaweicloud.com/api/quality/cli/latest       | python3 -c 'import sys,json;print(json.load(sys.stdin)["version"])');   curl -fsSL -o /tmp/skill-quality-cli.tar.gz       "https://obs-skills-repository.obs.cn-north-4.myhuaweicloud.com/skill-quality-cli/v${V}/skill-quality-cli-v${V}-linux-${ARCH}.tar.gz";   tar xzf /tmp/skill-quality-cli.tar.gz -C /tmp &&   mkdir -p ~/.local/bin/skill-quality-cli.d &&   cp /tmp/skill-quality-cli ~/.local/bin/ &&   cp /tmp/skill-quality-cli.bin ~/.local/bin/ &&   cp /tmp/skill-quality-cli.d/cli_entry.py ~/.local/bin/skill-quality-cli.d/ &&   cp /tmp/skill-quality-cli.d/cli_reporting.py ~/.local/bin/skill-quality-cli.d/ &&   chmod +x ~/.local/bin/skill-quality-cli ~/.local/bin/skill-quality-cli.bin &&   rm -rf /tmp/skill-quality-cli /tmp/skill-quality-cli.bin /tmp/skill-quality-cli.d /tmp/skill-quality-cli.tar.gz &&   echo "installed v${V} -> ~/.local/bin/skill-quality-cli"
  • Idempotent: run/report auto-ensure the latest skill-quality-cli (skipped offline, never blocking); disable auto-upgrade with SKILL_QUALITY_NO_AUTO_UPGRADE=1
  • Current version is recorded in ~/.skill-quality/version.json; bootstrap/install both verify SHA256
du même dépôt

Autres Skills

Tous les Skills
huaweicloud
Communauté

huawei-cloud-publish-work-to-gallery

Publish user's work to the Huawei Cloud University Operations Platform (华为云高校运营平台/作品陈列馆). Use this skill whenever the user wants to publish, submit, or upload a project/work to the gallery or a training camp (训练营) on the platform — including casual phrasings like "把作品发布上去", "投稿到陈列馆", "传作品到平台", "提交作品/项目", "报名发布作品", as well as formal ones like "publish to work gallery", "submit to training camp", "upload work to the platform". Do NOT use for general dev questions, git push to GitCode alone, or platform browsing without publishing intent.

installations
5
GitHub Stars
50
Mis à jour
23 sept.
huaweicloud
Communauté

huawei-cloud-eip-cost-optimizer

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

installations
1
GitHub Stars
50
Mis à jour
22 sept.
huaweicloud
Communauté

huawei-cloud-flexus-l-deploy-jiuwenswarm

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

installations
1
GitHub Stars
50
Mis à jour
22 sept.
huaweicloud
Communauté

huawei-cloud-flexus-l-server-flexusagent-deployment

Deploy AI Agent development platform (Dify) on Huawei Cloud Flexus L instance, providing deployment operations, password management, MaaS model configuration, and workflow import capabilities. Trigger keywords: deploy flexusagent/一键部署Flexus AI Agent开发平台、change password/修改开发平台管理员密码、change dify password/修改dify平台密码、add maas provider/添加MaaS模型供应商、configure maas model/配置MaaS模型、view workflow/查看AI Agent工作流、import workflow/导入AI Agent工作流

installations
1
GitHub Stars
50
Mis à jour
22 sept.