productkit 1.8.0 → 1.10.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.
Files changed (34) hide show
  1. package/README.md +32 -5
  2. package/package.json +6 -3
  3. package/src/cli.js +10 -1
  4. package/src/commands/check.js +2 -2
  5. package/src/commands/completion.js +26 -2
  6. package/src/commands/diff.js +4 -15
  7. package/src/commands/doctor.js +12 -4
  8. package/src/commands/export.js +169 -13
  9. package/src/commands/init.js +66 -6
  10. package/src/commands/list.js +17 -0
  11. package/src/commands/reset.js +1 -11
  12. package/src/commands/status.js +15 -11
  13. package/src/commands/update.js +42 -3
  14. package/src/commands/workspace.js +63 -0
  15. package/src/utils/fileUtils.js +57 -11
  16. package/templates/CLAUDE.md +37 -7
  17. package/templates/README.md +26 -6
  18. package/templates/commands/productkit.analyze.md +9 -0
  19. package/templates/commands/productkit.assumptions.md +9 -0
  20. package/templates/commands/productkit.audit.md +147 -0
  21. package/templates/commands/productkit.bootstrap.md +8 -1
  22. package/templates/commands/productkit.clarify.md +9 -0
  23. package/templates/commands/productkit.constitution.md +22 -1
  24. package/templates/commands/productkit.landscape.md +130 -0
  25. package/templates/commands/productkit.learn.md +80 -0
  26. package/templates/commands/productkit.prioritize.md +33 -7
  27. package/templates/commands/productkit.problem.md +10 -0
  28. package/templates/commands/productkit.solution.md +28 -1
  29. package/templates/commands/productkit.spec.md +20 -0
  30. package/templates/commands/productkit.stories.md +166 -0
  31. package/templates/commands/productkit.techreview.md +221 -0
  32. package/templates/commands/productkit.users.md +10 -0
  33. package/templates/commands/productkit.validate.md +204 -0
  34. package/templates/knowledge-README.md +33 -0
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
+ const { getWorkspaceRoot } = require('../utils/fileUtils');
4
5
 
5
6
  async function list() {
6
7
  const root = process.cwd();
@@ -25,6 +26,22 @@ async function list() {
25
26
  console.log(chalk.bold('Available slash commands:'));
26
27
  console.log();
27
28
 
29
+ // Show workspace landscape command if in a workspace
30
+ const workspaceRoot = getWorkspaceRoot(root);
31
+ if (workspaceRoot) {
32
+ const landscapePath = path.join(workspaceRoot, '.claude', 'commands', 'productkit.landscape.md');
33
+ if (fs.existsSync(landscapePath)) {
34
+ const content = fs.readFileSync(landscapePath, 'utf-8');
35
+ let description = '';
36
+ const match = content.match(/^---\s*\n[\s\S]*?description:\s*(.+)\n[\s\S]*?---/);
37
+ if (match) description = match[1].trim();
38
+
39
+ console.log(` ${chalk.cyan('/productkit.landscape')} ${chalk.dim('(workspace)')}`);
40
+ if (description) console.log(` ${description}`);
41
+ console.log();
42
+ }
43
+ }
44
+
28
45
  for (const file of files) {
29
46
  const name = '/' + file.replace('.md', '');
30
47
  const content = fs.readFileSync(path.join(commandsDir, file), 'utf-8');
@@ -2,17 +2,7 @@ const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
4
  const readline = require('readline');
5
- const { getArtifactDir } = require('../utils/fileUtils');
6
-
7
- const ARTIFACTS = [
8
- 'constitution.md',
9
- 'users.md',
10
- 'problem.md',
11
- 'assumptions.md',
12
- 'solution.md',
13
- 'priorities.md',
14
- 'spec.md',
15
- ];
5
+ const { getArtifactDir, ARTIFACT_FILES: ARTIFACTS } = require('../utils/fileUtils');
16
6
 
17
7
  function confirm(question) {
18
8
  const rl = readline.createInterface({
@@ -1,17 +1,7 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
  const chalk = require('chalk');
4
- const { getArtifactDir } = require('../utils/fileUtils');
5
-
6
- const ARTIFACTS = [
7
- { file: 'constitution.md', command: '/productkit.constitution', label: 'Constitution' },
8
- { file: 'users.md', command: '/productkit.users', label: 'Users' },
9
- { file: 'problem.md', command: '/productkit.problem', label: 'Problem' },
10
- { file: 'assumptions.md', command: '/productkit.assumptions', label: 'Assumptions' },
11
- { file: 'solution.md', command: '/productkit.solution', label: 'Solution' },
12
- { file: 'priorities.md', command: '/productkit.prioritize', label: 'Priorities' },
13
- { file: 'spec.md', command: '/productkit.spec', label: 'Spec' },
14
- ];
4
+ const { getArtifactDir, getWorkspaceRoot, ARTIFACTS_WITH_COMMANDS: ARTIFACTS } = require('../utils/fileUtils');
15
5
 
16
6
  async function status() {
17
7
  const root = process.cwd();
@@ -24,6 +14,7 @@ async function status() {
24
14
  }
25
15
 
26
16
  const artifactDir = getArtifactDir(root);
17
+ const workspaceRoot = getWorkspaceRoot(root);
27
18
  const done = [];
28
19
  const remaining = [];
29
20
 
@@ -37,6 +28,19 @@ async function status() {
37
28
  }
38
29
 
39
30
  console.log();
31
+
32
+ // Show workspace landscape status if in a workspace
33
+ if (workspaceRoot) {
34
+ const landscapeExists = fs.existsSync(path.join(workspaceRoot, 'landscape.md'));
35
+ console.log(chalk.bold('Workspace:'));
36
+ if (landscapeExists) {
37
+ console.log(chalk.green(' done Landscape (landscape.md)'));
38
+ } else {
39
+ console.log(chalk.yellow(' todo Landscape — run /productkit.landscape from workspace root'));
40
+ }
41
+ console.log();
42
+ }
43
+
40
44
  console.log(chalk.bold(`Progress: ${done.length}/${ARTIFACTS.length} artifacts`));
41
45
  console.log();
42
46
 
@@ -18,11 +18,20 @@ async function update() {
18
18
 
19
19
  fs.ensureDirSync(targetDir);
20
20
 
21
- const commandFiles = fs.readdirSync(commandsDir);
21
+ let commandFiles;
22
+ try {
23
+ commandFiles = fs.readdirSync(commandsDir);
24
+ } catch {
25
+ console.error(chalk.red('Templates directory missing — Product Kit installation may be corrupted.'));
26
+ process.exit(1);
27
+ }
22
28
  let updated = 0;
23
29
  let added = 0;
24
30
 
25
31
  for (const file of commandFiles) {
32
+ // Landscape is workspace-only, skip for projects
33
+ if (file === 'productkit.landscape.md') continue;
34
+
26
35
  const src = path.join(commandsDir, file);
27
36
  const dest = path.join(targetDir, file);
28
37
  const existed = fs.existsSync(dest);
@@ -37,10 +46,40 @@ async function update() {
37
46
  }
38
47
  }
39
48
 
40
- // Update CLAUDE.md
49
+ // Update workspace landscape command if in a workspace
50
+ const { getWorkspaceRoot } = require('../utils/fileUtils');
51
+ const workspaceRoot = getWorkspaceRoot(root);
52
+ if (workspaceRoot) {
53
+ const wsSrc = path.join(commandsDir, 'productkit.landscape.md');
54
+ const wsDest = path.join(workspaceRoot, '.claude', 'commands', 'productkit.landscape.md');
55
+ if (fs.existsSync(wsSrc)) {
56
+ fs.ensureDirSync(path.join(workspaceRoot, '.claude', 'commands'));
57
+ fs.copyFileSync(wsSrc, wsDest);
58
+ console.log(chalk.green(' ~ workspace landscape command updated'));
59
+ }
60
+ }
61
+
62
+ // Update CLAUDE.md — replace the Product Kit section, preserve user customizations
41
63
  const claudeSrc = path.join(templatesDir, 'CLAUDE.md');
42
64
  const claudeDest = path.join(root, 'CLAUDE.md');
43
- fs.copyFileSync(claudeSrc, claudeDest);
65
+ const templateContent = fs.readFileSync(claudeSrc, 'utf-8');
66
+
67
+ if (fs.existsSync(claudeDest)) {
68
+ const existingContent = fs.readFileSync(claudeDest, 'utf-8');
69
+ // Check if the file was created by init --existing (appended to user's CLAUDE.md)
70
+ const marker = '# Product Kit Project';
71
+ const markerIndex = existingContent.indexOf(marker);
72
+ if (markerIndex > 0) {
73
+ // Preserve everything before the Product Kit section
74
+ const userContent = existingContent.substring(0, markerIndex);
75
+ fs.writeFileSync(claudeDest, userContent + templateContent);
76
+ } else {
77
+ // Standalone CLAUDE.md — safe to replace entirely
78
+ fs.copyFileSync(claudeSrc, claudeDest);
79
+ }
80
+ } else {
81
+ fs.copyFileSync(claudeSrc, claudeDest);
82
+ }
44
83
 
45
84
  console.log();
46
85
  console.log(chalk.green.bold('Slash commands updated!'));
@@ -0,0 +1,63 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+ const chalk = require('chalk');
4
+
5
+ async function workspace(workspaceName) {
6
+ if (!workspaceName) {
7
+ console.error(chalk.red('Error: Workspace name is required.'));
8
+ console.error(chalk.dim('Usage: productkit workspace <name>'));
9
+ process.exit(1);
10
+ }
11
+
12
+ const workspaceRoot = path.join(process.cwd(), workspaceName);
13
+
14
+ if (fs.existsSync(workspaceRoot)) {
15
+ console.error(chalk.red(`Error: Directory "${workspaceName}" already exists`));
16
+ process.exit(1);
17
+ }
18
+
19
+ try {
20
+ const templatesDir = path.join(__dirname, '..', '..', 'templates');
21
+
22
+ // Create workspace directory and config
23
+ fs.ensureDirSync(path.join(workspaceRoot, '.productkit'));
24
+ const pkgVersion = require('../../package.json').version;
25
+ fs.writeJsonSync(path.join(workspaceRoot, '.productkit', 'config.json'), {
26
+ type: 'workspace',
27
+ version: pkgVersion,
28
+ created: new Date().toISOString(),
29
+ knowledge_dir: 'knowledge',
30
+ }, { spaces: 2 });
31
+
32
+ // Copy landscape slash command to workspace level
33
+ fs.ensureDirSync(path.join(workspaceRoot, '.claude', 'commands'));
34
+ fs.copyFileSync(
35
+ path.join(templatesDir, 'commands', 'productkit.landscape.md'),
36
+ path.join(workspaceRoot, '.claude', 'commands', 'productkit.landscape.md')
37
+ );
38
+
39
+ // Create workspace-level knowledge directory
40
+ const knowledgeDir = path.join(workspaceRoot, 'knowledge');
41
+ fs.ensureDirSync(knowledgeDir);
42
+ fs.copyFileSync(
43
+ path.join(templatesDir, 'knowledge-README.md'),
44
+ path.join(knowledgeDir, 'README.md')
45
+ );
46
+
47
+ console.log(chalk.green.bold('Workspace created successfully!'));
48
+ console.log();
49
+ console.log(chalk.cyan('Workspace:'), workspaceName);
50
+ console.log();
51
+ console.log(chalk.cyan('Next steps:'));
52
+ console.log(` 1. cd ${workspaceName}`);
53
+ console.log(' 2. productkit init my-app');
54
+ console.log(' 3. claude');
55
+ console.log(` 4. /productkit.landscape ${chalk.dim('(writes to workspace root)')}`);
56
+ console.log();
57
+ } catch (error) {
58
+ console.error(chalk.red('Error creating workspace:'), error.message);
59
+ process.exit(1);
60
+ }
61
+ }
62
+
63
+ module.exports = workspace;
@@ -1,15 +1,12 @@
1
1
  const fs = require('fs-extra');
2
2
  const path = require('path');
3
3
 
4
- function isProductKitProject() {
5
- return fs.existsSync(path.join(process.cwd(), '.productkit'));
6
- }
7
-
8
- function getProjectRoot() {
9
- if (isProductKitProject()) {
10
- return process.cwd();
4
+ function resolveContainedPath(root, relativePath, fallback) {
5
+ const resolved = path.resolve(root, relativePath);
6
+ if (!resolved.startsWith(root + path.sep) && resolved !== root) {
7
+ return fallback;
11
8
  }
12
- return null;
9
+ return resolved;
13
10
  }
14
11
 
15
12
  function getArtifactDir(root) {
@@ -17,14 +14,63 @@ function getArtifactDir(root) {
17
14
  try {
18
15
  const config = fs.readJsonSync(configPath);
19
16
  if (config.artifact_dir) {
20
- return path.join(root, config.artifact_dir);
17
+ return resolveContainedPath(root, config.artifact_dir, root);
21
18
  }
22
19
  } catch {}
23
20
  return root;
24
21
  }
25
22
 
23
+ function getWorkspaceRoot(projectRoot) {
24
+ const parentDir = path.dirname(projectRoot);
25
+ const configPath = path.join(parentDir, '.productkit', 'config.json');
26
+ try {
27
+ const config = fs.readJsonSync(configPath);
28
+ if (config.type === 'workspace') {
29
+ return parentDir;
30
+ }
31
+ } catch {}
32
+ return null;
33
+ }
34
+
35
+ const ARTIFACT_FILES = [
36
+ 'landscape.md',
37
+ 'constitution.md',
38
+ 'users.md',
39
+ 'problem.md',
40
+ 'assumptions.md',
41
+ 'validation.md',
42
+ 'solution.md',
43
+ 'priorities.md',
44
+ 'spec.md',
45
+ 'audit.md',
46
+ 'knowledge-index.md',
47
+ 'techreview.md',
48
+ 'stories.md',
49
+ ];
50
+
51
+ const ARTIFACTS_WITH_COMMANDS = [
52
+ { file: 'landscape.md', command: '/productkit.landscape', label: 'Landscape' },
53
+ { file: 'constitution.md', command: '/productkit.constitution', label: 'Constitution' },
54
+ { file: 'users.md', command: '/productkit.users', label: 'Users' },
55
+ { file: 'problem.md', command: '/productkit.problem', label: 'Problem' },
56
+ { file: 'assumptions.md', command: '/productkit.assumptions', label: 'Assumptions' },
57
+ { file: 'validation.md', command: '/productkit.validate', label: 'Validation' },
58
+ { file: 'solution.md', command: '/productkit.solution', label: 'Solution' },
59
+ { file: 'priorities.md', command: '/productkit.prioritize', label: 'Priorities' },
60
+ { file: 'spec.md', command: '/productkit.spec', label: 'Spec' },
61
+ { file: 'audit.md', command: '/productkit.audit', label: 'Audit' },
62
+ { file: 'knowledge-index.md', command: '/productkit.learn', label: 'Knowledge Index' },
63
+ { file: 'techreview.md', command: '/productkit.techreview', label: 'Tech Review' },
64
+ { file: 'stories.md', command: '/productkit.stories', label: 'Stories' },
65
+ ];
66
+
67
+ // Lighter version without command info (for export/diff)
68
+ const ARTIFACTS = ARTIFACTS_WITH_COMMANDS.map(({ file, label }) => ({ file, label }));
69
+
26
70
  module.exports = {
27
- isProductKitProject,
28
- getProjectRoot,
29
71
  getArtifactDir,
72
+ getWorkspaceRoot,
73
+ ARTIFACT_FILES,
74
+ ARTIFACTS,
75
+ ARTIFACTS_WITH_COMMANDS,
30
76
  };
@@ -6,30 +6,60 @@ This project uses Product Kit for structured product thinking.
6
6
 
7
7
  Use these commands in order to build your product foundation:
8
8
 
9
+ 0. `/productkit.landscape` — Capture company, team, and domain context (run once, before everything else)
9
10
  1. `/productkit.constitution` — Define your product principles
10
11
  2. `/productkit.users` — Define target user personas
11
12
  3. `/productkit.problem` — Frame the problem statement
12
13
  4. `/productkit.assumptions` — Extract and prioritize assumptions
13
- 5. `/productkit.solution` — Brainstorm and evaluate solutions
14
- 6. `/productkit.prioritize` — Score and rank features
15
- 7. `/productkit.spec` — Generate a product spec
16
- 8. `/productkit.clarify` — Resolve ambiguities across artifacts
17
- 9. `/productkit.analyze` — Run a completeness/consistency check
18
- 10. `/productkit.bootstrap` — Auto-draft all artifacts from an existing codebase
14
+ 5. `/productkit.validate` — Validate assumptions with interview scripts and surveys
15
+ 6. `/productkit.solution` — Brainstorm and evaluate solutions
16
+ 7. `/productkit.prioritize` — Score and rank features
17
+ 8. `/productkit.spec` — Generate a product spec
18
+ 9. `/productkit.clarify` — Resolve ambiguities across artifacts
19
+ 10. `/productkit.analyze` — Run a completeness/consistency check
20
+ 11. `/productkit.bootstrap` — Auto-draft all artifacts from an existing codebase
21
+ 12. `/productkit.audit` — Compare spec against codebase and surface gaps (post-build — what was actually implemented vs spec)
22
+ 13. `/productkit.learn` — Index knowledge directory into a summary for faster commands
23
+ 14. `/productkit.techreview` — Review spec against codebase and flag what needs engineering input (pre-build — feasibility before implementation)
24
+ 15. `/productkit.stories` — Break spec into user stories with acceptance criteria
25
+
26
+ ## Mode
27
+
28
+ Check `.productkit/config.json` for a `mode` field — either `"solo"` (building alone) or `"team"` (working with engineers/designers). Commands should adapt their output based on mode: solo mode can skip team-oriented sections (e.g., handoff notes, engineering specs), while team mode should include collaboration artifacts and detailed technical specs.
19
29
 
20
30
  ## Artifacts
21
31
 
22
32
  Product artifacts are written as markdown files. Check `.productkit/config.json` for an `artifact_dir` field — if set, artifacts live in that directory instead of the project root. Default artifact locations:
33
+ - `landscape.md` — Company, team, and domain landscape
23
34
  - `constitution.md` — Product principles and values
24
35
  - `users.md` — Target user personas
25
36
  - `problem.md` — Problem statement
26
37
  - `assumptions.md` — Prioritized assumptions
38
+ - `validation.md` — Assumption validation results, interview scripts, and survey questions
27
39
  - `solution.md` — Chosen solution with alternatives considered
28
40
  - `priorities.md` — Scored and ranked feature list
29
41
  - `spec.md` — Complete product spec ready for engineering
42
+ - `audit.md` — Spec vs codebase audit with gap analysis
43
+ - `knowledge-index.md` — Summary index of research files in `knowledge/`
44
+ - `techreview.md` — Technical feasibility review with effort estimates
45
+ - `stories.md` — User stories grouped by epic with acceptance criteria
30
46
 
31
47
  ## Workflow
32
48
 
33
- Start with `/productkit.constitution` or `/productkit.users`, then work through the commands in order. Each command reads previous artifacts to maintain consistency.
49
+ Start with `/productkit.landscape` to front-load company knowledge, then `/productkit.constitution` or `/productkit.users`, and work through the commands in order. Each command reads previous artifacts to maintain consistency.
34
50
 
35
51
  For existing projects, use `/productkit.bootstrap` to auto-draft all artifacts from your codebase in one session.
52
+
53
+ ## Workspaces
54
+
55
+ If this project lives inside a workspace (created with `productkit workspace`), it shares a workspace directory. The workspace holds:
56
+ - `landscape.md` at the workspace root — shared company/domain context across all projects
57
+ - `knowledge/` at the workspace root — shared research files
58
+
59
+ All slash commands automatically detect workspace membership by checking `../.productkit/config.json` for `"type": "workspace"`. Workspace-level `landscape.md` and `knowledge/` supplement project-level files.
60
+
61
+ ## Knowledge Directory
62
+
63
+ The `knowledge/` directory is for raw research files — interview transcripts, survey results, analytics exports, PDFs, and other evidence. Run `/productkit.learn` to index these files into `knowledge-index.md` — a compact summary that all other slash commands read instead of scanning raw files directly. Check `.productkit/config.json` for a `knowledge_dir` field (default: `knowledge`).
64
+
65
+ If the project is inside a workspace, `/productkit.learn` also indexes the workspace-level `knowledge/` directory.
@@ -10,16 +10,22 @@ claude
10
10
 
11
11
  Then use the slash commands to build your product foundation:
12
12
 
13
+ 0. `/productkit.landscape` — Capture company, team, and domain context
13
14
  1. `/productkit.constitution` — Define your product principles
14
15
  2. `/productkit.users` — Define target user personas
15
16
  3. `/productkit.problem` — Frame the problem statement
16
17
  4. `/productkit.assumptions` — Extract and prioritize assumptions
17
- 5. `/productkit.solution` — Brainstorm and evaluate solutions
18
- 6. `/productkit.prioritize` — Score and rank features
19
- 7. `/productkit.spec` — Generate a product spec
20
- 8. `/productkit.clarify` — Resolve ambiguities
21
- 9. `/productkit.analyze` — Check consistency and completeness
22
- 10. `/productkit.bootstrap` — Auto-draft all artifacts from existing codebase
18
+ 5. `/productkit.validate` — Validate assumptions with interviews and surveys
19
+ 6. `/productkit.solution` — Brainstorm and evaluate solutions
20
+ 7. `/productkit.prioritize` — Score and rank features
21
+ 8. `/productkit.spec` — Generate a product spec
22
+ 9. `/productkit.clarify` — Resolve ambiguities
23
+ 10. `/productkit.analyze` — Check consistency and completeness
24
+ 11. `/productkit.bootstrap` — Auto-draft all artifacts from existing codebase
25
+ 12. `/productkit.audit` — Compare spec against actual implementation
26
+ 13. `/productkit.learn` — Index knowledge directory for faster commands
27
+ 14. `/productkit.techreview` — Review spec against codebase, flag engineering questions
28
+ 15. `/productkit.stories` — Break spec into user stories with acceptance criteria
23
29
 
24
30
  ## Artifacts
25
31
 
@@ -27,10 +33,24 @@ Artifacts are written to the project root by default. If `artifact_dir` is set i
27
33
 
28
34
  | File | Description |
29
35
  |------|-------------|
36
+ | `landscape.md` | Company, team, and domain landscape |
30
37
  | `constitution.md` | Product principles and values |
31
38
  | `users.md` | Target user personas |
32
39
  | `problem.md` | Problem statement |
33
40
  | `assumptions.md` | Prioritized assumptions |
41
+ | `validation.md` | Assumption validation, interview scripts, survey questions |
34
42
  | `solution.md` | Chosen solution with alternatives considered |
35
43
  | `priorities.md` | Scored and ranked feature list |
36
44
  | `spec.md` | Complete product spec ready for engineering |
45
+ | `audit.md` | Spec vs codebase audit with gap analysis |
46
+ | `knowledge-index.md` | Summary index of research files in `knowledge/` |
47
+ | `techreview.md` | Technical feasibility review with effort estimates |
48
+ | `stories.md` | User stories grouped by epic with acceptance criteria |
49
+
50
+ ## Workspaces
51
+
52
+ If this project lives inside a workspace (created with `productkit workspace <name>`), the workspace root contains shared `landscape.md` and `knowledge/` that all projects inherit automatically.
53
+
54
+ ## Knowledge Directory
55
+
56
+ Drop raw research files into the `knowledge/` directory — interview transcripts, survey results, analytics exports, PDFs, etc. Run `/productkit.learn` to index these files into `knowledge-index.md` — all other slash commands read this index instead of scanning raw files directly. If inside a workspace, `/productkit.learn` also indexes the workspace-level `knowledge/` directory.
@@ -13,11 +13,20 @@ Evaluate the overall quality, consistency, and completeness of the product think
13
13
  Check `.productkit/config.json` for an `artifact_dir` field. If set, read artifacts there instead of the project root. If not set, default to the project root.
14
14
 
15
15
  Read all existing artifacts:
16
+ - `landscape.md`
16
17
  - `constitution.md`
17
18
  - `users.md`
18
19
  - `problem.md`
19
20
  - `assumptions.md`
20
21
 
22
+ Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Check whether artifacts adequately reference available evidence. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
23
+
24
+ ### Workspace Context
25
+
26
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
27
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
28
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
29
+
21
30
  Work with whatever exists.
22
31
 
23
32
  ## Analysis Dimensions
@@ -17,8 +17,17 @@ Read these files first (required):
17
17
  If either file is missing, tell the user which commands to run first.
18
18
 
19
19
  Also read if they exist:
20
+ - `landscape.md` — company and domain landscape
20
21
  - `constitution.md` — product principles
21
22
 
23
+ Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Reference relevant findings when identifying assumptions that need validation. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
24
+
25
+ ### Workspace Context
26
+
27
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
28
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
29
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
30
+
22
31
  ## Process
23
32
 
24
33
  1. **Extract assumptions** — Read through each artifact and identify every assumption (stated and unstated)
@@ -0,0 +1,147 @@
1
+ ---
2
+ description: Compare your spec against the actual codebase and surface gaps
3
+ ---
4
+
5
+ You are a product audit specialist comparing what was planned (in the product artifacts) against what was actually built (in the codebase). Your job is to surface gaps, scope creep, and unmet acceptance criteria so the PM can make informed decisions about what to do next.
6
+
7
+ ## Your Role
8
+
9
+ Read the product spec and supporting artifacts, then systematically scan the codebase to determine what was implemented, what's missing, what was added beyond the spec, and whether acceptance criteria are met. Produce a clear, actionable audit report.
10
+
11
+ ## Before You Start
12
+
13
+ Check `.productkit/config.json` for an `artifact_dir` field. If set, read artifacts there instead of the project root. If not set, default to the project root.
14
+
15
+ Read these artifacts (required):
16
+ - `spec.md` — the product spec (required)
17
+ - `priorities.md` — feature priorities and v1 scope (required)
18
+
19
+ Also read if they exist:
20
+ - `landscape.md` — company and domain landscape
21
+ - `solution.md` — chosen solution
22
+ - `validation.md` — assumption validation results
23
+ - `assumptions.md` — known risks
24
+
25
+ ### Workspace Context
26
+
27
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
28
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
29
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
30
+
31
+ At minimum, `spec.md` must exist. If it's missing, tell the user to run `/productkit.spec` first.
32
+
33
+ ### Scan the codebase
34
+
35
+ After reading the artifacts, scan the project's actual implementation:
36
+ - **README.md** — project description, setup instructions, documented features
37
+ - **package.json** (or equivalent) — dependencies, scripts, project metadata
38
+ - **Source code** — scan the directory structure, read key files, understand what's built
39
+ - **Tests** — what's tested indicates what's implemented and what the expected behavior is
40
+ - **Config files** — environment setup, deployment config, CI/CD
41
+ - **Comments and TODOs** — in-code notes about incomplete work or known issues
42
+
43
+ Read enough of the codebase to understand what exists. You don't need to read every file — focus on entry points, key modules, and test files to build a picture of what's implemented.
44
+
45
+ ## Process
46
+
47
+ 1. **Map spec features to code** — For each feature in `spec.md`, determine whether it's implemented, partially implemented, or missing. Reference specific files/modules as evidence.
48
+
49
+ 2. **Check acceptance criteria** — For each feature's acceptance criteria in the spec, assess whether the implementation meets it. Mark each criterion as:
50
+ - ✅ **Met** — evidence in code/tests that this works
51
+ - ⚠️ **Partially met** — implemented but incomplete or with caveats
52
+ - ❌ **Not met** — no evidence of implementation
53
+ - ❓ **Cannot assess** — would need manual testing or runtime verification
54
+
55
+ 3. **Identify scope creep** — Look for significant functionality in the codebase that isn't described in the spec. Flag it — it may be intentional evolution or unplanned drift.
56
+
57
+ 4. **Check deferred items** — Review the "Out of Scope" and "Deferred to v2+" sections. Were any deferred items actually built? Were any v1 items actually deferred?
58
+
59
+ 5. **Review risks and assumptions** — If `validation.md` exists, check whether invalidated assumptions affected the implementation. If `assumptions.md` exists, check whether high-risk assumptions have been addressed in the code (error handling, fallbacks, etc.).
60
+
61
+ 6. **Check success metrics** — Are the success metrics from the spec measurable with the current implementation? Is there analytics, logging, or monitoring in place?
62
+
63
+ 7. **Present findings** — Walk the PM through the audit, feature by feature. Discuss implications and recommendations.
64
+
65
+ ## Conversation Style
66
+
67
+ - Be specific — reference actual files, modules, and code when citing evidence
68
+ - Be fair — distinguish between "not implemented" and "implemented differently than specified"
69
+ - Don't assume missing code means failure — the PM may have intentionally changed course
70
+ - Ask about ambiguous cases rather than making assumptions
71
+ - Focus on what matters — minor deviations from spec wording are less important than missing core functionality
72
+
73
+ ## Output
74
+
75
+ Present the audit directly in the conversation, then offer to write it to `audit.md`. Use this structure:
76
+
77
+ ```markdown
78
+ # Product Audit: [Product Name]
79
+
80
+ _Audited: [Date]_
81
+ _Spec version compared: spec.md_
82
+
83
+ ## Summary
84
+
85
+ - **Features in spec:** [count]
86
+ - **Fully implemented:** [count]
87
+ - **Partially implemented:** [count]
88
+ - **Not implemented:** [count]
89
+ - **Unspecified features found:** [count]
90
+
91
+ ## Feature-by-Feature Audit
92
+
93
+ ### [Feature Name] — [Must Have / Nice to Have]
94
+ **Spec status:** [v1 must-have / v1 nice-to-have / deferred]
95
+ **Implementation status:** ✅ Implemented | ⚠️ Partial | ❌ Missing
96
+
97
+ **Evidence:** [Files/modules where this is implemented]
98
+
99
+ **Acceptance Criteria:**
100
+ - ✅ [Criterion 1] — [Evidence: file/test that confirms this]
101
+ - ⚠️ [Criterion 2] — [What's missing or incomplete]
102
+ - ❌ [Criterion 3] — [No evidence found]
103
+
104
+ **Notes:** [Any observations about implementation quality, approach differences, etc.]
105
+
106
+ ### [Next Feature]
107
+ [Same structure]
108
+
109
+ ## Scope Creep
110
+
111
+ Features found in the codebase that are NOT in the spec:
112
+
113
+ 1. **[Feature/functionality]** — Found in [file/module]. [Is this intentional? Should it be added to the spec?]
114
+
115
+ ## Deferred Items Check
116
+
117
+ | Deferred Item | Was it built? | Notes |
118
+ |--------------|---------------|-------|
119
+ | [Item from spec] | Yes / No | [Details] |
120
+
121
+ ## Risk & Assumption Check
122
+
123
+ | Risk/Assumption | Addressed in code? | How |
124
+ |----------------|-------------------|-----|
125
+ | [From spec/validation.md] | Yes / No / Partial | [Evidence] |
126
+
127
+ ## Success Metrics Readiness
128
+
129
+ | Metric | Measurable? | How |
130
+ |--------|------------|-----|
131
+ | [From spec] | Yes / No | [What's in place — analytics, logging, etc.] |
132
+
133
+ ## Recommendations
134
+
135
+ ### Critical (block launch)
136
+ 1. [Missing must-have feature or unmet critical criterion]
137
+
138
+ ### Important (address soon)
139
+ 1. [Partially implemented feature that needs completion]
140
+
141
+ ### Nice to Have (backlog)
142
+ 1. [Minor gaps or improvements]
143
+
144
+ ### Process Observations
145
+ - [Any patterns noticed — e.g., "spec was too vague on X, leading to implementation ambiguity"]
146
+ - [Suggestions for improving the spec → build → audit cycle]
147
+ ```
@@ -10,7 +10,14 @@ Analyze the existing project — code, docs, README, config files, comments —
10
10
 
11
11
  ## Before You Start
12
12
 
13
- 1. Read the project's README, CLAUDE.md, package.json (or equivalent), and scan the directory structure to understand what this project does.
13
+ 1. Read the project's README, CLAUDE.md, package.json (or equivalent), and scan the directory structure to understand what this project does. Also read `landscape.md` if it exists — use it for company and domain context. Read `knowledge-index.md` if it exists — it contains a summary of research from the `knowledge/` directory. Reference relevant findings as evidence when drafting artifacts. If the file doesn't exist but `knowledge/` has files, suggest running `/productkit.learn` first.
14
+
15
+ ### Workspace Context
16
+
17
+ Check if this project is inside a workspace: look for `../.productkit/config.json` with `"type": "workspace"`. If yes:
18
+ - Read `landscape.md` from the workspace root (parent directory) — this is shared company/domain landscape.
19
+ - Also read workspace-level `knowledge-index.md` if it exists. Workspace research index supplements (does not replace) project-level research index.
20
+
14
21
  2. Check `.productkit/config.json` for an `artifact_dir` field. If set, read and write artifacts there instead of the project root. If not set, default to the project root.
15
22
  3. Check which artifacts already exist (constitution.md, users.md, problem.md, assumptions.md, solution.md, priorities.md, spec.md) in the artifact directory. **Skip any that already exist** — tell the user you're skipping them.
16
23
  4. Check `.productkit/config.json` — if `minimal: true`, skip `constitution.md`.