Dependency Guard
Use this skill when dependency changes are in scope for npm, pnpm, yarn, Python packages, or other package ecosystems supported by Socket.
Prerequisites
- - The
socket CLI must be installed and on PATH (npm install -g socket). - Authentication is required for CLI-based reviews. See the Authentication section below.
Workflow
- 1. Confirm the exact dependency change being proposed.
- Check whether the feature can be implemented with the standard library or an existing project dependency.
- Prefer MCP
depscore if the host agent exposes it. - Otherwise run
scripts/check_dependency.sh <ecosystem> <package> [version]. - Apply the policy in
references/policy.md. - Apply the decision rules in
references/decision-matrix.md. - Before making the change, report:
- why the package is needed
- whether an existing alternative exists
- what Socket reported
- whether install scripts, risky capabilities, or transitive risk are present
- 8. If the decision is
allow_with_warning, present the warning clearly before making the change. If the decision is block_pending_human_review or block, stop and propose either:
- a safer dependency
- a no-dependency implementation
- explicit human review
Authentication
Three authentication paths are supported, in order of preference:
- 1. MCP
depscore — no local credentials needed; works through the host agent's MCP connection. socket login — interactive CLI login; stores auth locally.
- If your CLI supports it, pressing Enter at the token prompt uses limited public access.
- To use a private token, paste it at the prompt instead.
- 3.
SOCKET_SECURITY_API_TOKEN env var — set this for CI or headless environments.
Security: Never paste private tokens into agent prompts. Use the env var or socket login instead.
CI note: GitHub Actions workflows use SOCKET_SECURITY_API_KEY (a separate GitHub-integration key), not SOCKET_SECURITY_API_TOKEN. See examples/github/dependency-guard.yml.
Reporting Contract
Use the short response template in references/examples.md when presenting the package review to the user.
References
- - Read
references/policy.md for the canonical guardrail. - Read
references/decision-matrix.md for allow/block criteria. - Read
references/examples.md for user-facing review examples.
Notes
- - Keep
SKILL.md lean; do not duplicate the full policy here. - OpenClaw and ClawHub expect
metadata to be a single-line JSON object in frontmatter, so keep the OpenClaw metadata compact. - The
version field in frontmatter is the single source of truth; use publish_clawhub.sh --bump patch|minor|major to auto-increment. - Do not assume system-wide wrapper enforcement or shell-completion setup is desirable; keep CLI setup minimal.
- If Socket tooling is unavailable, require human review before adding the dependency.
- Review manifest and lockfile changes together.
依赖守卫
当 npm、pnpm、yarn、Python 包或 Socket 支持的其他包生态系统的依赖变更在范围内时,使用此技能。
前置条件
- - 必须安装 socket CLI 并将其加入 PATH(npm install -g socket)。
- 基于 CLI 的审查需要身份验证。请参阅下面的身份验证部分。
工作流程
- 1. 确认所提议的具体依赖变更。
- 检查该功能是否可以使用标准库或现有项目依赖来实现。
- 如果宿主代理暴露了 MCP depscore,则优先使用。
- 否则运行 scripts/check_dependency.sh <生态系统> <包名> [版本]。
- 应用 references/policy.md 中的策略。
- 应用 references/decision-matrix.md 中的决策规则。
- 在进行更改之前,报告:
- 为什么需要该包
- 是否存在现有替代方案
- Socket 报告了什么
- 是否存在安装脚本、风险能力或传递性风险
- 8. 如果决策是 allowwithwarning,在进行更改前清晰地呈现警告。如果决策是 blockpendinghuman_review 或 block,则停止并提出以下任一方案:
- 更安全的依赖
- 无依赖的实现
- 明确的人工审查
身份验证
支持三种身份验证路径,按优先级排序:
- 1. MCP depscore — 无需本地凭据;通过宿主代理的 MCP 连接工作。
- socket login — 交互式 CLI 登录;将认证信息存储在本地。
- 如果您的 CLI 支持,在令牌提示符下按 Enter 键可使用有限的公共访问权限。
- 要使用私有令牌,请在提示符下粘贴它。
- 3. SOCKETSECURITYAPI_TOKEN 环境变量 — 为 CI 或无头环境设置此变量。
安全: 切勿将私有令牌粘贴到代理提示符中。请改用环境变量或 socket login。
CI 说明: GitHub Actions 工作流使用 SOCKETSECURITYAPIKEY(一个独立的 GitHub 集成密钥),而不是 SOCKETSECURITYAPITOKEN。请参阅 examples/github/dependency-guard.yml。
报告约定
在向用户呈现包审查时,使用 references/examples.md 中的简短响应模板。
参考资料
- - 阅读 references/policy.md 了解规范的防护规则。
- 阅读 references/decision-matrix.md 了解允许/阻止标准。
- 阅读 references/examples.md 了解面向用户的审查示例。
注意事项
- - 保持 SKILL.md 简洁;不要在此处重复完整策略。
- OpenClaw 和 ClawHub 期望 metadata 是 frontmatter 中的单行 JSON 对象,因此请保持 OpenClaw 元数据紧凑。
- frontmatter 中的 version 字段是唯一真实来源;使用 publish_clawhub.sh --bump patch|minor|major 自动递增。
- 不要假设系统级包装器强制或 shell 补全设置是可取的;保持 CLI 设置最小化。
- 如果 Socket 工具不可用,则在添加依赖之前需要人工审查。
- 同时审查清单文件和锁文件的变化。