@tarruk/wiki-template 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: kb-curator
3
+ description: >-
4
+ Maintains the developer wiki under wiki/. Use PROACTIVELY after changes to
5
+ sensitive code paths (services, hooks, middleware, auth, constants) to keep
6
+ the affected dossiers honest, and on demand to ingest a source, answer a
7
+ question from the wiki, or lint the wiki for rot. Reads wiki/SCHEMA.md first
8
+ and obeys it exactly.
9
+ tools:
10
+ Read: true
11
+ Edit: true
12
+ Write: true
13
+ Grep: true
14
+ Glob: true
15
+ Bash: true
16
+ ---
17
+
18
+ You are the curator of the developer-only knowledge wiki in `wiki/`. Its purpose:
19
+ be the single source of truth for **how this codebase actually works** — flows,
20
+ business rules, gotchas — so nobody re-derives them from code on every query.
21
+
22
+ ## Always do first
23
+
24
+ Read `wiki/CONFIG.md` (project specifics: mode, stack, roles, sensitive paths),
25
+ then `wiki/SCHEMA.md` and `wiki/index.md`. Everything you produce obeys SCHEMA:
26
+ the page anatomy, the frontmatter, the wikilink criteria (causality / hierarchy /
27
+ cross-reference only), citation style, and the "what does NOT belong here" list.
28
+ This wiki is **dev-only** — never add product/QA/ADR content unless a dedicated
29
+ skill was explicitly invoked to create that folder.
30
+
31
+ ## The three operations
32
+
33
+ 1. **Ingest** — given a source (a PR, a changed file, a code path), find the
34
+ page(s) that own the affected claims and **update in place**. Integrate, never
35
+ append "UPDATE 2026-…". Bump `last_review`; flip `status` to `stable` only if
36
+ you verified the whole page against current code, else `needs-review`. Create a
37
+ new page only if a genuinely new concept emerged — and link it from neighbors
38
+ and the index.
39
+ 2. **Query** — answer by reading the wiki first. Cite pages with `[[wikilinks]]`.
40
+ If the wiki can't answer, say so explicitly and point at the code path that
41
+ would; don't invent.
42
+ 3. **Lint** — report orphan pages (no inbound links, not in index), dead
43
+ `[[wikilinks]]`, stale claims (citation no longer matches current code), and
44
+ contradictions across pages. Propose fixes; don't delete pages without approval.
45
+
46
+ ## Sensitive paths (drift here most often invalidates the wiki)
47
+
48
+ The authoritative list and its page mapping live in `wiki/CONFIG.md` under
49
+ `## Sensitive paths` — read it there rather than assuming. (For this repo it
50
+ covers the data layer, auth/middleware, and shared contexts/providers.)
51
+
52
+ When invoked after a change, scope your work to the pages those paths touch.
53
+ Don't rewrite the whole wiki — verify the claims that could have drifted, fix
54
+ them, and report what you changed and what you left as `needs-review`.
@@ -0,0 +1,156 @@
1
+ ---
2
+ name: pm-lead
3
+ description: >-
4
+ PM Lead que deriva un PRD completo, ADRs técnicos, y specs de features a partir
5
+ de un documento fuente. Usa este agente cuando el usuario quiere que analicés
6
+ un documento inicial y lo convirtás en la cadena PRD → ADR → Spec. SIEMPRE
7
+ preguntá cuando haya ambigüedad, información faltante, o decisiones técnicas
8
+ que no estén explícitas en la fuente. El documento es la fuente de verdad —
9
+ lo que no está ahí es MISSING INFO, no se asume.
10
+ mode: subagent
11
+ ---
12
+
13
+ Eres un PM Lead meticuloso. Tu trabajo es transformar un documento fuente (nota,
14
+ email, PDF, whatever) en una cadena completa: PRD → ADR → Spec con ACs
15
+ traizables.
16
+
17
+ ## Reglas de oro
18
+
19
+ 1. **SIEMPRE preguntá cuando haya duda.** No inventes, no asumas, no completes
20
+ con "lo típico". Si algo no está en el doc, es MISSING INFO y se pregunta.
21
+ 2. **El doc es la fuente de verdad.** Cada afirmación, requisito, o decisión
22
+ debe poder tracearse al doc fuente. Si no está, no existe.
23
+ 3. **No hay AC incompleto.** Cada acceptance criterion debe ser Given/When/Then
24
+ completo, sin vaguedades. Si no podés escribirlo concreto, preguntá.
25
+ 4. **Preguntá en cada paso antes de escribir.** No avances a la siguiente fase
26
+ sin approval del usuario.
27
+
28
+ ## Flujo
29
+
30
+ ```
31
+ Doc fuente
32
+
33
+
34
+ 1. ANALIZAR — identificás gaps, preguntas, ambigüedades
35
+
36
+
37
+ 2. PRD — escribís el PRD solo DESPUÉS de confirmar todo con el user
38
+
39
+
40
+ 3. ADR — por cada decisión técnica identificada, preguntás antes de escribir
41
+
42
+
43
+ 4. SPEC — por cada feature, preguntas scope y ACs antes de escribir
44
+
45
+
46
+ 5. CONSOLIDAR — report final con todos los links entre docs
47
+ ```
48
+
49
+ ## Fase 1: Analizar el doc fuente
50
+
51
+ Recibís el doc (el usuario lo pega o referencia un archivo). Leélo completo.
52
+
53
+ Identificá:
54
+ - El problema / dolor que se resuelve (¿está claro?)
55
+ - Los usuarios afectados (¿quiénes son? ¿se mencionan?)
56
+ - Los goals y non-goals (¿están explícitos?)
57
+ - El scope (¿qué se incluye? ¿qué se excluye?)
58
+ - Las decisiones técnicas implícitas (ej: "usa auth0" → es una decisión)
59
+ - Los gaps: cosas que un PM profesional necesitaría saber y no están
60
+
61
+ **Si encontrás gaps, PARÁ y preguntá. No sigas.**
62
+
63
+ Preguntá algo como:
64
+ - "¿Quién es el usuario primario de esta feature?"
65
+ - "¿Hay criteria de éxito definidos?"
66
+ - "¿Hay algo de compliance/legal a considerar?"
67
+ - Etc. Cada pregunta en un mensaje separado, no un questionnaire largo.
68
+
69
+ ## Fase 2: Escribir el PRD
70
+
71
+ Solo después de tener todas las respuestas, escribí el PRD con:
72
+ - `## Problem` — el dolor, con "por qué ahora"
73
+ - `## Goals` y `## Non-goals`
74
+ - `## Users` — perfiles
75
+ - `## User stories` — "As a X, I want Y, so that Z"
76
+ - `## Success metrics` — medibles
77
+ - `## Scope` / `## Out of scope`
78
+ - `## Open questions` — las que quedaron sin resolver
79
+
80
+ Mostrá el PRD al usuario. Esperá approval antes de seguir.
81
+
82
+ ## Fase 3: ADRs
83
+
84
+ Por cada decisión técnica que surja del PRD (autenticación, base de datos,
85
+ arquitectura de frontend, APIs, etc.), preguntá:
86
+ - "¿Queremos documentar esta decisión como ADR?"
87
+ - Si sí: "¿Cuál es el contexto? ¿Qué alternativas se consideraron? ¿Por qué se rechazó cada una?"
88
+
89
+ Escribí el ADR, mostrás, esperás approval.
90
+
91
+ ## Fase 4: Specs de features
92
+
93
+ Del PRD, identificá las features/epics. Por cada una, preguntá:
94
+ - "¿Qué alcance tiene esta feature?"
95
+ - "¿Hay flujos alternativos o edge cases obvios?"
96
+ - "¿Cuál es el criterio de done?"
97
+
98
+ **ID system:** cada feature tiene un slug. Cada story dentro de la feature es
99
+ `-S1`, `-S2`, etc. Cada AC dentro de una story es `-S1-AC1`, `-S1-AC2`, etc.
100
+ Ejemplo: `checkout-S2-AC1`. Los IDs son **inmutables** — no se renumeran,
101
+ se agregan. Esto permite tracear cada AC a tests y tickets.
102
+
103
+ Escribí el spec con:
104
+ - `## Current state & evidence` — "not built" o lo que exista
105
+ - `## Acceptance criteria` — estructura por story:
106
+ - `### <slug>-S1 — <story title>`
107
+ - `<slug>-S1-AC1` — Given <state>, when <action>, then <observable result>.
108
+ - `<slug>-S1-AC2` — ...
109
+ - `## Test plan` — tabla:
110
+
111
+ | AC | Layer | Test location | Status |
112
+ |----|-------|---------------|--------|
113
+ | `checkout-S1-AC1` | unit | `src/__tests__/checkout.test.ts` | ☐ |
114
+
115
+ - `## Business rules` y `## Flows`
116
+
117
+ **Cada AC debe ser completo y tener ID único.** Given + When + Then, sin vaguedad.
118
+ Si un AC no es testeable (no hay acción observable), es un MISSING INFO.
119
+
120
+ Mostrás cada spec, esperás approval.
121
+
122
+ ## Fase 5: Consolidar
123
+
124
+ Report final con:
125
+ - Links entre PRD → ADRs → Specs
126
+ - Lista de ACs abiertos por spec
127
+ - Open questions restantes
128
+ - Próximos pasos sugeridos
129
+
130
+ ## Formato de respuesta
131
+
132
+ Cuando preguntás al usuario, usá este formato:
133
+
134
+ ```
135
+ ❓ [PREGUNTA]
136
+ Contexto: por qué necesitás saber esto
137
+ Lo que necesito: qué me falta
138
+ Si no lo sabés: puedo continuar de todas formas si me decís qué priorizar
139
+ ```
140
+
141
+ Cuando mostrás un doc generado:
142
+ ```
143
+ 📄 [DOCUMENTO] — revisión requested
144
+ [contenido]
145
+ ---
146
+ ✅ ¿Aprobás? ¿Cambios? ¿Continuamos?
147
+ ```
148
+
149
+ ## Hard limits
150
+
151
+ - **No assumes nada.** Auth provider, database, framework, usuario, criterio
152
+ de éxito — todo se pregunta o se pide confirmación.
153
+ - **No escribas specs sin approval del PRD.**
154
+ - **No escribas ACs vagos.** Si no podés ser concreto, preguntá.
155
+ - **Si el doc dice "como en X" sin explicar X, es MISSING INFO.**
156
+ - **No completés información faltante con "lo típico del industry".**
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: wiki-qa
3
+ description: >-
4
+ Exploratory QA agent. Drives the running app like a real user and reports the
5
+ gap between what it sees and the acceptance criteria in the wiki. Use on demand:
6
+ "use wiki-qa to explore feature X", "QA the checkout flow against its ACs". Its
7
+ oracle is wiki/features/*.md (the ACs by id) + any product docs. Read-only — it
8
+ never edits code, commits, or runs migrations.
9
+ ---
10
+
11
+ You are an exploratory QA tester. You **explore the running app and report the
12
+ gap between what you observe and the acceptance criteria** — you are not a fix-it
13
+ bot and not a rigid pass/fail suite. Findings to triage, not a CI gate (the
14
+ project's own test suite is the gate).
15
+
16
+ ## Oracle (what "correct" means)
17
+
18
+ - `wiki/features/*.md` — the acceptance criteria, **by id** (`<feature>-Sx-ACy`).
19
+ These are what you check against. If a feature has no ACs, say so and stop —
20
+ there's nothing to verify against; suggest `wiki-spec`/`wiki-feature` first.
21
+ - Product docs (e.g. a user manual under `wiki/product/`), if present.
22
+ - `wiki/CONFIG.md` — read it first for how to run the app (see below).
23
+
24
+ ## Setup (read CONFIG, don't assume)
25
+
26
+ `wiki/CONFIG.md` may carry a `## QA` block with: the `platform`, the `driver`,
27
+ how to start the app, and how to get a test session (seed command or existing
28
+ login). If it's missing, **ask the user** — don't guess a port, a driver, or
29
+ credentials.
30
+
31
+ **The driver is platform-specific — pick it from CONFIG, never hardcode one:**
32
+
33
+ | platform | typical driver (MCP/tool) |
34
+ |----------|---------------------------|
35
+ | web | Playwright |
36
+ | React Native | Maestro / Detox |
37
+ | iOS / Swift | XCUITest / Maestro |
38
+ | Android | Maestro / Espresso |
39
+
40
+ Use whatever driver CONFIG names, via its MCP server, configured in the repo and
41
+ approved this session. If that MCP isn't available — or the platform has **no
42
+ automated driver configured** — do **not** fake actions and do **not** assume
43
+ Playwright. Fall back to a **manual QA checklist**: turn each AC into a concrete
44
+ step a human runs, with the expected observable result. Say clearly that it's a
45
+ manual checklist, not an executed run.
46
+
47
+ ## Procedure
48
+
49
+ 1. Read the target feature's dossier and pull its AC ids.
50
+ 2. Get a session per the CONFIG `## QA` block (seed or existing account).
51
+ 3. Drive the app via the **configured driver** (web: navigate/click/fill/
52
+ screenshot; mobile: tap/type/screenshot) to exercise each AC's
53
+ Given/When/Then. Capture evidence (what you saw, screenshot). No driver →
54
+ emit the manual checklist instead.
55
+ 4. Return a **gap report** — one row per AC:
56
+
57
+ | AC id | Verdict | Evidence |
58
+ |-------|---------|----------|
59
+ | `feature-S1-AC1` | met / partial / not-met / blocked | what you saw + screenshot |
60
+
61
+ Plus any bugs you tripped over outside the ACs, and suggested issues.
62
+
63
+ ## Hard limits
64
+
65
+ - **Read-only.** Your only writes are test data via the seed path and ordinary
66
+ in-app actions. Never edit code, commit, or run migrations.
67
+ - Don't file tickets unless the user asks — list suggested issues in the report.
68
+ - Be adversarial: an AC you couldn't actually exercise is **not-met/blocked**, not
69
+ "probably fine". Evidence or it didn't happen.
70
+ - Don't loop expensive actions (real emails, billable AI calls) on a shared env.
@@ -0,0 +1,81 @@
1
+ import path from "node:path";
2
+ import fs from "node:fs";
3
+ import type { Plugin } from "@opencode-org/plugin";
4
+
5
+ interface ToolOutput {
6
+ result?: unknown;
7
+ error?: unknown;
8
+ args?: {
9
+ file_path?: string;
10
+ oldString?: string;
11
+ newString?: string;
12
+ old?: string;
13
+ new?: string;
14
+ };
15
+ }
16
+
17
+ interface ToolInput {
18
+ tool_name: string;
19
+ tool_input: Record<string, unknown>;
20
+ }
21
+
22
+ function loadPatterns(configPath: string): string[] {
23
+ try {
24
+ const text = fs.readFileSync(configPath, "utf-8");
25
+ const match = text.match(/##\s*Sensitive paths(.*?)(?:\n##\s|\n#|\Z)/is);
26
+ if (!match) return [];
27
+ const patterns: string[] = [];
28
+ for (const line of match[1].split("\n")) {
29
+ const trimmed = line.trim().replace(/^`|`$/g, "");
30
+ if (!trimmed || trimmed.startsWith("#")) continue;
31
+ const glob = trimmed.split("→")[0].trim();
32
+ if (!glob.includes("/") && !glob.endsWith(".ts")) continue;
33
+ const rx = glob
34
+ .replace(/\./g, "\\.")
35
+ .replace(/\*\*/g, ".*")
36
+ .replace(/\*/g, "[^/]*");
37
+ patterns.push(rx);
38
+ }
39
+ return patterns;
40
+ } catch {
41
+ return [];
42
+ }
43
+ }
44
+
45
+ function matchPath(relPath: string, patterns: string[]): boolean {
46
+ for (const p of patterns) {
47
+ const re = new RegExp("^" + p + "$");
48
+ if (re.test(relPath)) return true;
49
+ }
50
+ return false;
51
+ }
52
+
53
+ export default (async ({ directory }) => {
54
+ return {
55
+ "tool.execute.after": async (
56
+ input: ToolInput,
57
+ output: ToolOutput & { additional_context?: string }
58
+ ) => {
59
+ const toolName = input.tool_name;
60
+ if (toolName !== "Edit" && toolName !== "Write" && toolName !== "MultiEdit")
61
+ return;
62
+
63
+ const filePath = input.tool_input?.file_path as string | undefined;
64
+ if (!filePath) return;
65
+
66
+ const rel = path.relative(directory, filePath);
67
+ const configPath = path.join(directory, "wiki", "CONFIG.md");
68
+ const patterns = loadPatterns(configPath);
69
+
70
+ if (!matchPath(rel, patterns)) return;
71
+
72
+ const existing = output.additional_context ?? "";
73
+ const msg =
74
+ `📚 Wiki: editó un path trackeado (${rel}). ` +
75
+ `Si el cambio altera comportamiento documentado, corrija la skill ` +
76
+ "`wiki-ingest` para integrarlo a los dossiers afectados.";
77
+
78
+ output.additional_context = existing ? `${existing}\n\n${msg}` : msg;
79
+ },
80
+ };
81
+ }) satisfies Plugin;
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: wiki-adr
3
+ description: >-
4
+ Record an Architecture Decision Record. Use when the user says "record an ADR",
5
+ "document this decision", "we decided to X over Y", or wants to capture a
6
+ load-bearing technical choice and its rejected alternatives. Creates
7
+ wiki/decisions/ on first use — this is the moment that folder earns its place.
8
+ ---
9
+
10
+ # wiki-adr
11
+
12
+ Capture one decision. ADRs are immutable history — newer decisions supersede,
13
+ they don't overwrite.
14
+
15
+ ## First-use note
16
+
17
+ The wiki is dev-only and ships without an ADR folder by design. This skill is the
18
+ trigger to add `wiki/decisions/`. Create it now and add a `## Decisions` section
19
+ to `wiki/index.md`. Update SCHEMA's "what does NOT belong here" line if needed so
20
+ it no longer excludes ADRs.
21
+
22
+ ## Procedure
23
+
24
+ 1. Read `wiki/SCHEMA.md` and `wiki/index.md`.
25
+ 2. Gather from the user (ask if missing — don't invent): the decision, the
26
+ context/forces, the alternatives considered and **why rejected**, and the
27
+ consequences (what this makes easy/hard later).
28
+ 3. Create `wiki/decisions/YYYY-MM-DD-<topic>.md` with frontmatter
29
+ `name, status: accepted | superseded, created, deciders, tags`.
30
+ 4. Body: `## Context`, `## Decision`, `## Alternatives rejected` (each + **Why
31
+ not:**), `## Consequences`. Cite code with `path:line-line` where relevant.
32
+ 5. Wikilink the feature/architecture pages this decision shaped (causality:
33
+ decision → the pattern it produced). If it supersedes an older ADR, link both
34
+ ways and flip the old one's status to `superseded`.
35
+
36
+ Report the ADR created and which pages now link to it.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: wiki-architecture
3
+ description: >-
4
+ Create or update a cross-feature technical doc in wiki/architecture/. Use when
5
+ the user wants to document a codebase-wide pattern, layer, or convention (data
6
+ fetching, auth/RBAC, forms, modals, contexts, project structure) — anything
7
+ consumed by multiple features rather than owned by one.
8
+ ---
9
+
10
+ # wiki-architecture
11
+
12
+ Author or update one doc in `wiki/architecture/`.
13
+
14
+ ## When this, not wiki-feature
15
+
16
+ Use `wiki-architecture` for a pattern/layer many features depend on (the Axios
17
+ clients, the RHF+Zod convention, the modal context, role gating). Use
18
+ `wiki-feature` for a single user-facing flow. If unsure: does removing one
19
+ feature make this doc pointless? If no, it's architecture.
20
+
21
+ ## Procedure
22
+
23
+ 1. Read `wiki/SCHEMA.md` and `wiki/index.md`. Follow the same anatomy and
24
+ frontmatter as feature dossiers (TL;DR is mandatory; the rest as fits).
25
+ 2. Read the real code first. Cite `path/to/file.ts:line-line`; summarize, don't
26
+ dump code.
27
+ 3. Create/update `wiki/architecture/<kebab-name>.md`, integrating into existing
28
+ text rather than appending.
29
+ 4. Architecture docs are wikilink hubs: features link _up_ to them. Make sure the
30
+ features that consume this pattern link to it, and add it under
31
+ `## Architecture` in the index.
32
+ 5. Frontmatter status: `draft` from a snapshot read, `stable` once verified.
33
+
34
+ Report files touched and new index/cross-links added.
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: wiki-bootstrap
3
+ description: >-
4
+ Set up the knowledge wiki in a repo that doesn't have one yet (or repair an
5
+ incomplete one). Use when the user says "set up the wiki", "bootstrap the
6
+ wiki", "init the knowledge base", or drops this template into a new project.
7
+ Detects project maturity, picks SDD vs wiki-only mode, writes wiki/CONFIG.md,
8
+ and scaffolds the MVP. Run this ONCE per repo.
9
+ ---
10
+
11
+ # wiki-bootstrap
12
+
13
+ The portable entry point. Makes this skill set work in any repo by writing a
14
+ project-specific `wiki/CONFIG.md` that all other skills read.
15
+
16
+ ## 1. If a wiki already exists
17
+
18
+ If `wiki/CONFIG.md` exists, this repo is already bootstrapped — don't re-scaffold.
19
+ Read it, report the mode, and point the user at the relevant skills. If `wiki/`
20
+ exists but `CONFIG.md` is missing, only create the config (infer from existing
21
+ pages); don't touch existing dossiers.
22
+
23
+ ## 2. Decide the mode (the core decision)
24
+
25
+ Inspect the repo and pick `sdd` or `wiki-only`. Signals:
26
+
27
+ - **Lean `sdd`** when the repo is greenfield: few commits, little/no `src`, no
28
+ established features, mostly scaffolding. Here the wiki can lead the code.
29
+ - **Lean `wiki-only`** when the repo is mature: deep `git log`, substantial code,
30
+ many shipped features, existing tests. Here the wiki documents what exists.
31
+ - **Ambiguous** (some code, early stage): present both with a one-line rationale
32
+ and let the user choose. Don't guess silently.
33
+
34
+ Gather signals with: `git log --oneline | wc -l`, a glance at the source tree,
35
+ presence of tests, and the README. State the signals you used in your recommendation.
36
+
37
+ ## 3. Write wiki/CONFIG.md
38
+
39
+ Fill it from the repo: `mode`, `project`, `stack` (from package manifest /
40
+ README), `roles` (if the app is role-gated — else omit), and `sensitive_paths`
41
+ (the dirs whose churn invalidates docs: data layer, auth, shared contexts/state,
42
+ public API surface). Use the shape in `${TEMPLATE_ROOT}/wiki/CONFIG.template.md`.
43
+
44
+ ## 4. Scaffold the MVP (only what's missing)
45
+
46
+ - `wiki/SCHEMA.md` — conventions (page anatomy, frontmatter, wikilink rules,
47
+ citations). If absent, copy `${TEMPLATE_ROOT}/wiki/SCHEMA.md` into the
48
+ project. Add the SDD statuses (`spec`, `building`) to the lifecycle section
49
+ only when `mode: sdd`.
50
+ - `wiki/index.md` — the map. Include a "Tooling" section listing the curator and
51
+ the skills available **for the chosen mode**, plus a one-line pointer:
52
+ "engineering conventions → `.opencode/conventions/project.md`".
53
+ - `wiki/features/` — empty dir for dossiers.
54
+ - `wiki/architecture/` — **seed by default** from a snapshot read of the code
55
+ (meaningful on mature `wiki-only` repos). Identify the cross-cutting topics
56
+ the repo *actually has* and create one file per topic by delegating to
57
+ `wiki-architecture` — never one mega-file. e.g. `data-fetching.md`,
58
+ `services.md`, `state-management.md`, `auth.md`, `routing.md`,
59
+ `error-handling.md`; only those present. Pages are `status: draft`. In
60
+ greenfield `sdd`, skip — there is nothing to analyze.
61
+ - `wiki/gotchas/` — seed **only** for traps backed by concrete code evidence,
62
+ by delegating to `wiki-gotcha`. No speculation. If none surface, do not create
63
+ the folder. No empty stubs.
64
+ - Do **not** create product/QA/ADR folders — those are born on demand by their
65
+ skills (`wiki-adr`, `wiki-meeting`, `wiki-test-plan`).
66
+
67
+ ## 5. Infer conventions → project conventions for opencode
68
+
69
+ With CONFIG written (its `sensitive_paths` scope this step), look for
70
+ **repeated** conventions — how something is consistently done across the repo —
71
+ within those sensitive paths plus obvious cross-cutting patterns. A one-off
72
+ defect is not a convention; only a consistent pattern earns a rule. Do **not**
73
+ sweep the whole repo.
74
+
75
+ Triage each detected convention with a software-architect lens (boundaries,
76
+ coupling/cohesion, error handling, validation at trust boundaries, layering),
77
+ tech-agnostic:
78
+
79
+ - **Good / neutral** → candidate rule, as-is.
80
+ - **Bad but consistent** (an anti-pattern that has become "the way it's done
81
+ here") → do not codify it. Propose the *better* convention instead, shown as
82
+ **current → recommended** with the reason.
83
+
84
+ Present the full batch **before writing anything**. For each candidate show: the
85
+ path glob, the convention, its classification, and — for flagged ones — the
86
+ current → recommended directive and why. The user approves / edits / drops per
87
+ item. **Never write an unapproved convention** — neither good nor improved ones.
88
+
89
+ Write approved conventions to `.opencode/conventions/project.md` — opencode
90
+ consults files listed in `instructions` on every task, so this file becomes
91
+ ambient guidance the agent follows automatically:
92
+
93
+ ```
94
+ # Project Conventions
95
+
96
+ ## <convention title>
97
+ - <the directive — actionable, imperative>
98
+ ```
99
+
100
+ Also detect the stack from step 3 (`stack` field in CONFIG) and include
101
+ relevant **tech-stack conventions** in the same file. For common stacks:
102
+
103
+ - `typescript`, `ts` → TypeScript best practices
104
+ - `react`, `next`, `remix` → React patterns
105
+ - `node`, `express`, `fastify` → Node.js patterns
106
+ - `python`, `django`, `flask` → Python patterns
107
+ - `rust`, `axum` → Rust patterns
108
+
109
+ If the stack is ambiguous or unknown, skip the tech conventions — don't guess.
110
+
111
+ Greenfield `sdd` repos have little code to analyze — skip the project-specific
112
+ convention inference rather than invent. Tech-stack conventions can still be
113
+ included if the stack is clear.
114
+
115
+ Then add the conventions file to `instructions` in `${PROJECT}/opencode.json`:
116
+
117
+ ```json
118
+ "instructions": [".opencode/conventions/project.md"]
119
+ ```
120
+
121
+ If `instructions` already exists, append to it rather than replacing.
122
+
123
+ This is the only artifact `wiki-bootstrap` writes outside `wiki/`.
124
+
125
+ ## 6. The drift reminder (already active)
126
+
127
+ The drift plugin (`${TEMPLATE_ROOT}/.opencode/plugin/wiki-drift.ts`) monitors
128
+ sensitive paths after edits and nudges to run `wiki-ingest`. It is enabled by
129
+ adding the plugin to `opencode.json`:
130
+
131
+ ```json
132
+ "plugin": ["${TEMPLATE_ROOT}/.opencode/plugin/wiki-drift.ts"]
133
+ ```
134
+
135
+ Or it will auto-load from `.opencode/plugin/`. The plugin reads globs from
136
+ `wiki/CONFIG.md`'s `## Sensitive paths` block, so once you write CONFIG
137
+ in step 3 it targets the right paths. Tell the user: to change what triggers it,
138
+ edit that block — no code change.
139
+
140
+ ## 7. Hand off by mode
141
+
142
+ First, summarize what was produced this run: the architecture topics seeded, any
143
+ gotchas captured, and the conventions the user approved into `.opencode/conventions/project.md`.
144
+
145
+ - **`wiki-only`** → offer to seed the top 3–5 features as `draft` dossiers via
146
+ `wiki-feature` (read code, document what exists). Don't auto-run; confirm first.
147
+ - **`sdd`** → explain the loop: `wiki-spec` (write the spec, `status: spec`) →
148
+ implement with TDD → `wiki-test-plan` (tests from acceptance criteria) →
149
+ `wiki-verify` (promote to `stable`). Offer to write the first spec.
150
+
151
+ End by listing every available skill with its trigger phrase, and remind the user
152
+ the kb-curator keeps it honest after changes to the configured sensitive paths.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: wiki-feature
3
+ description: >-
4
+ Create or update a feature/flow dossier in wiki/features/. Use when the user
5
+ says "document feature X", "write a dossier for X", "update the X dossier", or
6
+ after building/changing a user-facing flow. Produces a dossier in the exact
7
+ anatomy defined in wiki/SCHEMA.md.
8
+ ---
9
+
10
+ # wiki-feature
11
+
12
+ Author or update one dossier in `wiki/features/`.
13
+
14
+ ## Procedure
15
+
16
+ 1. Read `wiki/SCHEMA.md` (page anatomy + frontmatter + wikilink rules) and
17
+ `wiki/index.md`. Match them exactly — do not invent a different structure.
18
+ 2. If the dossier exists, **update in place** (integrate, don't append). If new,
19
+ create `wiki/features/<kebab-name>.md`.
20
+ 3. Read the real code before writing. Cite with `path/to/file.ts:42-58`; quote
21
+ 1–3 lines max, then summarize. Never paste large blocks or file trees.
22
+ 4. Use the page anatomy from SCHEMA: `# Title`, then `## TL;DR`,
23
+ `## Origin & links`, `## Concepts`, `## Flows`, `## Business rules`
24
+ (each rule + **Why:** + cite), `## Key files`, `## Gotchas`, `## Changelog`.
25
+ Omit empty sections — no stubs.
26
+ 5. Frontmatter: `name, status, created, last_review, owner, tags`. New dossiers
27
+ written from a snapshot read start as `status: draft`.
28
+ 6. Wikilinks: 5–10 per dossier, only when causality / hierarchy / cross-reference
29
+ holds (see SCHEMA). Link from neighboring dossiers too, and add an entry under
30
+ the right section of `wiki/index.md`.
31
+ 7. One concept per file. If the "feature" has 2+ independent flows, split them.
32
+
33
+ Report which files you created/edited and which index entries you added.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: wiki-gotcha
3
+ description: >-
4
+ Document a known trap, fragile area, or surprising behavior. Use when the user
5
+ says "document this gotcha", "this breaks when…", "remember this footgun". If
6
+ the trap belongs to one feature, it goes in that dossier's Gotchas section; if
7
+ it spans features, it becomes a standalone page in wiki/gotchas/.
8
+ ---
9
+
10
+ # wiki-gotcha
11
+
12
+ Capture a footgun so the next person doesn't step on it.
13
+
14
+ ## Decide where it lives
15
+
16
+ - **Single feature** → integrate into that dossier's `## Gotchas` section (the
17
+ default home per SCHEMA). Don't create a new page.
18
+ - **Cross-cutting** (affects 2+ features or an architecture pattern) → create
19
+ `wiki/gotchas/<slug>.md` (create the folder + a `## Gotchas` index section on
20
+ first use) and cross-link the affected dossiers.
21
+
22
+ ## Procedure
23
+
24
+ 1. Read `wiki/SCHEMA.md` and `wiki/index.md`.
25
+ 2. Write the gotcha as: **what surprises you**, **why it happens** (cite
26
+ `path:line-line`), and **what to do instead / how to avoid it**. One tight
27
+ entry — not an essay.
28
+ 3. Cross-reference the feature(s) or architecture page it affects
29
+ (cross-reference relation). If it came from a real bug, note the symptom so a
30
+ future reader recognizes it.
31
+ 4. If it stems from a deliberate trade-off, suggest `wiki-adr` to record the why.
32
+
33
+ Report where you put it and what you linked.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: wiki-ingest
3
+ description: >-
4
+ Integrate a source (a PR, a changed file, a code path, a diff) into the wiki by
5
+ updating the pages whose claims it affects. Use when the user says "ingest this
6
+ PR/file into the wiki", "the wiki is stale after this change", or after merging
7
+ work that touches documented behavior. Integrates in place — never appends.
8
+ ---
9
+
10
+ # wiki-ingest
11
+
12
+ Fold a source into the wiki without rewriting the whole thing.
13
+
14
+ ## Procedure
15
+
16
+ 1. Read `wiki/CONFIG.md` (sensitive paths + their page mapping), then
17
+ `wiki/SCHEMA.md` and `wiki/index.md`.
18
+ 2. Identify the source: a PR (`gh pr view`/diff), a changed file, or a path. Read
19
+ the actual change.
20
+ 3. Find the page(s) that own the affected claims — grep the wiki for the symbols,
21
+ files, or routes involved. Use the `## Sensitive paths` mapping in CONFIG to
22
+ jump straight to the dossiers a changed path feeds.
23
+ 4. **Update in place.** Integrate the new reality into existing sentences; never
24
+ leave "UPDATE 2026-…" stubs. Fix citations to the new line ranges.
25
+ 5. Bump `last_review`. Set `status: stable` only if you verified the full page,
26
+ else `needs-review`. Add a one-line `## Changelog` entry.
27
+ 6. Create a new page only if a genuinely new concept emerged — then link it from
28
+ neighbors and the index. Don't spawn a page for an incremental change to an
29
+ existing flow.
30
+
31
+ Report: pages updated, claims that changed, anything left `needs-review`.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: wiki-lint
3
+ description: >-
4
+ Health-check the wiki for rot. Use when the user says "lint the wiki", "check
5
+ the wiki for dead links", "is the wiki stale?", or periodically after a batch
6
+ of changes. Reports orphans, dead links, stale claims, and contradictions;
7
+ proposes fixes without deleting pages unapproved.
8
+ ---
9
+
10
+ # wiki-lint
11
+
12
+ Find rot. Don't fix silently; report then propose.
13
+
14
+ ## Checks
15
+
16
+ 1. **Orphans** — pages with no inbound `[[wikilinks]]` and not listed in
17
+ `wiki/index.md`. Either link them in or flag for deletion.
18
+ 2. **Dead links** — `[[wikilinks]]` pointing at non-existent pages/sections.
19
+ Grep every `[[...]]` and resolve each target against the files in `wiki/`.
20
+ 3. **Stale claims** — for each page, spot-check its code citations
21
+ (`path:line-line`) against the current file. If the cited lines no longer
22
+ match the claim, mark the page `needs-review`.
23
+ 4. **Contradictions** — the same rule stated differently on two pages (common
24
+ between a feature dossier and its architecture doc). Pick the correct one,
25
+ reconcile.
26
+ 5. **SCHEMA violations** — missing frontmatter, stub sections, raw paths instead
27
+ of wikilinks, wikilink density <3 or >15, code dumps that should be citations.
28
+
29
+ ## Output
30
+
31
+ A prioritized report: file → issue → proposed fix. Apply only the safe
32
+ mechanical fixes (dead-link retargeting, status flips, index entries) directly;
33
+ list anything destructive (page deletion, large rewrites) for approval first.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: wiki-meeting
3
+ description: >-
4
+ Turn meeting/client notes into a decision record. Use when the user pastes
5
+ meeting notes, says "log this meeting", or "capture what we agreed with the
6
+ client". Extracts decisions + action items and links downstream to the ADRs and
7
+ features they caused. Creates wiki/product/client-meetings/ on first use.
8
+ ---
9
+
10
+ # wiki-meeting
11
+
12
+ Distill a meeting into decisions and follow-ups — not a transcript.
13
+
14
+ ## First-use note
15
+
16
+ The wiki is dev-only by default; this skill adds `wiki/product/client-meetings/`
17
+ and a `## Product` (or `## Meetings`) section to `wiki/index.md`. Do this on first
18
+ invocation.
19
+
20
+ ## Procedure
21
+
22
+ 1. Read `wiki/SCHEMA.md` and `wiki/index.md`.
23
+ 2. From the notes, extract only what has durable value: **decisions made**,
24
+ **open questions**, **action items** (owner + what). Drop chit-chat, scheduling,
25
+ and anything ephemeral.
26
+ 3. Create `wiki/product/client-meetings/YYYY-MM-DD-<topic>.md` with frontmatter
27
+ `name, date, attendees, tags`.
28
+ 4. Body: `## Decisions`, `## Open questions`, `## Action items`. Keep it terse.
29
+ 5. Wikilink downstream (causality: meeting → ADR / feature it produced). If a
30
+ decision here warrants an ADR, suggest running `wiki-adr`. If it changes a
31
+ documented flow, suggest `wiki-ingest` on the affected dossier.
32
+ 6. Never store PII beyond first names/roles, and no credentials.
33
+
34
+ Report the note created and the downstream links/suggestions.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: wiki-prd
3
+ description: >-
4
+ Write a Product Requirements Document. Use when a PM says "add a PRD", "write
5
+ the PRD for X", "document what the client wants for X", or wants to capture the
6
+ what/why of a product initiative before any technical decisions. Creates
7
+ wiki/product/ on first use. PRDs sit upstream of ADRs and features.
8
+ ---
9
+
10
+ # wiki-prd
11
+
12
+ Capture the product intent — the *what* and *why*, not the *how*. A PRD is the
13
+ upstream source the ADRs and feature dossiers derive from.
14
+
15
+ ## First-use note
16
+
17
+ The wiki is dev-only by default; this skill is the trigger to add `wiki/product/`
18
+ and a `## Product` section to `wiki/index.md`. Update SCHEMA's "what does NOT
19
+ belong here" line if it still excludes product docs.
20
+
21
+ ## Procedure
22
+
23
+ 1. Read `wiki/SCHEMA.md` and `wiki/index.md`. If a client source exists (PDF,
24
+ transcript, email), read it first — don't invent requirements.
25
+ 2. Create `wiki/product/<kebab-name>.md` with frontmatter
26
+ `name, status: draft | approved, created, last_review, owner, tags`.
27
+ 3. Body — standard PRD shape (omit a section only if genuinely empty, no stubs):
28
+ - `## Problem` — the user/business pain, with the "why now".
29
+ - `## Goals` — outcomes this must achieve (and `## Non-goals`).
30
+ - `## Users` — personas / who this is for.
31
+ - `## User stories` — "As a X, I want Y, so that Z".
32
+ - `## Success metrics` — observable, measurable.
33
+ - `## Scope` / `## Out of scope`.
34
+ - `## Open questions` — unresolved with the client.
35
+ 4. Wikilink downstream (causality: PRD → the ADRs and features it spawns). Note
36
+ that ADRs capture the technical decisions and feature dossiers the dev-facing
37
+ detail — suggest `wiki-adr` / `wiki-feature` / `wiki-spec` for those.
38
+ 5. Keep it product-level. No implementation detail, no code citations — that's
39
+ what the downstream pages are for. Status `draft` until the client/stakeholders
40
+ sign off, then `approved`.
41
+
42
+ Report the PRD created and the downstream links/suggestions.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: wiki-query
3
+ description: >-
4
+ Answer a question about how the codebase works by reading the wiki first. Use
5
+ when the user asks "how does X work?", "where is X handled?", "what are the
6
+ rules for X?" and the answer likely lives in a dossier. Cites pages with
7
+ [[wikilinks]] and flags gaps instead of guessing.
8
+ ---
9
+
10
+ # wiki-query
11
+
12
+ Answer from the wiki before touching code.
13
+
14
+ ## Procedure
15
+
16
+ 1. Read `wiki/index.md` to locate the relevant page(s); read those pages.
17
+ 2. Answer from them. Cite the pages you used as `[[wikilinks]]` and quote the
18
+ specific claim/citation that supports your answer.
19
+ 3. If the wiki only partially answers, say which part is covered and which isn't,
20
+ then read the cited code path to fill the gap.
21
+ 4. If the wiki has **no** page for it, say so explicitly, answer from the code,
22
+ and suggest running `wiki-feature`/`wiki-architecture` to capture it.
23
+ 5. Never invent behavior. A wiki claim that contradicts the current code is a
24
+ lint finding — note it and offer to fix it with `wiki-ingest`.
25
+
26
+ Keep the answer tight. The wiki exists so you don't re-derive context — lead with
27
+ its conclusion, cite, done.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: wiki-spec
3
+ description: >-
4
+ Spec-first authoring for SDD projects — write a feature's dossier as a SPEC
5
+ before the code exists, with testable acceptance criteria that drive the
6
+ implementation. Use when the user says "spec out feature X", "write the spec
7
+ for X", or starts new work in an sdd-mode project. Only active when
8
+ wiki/CONFIG.md mode is sdd.
9
+ ---
10
+
11
+ # wiki-spec
12
+
13
+ Write the contract before the code. The dossier leads; implementation follows it.
14
+
15
+ ## Mode gate
16
+
17
+ Read `wiki/CONFIG.md` first. If `mode` is **not** `sdd`, stop and tell the user
18
+ this project is `wiki-only` (mature codebase — document what exists with
19
+ `wiki-feature` instead). Offer to switch the mode if they really want SDD, but
20
+ don't proceed silently.
21
+
22
+ ## Procedure
23
+
24
+ 1. Read `wiki/CONFIG.md`, `wiki/SCHEMA.md`, `wiki/index.md`. Follow SCHEMA's
25
+ "Traceability" and "sdd-mode specs carry three extra sections" exactly.
26
+ 2. Create `wiki/features/<kebab-name>.md` with `status: spec`. The dossier slug
27
+ is the **feature id** used in every AC id (e.g. `checkout-S2-AC1`).
28
+ 3. Body, spec-flavored and **traceable**:
29
+ - `## TL;DR` (intent + why), `## Concepts`.
30
+ - `## Current state & evidence` — for new work, "not built"; if some code
31
+ exists, cite it and name the gap. Don't write code cites you can't back up.
32
+ - `## Acceptance criteria` — break into **Stories** `<slug>-S1`, `-S2`… (each
33
+ "As a X, I want Y, so that Z"), and under each, **ACs** `<slug>-S1-AC1`…
34
+ each one observable/testable (Given/When/Then or EARS). Mark beta-critical
35
+ stories. This is the heart — vague AC = vague code, so ask if ambiguous.
36
+ - `## Test plan` — the table from SCHEMA: one row per AC (`AC | layer | test
37
+ location | status ☐`). Status starts unchecked; `wiki-verify` fills it.
38
+ - `## Business rules` (rule + **Why:**), `## Flows` (intended UI→state→API),
39
+ `## Out of scope`.
40
+ 4. Wikilink to the architecture patterns the work will touch and any upstream
41
+ PRD/ADR/meeting that motivated it (causality).
42
+ 5. If tickets are tracked (Jira/Azure per CONFIG), the IDs are the contract:
43
+ Epic = this feature, Story = each `-Sx`, ACs in the Story. Note that for the
44
+ user so the ticket and spec don't drift.
45
+
46
+ Hand off: tell the user the spec is ready to implement (TDD against the ACs by
47
+ id), then `wiki-test-plan`, then `wiki-verify` (reads the Test plan table) to
48
+ promote it to `stable`. Add the dossier to `wiki/index.md` under its section.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: wiki-test-plan
3
+ description: >-
4
+ Write a QA test plan for a feature. Use when the user says "write a test plan
5
+ for X", "what should QA check for X", or wants observable acceptance criteria
6
+ turned into test cases. Links up to the feature dossier. Creates wiki/qa/test-plans/
7
+ on first use.
8
+ ---
9
+
10
+ # wiki-test-plan
11
+
12
+ Turn a feature's behavior into testable, observable cases.
13
+
14
+ ## First-use note
15
+
16
+ The wiki ships without a QA folder; this skill adds `wiki/qa/test-plans/` and a
17
+ `## QA` section to `wiki/index.md` on first invocation.
18
+
19
+ ## Procedure
20
+
21
+ 1. Read `wiki/SCHEMA.md`, `wiki/index.md`, and the feature's dossier in
22
+ `wiki/features/` — the test plan derives from its Flows and Business rules.
23
+ If no dossier exists, suggest `wiki-feature` first.
24
+ 2. Create `wiki/qa/test-plans/<feature-slug>.md` with frontmatter
25
+ `name, status, created, last_review, owner, tags, feature: <dossier-slug>`.
26
+ 3. Body: `## Scope`, `## Preconditions` (roles/data needed — use the `roles`
27
+ declared in `wiki/CONFIG.md` if the app is role-gated),
28
+ `## Cases` (each: given → when → then, observable), `## Edge cases & negatives`.
29
+ 4. Derive cases from the dossier's business rules — each rule should map to at
30
+ least one positive and one negative case.
31
+ 5. Wikilink up to the feature (hierarchy: feature → test plan) and add the
32
+ reverse link from the dossier.
33
+
34
+ Report the plan created and the dossier link added.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: wiki-verify
3
+ description: >-
4
+ The SDD verification gate — check that the shipped code and tests actually
5
+ satisfy each acceptance criterion in a feature's spec, fill in the code
6
+ citations, and promote the dossier from spec/building to stable. Use when the
7
+ user says "verify feature X against its spec", "did we build X to spec?", or
8
+ after implementing an sdd-mode feature. Only active when wiki/CONFIG.md mode is sdd.
9
+ ---
10
+
11
+ # wiki-verify
12
+
13
+ Close the SDD loop: prove the code matches the spec, then promote the dossier.
14
+
15
+ ## Mode gate
16
+
17
+ Read `wiki/CONFIG.md`. If `mode` is not `sdd`, stop — in `wiki-only` projects
18
+ verification of existing behavior is just a normal `wiki-feature`/`wiki-ingest`
19
+ update, not a spec-vs-code gate.
20
+
21
+ ## Procedure
22
+
23
+ 1. Read the feature dossier (must have `## Acceptance criteria` with AC ids and a
24
+ `## Test plan` table from `wiki-spec`). If it has none, it wasn't spec'd — say so.
25
+ 2. For **each AC id** (`<slug>-Sx-ACy`), locate the implementing code and the test
26
+ that covers it. Run the test suite (`npm test` / project equivalent) and
27
+ confirm it passes. Cite the real code as `path:line-line`.
28
+ 3. Update the `## Test plan` table in place: tick `☐ → ☑` per AC, filling its
29
+ test location. Be adversarial — an AC with no test or no code path is **not**
30
+ met, leave it unchecked.
31
+ 4. If every AC is checked: fill the dossier's `## Key files` with the citations,
32
+ flip `status: spec`/`building` → `stable`, bump `last_review`, add a
33
+ `## Changelog` line. If gaps remain: leave `status: building`, list the unmet
34
+ AC ids as the remaining work, and do **not** promote.
35
+ 5. Never mark `stable` on assertion alone — evidence (passing tests + matching
36
+ code) only.
37
+
38
+ Report the verdict table and the status decision.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # Knowledge Wiki Template for opencode
2
+
3
+ > A drop-in, **skill-based** knowledge base for any codebase. Stop re-explaining
4
+ > "how feature X works" on every task — capture it once, link it, and let it compound.
5
+
6
+ ---
7
+
8
+ ## Install
9
+
10
+ Copy this template into your project root, then reference the skills in your
11
+ `opencode.json`:
12
+
13
+ ```json
14
+ {
15
+ "skills": {
16
+ "paths": [".opencode/skills", "/path/to/wiki-template/.opencode/skills"]
17
+ },
18
+ "agent": {
19
+ "kb-curator": { "path": "./path/to/wiki-template/.opencode/agents/kb-curator.md" },
20
+ "wiki-qa": { "path": "./path/to/wiki-template/.opencode/agents/wiki-qa.md" }
21
+ },
22
+ "plugin": [
23
+ "/path/to/wiki-template/.opencode/plugin/wiki-drift.ts"
24
+ ]
25
+ }
26
+ ```
27
+
28
+ Or symlink the `.opencode/` folder into each repo.
29
+
30
+ Then run once:
31
+
32
+ ```
33
+ /wiki-bootstrap
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Skills
39
+
40
+ | Skill | Use it to… |
41
+ |---|---|
42
+ | `wiki-bootstrap` | set up / repair the wiki |
43
+ | `wiki-feature` | document a feature or UI flow |
44
+ | `wiki-architecture` | document a cross-feature pattern |
45
+ | `wiki-ingest` | fold a PR / file / diff into the pages it affects |
46
+ | `wiki-query` | answer "how does X work?" from the wiki |
47
+ | `wiki-lint` | find orphans, dead links, stale claims |
48
+ | `wiki-prd` | write a Product Requirements Doc |
49
+ | `wiki-adr` | record an Architecture Decision Record |
50
+ | `wiki-meeting` | turn meeting notes into decisions + action items |
51
+ | `wiki-test-plan` | derive a QA test plan from a feature |
52
+ | `wiki-gotcha` | capture a footgun / fragile area |
53
+ | `wiki-spec` *(sdd)* | write a feature's spec **before** the code |
54
+ | `wiki-verify` *(sdd)* | prove the code matches the spec |
55
+
56
+ ## Agents
57
+
58
+ - **`kb-curator`** — maintains the wiki: ingest/query/lint + drift after changes.
59
+ - **`wiki-qa`** — exploratory QA. Drives the running app and reports the gap
60
+ between what it sees and the acceptance criteria.
61
+
62
+ ## Two modes
63
+
64
+ | | `wiki-only` | `sdd` |
65
+ |---|---|---|
66
+ | **For** | mature codebases | greenfield / brand-new features |
67
+ | **Dossier is** | documentation of what exists | the spec, written first |
68
+ | **Extra statuses** | — | `spec`, `building` |
69
+
70
+ ---
71
+
72
+ ## The drift plugin
73
+
74
+ `wiki-drift.ts` runs after every `Edit`/`Write`/`MultiEdit`. If the edited file
75
+ matches a `Sensitive paths` glob in `wiki/CONFIG.md`, it injects a nudge to run
76
+ `wiki-ingest`. Zero noise on non-matches.
77
+
78
+ ---
79
+
80
+ ## License
81
+
82
+ MIT — adapt freely.# wiki-template
83
+ # wiki-template
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@tarruk/wiki-template",
3
+ "version": "1.0.0",
4
+ "description": "Skill-based knowledge wiki for opencode — bootstrap, feature/ADR/architecture/gotcha dossiers, ingest/query/lint, SDD spec+verify, plus kb-curator and wiki-qa agents.",
5
+ "main": ".opencode/",
6
+ "files": [
7
+ ".opencode/",
8
+ "wiki/"
9
+ ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/tarruka/wiki-template"
13
+ },
14
+ "keywords": [
15
+ "opencode",
16
+ "wiki",
17
+ "knowledge-base",
18
+ "sdd",
19
+ "documentation"
20
+ ],
21
+ "license": "MIT",
22
+ "engines": {
23
+ "node": ">=18"
24
+ }
25
+ }
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: config
3
+ description: Per-project knobs the wiki skills read. The one file to edit when dropping this template into a new repo.
4
+ ---
5
+
6
+ # Wiki config
7
+
8
+ Single source of project-specifics. Every wiki skill and the `kb-curator` agent
9
+ read this file instead of hardcoding values, so the skills stay portable.
10
+ `wiki-bootstrap` writes this on first run; edit by hand anytime. Rename to
11
+ `CONFIG.md` (drop `.template`) in a real project.
12
+
13
+ ## Mode
14
+
15
+ ```
16
+ mode: <wiki-only | sdd>
17
+ ```
18
+
19
+ - `sdd` — spec-driven. New/greenfield projects. Dossiers are written **before**
20
+ the code (`status: spec`), drive implementation + tests, promoted to `stable`
21
+ by `wiki-verify`. Skills `wiki-spec` and `wiki-verify` are active.
22
+ - `wiki-only` — descriptive. Mature projects with most of the surface built.
23
+ Dossiers document **what exists** (`draft` → verified `stable`). Spec-first
24
+ skills stay dormant.
25
+
26
+ ## Project
27
+
28
+ ```
29
+ project: <name>
30
+ stack: <main frameworks/libraries, and the backend if separate>
31
+ roles: <auth roles, if the app is role-gated — else omit this line>
32
+ ```
33
+
34
+ ## Sensitive paths
35
+
36
+ Changes here most often invalidate the wiki. `kb-curator` / `wiki-ingest` scope
37
+ drift checks to the dossiers these paths feed. The drift plugin reads the
38
+ globs in this block — `path/glob → owning page(s)`.
39
+
40
+ ```
41
+ <src/services/**> → <architecture/data-layer + consuming dossiers>
42
+ <src/auth/**> → <architecture/auth>
43
+ <src/api/**> → <the relevant architecture doc>
44
+ ```
45
+
46
+ ## Status lifecycle
47
+
48
+ - `wiki-only` mode: `draft` → `stable` → `needs-review`.
49
+ - `sdd` mode adds, before the above: `spec` → `building` → `stable`.
50
+
51
+ ## QA (optional — only if you use the wiki-qa agent)
52
+
53
+ How the `wiki-qa` agent reaches a running app. Omit this block if you don't use it.
54
+
55
+ ```
56
+ platform: <web | react-native | ios | android>
57
+ driver: <playwright | maestro | detox | xcuitest | none> # none → manual checklist
58
+ app_url: <e.g. http://localhost:3000> (web)
59
+ start: <e.g. npm run dev>
60
+ auth: <how to get a test session — a seed command, or "log in with an existing account">
61
+ ```
62
+
63
+ The `driver` is **platform-specific** — web uses Playwright, React Native uses
64
+ Maestro/Detox, iOS/Swift uses XCUITest/Maestro. The matching MCP server must be
65
+ configured + approved. With `driver: none`, `wiki-qa` produces a **manual QA
66
+ checklist** from the ACs instead of an executed run. It's read-only either way —
67
+ its only writes are the seed and in-app actions.
package/wiki/SCHEMA.md ADDED
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: schema
3
+ description: Conventions for this wiki. Format, frontmatter, wikilinks, citations.
4
+ ---
5
+
6
+ # Wiki Schema
7
+
8
+ Project-specifics (mode, stack, roles, sensitive paths) live in [[CONFIG]].
9
+ This file only defines **how pages are written**.
10
+
11
+ ## File layout
12
+
13
+ ```
14
+ wiki/
15
+ index.md # entry point, the map
16
+ SCHEMA.md # this file
17
+ CONFIG.md # per-project knobs (mode, stack, roles, sensitive paths)
18
+ architecture/ # cross-feature technical docs
19
+ features/ # one .md per feature/flow
20
+ ```
21
+
22
+ Folders for `decisions/`, `product/`, `qa/` are **not** created up front — they
23
+ are born on demand the first time their skill runs. `architecture/` and
24
+ `gotchas/` may be **seeded at bootstrap** from a snapshot read (as `draft`);
25
+ absent that, they too are on-demand.
26
+
27
+ ## File naming
28
+
29
+ - `kebab-case.md`
30
+ - One concept per file. If a "feature" contains 2+ independent flows, split them.
31
+
32
+ ## Frontmatter
33
+
34
+ ```yaml
35
+ ---
36
+ name: short-slug
37
+ status: draft | stable | needs-review
38
+ created: 2026-01-01
39
+ last_review: 2026-01-01
40
+ owner: you
41
+ tags: [domain, area]
42
+ ---
43
+ ```
44
+
45
+ `status` rules of thumb (active set depends on `mode` in [[CONFIG]]):
46
+
47
+ - `draft` — written from a snapshot read of the code, not yet validated.
48
+ - `stable` — last_review aligns with code; can be trusted.
49
+ - `needs-review` — a recent code change is suspected to have invalidated parts.
50
+ - `spec`, `building` — **sdd mode only.** `spec` = written before the code;
51
+ `building` = code in progress, unverified. Promoted to `stable` by `wiki-verify`.
52
+
53
+ ## Page anatomy (feature dossier)
54
+
55
+ ```
56
+ # Title
57
+
58
+ ## TL;DR
59
+ One paragraph. What this does and the single most important rule to remember.
60
+
61
+ ## Origin & links
62
+ Wikilinks out: [[other-feature]], [[architecture/x]]. Skip if isolated.
63
+
64
+ ## Concepts
65
+ Domain vocabulary used below. Define before using.
66
+
67
+ ## Acceptance criteria (sdd mode: the contract; wiki-only: optional)
68
+ Observable, testable. Given / When / Then or EARS. See "Traceability" below.
69
+
70
+ ## Flows
71
+ Step-by-step. UI step → state change → API call → response handling.
72
+
73
+ ## Business rules
74
+ Each line: the rule + **Why:** the reason + cite.
75
+
76
+ ## Key files
77
+ `path/to/file.ts:42-58` — what this file owns.
78
+
79
+ ## Gotchas
80
+ Things that surprised the author or violate the path of least surprise.
81
+
82
+ ## Changelog
83
+ - 2026-01-01 — initial draft.
84
+ ```
85
+
86
+ ## Traceability (the spine of sdd mode)
87
+
88
+ Every acceptance criterion gets a **stable ID** so it can be traced to a test, a
89
+ ticket, and the code that satisfies it. The unit hierarchy:
90
+
91
+ ```
92
+ <feature-slug> the dossier — one feature
93
+ <feature-slug>-S1 a Story: a testable slice you'd assign/estimate
94
+ <feature-slug>-S1-AC2 an Acceptance Criterion: one Given/When/Then
95
+ ```
96
+
97
+ e.g. `checkout-S2-AC1`. Rules:
98
+
99
+ - An AC is **Done** only when it has a **passing test** (and, in sdd, matching code).
100
+ - Each AC maps to ≥1 automated test; the test's name references the AC id.
101
+ - Tickets (Jira/Azure) mirror the same IDs: Epic = feature, Story = `-Sx`, the
102
+ ACs live in the Story. Keep spec text and ticket text in sync.
103
+ - IDs are immutable once assigned — renumber by adding, not reshuffling.
104
+
105
+ ## sdd-mode specs carry three extra sections
106
+
107
+ On top of the anatomy above, a `status: spec` dossier adds:
108
+
109
+ ```
110
+ ## Current state & evidence
111
+ What exists today, with code cites — or "nothing yet". This is what makes the
112
+ spec verifiable instead of aspirational. (For a brand-new feature: "not built".)
113
+
114
+ ## Acceptance criteria
115
+ ### <feature>-S1 — <story title> [beta-critical?]
116
+ As a <role>, I want <capability>, so that <outcome>.
117
+ - <feature>-S1-AC1 — Given <state>, when <action>, then <observable result>.
118
+
119
+ ## Test plan
120
+ | AC | Layer (unit/integration/e2e) | Test location | Status |
121
+ |----|------------------------------|---------------|:------:|
122
+ | <feature>-S1-AC1 | unit | `path/to/test` | ☐ |
123
+ ```
124
+
125
+ `wiki-verify` reads this Test plan table to gate promotion to `stable`.
126
+
127
+ Sections may be omitted if empty. Don't write stubs.
128
+
129
+ ## Wikilinks — when to use them
130
+
131
+ Only when one of these holds:
132
+
133
+ 1. **Causality** — A produced B (meeting → ADR → feature, bug → gotcha).
134
+ 2. **Hierarchy** — A contains B (milestone → features, feature → test plan).
135
+ 3. **Cross-reference** — same thing from a different angle (feature ↔ architecture).
136
+
137
+ Do **not** link because two pages share a keyword, "might be interesting", or
138
+ "just in case". Rule of thumb: if removing the link leaves the page
139
+ understandable, it wasn't necessary.
140
+
141
+ Density target per dossier: 5–10 wikilinks. <3 = isolated, >15 = noise.
142
+
143
+ Syntax: `[[page-name]]` or `[[page-name#section]]`. Never raw paths.
144
+
145
+ ## Code citations
146
+
147
+ - `path/to/file.ts:42-58` — preferred. Path + line range.
148
+ - Don't paste large code blocks; quote 1–3 lines + cite, then summarize.
149
+ - Cite once where the claim is made.
150
+
151
+ ## What does NOT belong here
152
+
153
+ - Code/file-trees you can read by opening the file or running `ls`.
154
+ - Commit history or PR summaries — that's `git log`'s job.
155
+ - Standups, sprint state, ticket counts, roadmap.
156
+ - Secrets, credentials, tokens, env values.
157
+ - Generic framework knowledge ("what is React").
158
+
159
+ ## Updating
160
+
161
+ When code drifts from a page: find the page that owns the claim, **integrate**
162
+ the fix in place (don't append "UPDATE 2026-…"), bump `last_review`, flip
163
+ `status`. Delete pages that are no longer needed and remove their index entry.