h
hasna/skills Skill 技能
跨 Claude/Codex/Cursor 的可版本化 Agent Skill 库
技能简介
@hasna/skills 是 Hasna 推出的 Skills 库 + CLI + MCP 服务器,让 Claude、Codex、OpenCode、Cursor 任意一个 coding agent 都能"发现、固定版本、运行"可复用的能力(skill)。skills.md 平台化的私有目录机制,把每个组织自己写的 skill(提示词 + 可执行 bundle)封装成可版本化、可签名(SHA-256 digest)、可分发的资产;agent 通过 $skill-name 引用加载精确版本,profile 治理确保环境间一致性。CLI 同时登录多平台、安装钩子、迁移 vendor skill,配合 MCP server 让宿主 agent 在 prompt 上下文里自动检索/调用。
- 适用对象:需要统一团队 coding agent 工作流、把 skill 当代码资产分发的工程师
- 一句话定位:Skills-as-Code:以 Apache-2.0 开源的 skill 注册中心 + 跨 agent 装载协议
- 核心价值:把 Claude/Codex/OpenCode/Cursor 的"skill"概念从单机配置升级为可在 profile / session / project 之间精确流转的企业级资产
核心能力
- 跨 Agent 注册:同一份 skill 可注册到 Claude、Codex、OpenCode、Cursor 四个 agent("Codewith"等更多客户适配中),通过
skills hook agents与skills hook install --agent all统一装载。 - Profile 驱动的版本管理:每个 profile 锁定 exact version + SHA-256 bundle digest,更新要
If-Matchrevision CAS;skills profiles set/show+sync --station保证多 station 间一致。 - Native bridge + prompt hook:在 Claude / Codex / OpenCode / Cursor 上安装
skills-cli单文件桥(自带 CLI 指令但不带 catalog),prompt hook 在受信任路径检查$skill引用并加载精确版本。 - 私有目录与组织隔离:每个组织有独立 catalog(auth + tag + 版本 + 下载统计);空账户从空起步,本地仓库文件不会自动注入默认 catalog。
- 私有执行授权:通过
skills grants set绑定 skill 版本 + bundle digest + station id + Secrets authority;本地执行需要明确--target local+ 注入的环境变量;密钥值永远不会写进 bundle 或 session receipt。 - 多模型 backend:默认 SQLite 或 PostgreSQL 持久化 bundle;可选 S3 存大数据 bundle;所有读写走
/skills/v1/...路由,认证失败时 fail closed。 - Migrate 工具:把 native agents 现有 vendor
SKILL.md与用户自写 skill 归档到 private archive,drift refusal 报告冲突路径;migrate native --include-vendor --apply完整工作流。 - 供应商 profile-key 多目标凭证管理:磁盘 + macOS Keychain + 环境变量 + 显式参数 五层 tier 解析;
HASNA_SKILLS_API_KEY_REF指向 vault item(永不指向值)。 - 会话级 skills reconciliation:拉取已加载 selection 的精确 metadata + bundle digest;过期后自动 reconcile,无需重启;冲突时 fail closed。
- 会话锁与并发安全:包含 host + boot + PID namespace 标识,30 秒后通过身份证明方可接管;旧 PID-only 锁需单独 review。
安装配置
- CLI 全局安装:
bun install -g @hasna/skills(需要 Bun ≥ 1.3+)。 - 登录私有云目录:
skills login打开浏览器到 https://skills.md 登录,把 API key 写入~/.hasna/skills/config/credentials(owner-only mode 0400/0600)。 - 多客户端凭证配置:
HASNA_SKILLS_API_KEY_REF=让 SDK 每次重新从 Secrets 取值(轮转无需重启);HASNA_SKILLS_API_URL指定私有 server。 - **Fleet station 模式:填入 workstation 预置的 fleet key(workspace API key);
HASNA_HOME与HASNA_CONFIG_HOME重定向磁盘凭证。 - Auth 权限查询:
skills auth whoami --json输出permissions.publish与permissions.profilesWrite;推送前 stop on explicit denial。
使用步骤
- 首次安装与登录:运行
bun install -g @hasna/skills然后skills login,终端会自动提示注册到 Claude/Codex/OpenCode/Cursor。 - 确认身份:
skills whoami --json与skills capabilities --json验证 token 范围与可用能力。 - 建立 profile:
skills profiles set default --file selections.json --json(selections 数组含 slug/version/exact/digest/triggers);profiles show与sync --selection-profile default --check --json校验一致性。 - 安装 bridge hook:
skills hook agents --json查看支持的适配器;skills hook install --agent all --selection-profile default --apply --json一键装载。 - Codex 0.153–0.155 trust 流程:
skills hook trust --agent codex --json生成 plan → review → 与--plan-digest提交--apply;Codex 0.160.0+ 用--codex-native-catalog捕获 native skill 状态。 - 用 skill 启动任务:在 prompt 屏键入
Use $pdf-generate to create a PDF让 hook 自动注入该 skill 的精确指令;或在终端跑skills run --target local your-skill@0.5.2 --input '{...}' --json。 - 同步到其他 station:
skills sync --selection-profile default --station station-example --json记录 station receipt;或skills sync --project把项目级 selection 同步进 git。 - 运行私有授权 skill:把私有 policy 写入
./policy.json,skills grants set default --file ./policy.json提交;skills run --target local your-skill@0.5.2 --input '{...}' --json跑。 - 回收 vendor skill:
skills migrate native --include-unmanaged --include-vendor --apply --json归档 vendorSKILL.md与 native copies。
适用场景
- 企业内部 coding agent 技能库:把公司私有 skill(部署、codegen、review)封装进
skills.mdcatalog,按 profile 精确分发给不同团队。 - 跨 IDE coding workflow 一致性:让 Claude Code / Cursor / OpenCode 的项目级 skill 保持同一套精确版本;profile sync 保证开发者机器一致性。
- AI 编程工作室多模型编排:用 Skills CLI 串接 Claude、Codex 的多段任务,按 selection profile 精确装载 skill;session reconciliation 处理长任务 compaction 后的选择恢复。
- 私有部署 / 隔离环境:用
skills login --url https://skills.example.com切到自托管 server(OSS 代码 + 自有 SQLite/PostgreSQL/S3)。 - 执行授权治理:用 Skills + Secrets 体系管理 run 链所需的 API key / 数据库密码 / 服务 token(值在 vault,引用在 policy)。
- native agent 切换期整理:从 Claude 原生品切换到 Skills 注册制时,
migrate native --include-vendor一键归档所有 vendor skill。 - 多 Agent 工作流的合约:把跨 Agent 的合约 / artifact 流转规范化:用 profile-revision + bundle-digest 让变更可追溯、可回滚。
适用人群
- 企业 AI 转型 lead:统一公司 coding agent 的 skill 库,避免 Claude/Codex 各自为政。
- DevOps / Platform Engineer:把"skill"作为可审计、可版本化的资产治理。
- AI 编程工作室创始人:用 Skills + Skills CLI 把工作室工作流封装进自家产品。
- 自托管部署运维:自建 skills server 的 CTO,需要 SQLite/PostgreSQL/S3 部署。
- AI 安全/合规专家:评估 Skills 的 drift refusal、prompt hook、trust receipt 等审计边界。
官方链接
- npm 包:https://www.npmjs.com/package/@hasna/skills
- GitHub 仓库:https://github.com/hasna/skills
- Skills 服务:https://skills.md(登录页)
- License:Apache-2.0
- 当前版本:0.10.38(v0.10+ 阶段)
团队信息
AI产品库
官方
由 AI 猎手自动发现
评论与建议
登录 后参与评论或提建议