repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

feat(the-system): add invocable vertical-slices skill

9595cdd93ae30c2679e7785ca715d858643b9092

Oliver Jan Krylow <oliver@bugabinga.net> ·

SSH signature · not checked

Browse filesCompare with HEAD

Changed files (6)

extensions/the-system/CHANGELOG.md

Modified
14 14 - Keep generated `/system` lifecycle turns alive in print and JSON modes.
15 15 - Align mockup, artifact-slot, and board-proposal prompt metadata and tool rendering with Pi defaults.
16 16 - Keep board proposals and repeatable artifact slots available across clarification turns and compaction.
17 +- Add a generally invocable vertical-slicing skill and require it for `/system exec`.
18 19 ## 0.0.3

extensions/the-system/README.md

Modified
69 69 ## Resources
71 71 The extension exports no System skills or prompt templates statically.
72 -For valid initialized projects, resource discovery exposes `the-system-gfm`, `the-system-tex`, and `the-system-mermaid`.
73 -Each skill requires the injected System Markdown contract and an already-selected format, so syntax guidance cannot select a format, create bundles, or spill into unrelated projects.
74 -Projects initialized during a live session require `/reload` before those skills become available.
72 +Resource discovery always exposes the generic, manually invocable `vertical-slices` skill.
73 +For valid initialized projects, it additionally exposes `the-system-gfm`, `the-system-tex`, and `the-system-mermaid`.
74 +Each format skill requires the injected System Markdown contract and an already-selected format, so syntax guidance cannot select a format, create bundles, or spill into unrelated projects.
75 +Projects initialized during a live session require `/reload` before those format skills become available.
76 77 The generic `mockup` tool remains available.

extensions/the-system/__tests__/the-system.test.ts

Modified
240 240 assert.ok(!activeTools.includes("system_slot"));
243 - it("discovers format skills only for valid initialized projects", async () => {
244 - let discover:
245 - | ((event: { cwd: string }) => Promise<unknown>)
246 - | undefined;
247 - registerTheSystem({
248 - registerCommand() {},
249 - registerTool() {},
250 - on(event: string, handler: (...args: never[]) => unknown) {
251 - if (event === "resources_discover") discover = handler as never;
252 - },
253 - } as never);
254 - const inactive = temp();
255 - assert.equal(await discover?.({ cwd: inactive }), undefined);
256 - mkdirSync(path.join(inactive, ".system"));
257 - assert.equal(await discover?.({ cwd: inactive }), undefined);
258 - const active = temp();
259 - validSystem(active);
260 - assert.deepEqual(await discover?.({ cwd: active }), {
261 - skillPaths: [path.resolve(import.meta.dirname, "../skills")],
262 - });
263 - write(active, ".system/config.json", '{"prefix":"PX","schemaVersion":4}');
264 - assert.equal(await discover?.({ cwd: active }), undefined);
265 - });
243 + it(
244 + "discovers vertical slicing generally and format skills only in valid projects",
245 + async () => {
246 + let discover:
247 + | ((event: { cwd: string }) => Promise<unknown>)
248 + | undefined;
249 + registerTheSystem({
250 + registerCommand() {},
251 + registerTool() {},
252 + on(event: string, handler: (...args: never[]) => unknown) {
253 + if (event === "resources_discover") discover = handler as never;
254 + },
255 + } as never);
256 + const skills = path.resolve(import.meta.dirname, "../skills");
257 + const genericSkills = [path.join(skills, "vertical-slices")];
258 + const inactive = temp();
259 + assert.deepEqual(await discover?.({ cwd: inactive }), {
260 + skillPaths: genericSkills,
261 + });
262 + mkdirSync(path.join(inactive, ".system"));
263 + assert.deepEqual(await discover?.({ cwd: inactive }), {
264 + skillPaths: genericSkills,
265 + });
266 + const active = temp();
267 + validSystem(active);
268 + assert.deepEqual(await discover?.({ cwd: active }), {
269 + skillPaths: [
270 + ...genericSkills,
271 + path.join(skills, "the-system-gfm"),
272 + path.join(skills, "the-system-tex"),
273 + path.join(skills, "the-system-mermaid"),
274 + ],
275 + });
276 + write(
277 + active,
278 + ".system/config.json",
279 + '{"prefix":"PX","schemaVersion":4}',
280 + );
281 + assert.deepEqual(await discover?.({ cwd: active }), {
282 + skillPaths: genericSkills,
283 + });
284 + },
285 + );
267 287 it("reports schema mismatches with schema-0 init instructions", () => {
268 288 const project = temp();

extensions/the-system/__tests__/workflow-skills.test.ts

Modified
18 18 describe("the-system internal prompt model", () => {
19 - it("ships System format skills without exporting them statically", () => {
19 + it("ships conditional System format skills without exporting them statically", () => {
20 20 const extension = packageJson();
21 21 assert.deepEqual(extension.pi, { extensions: ["index.ts"] });
22 22 const repository = repositoryPackage();
34 34 "utf8",
36 36 assert.match(skill, new RegExp(`name: ${name}`));
37 - assert.match(skill, /current instructions contain The System Markdown contract/);
37 + assert.match(
38 + skill,
39 + /current instructions contain The System Markdown contract/,
40 + );
38 41 assert.match(skill, /already been selected/);
39 42 assert.doesNotMatch(skill.split("---", 3)[1] ?? "", /bundle|create|author/);
46 + it("ships a generally invocable vertical-slices skill", () => {
47 + const skill = readFileSync(
48 + path.join(root, "skills", "vertical-slices", "SKILL.md"),
49 + "utf8",
50 + );
51 + assert.match(skill, /name: vertical-slices/);
52 + assert.match(
53 + skill,
54 + /vertical slices, vertical slicing, a walking skeleton/,
55 + );
56 + assert.match(
57 + skill,
58 + /complete observable increments across required layers/,
59 + );
60 + assert.doesNotMatch(skill, /The System|\.system/);
61 + });
43 63 it("keeps System instructions internal to the /system command", () => {
44 64 const prompts = readFileSync(path.join(root, "system-prompts.ts"), "utf8");
45 65 assert.match(prompts, /The System document contract/);

extensions/the-system/index.ts

Modified
98 98 pi.on("resources_discover", async (event) => {
99 + const root = path.join(import.meta.dirname, "skills");
100 + const skillPaths = [path.join(root, "vertical-slices")];
99 101 const { startupRuntimeState } = await import("./startup-notice.js");
100 102 const runtime = await startupRuntimeState(event.cwd);
101 - if (!runtime.active || runtime.notice) return;
102 - return { skillPaths: [path.join(import.meta.dirname, "skills")] };
103 + if (runtime.active && !runtime.notice)
104 + skillPaths.push(
105 + ...["the-system-gfm", "the-system-tex", "the-system-mermaid"].map(
106 + (name) => path.join(root, name),
107 + ),
108 + );
109 + return { skillPaths };
104 111 pi.on("session_start", (_event, ctx) => {
105 112 deactivateArtifactSlot();

extensions/the-system/skills/vertical-slices/SKILL.md

Added
new file mode 100644
1 +---
2 +name: vertical-slices
3 +description: "Use when a task calls for vertical slices, vertical slicing, a walking skeleton, or thin end-to-end delivery; implements complete observable increments across required layers instead of horizontal component batches."
4 +---
6 +# Vertical Slices
8 +Deliver working behavior, not layer inventory.
10 +## Slice loop
12 +1. Select the smallest complete behavior required by the task that is observable through a user-facing or public interface.
13 +2. Identify only the architectural layers and components that behavior requires.
14 +3. Implement and integrate those parts as one unit.
15 +4. Test the observable behavior, adding narrower tests only for nontrivial rules.
16 +5. Run fresh verification and read its full result.
17 +6. Leave the repository working before starting the next slice.
19 +When no end-to-end path exists, make the first slice the thinnest working path through the critical components.
20 +Include only the minimum prerequisite work that slice needs.
22 +## Boundaries
24 +A slice is complete only when its behavior is integrated, observable, tested, and freshly verified.
25 +Do not batch work horizontally by UI, API, storage, architectural layer, or component.
26 +Do not build speculative shared foundations ahead of the first behavior that needs them.
27 +Not every slice touches every layer; it crosses every layer required for its behavior.