claudex-setup 1.10.2 → 1.11.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.10.3] - 2026-04-02
4
+
5
+ ### Added
6
+ - `--snapshot` support for `audit`, `augment`, `suggest-only`, `benchmark`, and `governance`, writing normalized evidence artifacts under `.claude/claudex-setup/snapshots/`
7
+ - shared snapshot history via `index.json` so before/after work can accumulate into a single local evidence spine
8
+ - `governance --out governance.md` for a shareable governance / pilot-readiness artifact
9
+ - packaged Claude-native `audit-repo` skill template under `content/claude-code/audit-repo/`
10
+ - lightweight release checklist in `content/release-checklist.md`
11
+
12
+ ### Changed
13
+ - default audit now surfaces `Top 5 Next Actions` with rationale, traceability, risk, confidence, and a suggested next command
14
+ - `--lite` now gives a shorter beginner-first top-3 quick scan
15
+ - README and docs now reflect snapshot artifacts, governance export, and the Claude-native skill path
16
+ - packaged content and public-facing counts are now aligned with the current CLAUDEX state
17
+
18
+ ## [1.11.0] - 2026-04-03
19
+
20
+ ### Added
21
+ - `history` command — show score timeline from saved snapshots
22
+ - `compare` command — diff latest vs previous snapshot with delta, regressions, improvements
23
+ - `trend --out report.md` — export trend report as shareable markdown
24
+ - `--require A,B` CI flag — exit code 1 if named checks fail (policy guardrails)
25
+ - Agentic DX positioning in README
26
+ - Real results table (4 case studies) in README
27
+ - Claude-native integration guide (skill, hook, agent examples)
28
+ - Trust-first help text reordering
29
+
30
+ ### Fixed
31
+ - Hook checks (hooksInSettings, preToolUse, postToolUse, sessionStart) now OR across settings.json and settings.local.json
32
+
3
33
  ## [1.10.2] - 2026-04-02
4
34
 
5
35
  ### Fixed
@@ -11,6 +41,12 @@
11
41
  - MCP preflight warnings for `setup`, `plan`, and `apply` when selected packs require missing environment variables
12
42
  - user-facing docs now reflect the actual 22 detected stacks
13
43
 
44
+ ## [1.10.1] - 2026-04-02
45
+
46
+ ### Fixed
47
+ - corrected MCP pack package names to verified npm packages
48
+ - aligned settings hierarchy checks with shared settings precedence
49
+
14
50
  ## [1.10.0] - 2026-04-01
15
51
 
16
52
  ### Added
package/README.md CHANGED
@@ -1,25 +1,56 @@
1
1
  # claudex-setup
2
2
 
3
- > Score your project 0-100 for Claude Code readiness. Discover gaps, export proposal bundles, apply safe starter changes with rollback, and benchmark the impact without touching your live repo.
3
+ > Score your repo's Claude Code setup against 62 checks. See what's missing, apply only what you approve with rollback, and benchmark the impact without breaking existing config.
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/claudex-setup)](https://www.npmjs.com/package/claudex-setup)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/claudex-setup)](https://www.npmjs.com/package/claudex-setup)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
8
 
9
+ ### What this is
10
+
11
+ - The **Agentic DX layer for Claude Code** — audit, improve, govern, and benchmark how Claude works with your repo
12
+ - A **Claude Code workflow audit and improvement tool** — not an MCP installer, not a code generator
13
+ - Scores your repo 0-100 across CLAUDE.md, hooks, commands, agents, skills, MCP, security, and more
14
+ - Proposes changes as diffs you review — applies only what you approve, with rollback for every change
15
+ - Includes governance (permission profiles, hook registry, policy packs) and benchmark (isolated before/after)
16
+
17
+ ### What this is NOT
18
+
19
+ - Not an MCP setup tool (MCP packs are one of 26 features, not the product)
20
+ - Not a code generator or refactoring tool — it configures how Claude works with your repo, not the code itself
21
+ - Not a replacement for hand-crafted CLAUDE.md — generated output is a strong starting point, not a final answer
22
+ - Not a score you should chase blindly — 90/100 with bad code is still bad code
23
+
9
24
  ## Quick Start
10
25
 
11
26
  ```bash
27
+ npx claudex-setup --lite # Quick beginner scan: top 3 fixes + next command
12
28
  npx claudex-setup # Audit your project (10 seconds)
29
+ npx claudex-setup --snapshot # Save a normalized snapshot under .claude/claudex-setup/
13
30
  npx claudex-setup setup # Create a starter-safe baseline
14
31
  npx claudex-setup augment # Repo-aware plan, no writes
15
32
  npx claudex-setup plan # Export proposal bundles with file previews
16
33
  npx claudex-setup governance # See permission profiles, packs, and pilot guidance
34
+ npx claudex-setup governance --out governance.md # Export a shareable governance report
17
35
  npx claudex-setup benchmark # Measure before/after in an isolated temp copy
18
36
  npx claudex-setup --threshold 60 # Fail CI if score is below 60
19
37
  ```
20
38
 
21
39
  No install. No config. No dependencies.
22
40
 
41
+ ## Real Results
42
+
43
+ Tested on 4 real projects — not demos:
44
+
45
+ | Project | Type | Before | After | Delta |
46
+ |---------|------|--------|-------|-------|
47
+ | CLAUDEX | Research engine, Python | 62 | 90 | **+28** |
48
+ | VTCLE | Marketing automation, FastAPI | 46 | 64 | **+18** |
49
+ | Social | Mobile app, React Native | 40 | 48 | **+8** |
50
+ | Polymiro | Prediction system, Python/Docker | 35 | 48 | **+13** |
51
+
52
+ Most common gaps found: missing secrets protection, no deny rules, no mermaid diagram, no hooks in settings.
53
+
23
54
  ## What You Get
24
55
 
25
56
  ```
@@ -41,18 +72,35 @@ No install. No config. No dependencies.
41
72
  CI pipeline configured
42
73
  → Add .github/workflows/ for automated testing
43
74
 
44
- Best next fixes
75
+ Top 5 Next Actions
45
76
  1. Add CLAUDE.md verification criteria
77
+ Why: Claude needs an explicit verification loop before handoff
78
+ Trace: failed-check:verificationLoop | impact:critical | category:quality
79
+ Risk: high | Confidence: high
80
+ Fix: Add test/lint/build commands to CLAUDE.md so Claude can verify its own work
81
+
46
82
  2. Configure safe permissions + deny rules
83
+ Why: Explicit permissions are the main safety layer for repo writes
84
+ Trace: failed-check:permissionDeny | impact:high | category:security
85
+ Risk: medium | Confidence: high
86
+ Fix: Add permissions.deny rules to block dangerous operations
47
87
 
48
88
  Weakest areas:
49
89
  design: none (0/2)
50
90
  devops: none (0/4)
51
91
 
52
92
  29/62 checks passing
53
- Run npx claudex-setup setup to create a starter-safe baseline
93
+ Next command: npx claudex-setup setup
54
94
  ```
55
95
 
96
+ Want the shortest possible first run?
97
+
98
+ ```bash
99
+ npx claudex-setup --lite
100
+ ```
101
+
102
+ That prints a compact top-3 quick scan with one clear next command.
103
+
56
104
  ## All Commands
57
105
 
58
106
  | Command | What it does |
@@ -84,6 +132,8 @@ No install. No config. No dependencies.
84
132
  | `--only A,B` | Limit plan/apply to selected proposal ids |
85
133
  | `--profile NAME` | Choose a permission profile for write-capable flows |
86
134
  | `--mcp-pack A,B` | Merge named MCP packs into generated or patched settings |
135
+ | `--snapshot` | Save a normalized artifact under `.claude/claudex-setup/snapshots/` |
136
+ | `--lite` | Show a short top-3 quick scan with one clear next command |
87
137
  | `--dry-run` | Preview apply without writing files |
88
138
  | `--verbose` | Show all recommendations (not just critical/high) |
89
139
  | `--json` | Machine-readable JSON output (for CI) |
@@ -141,6 +191,7 @@ Use `governance` when the question is "can we pilot this safely?" instead of "wh
141
191
 
142
192
  ```bash
143
193
  npx claudex-setup governance
194
+ npx claudex-setup governance --out governance.md
144
195
  ```
145
196
 
146
197
  It exposes:
@@ -152,6 +203,8 @@ It exposes:
152
203
  - 26 MCP packs: Context7, Next.js devtools, GitHub, PostgreSQL, Playwright, Docker, Notion, Linear, Sentry, Slack, Stripe, Figma, Shopify, Hugging Face, Blender, WordPress, Jira/Confluence, GA4, Search Console, n8n, Zendesk, Infisical, Composio, memory, sequential-thinking, mcp-security
153
204
  - a pilot rollout kit with scope, approvals, success metrics, and rollback expectations
154
205
 
206
+ Use `--out governance.md` if you want a shareable artifact for leads, platform teams, or security review.
207
+
155
208
  ## Domain Packs And MCP Packs
156
209
 
157
210
  `augment` and `suggest-only` now recommend repo-shaped guidance instead of giving every project the same advice.
@@ -181,6 +234,31 @@ Benchmark mode:
181
234
  - applies starter-safe artifacts only in the copy
182
235
  - reruns the audit and emits before/after deltas, workflow-evidence coverage, a case-study summary, and an executive recommendation
183
236
 
237
+ If you want repeatable evidence artifacts for before/after work, add `--snapshot` to `audit`, `augment`, `suggest-only`, `benchmark`, or `governance`.
238
+
239
+ ```bash
240
+ npx claudex-setup --snapshot
241
+ npx claudex-setup augment --snapshot
242
+ npx claudex-setup benchmark --snapshot
243
+ ```
244
+
245
+ Snapshots are written to `.claude/claudex-setup/snapshots/` with a shared envelope and an `index.json` history file.
246
+
247
+ ## Use Inside Claude Code
248
+
249
+ If you want the first Claude-native entry point, copy the shipped skill template into your repo.
250
+
251
+ If `claudex-setup` is installed locally in `node_modules`, use:
252
+
253
+ ```bash
254
+ mkdir -p .claude/skills/audit-repo
255
+ cp ./node_modules/claudex-setup/content/claude-code/audit-repo/SKILL.md .claude/skills/audit-repo/SKILL.md
256
+ ```
257
+
258
+ If you are using `npx` only, copy the same file from the GitHub repo at `content/claude-code/audit-repo/SKILL.md`.
259
+
260
+ The skill runs `npx claudex-setup --json`, summarizes the score, shows the top next actions, and points to the right next command without applying changes.
261
+
184
262
  ## 62 Checks Across 14 Categories
185
263
 
186
264
  The exact applicable count can be lower on a given repo because stack-specific checks are skipped when they do not apply.
@@ -227,7 +305,7 @@ jobs:
227
305
  runs-on: ubuntu-latest
228
306
  steps:
229
307
  - uses: actions/checkout@v4
230
- - uses: DnaFin/claudex-setup@v1.10.2
308
+ - uses: DnaFin/claudex-setup@v1.11.0
231
309
  with:
232
310
  threshold: 50
233
311
  ```
@@ -288,7 +366,7 @@ Every check traces to a verified technique from a systematic audit of:
288
366
  - Anthropic blog posts and benchmark papers
289
367
  - 194 hands-on experiments with real evidence
290
368
 
291
- The catalog includes 1,107 entries (features, techniques, patterns, tools, stats, and known limitations) — not all are actionable checks. 954 were verified with real evidence. Continuously updated.
369
+ The catalog includes 1,107 entries (features, techniques, patterns, tools, stats, and known limitations) — not all are actionable checks. 948 were verified with real evidence. Continuously updated.
292
370
 
293
371
  **Note:** A hand-crafted CLAUDE.md that reflects your real conventions will always be better than a generated one. This tool is most useful for projects starting from zero, or as a checklist for what you might be missing.
294
372
 
package/bin/cli.js CHANGED
@@ -4,8 +4,9 @@ const { audit } = require('../src/audit');
4
4
  const { setup } = require('../src/setup');
5
5
  const { analyzeProject, printAnalysis, exportMarkdown } = require('../src/analyze');
6
6
  const { buildProposalBundle, printProposalBundle, writePlanFile, applyProposalBundle, printApplyResult } = require('../src/plans');
7
- const { getGovernanceSummary, printGovernanceSummary, ensureWritableProfile } = require('../src/governance');
7
+ const { getGovernanceSummary, printGovernanceSummary, ensureWritableProfile, renderGovernanceMarkdown } = require('../src/governance');
8
8
  const { runBenchmark, printBenchmark, writeBenchmarkReport } = require('../src/benchmark');
9
+ const { writeSnapshotArtifact } = require('../src/activity');
9
10
  const { version } = require('../package.json');
10
11
 
11
12
  const args = process.argv.slice(2);
@@ -18,7 +19,7 @@ const COMMAND_ALIASES = {
18
19
  suggest: 'suggest-only',
19
20
  gov: 'governance',
20
21
  };
21
- const KNOWN_COMMANDS = ['audit', 'setup', 'augment', 'suggest-only', 'plan', 'apply', 'governance', 'benchmark', 'deep-review', 'interactive', 'watch', 'badge', 'insights', 'help', 'version'];
22
+ const KNOWN_COMMANDS = ['audit', 'setup', 'augment', 'suggest-only', 'plan', 'apply', 'governance', 'benchmark', 'deep-review', 'interactive', 'watch', 'badge', 'insights', 'history', 'compare', 'trend', 'help', 'version'];
22
23
 
23
24
  function levenshtein(a, b) {
24
25
  const matrix = Array.from({ length: a.length + 1 }, () => Array(b.length + 1).fill(0));
@@ -60,12 +61,13 @@ function parseArgs(rawArgs) {
60
61
  let only = [];
61
62
  let profile = 'safe-write';
62
63
  let mcpPacks = [];
64
+ let requireChecks = [];
63
65
  let commandSet = false;
64
66
 
65
67
  for (let i = 0; i < rawArgs.length; i++) {
66
68
  const arg = rawArgs[i];
67
69
 
68
- if (arg === '--threshold' || arg === '--out' || arg === '--plan' || arg === '--only' || arg === '--profile' || arg === '--mcp-pack') {
70
+ if (arg === '--threshold' || arg === '--out' || arg === '--plan' || arg === '--only' || arg === '--profile' || arg === '--mcp-pack' || arg === '--require') {
69
71
  const value = rawArgs[i + 1];
70
72
  if (!value || value.startsWith('--')) {
71
73
  throw new Error(`${arg} requires a value`);
@@ -76,10 +78,16 @@ function parseArgs(rawArgs) {
76
78
  if (arg === '--only') only = value.split(',').map(item => item.trim()).filter(Boolean);
77
79
  if (arg === '--profile') profile = value.trim();
78
80
  if (arg === '--mcp-pack') mcpPacks = value.split(',').map(item => item.trim()).filter(Boolean);
81
+ if (arg === '--require') requireChecks = value.split(',').map(item => item.trim()).filter(Boolean);
79
82
  i++;
80
83
  continue;
81
84
  }
82
85
 
86
+ if (arg.startsWith('--require=')) {
87
+ requireChecks = arg.split('=').slice(1).join('=').split(',').map(item => item.trim()).filter(Boolean);
88
+ continue;
89
+ }
90
+
83
91
  if (arg.startsWith('--threshold=')) {
84
92
  threshold = arg.split('=')[1];
85
93
  continue;
@@ -123,39 +131,48 @@ function parseArgs(rawArgs) {
123
131
 
124
132
  const normalizedCommand = COMMAND_ALIASES[command] || command;
125
133
 
126
- return { flags, command, normalizedCommand, threshold, out, planFile, only, profile, mcpPacks };
134
+ return { flags, command, normalizedCommand, threshold, out, planFile, only, profile, mcpPacks, requireChecks };
127
135
  }
128
136
 
129
137
  const HELP = `
130
138
  claudex-setup v${version}
131
- Audit and optimize any project for Claude Code.
132
- Backed by CLAUDEX research and evidence.
133
-
134
- Usage:
135
- npx claudex-setup Run audit on current directory
136
- npx claudex-setup discover Discover the highest-value improvements
137
- npx claudex-setup audit Same as above
138
- npx claudex-setup starter Alias for setup
139
- npx claudex-setup setup Apply recommended configuration
140
- npx claudex-setup setup --auto Apply all without prompts
141
- npx claudex-setup augment Repo-aware augment plan (no writes)
142
- npx claudex-setup suggest-only Structured suggestion report (no writes)
143
- npx claudex-setup plan Exportable proposal bundles with file previews
144
- npx claudex-setup apply Apply ready proposal bundles with rollback manifest
145
- npx claudex-setup governance Profiles, hooks, and pilot rollout guidance
146
- npx claudex-setup benchmark Measure before/after impact in an isolated temp copy
147
- npx claudex-setup deep-review AI-powered config review (uses Claude Code or API key)
139
+ Score your repo's Claude Code setup. Fix gaps safely. Benchmark the impact.
140
+
141
+ Start here (read-only, nothing changes):
142
+ npx claudex-setup Audit your project (10 seconds)
143
+ npx claudex-setup --lite Quick scan: top 3 gaps + next command
144
+ npx claudex-setup augment Repo-aware analysis, no writes
145
+ npx claudex-setup suggest-only Structured report, no writes
146
+
147
+ Plan and apply (when you're ready to change things):
148
+ npx claudex-setup plan Export proposal bundles with previews
149
+ npx claudex-setup apply Apply proposals selectively with rollback
150
+ npx claudex-setup setup Generate starter-safe baseline
151
+ npx claudex-setup setup --auto Apply all generated files without prompts
152
+
153
+ Track progress over time:
154
+ npx claudex-setup history Show score history from saved snapshots
155
+ npx claudex-setup compare Compare latest vs previous snapshot
156
+ npx claudex-setup trend --out r.md Export trend report as markdown
157
+
158
+ Advanced:
159
+ npx claudex-setup governance Permission profiles, hooks, policy packs
160
+ npx claudex-setup benchmark Before/after in isolated temp copy
161
+ npx claudex-setup deep-review AI-powered config review (opt-in, uses API)
148
162
  npx claudex-setup interactive Step-by-step guided wizard
149
- npx claudex-setup watch Monitor changes and re-audit live
163
+ npx claudex-setup watch Live monitoring on config changes
150
164
  npx claudex-setup badge Generate shields.io badge markdown
151
165
 
152
166
  Options:
153
167
  --threshold N Exit with code 1 if score is below N (useful for CI)
168
+ --require A,B Exit with code 1 if named checks fail (e.g. --require secretsProtection,permissionDeny)
154
169
  --out FILE Write JSON or markdown output to a file
155
170
  --plan FILE Load a previously exported plan file
156
171
  --only A,B Limit plan/apply to selected proposal ids or technique keys
157
172
  --profile NAME Choose permission profile (read-only, suggest-only, safe-write, power-user, internal-research)
158
173
  --mcp-pack A,B Merge named MCP packs into generated settings (e.g. context7-docs,next-devtools)
174
+ --snapshot Save a normalized snapshot artifact under .claude/claudex-setup/snapshots/
175
+ --lite Show a short top-3 quick scan with one clear next command
159
176
  --dry-run Preview apply without writing files
160
177
  --verbose Show all recommendations (not just critical/high)
161
178
  --json Output as JSON (for CI pipelines)
@@ -166,8 +183,12 @@ const HELP = `
166
183
 
167
184
  Examples:
168
185
  npx claudex-setup
186
+ npx claudex-setup --lite
187
+ npx claudex-setup --snapshot
169
188
  npx claudex-setup augment
189
+ npx claudex-setup augment --snapshot
170
190
  npx claudex-setup suggest-only --json
191
+ npx claudex-setup governance --snapshot
171
192
  npx claudex-setup plan --out claudex-plan.json
172
193
  npx claudex-setup plan --profile safe-write
173
194
  npx claudex-setup setup --mcp-pack context7-docs
@@ -210,6 +231,8 @@ async function main() {
210
231
  verbose: flags.includes('--verbose'),
211
232
  json: flags.includes('--json'),
212
233
  auto: flags.includes('--auto'),
234
+ lite: flags.includes('--lite'),
235
+ snapshot: flags.includes('--snapshot'),
213
236
  dryRun: flags.includes('--dry-run'),
214
237
  threshold: parsed.threshold !== null ? Number(parsed.threshold) : null,
215
238
  out: parsed.out,
@@ -217,6 +240,7 @@ async function main() {
217
240
  only: parsed.only,
218
241
  profile: parsed.profile,
219
242
  mcpPacks: parsed.mcpPacks,
243
+ require: parsed.requireChecks,
220
244
  dir: process.cwd()
221
245
  };
222
246
 
@@ -251,7 +275,48 @@ async function main() {
251
275
  }
252
276
 
253
277
  try {
254
- if (normalizedCommand === 'badge') {
278
+ if (normalizedCommand === 'history') {
279
+ const { formatHistory } = require('../src/activity');
280
+ console.log('');
281
+ console.log(formatHistory(options.dir));
282
+ console.log('');
283
+ process.exit(0);
284
+ } else if (normalizedCommand === 'compare') {
285
+ const { compareLatest } = require('../src/activity');
286
+ const result = compareLatest(options.dir);
287
+ if (!result) {
288
+ console.log('\n Need at least 2 snapshots to compare. Run `npx claudex-setup --snapshot` twice.\n');
289
+ process.exit(0);
290
+ }
291
+ if (options.json) {
292
+ console.log(JSON.stringify(result, null, 2));
293
+ } else {
294
+ const sign = result.delta.score >= 0 ? '+' : '';
295
+ console.log('');
296
+ console.log(` Previous: ${result.previous.score}/100 (${result.previous.date?.split('T')[0]})`);
297
+ console.log(` Current: ${result.current.score}/100 (${result.current.date?.split('T')[0]})`);
298
+ console.log(` Delta: ${sign}${result.delta.score} points`);
299
+ console.log(` Trend: ${result.trend}`);
300
+ if (result.improvements.length > 0) console.log(` Fixed: ${result.improvements.join(', ')}`);
301
+ if (result.regressions.length > 0) console.log(` New gaps: ${result.regressions.join(', ')}`);
302
+ console.log('');
303
+ }
304
+ process.exit(0);
305
+ } else if (normalizedCommand === 'trend') {
306
+ const { exportTrendReport } = require('../src/activity');
307
+ const report = exportTrendReport(options.dir);
308
+ if (!report) {
309
+ console.log('\n No snapshots found. Run `npx claudex-setup --snapshot` to start tracking.\n');
310
+ process.exit(0);
311
+ }
312
+ if (options.out) {
313
+ require('fs').writeFileSync(options.out, report, 'utf8');
314
+ console.log(`\n Trend report exported to ${options.out}\n`);
315
+ } else {
316
+ console.log(report);
317
+ }
318
+ process.exit(0);
319
+ } else if (normalizedCommand === 'badge') {
255
320
  const { getBadgeMarkdown } = require('../src/badge');
256
321
  const result = await audit({ ...options, silent: true });
257
322
  console.log(getBadgeMarkdown(result.score));
@@ -295,6 +360,9 @@ async function main() {
295
360
  return; // keep process alive for http
296
361
  } else if (normalizedCommand === 'augment' || normalizedCommand === 'suggest-only') {
297
362
  const report = await analyzeProject({ ...options, mode: normalizedCommand });
363
+ const snapshot = options.snapshot ? writeSnapshotArtifact(options.dir, normalizedCommand, report, {
364
+ sourceCommand: normalizedCommand,
365
+ }) : null;
298
366
  if (options.out && !options.json) {
299
367
  const fs = require('fs');
300
368
  const md = exportMarkdown(report);
@@ -302,6 +370,11 @@ async function main() {
302
370
  console.log(`\n Report exported to ${options.out}\n`);
303
371
  }
304
372
  printAnalysis(report, options);
373
+ if (snapshot && !options.json) {
374
+ console.log(` Snapshot saved: ${snapshot.relativePath}`);
375
+ console.log(` Snapshot index: ${snapshot.indexPath}`);
376
+ console.log('');
377
+ }
305
378
  } else if (normalizedCommand === 'plan') {
306
379
  const bundle = await buildProposalBundle(options);
307
380
  let artifact = null;
@@ -320,10 +393,34 @@ async function main() {
320
393
  const result = await applyProposalBundle(options);
321
394
  printApplyResult(result, options);
322
395
  } else if (normalizedCommand === 'governance') {
396
+ const fs = require('fs');
397
+ const path = require('path');
323
398
  const summary = getGovernanceSummary();
399
+ if (options.out) {
400
+ fs.mkdirSync(path.dirname(options.out), { recursive: true });
401
+ const content = path.extname(options.out).toLowerCase() === '.md'
402
+ ? renderGovernanceMarkdown(summary)
403
+ : JSON.stringify(summary, null, 2);
404
+ fs.writeFileSync(options.out, content, 'utf8');
405
+ }
324
406
  printGovernanceSummary(summary, options);
407
+ const snapshot = options.snapshot ? writeSnapshotArtifact(options.dir, 'governance', summary, {
408
+ sourceCommand: normalizedCommand,
409
+ }) : null;
410
+ if (options.out && !options.json) {
411
+ console.log(` Governance report written to ${options.out}`);
412
+ console.log('');
413
+ }
414
+ if (snapshot && !options.json) {
415
+ console.log(` Snapshot saved: ${snapshot.relativePath}`);
416
+ console.log(` Snapshot index: ${snapshot.indexPath}`);
417
+ console.log('');
418
+ }
325
419
  } else if (normalizedCommand === 'benchmark') {
326
420
  const report = await runBenchmark(options);
421
+ const snapshot = options.snapshot ? writeSnapshotArtifact(options.dir, 'benchmark', report, {
422
+ sourceCommand: normalizedCommand,
423
+ }) : null;
327
424
  if (options.out) {
328
425
  writeBenchmarkReport(report, options.out);
329
426
  }
@@ -332,6 +429,11 @@ async function main() {
332
429
  console.log(` Benchmark report written to ${options.out}`);
333
430
  console.log('');
334
431
  }
432
+ if (snapshot && !options.json) {
433
+ console.log(` Snapshot saved: ${snapshot.relativePath}`);
434
+ console.log(` Snapshot index: ${snapshot.indexPath}`);
435
+ console.log('');
436
+ }
335
437
  } else if (normalizedCommand === 'deep-review') {
336
438
  const { deepReview } = require('../src/deep-review');
337
439
  await deepReview(options);
@@ -345,12 +447,33 @@ async function main() {
345
447
  await setup(options);
346
448
  } else {
347
449
  const result = await audit(options);
450
+ const snapshot = options.snapshot ? writeSnapshotArtifact(options.dir, 'audit', result, {
451
+ sourceCommand: normalizedCommand,
452
+ }) : null;
453
+ if (snapshot && !options.json) {
454
+ console.log(` Snapshot saved: ${snapshot.relativePath}`);
455
+ console.log(` Snapshot index: ${snapshot.indexPath}`);
456
+ console.log('');
457
+ }
348
458
  if (options.threshold !== null && result.score < options.threshold) {
349
459
  if (!options.json) {
350
460
  console.error(` Threshold failed: score ${result.score}/100 is below required ${options.threshold}/100.\n`);
351
461
  }
352
462
  process.exit(1);
353
463
  }
464
+ if (options.require && options.require.length > 0) {
465
+ const failedRequired = options.require.filter(key => {
466
+ const check = result.results.find(r => r.key === key);
467
+ return !check || check.passed !== true;
468
+ });
469
+ if (failedRequired.length > 0) {
470
+ if (!options.json) {
471
+ console.error(`\n Required checks failed: ${failedRequired.join(', ')}`);
472
+ console.error(' These must pass for CI to succeed.\n');
473
+ }
474
+ process.exit(1);
475
+ }
476
+ }
354
477
  }
355
478
  } catch (err) {
356
479
  console.error(`\n Error: ${err.message}`);
@@ -0,0 +1,91 @@
1
+ # Case Study: [Project Name]
2
+
3
+ ## Overview
4
+
5
+ | Field | Value |
6
+ |-------|-------|
7
+ | Project | [name] |
8
+ | Repo type | [e.g., backend API, frontend SPA, monorepo, data pipeline] |
9
+ | Team size | [e.g., solo, 3 developers, 15-person team] |
10
+ | Prior Claude setup | [none / basic CLAUDE.md / mature .claude/ config] |
11
+ | Claudex Setup version | [e.g., 1.9.0] |
12
+ | Date | [YYYY-MM-DD] |
13
+
14
+ ## Before State
15
+
16
+ **Audit score:** [X/100]
17
+ **Organic score:** [X/100]
18
+
19
+ What existed before running claudex-setup:
20
+ - [ ] CLAUDE.md
21
+ - [ ] .claude/settings.json
22
+ - [ ] Custom commands
23
+ - [ ] Rules
24
+ - [ ] Hooks
25
+ - [ ] Agents
26
+ - [ ] MCP servers
27
+
28
+ Key observations:
29
+ - [What was good already]
30
+ - [What was missing]
31
+ - [What was risky or misconfigured]
32
+
33
+ ## What We Did
34
+
35
+ **Mode used:** [discover / starter / augment / plan+apply / suggest-only]
36
+
37
+ **Steps:**
38
+ 1. Ran `npx claudex-setup discover` to understand current state
39
+ 2. [Next step]
40
+ 3. [Next step]
41
+
42
+ **Domain pack matched:** [e.g., backend-api]
43
+ **MCP packs recommended:** [e.g., context7-docs, postgres-mcp]
44
+
45
+ ## Changes Applied
46
+
47
+ | Change | Type | Risk | Applied? |
48
+ |--------|------|------|----------|
49
+ | [e.g., Created CLAUDE.md with architecture] | new file | low | yes |
50
+ | [e.g., Added hooks for auto-lint] | new config | medium | yes |
51
+ | [e.g., Added permission deny rules] | security | low | yes |
52
+
53
+ **Strengths preserved:**
54
+ - [What we explicitly kept unchanged]
55
+
56
+ ## After State
57
+
58
+ **Audit score:** [X/100] (was [X/100])
59
+ **Organic score:** [X/100] (was [X/100])
60
+ **Score improvement:** +[X] points
61
+
62
+ ## Measured Impact
63
+
64
+ | Metric | Before | After | Change |
65
+ |--------|--------|-------|--------|
66
+ | Audit score | X | X | +X |
67
+ | Checks passing | X/58 | X/58 | +X |
68
+ | Time to first productive session | Xm | Xm | -Xm |
69
+ | [Other metric] | | | |
70
+
71
+ ## What Worked Well
72
+
73
+ - [Specific thing that added clear value]
74
+ - [Another]
75
+
76
+ ## What Could Be Better
77
+
78
+ - [Specific improvement suggestion for the tool]
79
+ - [Another]
80
+
81
+ ## Verdict
82
+
83
+ **Would recommend:** [Yes / Yes with caveats / Not yet]
84
+
85
+ **Best for:** [Who should try this based on our experience]
86
+
87
+ **One-line summary:** [e.g., "Took our Claude setup from basic to production-ready in 15 minutes with zero breakage."]
88
+
89
+ ---
90
+
91
+ *Generated with claudex-setup v[version]. Case study template from CLAUDEX.*
@@ -0,0 +1,37 @@
1
+ # Claims Governance
2
+
3
+ Use this checklist before publishing product-facing claims about Claudex Setup.
4
+
5
+ ## Allowed only with evidence
6
+
7
+ - score delta claims
8
+ - organic score delta claims
9
+ - time-to-value claims
10
+ - recommendation acceptance rate claims
11
+ - reduction in manual corrections
12
+ - benchmark outcomes on named repo types
13
+
14
+ ## Evidence standard
15
+
16
+ Every claim should have:
17
+
18
+ - a benchmark run or pilot report
19
+ - the repo type or cohort it applies to
20
+ - the date the evidence was collected
21
+ - the exact metric definition
22
+ - the comparison method (`before/after`, `control/pilot`, or `observed over time`)
23
+
24
+ ## Avoid
25
+
26
+ - universal productivity multipliers
27
+ - unsupported token savings claims
28
+ - “works for every repo” language
29
+ - suspiciously precise numbers without a method section
30
+ - implying quality scores are objective truth rather than framework coverage
31
+
32
+ ## Safer phrasing
33
+
34
+ - "In benchmark mode, this repo improved from 41/100 to 60/100."
35
+ - "Starter-safe artifacts improved readiness on an isolated temp copy."
36
+ - "Suggest-only mode gives mature teams a zero-write review path."
37
+ - "Use governance mode to select permission profiles and inspect shipped hooks."
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: audit-repo
3
+ description: Run claudex-setup on the current repo and summarize the score, top gaps, and next command
4
+ ---
5
+
6
+ Run `npx claudex-setup --json` in the current project directory and summarize the result.
7
+
8
+ Your output should include:
9
+
10
+ 1. The overall score and organic score
11
+ 2. The top 3 next actions from `topNextActions`
12
+ 3. The suggested next command from `suggestedNextCommand`
13
+ 4. A short explanation of what the repo already does well if there are notable strengths
14
+
15
+ Behavior rules:
16
+
17
+ - If the user asks for the shortest version, run `npx claudex-setup --lite`
18
+ - If the user wants deeper no-write analysis, run `npx claudex-setup augment --json`
19
+ - If the score is below 50, explicitly recommend `npx claudex-setup setup`
20
+ - Never apply changes automatically from this skill