@kennethsolomon/shipkit 3.10.2 → 3.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.
Files changed (30) hide show
  1. package/README.md +92 -4
  2. package/commands/sk/context-budget.md +5 -0
  3. package/commands/sk/eval.md +5 -0
  4. package/commands/sk/health.md +5 -0
  5. package/commands/sk/help.md +32 -8
  6. package/commands/sk/learn.md +5 -0
  7. package/commands/sk/resume-session.md +5 -0
  8. package/commands/sk/safety-guard.md +5 -0
  9. package/commands/sk/save-session.md +5 -0
  10. package/commands/sk/set-profile.md +8 -0
  11. package/package.json +1 -1
  12. package/skills/sk:brainstorming/SKILL.md +13 -0
  13. package/skills/sk:context-budget/SKILL.md +126 -0
  14. package/skills/sk:eval/SKILL.md +188 -0
  15. package/skills/sk:health/SKILL.md +146 -0
  16. package/skills/sk:learn/SKILL.md +138 -0
  17. package/skills/sk:resume-session/SKILL.md +95 -0
  18. package/skills/sk:safety-guard/SKILL.md +134 -0
  19. package/skills/sk:save-session/SKILL.md +84 -0
  20. package/skills/sk:setup-claude/SKILL.md +39 -2
  21. package/skills/sk:setup-claude/templates/.claude/settings.json.template +110 -26
  22. package/skills/sk:setup-claude/templates/CLAUDE.md.template +8 -1
  23. package/skills/sk:setup-claude/templates/hooks/config-protection.sh +71 -0
  24. package/skills/sk:setup-claude/templates/hooks/console-log-warning.sh +42 -0
  25. package/skills/sk:setup-claude/templates/hooks/cost-tracker.sh +26 -0
  26. package/skills/sk:setup-claude/templates/hooks/post-edit-format.sh +53 -0
  27. package/skills/sk:setup-claude/templates/hooks/safety-guard.sh +72 -0
  28. package/skills/sk:setup-claude/templates/hooks/suggest-compact.sh +35 -0
  29. package/skills/sk:setup-optimizer/SKILL.md +59 -8
  30. package/skills/sk:start/SKILL.md +25 -0
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: sk:health
3
+ description: "Run harness self-audit and produce a health scorecard."
4
+ ---
5
+
6
+ # /sk:health — Harness Self-Audit Scorecard
7
+
8
+ Deterministic scoring of your ShipKit setup across 7 categories. Produces a reproducible scorecard that identifies gaps and recommends improvements.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /sk:health # full scorecard
14
+ /sk:health --category <name> # single category deep-dive
15
+ ```
16
+
17
+ ## Model Routing
18
+
19
+ Read `.shipkit/config.json` from the project root if it exists.
20
+
21
+ | Profile | Model |
22
+ |---------|-------|
23
+ | `full-sail` | haiku |
24
+ | `quality` | haiku |
25
+ | `balanced` | haiku |
26
+ | `budget` | haiku |
27
+
28
+ > File checks + arithmetic — haiku is sufficient.
29
+
30
+ ## Scoring Categories
31
+
32
+ Each category scores 0-10. Maximum total: 70.
33
+
34
+ ### 1. Tool Coverage (0-10)
35
+
36
+ Check for presence and completeness of:
37
+
38
+ | Check | Points |
39
+ |-------|--------|
40
+ | `.claude/hooks/` exists with 6+ hooks | +2 |
41
+ | `.claude/agents/` exists with 4+ agents | +2 |
42
+ | `.claude/rules/` exists with 1+ rules | +1 |
43
+ | `commands/sk/` or `.claude/commands/sk/` has 10+ commands | +2 |
44
+ | MCP servers configured | +1 |
45
+ | Statusline configured in settings.json | +1 |
46
+ | Permissions deny list has 3+ entries | +1 |
47
+
48
+ ### 2. Context Efficiency (0-10)
49
+
50
+ | Check | Points |
51
+ |-------|--------|
52
+ | CLAUDE.md exists and is <250 lines | +2 (>250: +1, >400: 0) |
53
+ | No duplicate instructions across CLAUDE.md and skills | +2 |
54
+ | MCP tools total <40 | +2 (40-60: +1, >60: 0) |
55
+ | Skills total <60 | +2 (>60: +1, >80: 0) |
56
+ | Agent descriptions all <200 lines | +2 |
57
+
58
+ ### 3. Quality Gates (0-10)
59
+
60
+ | Check | Points |
61
+ |-------|--------|
62
+ | Lint configured (package.json scripts or Makefile) | +2 |
63
+ | Test runner configured | +2 |
64
+ | Security check available (npm audit, composer audit, etc.) | +2 |
65
+ | E2E test config exists (playwright.config, cypress.config) | +2 |
66
+ | Code review skill available | +2 |
67
+
68
+ ### 4. Memory Persistence (0-10)
69
+
70
+ | Check | Points |
71
+ |-------|--------|
72
+ | `tasks/findings.md` exists and has content | +2 |
73
+ | `tasks/lessons.md` exists and has content | +2 |
74
+ | `tasks/progress.md` exists | +1 |
75
+ | `tasks/tech-debt.md` exists | +1 |
76
+ | `tasks/cross-platform.md` exists | +1 |
77
+ | Session hooks active (session-start.sh, session-stop.sh) | +2 |
78
+ | `.claude/sessions/` directory exists | +1 |
79
+
80
+ ### 5. Eval Coverage (0-10)
81
+
82
+ | Check | Points |
83
+ |-------|--------|
84
+ | Test directory exists (`tests/`, `test/`, `spec/`, `__tests__/`) | +2 |
85
+ | Test assertions exist (grep for assert/expect/test/it/describe) | +2 |
86
+ | Coverage config exists (jest.config coverage, phpunit coverage) | +2 |
87
+ | `.claude/evals/` directory exists with eval definitions | +2 |
88
+ | CI/CD runs tests (`.github/workflows/` with test step) | +2 |
89
+
90
+ ### 6. Security Guardrails (0-10)
91
+
92
+ | Check | Points |
93
+ |-------|--------|
94
+ | validate-commit hook exists | +2 |
95
+ | validate-push hook exists | +2 |
96
+ | config-protection hook exists | +2 |
97
+ | Deny rules in settings.json (3+ patterns) | +2 |
98
+ | safety-guard hook exists | +2 |
99
+
100
+ ### 7. Cost Efficiency (0-10)
101
+
102
+ | Check | Points |
103
+ |-------|--------|
104
+ | Model routing configured (`.shipkit/config.json` exists) | +3 |
105
+ | Compact suggestions active (suggest-compact hook) | +2 |
106
+ | Cost tracker active (cost-tracker hook) | +2 |
107
+ | Context budget recently audited (`/sk:context-budget` run) | +3 |
108
+
109
+ ## Output Format
110
+
111
+ ```
112
+ === ShipKit Health Scorecard ===
113
+
114
+ Tool Coverage: 8/10 ||||||||..
115
+ Context Efficiency: 7/10 |||||||...
116
+ Quality Gates: 10/10 ||||||||||
117
+ Memory Persistence: 6/10 ||||||....
118
+ Eval Coverage: 4/10 ||||......
119
+ Security Guardrails: 8/10 ||||||||..
120
+ Cost Efficiency: 5/10 |||||.....
121
+ ─────────────────────────────────
122
+ Total: 48/70 (69%)
123
+
124
+ Rating: GOOD
125
+
126
+ Findings:
127
+ [MISSING] No .claude/evals/ directory — no formal eval definitions
128
+ [MISSING] No CI/CD test step detected
129
+ [MISSING] Context budget never audited
130
+ [WEAK] Only 4 hooks installed (recommended: 8+)
131
+
132
+ Top 3 Actions:
133
+ 1. Run /sk:eval define to create eval definitions (+4 points)
134
+ 2. Add CI/CD test workflow (+2 points)
135
+ 3. Run /sk:context-budget to audit token usage (+3 points)
136
+ ```
137
+
138
+ ### Rating Scale
139
+
140
+ | Score | Rating |
141
+ |-------|--------|
142
+ | 60-70 | EXCELLENT |
143
+ | 45-59 | GOOD |
144
+ | 30-44 | FAIR |
145
+ | 15-29 | NEEDS WORK |
146
+ | 0-14 | CRITICAL |
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: sk:learn
3
+ description: "Extract reusable patterns from the current session into learned instincts."
4
+ ---
5
+
6
+ # /sk:learn — Extract Reusable Patterns
7
+
8
+ Analyzes the current session for extractable patterns and saves them as learned instincts. Patterns evolve from tentative observations into strong conventions over time.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /sk:learn # analyze current session
14
+ /sk:learn --list # show all learned patterns
15
+ /sk:learn --promote <id> # promote project pattern to global
16
+ /sk:learn --export # export patterns as shareable file
17
+ ```
18
+
19
+ ## Model Routing
20
+
21
+ Read `.shipkit/config.json` from the project root if it exists.
22
+
23
+ | Profile | Model |
24
+ |---------|-------|
25
+ | `full-sail` | haiku |
26
+ | `quality` | haiku |
27
+ | `balanced` | haiku |
28
+ | `budget` | haiku |
29
+
30
+ > Pattern detection is lightweight keyword matching — haiku is sufficient.
31
+
32
+ ## How It Works
33
+
34
+ ### Phase 1: Session Analysis
35
+
36
+ Scan the current conversation for extractable patterns:
37
+
38
+ 1. **Error resolutions** — problems encountered and how they were solved
39
+ 2. **Debugging techniques** — investigation steps that led to root causes
40
+ 3. **Workarounds** — non-obvious solutions to framework/tool limitations
41
+ 4. **Project conventions** — naming patterns, file organization, code style decisions
42
+ 5. **Tool usage patterns** — effective tool combinations and sequences
43
+
44
+ Filter out trivial items:
45
+ - Typo fixes, syntax errors, simple formatting
46
+ - One-off configuration changes
47
+ - Standard framework usage (documented in official docs)
48
+
49
+ ### Phase 2: Pattern Extraction
50
+
51
+ For each candidate pattern, extract:
52
+
53
+ ```markdown
54
+ ---
55
+ name: [descriptive-slug]
56
+ type: [error-resolution | debugging | workaround | convention | tool-usage]
57
+ confidence: [0.3 | 0.5 | 0.7 | 0.9]
58
+ scope: [project | global]
59
+ created: [YYYY-MM-DD]
60
+ seen_count: 1
61
+ ---
62
+
63
+ ## Problem
64
+ [What triggered this pattern]
65
+
66
+ ## Solution
67
+ [What resolved it — specific steps]
68
+
69
+ ## Example
70
+ [Concrete code or command example]
71
+
72
+ ## When to Apply
73
+ [Conditions that indicate this pattern is relevant]
74
+ ```
75
+
76
+ ### Phase 3: Confidence Scoring
77
+
78
+ | Score | Label | Meaning |
79
+ |-------|-------|---------|
80
+ | 0.3 | tentative | Seen once, might be coincidence |
81
+ | 0.5 | emerging | Seen in similar contexts, likely a real pattern |
82
+ | 0.7 | strong | Proven effective multiple times |
83
+ | 0.9 | near-certain | Battle-tested, consistently reliable |
84
+
85
+ New patterns start at 0.3. Confidence increases when:
86
+ - Same pattern seen again in a different session (+0.2)
87
+ - User explicitly confirms the pattern (+0.2)
88
+ - Pattern seen in a different project (+0.1, also promotes to global)
89
+
90
+ ### Phase 4: Storage
91
+
92
+ - **Project patterns**: `~/.claude/skills/learned/[project-name]/[pattern-name].md`
93
+ - **Global patterns**: `~/.claude/skills/learned/global/[pattern-name].md`
94
+
95
+ ### Phase 5: User Confirmation
96
+
97
+ Present extracted patterns and ask for confirmation before saving:
98
+
99
+ ```
100
+ Extracted 3 patterns from this session:
101
+
102
+ 1. [error-resolution] "laravel-queue-retry-after" (0.3 tentative)
103
+ Problem: Queue jobs silently failing after Redis timeout
104
+ Solution: Set retry_after in queue config > job timeout
105
+
106
+ 2. [convention] "api-resource-wrapping" (0.3 tentative)
107
+ Problem: Inconsistent API response format
108
+ Solution: Always wrap in ApiResource with data key
109
+
110
+ 3. [tool-usage] "parallel-explore-before-implement" (0.3 tentative)
111
+ Problem: Missing context leads to wrong implementation
112
+ Solution: Launch 3 Explore agents before writing code
113
+
114
+ Save patterns? (all / 1,3 / none)
115
+ ```
116
+
117
+ ## Promotion: Project to Global
118
+
119
+ A pattern is auto-promoted to global when:
120
+ - Same pattern (by name or content similarity) appears in 2+ projects
121
+ - Confidence >= 0.7 in both projects
122
+ - User hasn't marked it as project-specific
123
+
124
+ Manual promotion: `/sk:learn --promote <pattern-id>`
125
+
126
+ ## Export / Import
127
+
128
+ Export all patterns for sharing:
129
+ ```
130
+ /sk:learn --export > my-patterns.json
131
+ ```
132
+
133
+ Import from a colleague:
134
+ ```
135
+ /sk:learn --import colleague-patterns.json
136
+ ```
137
+
138
+ Imported patterns start at 0.3 confidence regardless of source confidence.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: sk:resume-session
3
+ description: "Resume a previously saved session with full context restoration."
4
+ ---
5
+
6
+ # /sk:resume-session — Restore Session Context
7
+
8
+ Lists available saved sessions and restores the selected one, injecting the saved context into the current conversation.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /sk:resume-session # list sessions, pick one
14
+ /sk:resume-session --latest # auto-pick most recent session
15
+ /sk:resume-session --name "auth-flow" # resume specific named session
16
+ ```
17
+
18
+ ## Model Routing
19
+
20
+ Read `.shipkit/config.json` from the project root if it exists.
21
+
22
+ | Profile | Model |
23
+ |---------|-------|
24
+ | `full-sail` | haiku |
25
+ | `quality` | haiku |
26
+ | `balanced` | haiku |
27
+ | `budget` | haiku |
28
+
29
+ > Deserialization is lightweight — haiku is sufficient.
30
+
31
+ ## How It Works
32
+
33
+ ### Step 1: List Available Sessions
34
+
35
+ Read `.claude/sessions/` and display:
36
+
37
+ ```
38
+ Available sessions:
39
+
40
+ 1. [2026-03-25] feat/auth-flow — "auth-flow" (3 hours ago)
41
+ Task: Implement OAuth2 login with Google
42
+ Step: 5 (Write Tests + Implement)
43
+
44
+ 2. [2026-03-24] feat/api-redesign — "api-v2" (1 day ago)
45
+ Task: Redesign REST API to v2 spec
46
+ Step: 7 (Gates)
47
+
48
+ 3. [2026-03-23] fix/queue-timeout — auto-save (2 days ago)
49
+ Task: Fix Redis queue timeout in production
50
+ Step: 4 (Branch)
51
+
52
+ Select session (1-3) or 'q' to cancel:
53
+ ```
54
+
55
+ ### Step 2: Load Session
56
+
57
+ Read the selected session file and inject context:
58
+
59
+ 1. **Verify branch** — check if the session's branch still exists
60
+ - If yes: suggest `git checkout [branch]` if not already on it
61
+ - If no: warn that the branch was deleted, proceed with context anyway
62
+ 2. **Load task state** — read `tasks/todo.md` and cross-reference with saved state
63
+ 3. **Load progress** — read `tasks/progress.md` for the full history
64
+ 4. **Restore context** — output the session's findings, open questions, and next steps
65
+
66
+ ### Step 3: Report
67
+
68
+ ```
69
+ Resumed session from 2026-03-25 on branch feat/auth-flow
70
+
71
+ Task: Implement OAuth2 login with Google
72
+ Step: 5 (Write Tests + Implement)
73
+ Commits since save: 2
74
+
75
+ Open Questions:
76
+ - Should we support refresh token rotation?
77
+ - Which scopes are required for profile access?
78
+
79
+ Next Steps:
80
+ - Write integration test for token exchange
81
+ - Implement callback controller
82
+ ```
83
+
84
+ ### Step 4: Continue
85
+
86
+ The workflow continues from wherever it left off. The session file provides enough context to avoid re-reading the entire codebase.
87
+
88
+ ## Session Cleanup
89
+
90
+ Sessions older than 30 days are candidates for cleanup. Run manually:
91
+ ```bash
92
+ find .claude/sessions/ -name "*.md" -mtime +30 -delete
93
+ ```
94
+
95
+ Future: add `--cleanup` flag to auto-remove old sessions.
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: sk:safety-guard
3
+ description: "Protect against destructive operations with careful, freeze, and guard modes."
4
+ ---
5
+
6
+ # /sk:safety-guard — Destructive Operation Protection
7
+
8
+ Three modes of protection that prevent accidental destructive operations and constrain file edits to specific directories.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /sk:safety-guard careful # intercept destructive commands
14
+ /sk:safety-guard freeze --dir src/ # lock edits to src/ only
15
+ /sk:safety-guard guard --dir src/ # both careful + freeze
16
+ /sk:safety-guard off # disable all guards
17
+ /sk:safety-guard status # show current mode
18
+ ```
19
+
20
+ ## Model Routing
21
+
22
+ Read `.shipkit/config.json` from the project root if it exists.
23
+
24
+ | Profile | Model |
25
+ |---------|-------|
26
+ | `full-sail` | haiku |
27
+ | `quality` | haiku |
28
+ | `balanced` | haiku |
29
+ | `budget` | haiku |
30
+
31
+ > Config read/write — haiku is sufficient.
32
+
33
+ ## Modes
34
+
35
+ ### Careful Mode
36
+
37
+ Intercepts destructive commands before execution:
38
+
39
+ | Command Pattern | Risk |
40
+ |----------------|------|
41
+ | `rm -rf`, `rm -fr` | File deletion |
42
+ | `git push --force`, `git push -f` | History rewrite |
43
+ | `git reset --hard` | Uncommitted changes lost |
44
+ | `git clean -f` | Untracked files deleted |
45
+ | `DROP TABLE`, `DROP DATABASE` | Data loss |
46
+ | `chmod 777`, `chmod -R 777` | Security vulnerability |
47
+ | `--no-verify` | Hook bypass |
48
+
49
+ When a destructive command is detected:
50
+ ```
51
+ BLOCKED by safety-guard (careful mode): destructive command detected.
52
+ Command: rm -rf /tmp/build
53
+ Pattern: rm -rf
54
+ Disable: /sk:safety-guard off
55
+ ```
56
+
57
+ ### Freeze Mode
58
+
59
+ Locks file edits (Edit/Write tools) to a specific directory tree:
60
+
61
+ ```
62
+ /sk:safety-guard freeze --dir src/api/
63
+ ```
64
+
65
+ After activation:
66
+ - Edit/Write to `src/api/**` → allowed
67
+ - Edit/Write to `src/models/**` → **BLOCKED**
68
+ - Edit/Write to `tests/**` → **BLOCKED**
69
+ - Bash commands → not restricted (use careful mode for that)
70
+
71
+ When a write outside the frozen directory is detected:
72
+ ```
73
+ BLOCKED by safety-guard (freeze mode): write outside frozen directory.
74
+ File: tests/api/auth.test.ts
75
+ Allowed: src/api/
76
+ Disable: /sk:safety-guard off
77
+ ```
78
+
79
+ ### Guard Mode
80
+
81
+ Combines careful + freeze. Both protections active simultaneously.
82
+
83
+ ### Off
84
+
85
+ Disables all guards. Removes `.claude/safety-guard.json`.
86
+
87
+ ## Implementation
88
+
89
+ ### Configuration File
90
+
91
+ Safety guard state is stored in `.claude/safety-guard.json`:
92
+
93
+ ```json
94
+ {
95
+ "mode": "guard",
96
+ "freeze_dir": "src/api/",
97
+ "activated_at": "2026-03-25T10:30:00Z",
98
+ "activated_by": "user"
99
+ }
100
+ ```
101
+
102
+ ### Hook Integration
103
+
104
+ The `safety-guard.sh` hook (deployed to `.claude/hooks/`) reads this config file on every PreToolUse event for Bash/Edit/Write tools. If no config file exists, the hook exits immediately (no overhead).
105
+
106
+ ## Steps
107
+
108
+ When invoked:
109
+
110
+ 1. Parse the mode argument (`careful` | `freeze` | `guard` | `off` | `status`)
111
+ 2. For freeze/guard: require `--dir` argument
112
+ 3. Write config to `.claude/safety-guard.json`
113
+ 4. Confirm activation:
114
+ ```
115
+ Safety guard activated: guard mode
116
+ Freeze directory: src/api/
117
+ Destructive commands: blocked
118
+ Disable: /sk:safety-guard off
119
+ ```
120
+
121
+ For `status`:
122
+ ```
123
+ Safety guard: guard mode (active since 2026-03-25 10:30)
124
+ Freeze directory: src/api/
125
+ Blocked actions: 3 (2 destructive commands, 1 out-of-scope write)
126
+ Log: .claude/safety-guard.log
127
+ ```
128
+
129
+ ## Best Practices
130
+
131
+ - Use **freeze mode** during `/sk:autopilot` to prevent scope creep in file edits
132
+ - Use **careful mode** as a default for new team members
133
+ - Use **guard mode** for production hotfixes — maximum protection
134
+ - Always disable after the focused task is complete
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: sk:save-session
3
+ description: "Save current session state for cross-session continuity."
4
+ ---
5
+
6
+ # /sk:save-session — Persist Session State
7
+
8
+ Saves the current session state to `.claude/sessions/` so you can resume work in a future conversation. Essential for EPIC-scope tasks that span multiple sessions.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /sk:save-session # save with auto-generated name
14
+ /sk:save-session --name "auth-flow" # save with custom name
15
+ ```
16
+
17
+ ## Model Routing
18
+
19
+ Read `.shipkit/config.json` from the project root if it exists.
20
+
21
+ | Profile | Model |
22
+ |---------|-------|
23
+ | `full-sail` | haiku |
24
+ | `quality` | haiku |
25
+ | `balanced` | haiku |
26
+ | `budget` | haiku |
27
+
28
+ > Serialization is lightweight — haiku is sufficient.
29
+
30
+ ## What Gets Saved
31
+
32
+ The session file captures:
33
+
34
+ ```markdown
35
+ ---
36
+ saved: [YYYY-MM-DDTHH:MM:SSZ]
37
+ branch: [current git branch]
38
+ task: [current task title from tasks/todo.md]
39
+ step: [current workflow step number]
40
+ ---
41
+
42
+ ## Active Task
43
+ [Current task description from tasks/todo.md — first unchecked item]
44
+
45
+ ## Branch State
46
+ - Branch: [name]
47
+ - Commits since main: [count]
48
+ - Uncommitted changes: [list of modified files]
49
+
50
+ ## Progress Summary
51
+ [Last 10 lines from tasks/progress.md]
52
+
53
+ ## Key Findings This Session
54
+ [Any entries added to tasks/findings.md during this session]
55
+
56
+ ## Open Questions
57
+ [Questions that were raised but not resolved]
58
+
59
+ ## Next Steps
60
+ [What should be done when resuming — derived from todo.md + progress]
61
+
62
+ ## Context Notes
63
+ [Any important context that would be lost on session end]
64
+ ```
65
+
66
+ ## Storage
67
+
68
+ - **Path**: `.claude/sessions/[YYYY-MM-DD]-[branch]-[name].md`
69
+ - **Example**: `.claude/sessions/2026-03-25-feat-auth-flow-auth-flow.md`
70
+ - **Gitignore**: Add `.claude/sessions/` to `.gitignore` (session state is personal, not shared)
71
+
72
+ ## Steps
73
+
74
+ 1. Read current git state (branch, uncommitted changes, recent commits)
75
+ 2. Read `tasks/todo.md` — extract current task and step
76
+ 3. Read `tasks/progress.md` — extract recent entries
77
+ 4. Read `tasks/findings.md` — extract entries from today
78
+ 5. Ask user: "Any open questions or context to preserve?" (optional)
79
+ 6. Write session file to `.claude/sessions/`
80
+ 7. Confirm save with file path
81
+
82
+ ## Auto-Save via Hook
83
+
84
+ The `session-stop.sh` hook automatically saves a minimal session snapshot on every session end. The `/sk:save-session` command creates a richer, more detailed snapshot with user input.
@@ -102,6 +102,28 @@ Never overwrite `tasks/lessons.md` — always append.
102
102
  - `.claude/docs/changelog-guide.md`
103
103
  - `.claude/docs/arch-changelog-guide.md`
104
104
 
105
+ ## Phase 0: Reconnaissance (first setup only)
106
+
107
+ On **first-time setup** (no existing `CLAUDE.md` or `tasks/findings.md`), run a reconnaissance pass before stack detection:
108
+
109
+ 1. **Directory scan** — list top 2 levels of the project tree (excluding node_modules, vendor, .git, dist, build)
110
+ 2. **Entry point detection** — find main.*, index.*, app.*, server.*, manage.py, artisan, Makefile
111
+ 3. **Architecture classification**:
112
+ - Monorepo: multiple package.json/go.mod files, `packages/` or `apps/` directory
113
+ - Monolith: single manifest, `src/` or `app/` directory
114
+ - Microservices: `services/` directory with separate manifests
115
+ 4. **Data flow trace** — from entry point, identify: request handling → validation → business logic → data persistence
116
+ 5. **Output** — append architecture summary to `tasks/findings.md`:
117
+ ```
118
+ ## Reconnaissance (auto-generated by /sk:setup-claude)
119
+ - Architecture: [monolith/monorepo/microservices]
120
+ - Entry points: [list]
121
+ - Key directories: [list with purposes]
122
+ - Data flow: [request → ... → response]
123
+ ```
124
+
125
+ Skip this phase on re-runs (when `tasks/findings.md` already contains "Reconnaissance").
126
+
105
127
  ## Generation Inputs
106
128
 
107
129
  This skill detects:
@@ -309,7 +331,7 @@ Additionally report:
309
331
 
310
332
  ### Hooks (in `.claude/hooks/`)
311
333
 
312
- Deployed from `templates/hooks/` to `.claude/hooks/` (made executable):
334
+ **Core hooks** — always deployed from `templates/hooks/` to `.claude/hooks/` (made executable):
313
335
 
314
336
  - `session-start.sh` — runs on SessionStart, loads context
315
337
  - `session-stop.sh` — runs on Stop, persists session state
@@ -318,6 +340,21 @@ Deployed from `templates/hooks/` to `.claude/hooks/` (made executable):
318
340
  - `validate-push.sh` — PreToolUse hook for `git push*`, confirms before pushing
319
341
  - `log-agent.sh` — SubagentStart hook, logs sub-agent launches
320
342
 
343
+ **Enhanced hooks** — deployed only when user opts in. After deploying core hooks, prompt:
344
+
345
+ > "Install enhanced hooks? These add config protection, auto-formatting, debug statement warnings, compact suggestions, and cost tracking. [y/n]"
346
+
347
+ If yes, deploy these additional hooks:
348
+
349
+ - `config-protection.sh` — PreToolUse hook for Edit/Write, blocks linter/formatter config modifications
350
+ - `post-edit-format.sh` — PostToolUse hook for Edit, auto-formats with project's formatter
351
+ - `console-log-warning.sh` — Stop hook, warns about debug statements in modified files
352
+ - `cost-tracker.sh` — Stop hook (async), logs session metadata to `.claude/sessions/cost-log.jsonl`
353
+ - `suggest-compact.sh` — PreToolUse hook, suggests `/compact` after 50+ tool calls
354
+ - `safety-guard.sh` — PreToolUse hook for Bash/Edit/Write, reads `.claude/safety-guard.json` for protection rules
355
+
356
+ If no, skip enhanced hooks — core hooks are always installed.
357
+
321
358
  ### Agent Definitions (in `.claude/agents/`)
322
359
 
323
360
  Deployed from `templates/.claude/agents/` (create-if-missing):
@@ -345,7 +382,7 @@ Deployed from `templates/.claude/rules/` based on detected stack:
345
382
  Rendered from `templates/.claude/settings.json.template`. Contains:
346
383
  - Statusline configuration (points to `.claude/statusline.sh`)
347
384
  - Permission allow/deny lists for safe Bash commands
348
- - Hook wiring for all 6 hooks above
385
+ - Hook wiring for all hooks (core 6 + enhanced 6 if opted in)
349
386
 
350
387
  ### Statusline Generation (`.claude/statusline.sh`)
351
388