360 Secure SkillHub
360 安全技能中心

rebels-skill-portabilizer

用于审计 Agent Skill 的平台锁定与跨 Agent 兼容问题,检查硬编码路径、数据目录回退、平台 CLI 依赖、User-Agent、文档路径、无头 OAuth 和凭据环境变量,并自动修复部分路径问题,输出审计报告或 JSON。

99rebels
99rebels
热度 19.75
最近更新 2026-04-05 03:47:53
分类:开发依赖:代码执行 / 读写文件应用场景:代码审查 / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add skill-portabilizer
Metadata
name
skill-portabilizer
description
Audit agent skills for platform lock-in and cross-agent compatibility. Use when checking if a skill is portable, making a skill work across multiple agents (OpenClaw, Claude Code, Codex, etc.), fixing hardcoded paths, or preparing a skill for multi-platform distribution.

Skill Portabilizer 🔌

Audit an agent skill for platform lock-in. Auto-fixes what it can, flags what needs manual attention.

Why

Skills with hardcoded paths only work on one platform. This tool catches those issues and fixes them — making your skills work everywhere agents run.

When to Use

  • "Is this skill portable?"
  • "Make this skill cross-platform"
  • "Check for hardcoded paths"
  • "Prepare a skill for other agents"

How to Run

python3 scripts/audit.py <skill_dir>          # audit only
python3 scripts/audit.py <skill_dir> --fix    # auto-fix + audit
python3 scripts/audit.py <skill_dir> --json   # structured output

What It Checks

📍 Hardcoded paths     — platform-specific dirs like ~/.<platform>/ in scripts
🔧 SKILL_DATA_DIR      — env var support for data dir resolution
📦 XDG fallback        — ~/.config/<skill>/ fallback path
🔌 Platform CLI deps    — external binary dependencies (e.g. clawhub, gh)
🏷️  User-Agent strings — platform names in HTTP headers
📄 SKILL.md paths      — platform-specific path references in docs
🖥️  Headless setup     — OAuth scripts without --no-browser flag
🔑 Credential env vars — file-only credentials with no env var alternative

Output Example

❌ github-growth-tracker — 8 errors, 9 warnings (9 auto-fixable)

📍 Hardcoded Paths
  ❌ scripts/github_tracker.py:28: ~/.<platform>/ [auto-fix]
  ❌ scripts/github_tracker.py:31: ~/.<platform>/ [auto-fix]

🔧 SKILL_DATA_DIR: Not supported — scripts use hardcoded paths
🔧 XDG Fallback: Missing ~/.config/ fallback path

Auto-Fixes

  • Replaces ~/.<platform>/credentials/ with $SKILL_DATA_DIR
  • Replaces ~/.<platform>/workspace/data/<skill>/ with $SKILL_DATA_DIR/<skill>/
  • Strips platform names from User-Agent strings

Manual flags require human review (platform CLI deps, headless setup, env var alternatives).

The Portability Pattern

Skills that work everywhere follow this:

1. Resolve data dir via $SKILL_DATA_DIR (set by agent platform)
2. Fall back to ~/.config/<skill>/ (XDG-compliant, works everywhere)
3. Accept credentials via env var OR file (env var preferred)
4. Output to stdout — no platform messaging APIs
5. Self-contained scripts — no platform SDK imports