Skip to content

Instantly share code, notes, and snippets.

@fenying
Last active May 27, 2026 03:11
Show Gist options
  • Select an option

  • Save fenying/ee605ed5fb7267767faa7a42cc2bff5f to your computer and use it in GitHub Desktop.

Select an option

Save fenying/ee605ed5fb7267767faa7a42cc2bff5f to your computer and use it in GitHub Desktop.
update AI skills by skills-lock.json
#!/usr/bin/env node
/**
* This file fix when the `npx skills update` doesn't work, in project mode.
*/
import { execSync } from "node:child_process";
import { readFileSync } from "node:fs";
import { resolve, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const lockFile = process.argv[2] ?? './skills-lock.json';
const { skills } = JSON.parse(readFileSync(lockFile, "utf-8"));
const groups = {};
for (const [name, skill] of Object.entries(skills)) {
(groups[skill.source] ??= []).push(name);
}
for (const [url, names] of Object.entries(groups)) {
const skillArgs = names.map(n => `--skill "${n}"`).join(" ");
const cmd = `npx skills add "${url}" ${skillArgs} -y`;
console.log(`\nUpdating skills: ${names.join(", ")}`);
console.log(` ${cmd}`);
execSync(cmd, { stdio: "inherit" });
}
console.log("\nAll skills updated.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment