一键导入
update-zskills
Install or update Z Skills supporting infrastructure (CLAUDE.md rules, hooks, scripts)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Install or update Z Skills supporting infrastructure (CLAUDE.md rules, hooks, scripts)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate game audio (music, voices, sound effects) via ElevenLabs.
Generate a project briefing: worktree status, open checkboxes, recent commits. Modes: summary (default), report, verify, current, worktrees. Period: 1h, 6h, 24h, 2d, 7d.
Safe commit workflow with optional scope hint. Inventories all changes, classifies related vs. unrelated files, traces dependencies, protects other agents' work, and optionally pushes or lands worktree commits. Usage: /commit [pr] [scope] [push|land]
Lightweight task dispatcher for ad-hoc work: documentation, examples, refactoring, content updates. Supports scheduling with every/now/next/stop. Usage: /do <description> [worktree] [push] [pr] [every SCHEDULE] [now] | stop | next.
Audit and fix documentation gaps: block library panel entries, example models, getting-started guides, block library, presentations, README updates. Also handles newsletter entries (/doc newsletter). Use when the user asks to "write a newsletter entry", "add to the newsletter", or "update the newsletter". Usage: /doc [blocks|examples|newsletter|<description>]
Draft a high-quality plan through iterative adversarial review. Multiple rounds of research, drafting, review, devil's advocate, and refinement until the plan converges. Output is a plan file ready for /run-plan. Usage: /draft-plan [output FILE] [rounds N] <description...>
| name | update-zskills |
| description | Install or update Z Skills supporting infrastructure (CLAUDE.md rules, hooks, scripts) |
Install or update the supporting infrastructure that Z Skills depend on: CLAUDE.md agent rules, safety hooks, helper scripts, and skill dependencies.
Invocation:
/update-zskills [install] [--with-addons | --with-block-diagram-addons]
Default mode (no argument): smart detection — if nothing is installed yet, do a full install; if already installed, pull latest, update changed skills, and fill new gaps. Always begins with an audit and reports what was found and what was done about it.
Explicit mode:
install — force a full first-time setup (same as what the default
mode does when nothing is installed, but skips the detection step)Add-on flags:
--with-addons — install/update core skills + ALL available add-on packs--with-block-diagram-addons — install/update core skills + block-diagram
add-on (3 skills: /add-block, /add-example, /model-design)Without an add-on flag, only the 17 core skills are installed/updated. If core is already installed, adding an add-on flag just copies the add-on skills (the audit detects core is satisfied and skips it).
This step runs before any mode. The portable assets (hooks, scripts,
CLAUDE_TEMPLATE.md, skills) can come from two sources: the zskills-portable/
vendored directory (inside projects like yours), or the Z Skills repo
root (which has the same structure). To find them:
zskills-portable/ exists in the current working directory. If
yes, use it as $PORTABLE.zskills/ exists in the current directory and contains
CLAUDE_TEMPLATE.md. If yes, it's a repo clone — use zskills/ as
both $PORTABLE and $ZSKILLS_PATH./tmp/zskills exists and contains CLAUDE_TEMPLATE.md. If
yes, use it.git clone https://github.com/zeveck/zskills.git /tmp/zskills
If /tmp/zskills already exists, pull instead:
git -C /tmp/zskills pull
If the clone/pull fails (network, permissions), report the error clearly
and stop — do not silently continue without portable assets.
Tell the user:
Using Z Skills repo at /tmp/zskills for portable assets.
Portable asset detection: A valid portable source contains
CLAUDE_TEMPLATE.md, hooks/, scripts/, and skills/. The Z Skills
repo root has these at the top level (no zskills-portable/ subdirectory).
If the audit finds no gaps (all hooks, scripts, and CLAUDE.md rules already present — e.g., because the LLM already copied everything), the portable assets are not needed and Step 0 can return early.
Store the resolved path as $PORTABLE for use in install/update modes.
If the source is a git repo, also store it as $ZSKILLS_PATH for use
in update mode.
Check if .claude/zskills-config.json exists in the target project root ($PROJECT_ROOT).
If it exists:
CONFIG_CONTENT=$(cat "$PROJECT_ROOT/.claude/zskills-config.json")
# Extract a string value (note: ([^\"]*) allows empty strings):
if [[ "$CONFIG_CONTENT" =~ \"project_name\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
PROJECT_NAME="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"unit_cmd\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
UNIT_CMD="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"full_cmd\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
FULL_CMD="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"output_file\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
OUTPUT_FILE="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"cmd\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
DEV_SERVER_CMD="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"port_script\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
PORT_SCRIPT="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"main_repo_path\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
MAIN_REPO_PATH="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"file_patterns\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
UI_FILE_PATTERNS="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"auth_bypass\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
AUTH_BYPASS="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"timezone\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
TIMEZONE="${BASH_REMATCH[1]}"
fi
# Extract a boolean value:
if [[ "$CONFIG_CONTENT" =~ \"main_protected\"[[:space:]]*:[[:space:]]*(true|false) ]]; then
MAIN_PROTECTED="${BASH_REMATCH[1]}"
fi
# Extract landing mode:
if [[ "$CONFIG_CONTENT" =~ \"landing\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
LANDING_MODE="${BASH_REMATCH[1]}"
fi
# Extract branch prefix:
if [[ "$CONFIG_CONTENT" =~ \"branch_prefix\"[[:space:]]*:[[:space:]]*\"([^\"]*)\" ]]; then
BRANCH_PREFIX="${BASH_REMATCH[1]}"
fi
# Extract CI config:
if [[ "$CONFIG_CONTENT" =~ \"auto_fix\"[[:space:]]*:[[:space:]]*(true|false) ]]; then
CI_AUTO_FIX="${BASH_REMATCH[1]}"
fi
if [[ "$CONFIG_CONTENT" =~ \"max_fix_attempts\"[[:space:]]*:[[:space:]]*([0-9]+) ]]; then
CI_MAX_ATTEMPTS="${BASH_REMATCH[1]}"
fi
config/zskills-config.schema.json from $PORTABLE to
.claude/zskills-config.schema.json in the target project (so the
$schema reference in the config resolves correctly).If it does not exist:
! cat > .claude/zskills-config.json <<'EOF'
{
"$schema": "./zskills-config.schema.json",
"project_name": "<detected>",
"timezone": "America/New_York",
"execution": {
"landing": "cherry-pick",
"main_protected": false,
"branch_prefix": "feat/"
},
"testing": {
"unit_cmd": "<detected>",
"full_cmd": "<detected>",
"output_file": ".test-results.txt",
"file_patterns": ["<detected>"]
},
"dev_server": {
"cmd": "<detected>",
"port_script": "",
"main_repo_path": "<detected>"
},
"ui": {
"file_patterns": "",
"auth_bypass": ""
},
"ci": {
"auto_fix": true,
"max_fix_attempts": 2
}
}
EOF
Important: .claude/zskills-config.json is protected by Claude Code's
built-in permission system -- agent writes trigger a prompt. The agent presents
the values and instructs the user to create the file using the ! prefix
(user action).Merge algorithm pseudocode:
for each field F in schema:
if config[F] is non-empty string (or true/false for booleans):
use config[F]
else if auto_detect[F] is non-empty:
use auto_detect[F]
else:
mark as empty -> template section gets commented out
Template placeholder mapping:
| Placeholder | Config path | Example |
|---|---|---|
{{UNIT_TEST_CMD}} | testing.unit_cmd | npm run test |
{{FULL_TEST_CMD}} | testing.full_cmd | npm run test:all |
{{UI_FILE_PATTERNS}} | ui.file_patterns | src/(components|ui)/.*\\.tsx?$ |
{{DEV_SERVER_CMD}} | dev_server.cmd | npm start |
{{PORT_SCRIPT}} | dev_server.port_script | scripts/port.sh |
{{MAIN_REPO_PATH}} | dev_server.main_repo_path | /workspaces/my-app |
{{AUTH_BYPASS}} | ui.auth_bypass | localStorage.setItem(...) |
Empty value handling: When a config field is empty string "", the
corresponding template section is commented out with a TODO marker:
# Example: if UI_FILE_PATTERNS is empty, comment out the UI verification section
# in block-unsafe-project.sh:
#
# Before:
# UI_FILE_PATTERNS="src/components/.*\.tsx?$"
#
# After (empty):
# # TODO: Configure UI file patterns in .claude/zskills-config.json
# # UI_FILE_PATTERNS=""
The audit scans the project for all Z Skills dependencies and reports what is present and what is missing. The audit itself never modifies any files. Its output is always displayed so the user can see exactly what was found before any changes are made.
List all .claude/skills/*/SKILL.md files. For each skill:
requires: field (list of skill
names), check that each required skill is also installed. Collect all
missing dependencies.npm test, npm run test:all,
{{FULL_TEST_CMD}}) — check if test commands are configured.playwright-cli, gh) — check if the tool is
available via which.node, python3) — check via which.
These are not required but enable features:
node: enables scripts/briefing.cjs (preferred for /briefing)python3: enables scripts/briefing.py (fallback for /briefing)block-unsafe) — check if the hook file
exists in .claude/hooks/.scripts/port.sh, scripts/test-all.sh) — check if
the script file exists.Read the project's CLAUDE.md (if it exists). For each of the 13 generic
rules, search for a distinctive key phrase that identifies the rule
(case-insensitive). Mark the rule as present if the key phrase is
found, missing otherwise.
| # | Rule Name | Key Phrase(s) to Search |
|---|---|---|
| 1 | Never weaken tests | "loosen tolerances" or "widen thresholds" |
| 2 | Capture test output | "capture" AND "output" AND "never pipe" |
| 3 | Max 2 fix attempts | "two attempts.*maximum" or "NEVER thrash" |
| 4 | Pre-existing failures | "pre-existing" AND "it.skip" |
| 5 | Never discard others' changes | "discard" AND "changes" AND "didn't make" |
| 6 | Protect untracked files | "protect untracked" or "git stash -u" |
| 7 | Feature-complete commits | "feature-complete" AND "trace" AND "imports" |
| 8 | Landed marker check | ".landed" AND "status: full" |
| 9 | Worktree verify before remove | "worktree" AND "batch-remove" |
| 10 | Never defer hard parts | "defer" AND "hard parts" AND "future phases" |
| 11 | Correctness over speed | "correctness over speed" or "correctness, not speed" |
| 12 | Enumerate before guessing | "enumerate before guessing" |
| 13 | Never skip hooks | "never.*--no-verify" or "skip.*pre-commit hooks" |
Search the project's CLAUDE.md for these documentation-presence signals.
Mark each present/missing based on case-insensitive substring match:
| Check | Key phrase(s) to search in CLAUDE.md |
|---|---|
| Execution Modes section | ## Execution Modes (heading) |
| Landing mode keywords documented | cherry-pick AND pr AND direct |
| Direct mode description present | Work directly on main |
Report in the same pass/fail format as Step 2. Missing items are recommendations, not errors — this is a documentation-only gap with no enforcement consequence.
Look in .claude/hooks/ for these 2 files:
block-unsafe-generic.sh (or block-unsafe.sh — either name counts)block-unsafe-project.shLook in scripts/ for these 4 files:
port.shtest-all.shbriefing.cjs OR briefing.py (either counts — Node or Python version)clear-tracking.shIf /briefing is installed, check for briefing.cjs or briefing.py in scripts/.
If neither is found, add a note: "The /briefing skill requires briefing.cjs
or briefing.py in scripts/ — see /briefing skill documentation."
Output the report in this exact format:
Z Skills Audit Report
=====================
Skills installed: N
[list of skill names]
Skill Dependencies: all satisfied | K missing
Missing:
- /run-plan requires /verify-changes — NOT INSTALLED
...
CLAUDE.md Rules: M/13 present (K missing)
Missing:
- [rule name]: [key phrase not found]
...
Execution Mode Docs: M/3 present (K missing/recommended)
Missing (recommendation only):
- [check name]: [key phrase not found]
...
Hooks: M/2 installed (K missing)
Missing:
- [filename]
...
Scripts: M/3 installed (K missing)
Missing:
- [filename]
...
Tools: M/N available (K missing)
Missing:
- [tool name]: not found in PATH
...
Skills with additional requirements:
- /briefing: requires briefing.cjs or briefing.py in scripts/ (not found)
...
Overall: X/Y dependencies satisfied.
If everything is satisfied, end with:
Overall: Y/Y dependencies satisfied. Nothing to install.
If there are gaps and the skill is running in default or install mode, proceed to fill them (see below). The audit report is always shown first so the user sees what was found before any modifications.
Run the audit (Steps 1-6 above). Display the gap report.
Detect installation state:
.claude/skills/ directory exists, or it contains zero skills
-> treat as first-time install (proceed to "Fill All Gaps" below).This is also the path taken by the explicit install mode.
Run Step 0 (locate portable assets). If the path cannot be resolved, stop with an error: "Cannot locate zskills-portable/ directory. Please provide the path to the Z Skills source repo."
If CLAUDE.md does NOT exist:
Copy $PORTABLE/CLAUDE_TEMPLATE.md to CLAUDE.md. Then auto-detect
placeholder values and fill them in — do not prompt or block:
Scan project files for detection signals:
package.json — name, scripts.start, scripts.dev, scripts.test,
scripts["test:all"], scripts["test:ci"]Cargo.toml — [package] namepyproject.toml / setup.py / setup.cfg — project name, test configMakefile — test, serve, dev targetsmanage.py — Django project (dev server: python manage.py runserver).github/workflows/ / .gitlab-ci.yml — CI test commandspytest.ini / jest.config.* / .mocharc.* — test framework detectionFill in values automatically. Do not prompt. Do not block.
{{PROJECT_NAME}} -> directory name (always available){{DEV_SERVER_CMD}} -> npm start if package.json exists,
otherwise comment out the section{{UNIT_TEST_CMD}} -> npm test if package.json exists,
otherwise comment out{{FULL_TEST_CMD}} -> same as unit test command, or comment out<!-- TODO: fill in when known -->Report what was filled and what needs review:
CLAUDE.md created. Values filled:
Project name: my-app (from package.json)
Dev server: npm start (detected)
Test command: npm test (detected)
Full test: commented out (no test:all script found — update when ready)
Review CLAUDE.md and adjust any values that need changing.
The CLAUDE.md should be functional immediately — the 13 agent rules
work regardless of project-specific values. Unfilled placeholders should
never leave broken {{PLACEHOLDER}} strings in the file.
If CLAUDE.md EXISTS but is missing rules:
Show the user which rules are missing, show the exact text that will be
appended, and ASK before modifying. Append to a ## Agent Rules section at
the end of the existing CLAUDE.md. If ## Agent Rules already exists in
CLAUDE.md, append the missing rules to the existing section — do NOT create
a duplicate section header.
NEVER overwrite or modify existing CLAUDE.md content.
Copy missing hooks from $PORTABLE/hooks/ to .claude/hooks/.
block-unsafe-project.sh.template: copy to
.claude/hooks/block-unsafe-project.sh, then fill in the
# CONFIGURE: values from project detection (test commands, UI file
patterns). Use placeholders/fallbacks for anything undetectable.Explain what each hook does so the user understands what's being added:
Installing 2 safety hooks:
- block-unsafe-generic.sh — blocks destructive commands (git reset --hard, rm -rf, kill -9, git checkout --, etc.) and discipline violations (git add ., --no-verify)
- block-unsafe-project.sh — project-specific guards: prevents piping test output (must capture to file), verifies tests ran before commit, and optionally checks for UI verification before committing UI changes
Ask about git push blocking:
block-unsafe-generic.sh has an optional git push block. When enabled, agents cannot push to remote — you push when ready (using
! git push). This prevents accidental pushes of incomplete work.Enable git push blocking? (recommended for shared repos)
If the user says yes (or in auto mode — default to enabled), uncomment
the push blocking section in .claude/hooks/block-unsafe-generic.sh:
if [[ "$INPUT" =~ git[[:space:]]+push ]]; then
block_with_reason "BLOCKED: Agents must not push. The user decides when to push — they can run: ! git push"
fi
If the user says no, leave it commented out.
Note on tracking enforcement: The tracking enforcement section in
block-unsafe-project.sh (protecting .zskills/tracking/, blocking
clear-tracking.sh execution, and enforcing delegation/step verification)
has no placeholders — it works out of the box. No configuration needed.
Add tracking directory to .gitignore: During installation, add
.zskills/tracking/ to the project's .gitignore if not already present.
Tracking files are ephemeral session state and should never be committed.
Then register the hooks in .claude/settings.json. The format is:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/block-unsafe-generic.sh\"",
"timeout": 5
},
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/block-unsafe-project.sh\"",
"timeout": 5
}
]
},
{
"matcher": "Agent",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/block-agents.sh\"",
"timeout": 5
}
]
}
]
}
}
Note: both Bash and Agent matchers are used for PreToolUse hooks. The Bash
matcher hooks enforce command safety and tracking. The Agent matcher hook
enforces agents.min_model — blocking subagent dispatches that specify a model
below the configured minimum (haiku=1 < sonnet=2 < opus=3).
Report: "Installed N hooks: [list]"
If .claude/settings.json already has a "statusLine" key, skip.
Otherwise, offer to install: "Add zskills statusline? Shows context window, 5-hour, and 7-day rate limits as colored bars."
If yes: copy $PORTABLE/scripts/statusline.sh to ~/.claude/statusline-command.sh
and add "statusLine": {"type":"command","command":"bash ~/.claude/statusline-command.sh"}
to .claude/settings.json. Users can customize further with /statusline.
Copy missing scripts from $PORTABLE/scripts/ to scripts/.
clear-tracking.sh from $PORTABLE/scripts/ to scripts/ if missing.
This script lets the user manually clear stale tracking state. Agents are
blocked from running it by the project hook.Report: "Installed N scripts: [list]"
--with-addons or --with-block-diagram-addons)Skip this step if no add-on flag was provided.
Determine which add-on packs to install:
--with-addons -> all packs in $PORTABLE/../block-diagram/ (and any
future add-on directories)--with-block-diagram-addons -> only $PORTABLE/../block-diagram/For each add-on skill (e.g., add-block, add-example, model-design):
.claude/skills/<name>/SKILL.md already exists, skip (never overwrite).claude/skills/<name>/Report: "Installed N add-on skills: [list]" or "Add-on skills already installed — skipped."
Installation complete.
Installed:
- CLAUDE.md: [created | N rules appended | already complete]
- Hooks: N hooks installed
- Scripts: N scripts installed
- Add-ons: N add-on skills installed (omit this line if no add-on flag was used)
Skills with additional requirements:
- /briefing: requires briefing.cjs or briefing.py in scripts/ (see /briefing skill docs)
Run /update-zskills to check for updates later.
Pull latest from upstream. Find the zskills/ clone (Step 0) and
update it:
git -C "$ZSKILLS_PATH" pull
If the pull fails (no remote, not a git repo), warn and continue with the local copy as-is.
Diff against installed skills. For each skill in the source
$ZSKILLS_PATH/skills/, compare against the installed version in
.claude/skills/. Report which skills have upstream changes.
Update changed skills. For each skill with upstream changes, copy
the new version to .claude/skills/. Show the user what changed (file
names and a brief diff summary) before overwriting.
Update installed add-ons. Check if any block-diagram add-on skills
are installed (e.g., .claude/skills/add-block/SKILL.md exists). If so,
diff against $ZSKILLS_PATH/block-diagram/ and update the same way.
Fill new gaps. For any NEW items (skills, hooks, scripts, CLAUDE.md rules) that don't exist yet, install them using the same steps as the install path above (Steps B-E).
Report:
Z Skills updated.
Updated: N skills (list)
New: N items installed (list)
Unchanged: N skills
Source: $ZSKILLS_PATH (pulled from origin)
These rules are inviolable. They apply to all modes:
## Agent Rules at the end. Never modify or delete existing
sections.zskills-portable/ — Step 0 describes how to
locate it. Never hardcode paths or guess where assets live.