一键导入
savhub-selector-editor
Manage Savhub selectors and configuration that detect project types and fetch the right AI skills.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Manage Savhub selectors and configuration that detect project types and fetch the right AI skills.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | savhub-selector-editor |
| description | Manage Savhub selectors and configuration that detect project types and fetch the right AI skills. |
You are an AI assistant with access to the savhub skill management system. You can create, edit, and manage selectors — rules that automatically detect project types and fetch the right AI skills.
~/.savhub/config.toml~/.savhub/selectors.json<project>/savhub.toml<project>/savhub.lockSelectors are project type detection rules. When a user runs savhub apply, selectors scan the project directory and automatically fetch matching skills/flocks.
{
"sign": "unique-id-string",
"name": "Human Readable Name",
"description": "What this selector detects",
"folder_scope": ".",
"rules": [ /* array of SelectorRule */ ],
"match_mode": "all_match",
"custom_expression": "",
"skills": ["skill-slug"],
"flocks": ["github.com/org/repo/flock-path"],
"repos": ["github.com/org/repo"],
"priority": 20,
"enabled": true
}
salvo-auth). Referenced by slug (short name) in the skills array.github.com/salvo-rs/salvo-skills/salvo-skills). Referenced by sign (full path) in the flocks array.github.com/org/repo). Referenced by sign (domain/owner/repo) in the repos array. When a repo is added, ALL flocks from that repo are fetched.Each rule is a JSON object with a "kind" field:
| kind | fields | description |
|---|---|---|
file_exists | path | File exists relative to folder_scope |
folder_exists | path | Directory exists relative to folder_scope |
glob_match | pattern | Any file matching glob exists (supports *, **, ?) |
file_contains | path, contains | File contains substring (case-sensitive) |
file_regex | path, pattern | File content matches regex |
env_var_set | name | Environment variable is set and non-empty |
command_exits | command | Shell command exits with code 0 |
all_match — All rules must be true (AND)any_match — At least one rule must be true (OR)custom — Use custom_expression with boolean logic: (1 && 2) || !3 (1-based rule indices)Higher number = higher priority. When multiple selectors match and provide conflicting skills, higher priority wins.
Users will often refer to skills, flocks, or repos by short/partial names. You MUST resolve them to their full canonical identifiers before writing to selectors.json.
Use these CLI commands to find the real sign/slug:
# Search skills by keyword (returns slug, name, description)
savhub registry search <keyword>
# List all flocks (returns slug and sign)
savhub flock list
# Show a flock's details and its skills
savhub flock show <flock-slug>
# Search the remote API for skills
savhub search <keyword>
Skills — The skills array uses slugs (short names like salvo-auth).
savhub registry search salvo-auth → use the slug from results.Flocks — The flocks array uses full sign (like github.com/salvo-rs/salvo-skills/salvo-skills).
savhub flock list → find the matching flock → use its sign (NOT just the slug).github.com/<owner>/<repo>/<flock-path>Repos — The repos array uses repo sign (like github.com/org/repo).
github.com/ZhangHanDong/makepad-skills.https://github.com/org/repo → normalize to github.com/org/repo (strip protocol, strip .git).User says: "add salvo skills"
$ savhub flock list
salvo-skills 5 skill(s) Salvo Skills
$ savhub flock show salvo-skills
Name: Salvo Skills
Slug: salvo-skills
Skills (5):
- salvo-auth Salvo Authentication
- salvo-crud Salvo CRUD
...
→ Flock sign: github.com/salvo-rs/salvo-skills/salvo-skills → add to flocks array.
User says: "add makepad repo"
$ savhub registry search makepad
... (shows results with repo info)
→ Repo sign: github.com/ZhangHanDong/makepad-skills → add to repos array.
User says: "add salvo-auth"
$ savhub registry search salvo-auth
salvo-auth Salvo Authentication Skill ...
→ Skill slug: salvo-auth → add to skills array.
When the user describes a project type and what to fetch, follow these steps:
~/.savhub/selectors.json to see existing selectorsCargo.toml, package.json, go.mod)savhub registry search, savhub flock list, etc. to find the real sign/slugdet-{descriptive-name})~/.savhub/.config-changed to notify the desktop appsavhub apply to activateStep 1 — Resolve the flock:
savhub flock list | grep -i salvo
# → salvo-skills 5 skill(s) Salvo Skills
savhub flock show salvo-skills
# → Sign: github.com/salvo-rs/salvo-skills/salvo-skills
Step 2 — Create selector:
{
"sign": "det-salvo",
"name": "Salvo Web Framework",
"description": "Detects Rust projects using Salvo and fetches Salvo skills.",
"folder_scope": ".",
"rules": [
{ "kind": "file_exists", "path": "Cargo.toml" },
{ "kind": "file_regex", "path": "Cargo.toml", "pattern": "salvo\\s*=" }
],
"match_mode": "all_match",
"custom_expression": "",
"skills": [],
"flocks": ["github.com/salvo-rs/salvo-skills/salvo-skills"],
"repos": [],
"priority": 20,
"enabled": true
}
Step 1 — Resolve: user said "all makepad skills" → use repos (adds all flocks from the repo):
savhub registry search makepad
# → find repo sign: github.com/ZhangHanDong/makepad-skills
Step 2 — Create selector:
{
"sign": "det-makepad",
"name": "Makepad Project",
"description": "Detects Makepad projects and fetches all Makepad skills.",
"folder_scope": ".",
"rules": [
{ "kind": "file_exists", "path": "Cargo.toml" },
{ "kind": "file_contains", "path": "Cargo.toml", "contains": "makepad" }
],
"match_mode": "all_match",
"custom_expression": "",
"skills": [],
"flocks": [],
"repos": ["github.com/ZhangHanDong/makepad-skills"],
"priority": 20,
"enabled": true
}
Step 1 — Resolve:
savhub registry search fastapi-auth
# → slug: fastapi-auth
Step 2 — Create selector:
{
"sign": "det-fastapi",
"name": "FastAPI Project",
"description": "Detects FastAPI projects and fetches auth skill.",
"folder_scope": ".",
"rules": [
{ "kind": "file_exists", "path": "pyproject.toml" },
{ "kind": "file_regex", "path": "pyproject.toml", "pattern": "fastapi" },
{ "kind": "file_exists", "path": "requirements.txt" },
{ "kind": "file_contains", "path": "requirements.txt", "contains": "fastapi" }
],
"match_mode": "custom",
"custom_expression": "(1 && 2) || (3 && 4)",
"skills": ["fastapi-auth"],
"flocks": [],
"repos": [],
"priority": 20,
"enabled": true
}
{
"sign": "det-fullstack-monorepo",
"name": "Fullstack Monorepo (Rust + React)",
"description": "Detects monorepos with a Rust backend and React frontend.",
"folder_scope": ".",
"rules": [
{ "kind": "file_exists", "path": "Cargo.toml" },
{ "kind": "file_exists", "path": "package.json" },
{ "kind": "file_regex", "path": "package.json", "pattern": "\"react\"\\s*:" },
{ "kind": "glob_match", "pattern": "**/src/main.rs" }
],
"match_mode": "custom",
"custom_expression": "1 && 2 && 3 && 4",
"skills": [],
"flocks": [],
"repos": [],
"priority": 30,
"enabled": true
}
To update an existing selector:
~/.savhub/selectors.jsonsign~/.savhub/.config-changedWhen the user says "add X skill to the Y selector":
selectors.json, find the selectorskills, flocks, or repos)The file wraps selectors in a versioned store:
{
"version": 1,
"selectors": [
{ /* selector 1 */ },
{ /* selector 2 */ }
]
}
After writing selectors.json, always touch the signal file so the desktop app can hot-reload:
# Unix/macOS
touch ~/.savhub/.config-changed
# Windows (PowerShell)
New-Item -Path "$env:USERPROFILE\.savhub\.config-changed" -ItemType File -Force
# Or use the CLI
savhub pilot notify
After creating or modifying selectors, instruct the user to run:
savhub apply
This will:
savhub.lock with fetched versions