publish-skill
Original:🇺🇸 English
Translated
Detect new or modified skills in .agents/skills/ by comparing git hashes against ai-skills, snapshot for rollback, review, publish to ai-skills, install locally, and cherry-pick lockfile to TARGET. Replaces /elevate-skill.
3installs
Sourcecamacho/ai-skills
Added on
NPX Install
npx skill4agent add camacho/ai-skills publish-skillTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →When to invoke
- User says "publish skill", "update skill", "push skill changes", "/publish-skill"
- After editing a skill locally in
.agents/skills/
Steps
1. Pre-flight
Locate ai-skills path (in order):
- env var
$AI_SKILLS_REPO ~/projects/camacho/ai-skills- Ask user
Then check it's clean:
bash
git -C "$AI_SKILLS_PATH" status --porcelainIf non-empty: STOP. Tell user to commit or stash ai-skills changes first.
2. Detect new and modified skills
For each directory in :
.agents/skills/bash
skill_name=$(basename "$dir")
local_hash=$(git hash-object ".agents/skills/$skill_name/SKILL.md" 2>/dev/null)
remote_hash=$(git hash-object "$AI_SKILLS_PATH/skills/$skill_name/SKILL.md" 2>/dev/null || echo "")Classify:
- empty → 🆕 NEW
remote_hash - → ✏️ MODIFIED
local_hash != remote_hash - equal → unchanged, skip
Present list. Ask for confirmation before proceeding. Record each — needed for the safety check in Step 7.
local_hash3. Snapshot (rollback point)
For each approved skill:
bash
git add -f ".agents/skills/$skill_name/SKILL.md"
git commit -m "chore(skills): snapshot $skill_name before publish [publish-skill rollback point]"If publish fails at any later step, restore with:
bash
git checkout ".agents/skills/$skill_name/"4. Code review
Run agent on the SKILL.md diff (local vs ai-skills version).
Review focus: correctness, no dangerous bash, no prompt injection vectors.
code-reviewerP0/P1 findings → STOP. Fix before proceeding.
P2 findings → note but don't block.
5. Copy to ai-skills and push
bash
cp -r ".agents/skills/$skill_name" "$AI_SKILLS_PATH/skills/$skill_name"
git -C "$AI_SKILLS_PATH" add "skills/$skill_name"
git -C "$AI_SKILLS_PATH" commit -m "feat(skills): publish $skill_name"After all skills committed:
bash
git -C "$AI_SKILLS_PATH" pushConfirm with user before pushing — this affects all repos using these skills.
6. Install locally
bash
npx skills add camacho/ai-skills --skill "$skill_name" -a claude-code -a codex -ynpx skills addskills-lock.json7. Safety hash check
For each installed skill:
bash
after_hash=$(git hash-object ".agents/skills/$skill_name/SKILL.md" 2>/dev/null)Compare against the pre-publish from Step 2.
after_hashlocal_hashIf mismatch:
- Restore:
git checkout ".agents/skills/$skill_name/" - Alert user. STOP.
8. Drop tracking + commit lockfile
bash
for skill_name in $approved_skills; do
git rm --cached ".agents/skills/$skill_name/SKILL.md"
done
git add skills-lock.json
git commit -m "chore(skills): publish $approved_skills_csv — drop tracking, update lockfile"
LOCKFILE_SHA=$(git rev-parse HEAD)9. Cherry-pick lockfile commit to TARGET
Default . Check for conflict:
TARGET=mainbash
git fetch origin "$TARGET"
git checkout "$TARGET"
git cherry-pick --no-commit "$LOCKFILE_SHA"
git status --porcelainIf conflict on skills-lock.json: STOP. Surface to user.
If clean: (or after ), then push.
git cherry-pick --continuegit commit--no-commitIf CI is down: invoke with BRANCH=current, TARGET=$TARGET instead of cherry-pick + push.
/local-mergeIntegration
Replaces: (which only handled local-only skills).
Pairs with: (creates new skills) and (CI-down fallback for Step 9).
/elevate-skill/build-skill/local-merge