diff --git a/README.md b/README.md index f6cb471..f7c513d 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ After installation, the package registers one tool: `ask_user`. That is enough for the agent to gain this clarification capability. The extension already injects prompt guidance that encourages the agent to call `ask_user` when requirements are ambiguous or user preference matters, instead of guessing. -This package also includes an auto-bundled skill profile at `skills/ask-user/SKILL.md` (`ask-user-decision-gate`) for stricter decision-gate behavior in high-stakes or ambiguous boundaries. It is enabled by default when the package is installed, but can be disabled via `pi config`. +This package also includes an auto-bundled skill profile at `skills/ask-user/SKILL.md` (`ask-user`) for stricter decision-gate behavior in high-stakes or ambiguous boundaries. It is enabled by default when the package is installed, but can be disabled via `pi config`. You can still add your own agent instruction if you want to further reinforce when and how the tool should be used. diff --git a/skills/ask-user/SKILL.md b/skills/ask-user/SKILL.md index 9536925..3580c96 100644 --- a/skills/ask-user/SKILL.md +++ b/skills/ask-user/SKILL.md @@ -1,5 +1,5 @@ --- -name: ask-user-decision-gate +name: ask-user description: "Use ask_user as a decision gate before high-stakes or ambiguous implementation choices." metadata: short-description: Decision gate for ambiguity and high-stakes choices diff --git a/tests/package.test.ts b/tests/package.test.ts new file mode 100644 index 0000000..f10c6f0 --- /dev/null +++ b/tests/package.test.ts @@ -0,0 +1,32 @@ +import assert from "node:assert/strict"; +import { readdirSync, readFileSync } from "node:fs"; +import path from "node:path"; +import test from "node:test"; + +const skillsDir = path.resolve("skills"); +const SKILL_NAME_RE = /^name:\s*(.+)$/m; + +function readDeclaredSkillName(skillPath: string): string | undefined { + const content = readFileSync(skillPath, "utf8"); + const match = content.match(SKILL_NAME_RE); + return match?.[1]?.trim(); +} + +test("each bundled skill name matches its folder name", () => { + const skillFolders = readdirSync(skillsDir, { withFileTypes: true }).filter( + (entry) => entry.isDirectory() + ); + + assert.ok(skillFolders.length > 0); + + for (const folder of skillFolders) { + const skillPath = path.join(skillsDir, folder.name, "SKILL.md"); + const declaredName = readDeclaredSkillName(skillPath); + + assert.equal( + declaredName, + folder.name, + `${skillPath} declares name "${declaredName}" but folder is "${folder.name}"` + ); + } +});