@c0x12c/spartan-ai-toolkit 1.0.1
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/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +12 -0
- package/README.md +300 -0
- package/VERSION +1 -0
- package/agents/idea-killer.md +72 -0
- package/agents/micronaut-backend-expert.md +45 -0
- package/agents/research-planner.md +70 -0
- package/agents/solution-architect-cto.md +49 -0
- package/bin/cli.js +589 -0
- package/claude-md/00-header.md +39 -0
- package/claude-md/01-core.md +94 -0
- package/claude-md/05-database.md +20 -0
- package/claude-md/11-backend-micronaut.md +36 -0
- package/claude-md/20-frontend-react.md +23 -0
- package/claude-md/30-project-mgmt.md +91 -0
- package/claude-md/40-product.md +36 -0
- package/claude-md/50-ops.md +34 -0
- package/claude-md/60-research.md +75 -0
- package/claude-md/90-footer.md +21 -0
- package/commands/spartan/brainstorm.md +134 -0
- package/commands/spartan/brownfield.md +157 -0
- package/commands/spartan/careful.md +94 -0
- package/commands/spartan/content.md +17 -0
- package/commands/spartan/context-save.md +161 -0
- package/commands/spartan/daily.md +42 -0
- package/commands/spartan/debug.md +156 -0
- package/commands/spartan/deep-dive.md +55 -0
- package/commands/spartan/deploy.md +207 -0
- package/commands/spartan/e2e.md +264 -0
- package/commands/spartan/env-setup.md +166 -0
- package/commands/spartan/fe-review.md +134 -0
- package/commands/spartan/figma-to-code.md +244 -0
- package/commands/spartan/forensics.md +46 -0
- package/commands/spartan/freeze.md +84 -0
- package/commands/spartan/full-run.md +78 -0
- package/commands/spartan/fundraise.md +53 -0
- package/commands/spartan/gsd-upgrade.md +376 -0
- package/commands/spartan/guard.md +42 -0
- package/commands/spartan/init-project.md +178 -0
- package/commands/spartan/interview.md +154 -0
- package/commands/spartan/kickoff.md +52 -0
- package/commands/spartan/kotlin-service.md +109 -0
- package/commands/spartan/lean-canvas.md +222 -0
- package/commands/spartan/map-codebase.md +72 -0
- package/commands/spartan/migration.md +82 -0
- package/commands/spartan/next-app.md +317 -0
- package/commands/spartan/next-feature.md +197 -0
- package/commands/spartan/outreach.md +16 -0
- package/commands/spartan/phase.md +119 -0
- package/commands/spartan/pitch.md +18 -0
- package/commands/spartan/pr-ready.md +200 -0
- package/commands/spartan/project.md +106 -0
- package/commands/spartan/quickplan.md +122 -0
- package/commands/spartan/research.md +19 -0
- package/commands/spartan/review.md +102 -0
- package/commands/spartan/teardown.md +161 -0
- package/commands/spartan/testcontainer.md +97 -0
- package/commands/spartan/think.md +221 -0
- package/commands/spartan/unfreeze.md +13 -0
- package/commands/spartan/update.md +81 -0
- package/commands/spartan/validate.md +193 -0
- package/commands/spartan/workstreams.md +109 -0
- package/commands/spartan/write.md +16 -0
- package/commands/spartan.md +222 -0
- package/frameworks/00-framework-comparison-guide.md +317 -0
- package/frameworks/01-lean-canvas.md +196 -0
- package/frameworks/02-design-sprint.md +304 -0
- package/frameworks/03-foundation-sprint.md +337 -0
- package/frameworks/04-business-model-canvas.md +391 -0
- package/frameworks/05-customer-development.md +426 -0
- package/frameworks/06-jobs-to-be-done.md +358 -0
- package/frameworks/07-mom-test.md +392 -0
- package/frameworks/08-value-proposition-canvas.md +488 -0
- package/frameworks/09-javelin-board.md +428 -0
- package/frameworks/10-build-measure-learn.md +467 -0
- package/frameworks/11-mvp-approaches.md +533 -0
- package/frameworks/think-before-build.md +593 -0
- package/lib/assembler.js +52 -0
- package/lib/packs.js +16 -0
- package/lib/resolver.js +144 -0
- package/lib/resolver.test.js +140 -0
- package/package.json +48 -0
- package/packs/backend-micronaut.yaml +34 -0
- package/packs/backend-nodejs.yaml +15 -0
- package/packs/backend-python.yaml +15 -0
- package/packs/core.yaml +25 -0
- package/packs/database.yaml +21 -0
- package/packs/frontend-react.yaml +23 -0
- package/packs/ops.yaml +16 -0
- package/packs/packs.compiled.json +281 -0
- package/packs/product.yaml +20 -0
- package/packs/project-mgmt.yaml +21 -0
- package/packs/research.yaml +39 -0
- package/packs/shared-backend.yaml +14 -0
- package/rules/backend-micronaut/API_DESIGN.md +250 -0
- package/rules/backend-micronaut/CONTROLLERS.md +755 -0
- package/rules/backend-micronaut/KOTLIN.md +483 -0
- package/rules/backend-micronaut/RETROFIT_PLACEMENT.md +258 -0
- package/rules/backend-micronaut/SERVICES_AND_BEANS.md +673 -0
- package/rules/core/NAMING_CONVENTIONS.md +208 -0
- package/rules/database/ORM_AND_REPO.md +393 -0
- package/rules/database/SCHEMA.md +146 -0
- package/rules/database/TRANSACTIONS.md +311 -0
- package/rules/frontend-react/FRONTEND.md +344 -0
- package/rules/shared-backend/ARCHITECTURE.md +46 -0
- package/skills/api-endpoint-creator/SKILL.md +560 -0
- package/skills/api-endpoint-creator/error-handling-guide.md +244 -0
- package/skills/api-endpoint-creator/examples.md +522 -0
- package/skills/api-endpoint-creator/testing-patterns.md +302 -0
- package/skills/article-writing/SKILL.md +95 -0
- package/skills/backend-api-design/SKILL.md +187 -0
- package/skills/brainstorm/SKILL.md +85 -0
- package/skills/competitive-teardown/SKILL.md +105 -0
- package/skills/content-engine/SKILL.md +101 -0
- package/skills/database-patterns/SKILL.md +145 -0
- package/skills/database-table-creator/SKILL.md +588 -0
- package/skills/database-table-creator/examples.md +552 -0
- package/skills/database-table-creator/migration-template.sql +68 -0
- package/skills/database-table-creator/validation-checklist.md +337 -0
- package/skills/deep-research/SKILL.md +94 -0
- package/skills/idea-validation/SKILL.md +115 -0
- package/skills/investor-materials/SKILL.md +115 -0
- package/skills/investor-outreach/SKILL.md +98 -0
- package/skills/kotlin-best-practices/SKILL.md +145 -0
- package/skills/market-research/SKILL.md +113 -0
- package/skills/security-checklist/SKILL.md +150 -0
- package/skills/startup-pipeline/SKILL.md +125 -0
- package/skills/testing-strategies/SKILL.md +156 -0
- package/skills/ui-ux-pro-max/SKILL.md +377 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/templates/competitor-analysis.md +60 -0
- package/templates/content/AGENT_TEMPLATE.md +47 -0
- package/templates/content/COMMAND_TEMPLATE.md +27 -0
- package/templates/content/RULE_TEMPLATE.md +40 -0
- package/templates/content/SKILL_TEMPLATE.md +41 -0
- package/templates/idea-canvas.md +47 -0
- package/templates/prd-template.md +84 -0
- package/templates/project-readme.md +35 -0
- package/templates/user-interview.md +69 -0
- package/templates/validation-checklist.md +108 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:brownfield
|
|
3
|
+
description: Analyze an existing codebase and generate a structured context map + onboarding spec before making any changes. Use when joining a legacy project or unfamiliar service.
|
|
4
|
+
argument-hint: "[service name or directory] [optional: area of focus]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Brownfield Onboarding: {{ args[0] }}
|
|
8
|
+
Focus area: {{ args[1] | default: "full codebase" }}
|
|
9
|
+
|
|
10
|
+
You are performing a **brownfield analysis** — mapping an existing codebase before touching it.
|
|
11
|
+
This prevents the most common AI coding mistake: making changes without understanding the terrain.
|
|
12
|
+
|
|
13
|
+
Inspired by OpenSpec's change-isolation philosophy: understand first, change second.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Phase 1: Structure Mapping (automated)
|
|
18
|
+
|
|
19
|
+
Run these commands to get a high-level picture:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Project structure
|
|
23
|
+
find . -type f -name "*.kt" | head -60
|
|
24
|
+
find . -type f -name "*.gradle.kts" | head -10
|
|
25
|
+
|
|
26
|
+
# Dependencies
|
|
27
|
+
cat build.gradle.kts 2>/dev/null || cat pom.xml 2>/dev/null
|
|
28
|
+
|
|
29
|
+
# Database migrations (Flyway)
|
|
30
|
+
ls src/main/resources/db/migration/ 2>/dev/null | sort
|
|
31
|
+
|
|
32
|
+
# Test coverage picture
|
|
33
|
+
find . -path "*/test/*" -name "*.kt" | wc -l
|
|
34
|
+
find . -path "*/main/*" -name "*.kt" | wc -l
|
|
35
|
+
|
|
36
|
+
# Recent git activity
|
|
37
|
+
git log --oneline -20
|
|
38
|
+
git log --oneline --since="30 days ago" | wc -l
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Phase 2: Architecture Analysis
|
|
44
|
+
|
|
45
|
+
Read and analyze these files (if they exist):
|
|
46
|
+
- `README.md` / `docs/`
|
|
47
|
+
- `CLAUDE.md` / `AGENTS.md`
|
|
48
|
+
- `src/main/resources/application.yml`
|
|
49
|
+
- Main `@MicronautApplication or Application.kt` class
|
|
50
|
+
- Domain model files in `domain/model/`
|
|
51
|
+
|
|
52
|
+
Then answer:
|
|
53
|
+
1. **What does this service do?** (1-2 sentences)
|
|
54
|
+
2. **What are the main domain entities?**
|
|
55
|
+
3. **What external systems does it talk to?** (DB, Kafka, Redis, HTTP)
|
|
56
|
+
4. **What are the main entry points?** (controllers, consumers)
|
|
57
|
+
5. **What tech debt is visible?** (TODO comments, deprecated APIs, inconsistent patterns)
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Phase 3: Hotspot Detection
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Most-changed files (potential complexity hotspots)
|
|
65
|
+
git log --format=format: --name-only | grep "\.kt$" | sort | uniq -c | sort -rn | head -15
|
|
66
|
+
|
|
67
|
+
# Largest files (potential god classes)
|
|
68
|
+
find . -name "*.kt" -exec wc -l {} \; | sort -rn | head -10
|
|
69
|
+
|
|
70
|
+
# TODO/FIXME density
|
|
71
|
+
grep -r "TODO\|FIXME\|HACK\|XXX" --include="*.kt" | wc -l
|
|
72
|
+
grep -r "TODO\|FIXME\|HACK\|XXX" --include="*.kt" | head -10
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Phase 4: Test Health Check
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Test types present
|
|
81
|
+
find . -name "*Test*.kt" -o -name "*Spec*.kt" | head -20
|
|
82
|
+
|
|
83
|
+
# Integration tests (Testcontainers)
|
|
84
|
+
grep -r "Testcontainers\|@Container" --include="*.kt" -l
|
|
85
|
+
|
|
86
|
+
# Test coverage (if JaCoCo configured)
|
|
87
|
+
cat build.gradle.kts | grep -A5 "jacoco"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Assess:
|
|
91
|
+
- Unit test coverage (estimate from file count ratio)
|
|
92
|
+
- Integration test presence
|
|
93
|
+
- Any tests using mocks where Testcontainers would be better
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Phase 5: Generate Context Map
|
|
98
|
+
|
|
99
|
+
Save output as `docs/CONTEXT-MAP.md`:
|
|
100
|
+
|
|
101
|
+
```markdown
|
|
102
|
+
# Context Map: [service name]
|
|
103
|
+
Generated: [date]
|
|
104
|
+
|
|
105
|
+
## Service Purpose
|
|
106
|
+
[1-2 sentences]
|
|
107
|
+
|
|
108
|
+
## Architecture
|
|
109
|
+
- Pattern: [layered / hexagonal / other]
|
|
110
|
+
- Main layers: [list]
|
|
111
|
+
- External dependencies: [list with protocols]
|
|
112
|
+
|
|
113
|
+
## Domain Model
|
|
114
|
+
[key entities and their relationships]
|
|
115
|
+
|
|
116
|
+
## Entry Points
|
|
117
|
+
[controllers + endpoints, consumers + topics]
|
|
118
|
+
|
|
119
|
+
## Known Tech Debt
|
|
120
|
+
[ordered by severity]
|
|
121
|
+
|
|
122
|
+
## Test Health
|
|
123
|
+
- Unit tests: [count / assessment]
|
|
124
|
+
- Integration tests: [count / assessment]
|
|
125
|
+
- Coverage gaps: [where tests are missing]
|
|
126
|
+
|
|
127
|
+
## Safe Change Zones
|
|
128
|
+
[areas that are well-tested and safe to modify]
|
|
129
|
+
|
|
130
|
+
## Danger Zones
|
|
131
|
+
[areas that are fragile, under-tested, or have unclear behavior]
|
|
132
|
+
|
|
133
|
+
## Recommended First Steps
|
|
134
|
+
1. [what to do before making any changes]
|
|
135
|
+
2. [what tests to add first]
|
|
136
|
+
3. [what to refactor before building new features]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Phase 6: Change Isolation Setup
|
|
142
|
+
|
|
143
|
+
For each planned change to this codebase, create a folder:
|
|
144
|
+
```
|
|
145
|
+
.changes/
|
|
146
|
+
[YYYY-MM-DD]-[change-name]/
|
|
147
|
+
PROPOSAL.md ← what you want to change and why
|
|
148
|
+
DESIGN.md ← how you'll change it
|
|
149
|
+
TASKS.md ← atomic steps (max 4)
|
|
150
|
+
RISKS.md ← what could break
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This prevents scope creep and keeps each change independently reviewable.
|
|
154
|
+
|
|
155
|
+
After analysis, present the Context Map summary and ask:
|
|
156
|
+
"Analysis complete. What change would you like to make first?
|
|
157
|
+
I'll create a change folder and use `/spartan:quickplan` for it."
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:careful
|
|
3
|
+
description: Activate destructive operation warnings. Claude will detect and require explicit confirmation before running dangerous commands like rm -rf, DROP TABLE, force-push, git reset --hard, overwriting migrations, or deleting production resources.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Careful Mode — ACTIVATED
|
|
7
|
+
|
|
8
|
+
You are now in **careful mode**. Before executing any destructive operation, you MUST:
|
|
9
|
+
1. Print a clear warning
|
|
10
|
+
2. Explain what will be destroyed/changed irreversibly
|
|
11
|
+
3. Wait for explicit confirmation ("I confirm" or "proceed anyway")
|
|
12
|
+
|
|
13
|
+
**Never skip this — not even in auto mode.**
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Destructive Operations Watchlist
|
|
18
|
+
|
|
19
|
+
Detect and block these patterns. This list is not exhaustive — use judgment for anything that smells destructive.
|
|
20
|
+
|
|
21
|
+
### Filesystem
|
|
22
|
+
- `rm -rf` / `rm -r` on any directory
|
|
23
|
+
- Overwriting files without backup (especially config, migrations, `.env`)
|
|
24
|
+
- `chmod 777` or `chown` on sensitive paths
|
|
25
|
+
- Truncating or overwriting log files
|
|
26
|
+
|
|
27
|
+
### Git
|
|
28
|
+
- `git push --force` or `git push -f` (use `--force-with-lease` instead, still warn)
|
|
29
|
+
- `git reset --hard`
|
|
30
|
+
- `git clean -fd`
|
|
31
|
+
- `git branch -D` (force delete branch)
|
|
32
|
+
- `git rebase` on shared branches (main, develop)
|
|
33
|
+
- Amending commits already pushed to remote
|
|
34
|
+
|
|
35
|
+
### Database
|
|
36
|
+
- `DROP TABLE` / `DROP DATABASE` / `DROP SCHEMA`
|
|
37
|
+
- `TRUNCATE TABLE`
|
|
38
|
+
- `DELETE FROM` without `WHERE` clause
|
|
39
|
+
- `ALTER TABLE ... DROP COLUMN`
|
|
40
|
+
- Overwriting or renaming existing Flyway migrations (breaks checksum)
|
|
41
|
+
- Running migrations on production database
|
|
42
|
+
|
|
43
|
+
### Infrastructure
|
|
44
|
+
- `terraform destroy`
|
|
45
|
+
- `terraform apply` without prior `terraform plan` review
|
|
46
|
+
- `docker system prune`
|
|
47
|
+
- `railway delete` / removing Railway services
|
|
48
|
+
- Modifying production env vars (DATASOURCES_DEFAULT_*, secrets)
|
|
49
|
+
- Scaling down to 0 replicas
|
|
50
|
+
|
|
51
|
+
### Application
|
|
52
|
+
- Changing API endpoints that other services depend on (breaking changes)
|
|
53
|
+
- Removing Kafka topics or consumer groups
|
|
54
|
+
- Invalidating all user sessions / tokens
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Warning Format
|
|
59
|
+
|
|
60
|
+
When a destructive operation is detected, print:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
⚠️ DESTRUCTIVE OPERATION DETECTED
|
|
64
|
+
|
|
65
|
+
Action: [what will happen]
|
|
66
|
+
Impact: [what will be destroyed/changed irreversibly]
|
|
67
|
+
Recovery: [how to undo, or "NOT RECOVERABLE"]
|
|
68
|
+
|
|
69
|
+
Alternatives:
|
|
70
|
+
- [safer approach if one exists]
|
|
71
|
+
|
|
72
|
+
Type "I confirm" or "proceed anyway" to execute.
|
|
73
|
+
Type "cancel" or "no" to abort.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Behavior Rules
|
|
79
|
+
|
|
80
|
+
1. **Always warn, even if user explicitly asked for the destructive action.** They may not realize the full impact.
|
|
81
|
+
2. **Suggest safer alternatives when possible.** E.g., `--force-with-lease` instead of `--force`, soft delete instead of DROP, backup before overwrite.
|
|
82
|
+
3. **In auto mode, careful mode OVERRIDES auto mode.** Destructive actions always require confirmation.
|
|
83
|
+
4. **Chain detection:** If a script contains multiple destructive operations, warn about ALL of them upfront, not one at a time.
|
|
84
|
+
5. **Stay active until `/spartan:careful off` or session ends.** This is sticky — once activated, it stays on.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Quick Toggle
|
|
89
|
+
|
|
90
|
+
- `/spartan:careful` — activate (this command)
|
|
91
|
+
- `/spartan:careful off` — deactivate (say: "Careful mode OFF. Destructive operations will execute without extra confirmation.")
|
|
92
|
+
|
|
93
|
+
Claude should acknowledge activation:
|
|
94
|
+
"🛡️ Careful mode ON — tôi sẽ cảnh báo trước mọi thao tác destructive. Nói 'careful off' để tắt."
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:content
|
|
3
|
+
description: Turn research or ideas into platform-native content — blog posts, tweets, LinkedIn, newsletters
|
|
4
|
+
argument-hint: "[source material and target platform]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Content: {{ args[0] | default: "from existing research" }}
|
|
8
|
+
|
|
9
|
+
Create platform-native content from existing work.
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. Use the `content-engine` skill
|
|
14
|
+
2. Find the source material (research report, idea, validation, etc.)
|
|
15
|
+
3. Ask: What platform? What audience? What goal?
|
|
16
|
+
4. Create platform-specific drafts
|
|
17
|
+
5. No copy-paste between platforms — each platform gets native format
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:context-save
|
|
3
|
+
description: Manage context window — first tries /compact to free space, then saves full handoff if needed. Auto-triggered when Claude detects context pressure, or run manually anytime.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Save — Smart Context Management
|
|
7
|
+
|
|
8
|
+
## Step 0: Triage — Compact or Full Save?
|
|
9
|
+
|
|
10
|
+
Assess the situation before doing a full handoff:
|
|
11
|
+
|
|
12
|
+
**Option A: Compact (stay in same session)**
|
|
13
|
+
If the session has useful remaining capacity and user wants to keep working:
|
|
14
|
+
1. Summarize the conversation so far into key decisions + current state
|
|
15
|
+
2. Run `/compact` to free context space
|
|
16
|
+
3. Continue working in the same session
|
|
17
|
+
|
|
18
|
+
Use compact when: mid-task, still productive, just need to free space.
|
|
19
|
+
|
|
20
|
+
**Option B: Full Save (end session, resume in new one)**
|
|
21
|
+
If the session is too deep to recover, or user is done for now:
|
|
22
|
+
1. Save everything to `.handoff/` file
|
|
23
|
+
2. Update `.memory/` with new knowledge
|
|
24
|
+
3. User starts fresh session and reads the handoff file
|
|
25
|
+
|
|
26
|
+
Use full save when: session > 60%, quality visibly degrading, end of work day, switching to different task.
|
|
27
|
+
|
|
28
|
+
**Auto-triggered?** When Claude detects its own context pressure (forgetting earlier context, slow responses, repeating itself), it should:
|
|
29
|
+
1. First try compact (Option A)
|
|
30
|
+
2. If already compacted once this session → go to full save (Option B)
|
|
31
|
+
3. Tell the user what's happening: "Context getting heavy — compacting to stay productive."
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Full Save Process (Option B)
|
|
36
|
+
|
|
37
|
+
## Step 1: Capture Current State
|
|
38
|
+
|
|
39
|
+
Answer these by reviewing the conversation and codebase:
|
|
40
|
+
|
|
41
|
+
**1. What was being worked on?**
|
|
42
|
+
(Feature name, ticket, GSD phase, etc.)
|
|
43
|
+
|
|
44
|
+
**2. What was completed in this session?**
|
|
45
|
+
(List commits made, tasks finished)
|
|
46
|
+
|
|
47
|
+
**3. What is the current status?**
|
|
48
|
+
(In-progress task, where exactly we stopped)
|
|
49
|
+
|
|
50
|
+
**4. What are the immediate next steps?**
|
|
51
|
+
(Exactly what to do next — be specific enough that a fresh agent can start without asking)
|
|
52
|
+
|
|
53
|
+
**5. What context is critical to carry forward?**
|
|
54
|
+
(Key decisions made, tradeoffs chosen, things tried that didn't work)
|
|
55
|
+
|
|
56
|
+
**6. What are the known risks / things to watch out for?**
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Step 2: Check Git State
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Uncommitted changes?
|
|
64
|
+
git status
|
|
65
|
+
git diff --stat
|
|
66
|
+
|
|
67
|
+
# Last commits this session
|
|
68
|
+
git log --oneline -5
|
|
69
|
+
|
|
70
|
+
# Current branch
|
|
71
|
+
git branch --show-current
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If there are uncommitted changes:
|
|
75
|
+
- Stash them: `git stash save "wip: [description]"`
|
|
76
|
+
- Or commit as WIP: `git commit -m "chore: wip - [what's in progress]"`
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Step 3: Write Handoff File
|
|
81
|
+
|
|
82
|
+
Save as `.handoff/[YYYY-MM-DD-HH]-[feature-slug].md`:
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
# Session Handoff: [feature/task name]
|
|
86
|
+
Created: [timestamp]
|
|
87
|
+
Branch: [current branch]
|
|
88
|
+
Author: [git user.name]
|
|
89
|
+
|
|
90
|
+
## What We Were Building
|
|
91
|
+
[1-2 sentences on the feature/task]
|
|
92
|
+
|
|
93
|
+
## Session Progress
|
|
94
|
+
### Completed ✅
|
|
95
|
+
- [task 1 — commit hash if available]
|
|
96
|
+
- [task 2]
|
|
97
|
+
|
|
98
|
+
### In Progress 🔨
|
|
99
|
+
- [exactly what was being done when session ended]
|
|
100
|
+
- Current file being edited: [path]
|
|
101
|
+
- Stopped at: [line/function/what was next]
|
|
102
|
+
|
|
103
|
+
## Resume Instructions
|
|
104
|
+
To pick up immediately:
|
|
105
|
+
1. `git checkout [branch]`
|
|
106
|
+
2. [specific command or action to run first]
|
|
107
|
+
3. [next step]
|
|
108
|
+
4. Goal: [what "done" looks like for the next session]
|
|
109
|
+
|
|
110
|
+
## Key Decisions Made This Session
|
|
111
|
+
- [decision 1 and why]
|
|
112
|
+
- [decision 2 and why]
|
|
113
|
+
|
|
114
|
+
## Things Tried That Didn't Work
|
|
115
|
+
- [approach X] — didn't work because [reason], don't try again
|
|
116
|
+
- [approach Y] — causes [problem]
|
|
117
|
+
|
|
118
|
+
## Critical Context
|
|
119
|
+
[Any important information that isn't obvious from the code:
|
|
120
|
+
- Business rules that affected implementation
|
|
121
|
+
- Gotchas discovered
|
|
122
|
+
- Dependencies or constraints to be aware of]
|
|
123
|
+
|
|
124
|
+
## Blockers / Risks
|
|
125
|
+
- [any outstanding questions or blockers]
|
|
126
|
+
|
|
127
|
+
## GSD State (if using GSD)
|
|
128
|
+
- Project: [PROJECT.md location]
|
|
129
|
+
- Milestone: [current milestone]
|
|
130
|
+
- Phase: [current phase N of M]
|
|
131
|
+
- Resume with: `/gsd:status` then `/gsd:execute-phase [N]`
|
|
132
|
+
|
|
133
|
+
## Files Modified This Session
|
|
134
|
+
[list of key files changed]
|
|
135
|
+
|
|
136
|
+
## Tests Status
|
|
137
|
+
- All tests passing: [yes/no]
|
|
138
|
+
- Tests added: [list]
|
|
139
|
+
- Known failing tests: [list if any, why]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Step 4: Verify Handoff is Complete
|
|
145
|
+
|
|
146
|
+
Read back the handoff file you just wrote and confirm:
|
|
147
|
+
- [ ] Someone could resume without asking any questions
|
|
148
|
+
- [ ] The "Resume Instructions" are specific enough to act on immediately
|
|
149
|
+
- [ ] Git state is clean (committed or stashed)
|
|
150
|
+
- [ ] No context is locked in this conversation that isn't in the file
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## How to Resume in Next Session
|
|
155
|
+
|
|
156
|
+
Start the new session with:
|
|
157
|
+
```
|
|
158
|
+
Read .handoff/[filename].md and resume where we left off.
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The fresh Claude session will have full 200k context and all the state from this file.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:daily
|
|
3
|
+
description: Generate a daily standup summary based on recent git history and GSD status
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Generate a daily engineering standup summary for the current project.
|
|
7
|
+
|
|
8
|
+
## Steps
|
|
9
|
+
|
|
10
|
+
1. **Check recent git history** (last 24-48h):
|
|
11
|
+
```bash
|
|
12
|
+
git log --since="2 days ago" --oneline --author="$(git config user.name)"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
2. **Check GSD status** (if GSD project exists):
|
|
16
|
+
Read `.planning/` directory for current milestone and phase status.
|
|
17
|
+
|
|
18
|
+
3. **Check for any failing tests or CI notes** (if available):
|
|
19
|
+
Look for recent test output files or CI logs.
|
|
20
|
+
|
|
21
|
+
## Output Format
|
|
22
|
+
|
|
23
|
+
```markdown
|
|
24
|
+
## Daily Standup — [DATE]
|
|
25
|
+
|
|
26
|
+
### ✅ Yesterday / Done
|
|
27
|
+
- [completed items from git log / GSD progress]
|
|
28
|
+
|
|
29
|
+
### 🔨 Today / In Progress
|
|
30
|
+
- [current phase or active task]
|
|
31
|
+
- [next planned task]
|
|
32
|
+
|
|
33
|
+
### 🚧 Blockers
|
|
34
|
+
- [any blockers found, or "None"]
|
|
35
|
+
|
|
36
|
+
### 📊 Progress on Current Milestone
|
|
37
|
+
- Phase X of Y complete
|
|
38
|
+
- Est. completion: [if determinable from roadmap]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Keep it concise — each section max 3-4 bullet points.
|
|
42
|
+
This is for a 15-minute standup, not a status report.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:debug
|
|
3
|
+
description: Structured root-cause debugging using a 4-phase investigation protocol. Produces a Debug Report with fix plan. Use for bugs that aren't immediately obvious.
|
|
4
|
+
argument-hint: "[describe the symptom / error]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Debug Investigation: {{ args[0] }}
|
|
8
|
+
|
|
9
|
+
You are running a **structured debugging session**.
|
|
10
|
+
Do NOT guess. Do NOT try random fixes. Follow the 4 phases in order.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1: Reproduce & Characterize (understand before touching anything)
|
|
15
|
+
|
|
16
|
+
**Goal:** Make the failure deterministic and fully described.
|
|
17
|
+
|
|
18
|
+
1. Get the exact error message, stack trace, or symptom
|
|
19
|
+
2. Find the minimal reproduction case:
|
|
20
|
+
- What inputs trigger it?
|
|
21
|
+
- What inputs do NOT trigger it?
|
|
22
|
+
- Is it consistent or flaky?
|
|
23
|
+
- Environment-specific? (local / CI / prod)
|
|
24
|
+
|
|
25
|
+
3. Gather context:
|
|
26
|
+
```bash
|
|
27
|
+
# Recent changes that could have introduced this
|
|
28
|
+
git log --oneline -10
|
|
29
|
+
git diff HEAD~5 --stat
|
|
30
|
+
|
|
31
|
+
# Are tests failing?
|
|
32
|
+
./gradlew test --info 2>&1 | tail -40
|
|
33
|
+
|
|
34
|
+
# Logs around the failure time
|
|
35
|
+
# (ask user for relevant log snippets if not in repo)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Document findings. Do NOT proceed until the bug is reproducible.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 2: Isolate the Root Cause (narrow the search space)
|
|
43
|
+
|
|
44
|
+
**Goal:** Find the exact line / decision / data that causes the failure.
|
|
45
|
+
|
|
46
|
+
Use binary isolation:
|
|
47
|
+
1. Start from the failure point, trace backwards through the call stack
|
|
48
|
+
2. At each layer, ask: "Is the data correct at this point?"
|
|
49
|
+
3. Keep narrowing until you find where correct data becomes incorrect data
|
|
50
|
+
|
|
51
|
+
For common Kotlin/Micronaut patterns, check:
|
|
52
|
+
- **Null safety violations**: Any `!!` operators? (BANNED — see CORE_RULES)
|
|
53
|
+
- **Either handling**: Is `.left()` / `.right()` used correctly? Missing error cases?
|
|
54
|
+
- **Coroutine scope leaks**: Is a coroutine cancelled before work completes?
|
|
55
|
+
- **Exposed transaction scope**: Is `newSuspendedTransaction {}` wrapping DB calls correctly?
|
|
56
|
+
- **Soft delete filtering**: Is `deleted_at IS NULL` included in queries? (DATABASE_RULES)
|
|
57
|
+
- **Testcontainers state**: Is a previous test leaving dirty data?
|
|
58
|
+
|
|
59
|
+
```kotlin
|
|
60
|
+
// Add strategic logging to narrow the search
|
|
61
|
+
log.debug("State at boundary: entity={}, dto={}", entity, dto)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Document: "The root cause is [X] because [evidence]."
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Phase 3: Fix with Test First (TDD the fix)
|
|
69
|
+
|
|
70
|
+
**Goal:** Fix correctly and ensure it cannot regress.
|
|
71
|
+
|
|
72
|
+
1. **Write a failing test that captures the bug FIRST:**
|
|
73
|
+
```kotlin
|
|
74
|
+
@Test
|
|
75
|
+
fun `given [condition that triggers bug], when [action], then [correct behavior]`() {
|
|
76
|
+
// Reproduce the exact scenario that fails
|
|
77
|
+
// This test must FAIL right now
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
2. **Confirm test is red** — if it passes, you haven't reproduced the bug in the test
|
|
82
|
+
|
|
83
|
+
3. **Write the minimal fix** — change as little as possible
|
|
84
|
+
|
|
85
|
+
4. **Confirm test is green**
|
|
86
|
+
|
|
87
|
+
5. **Check for similar patterns** in the codebase:
|
|
88
|
+
```bash
|
|
89
|
+
# Find similar code that might have the same bug
|
|
90
|
+
grep -r "[pattern from the bug]" --include="*.kt" src/
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Phase 4: Verify & Harden
|
|
96
|
+
|
|
97
|
+
**Goal:** Confirm fix is complete and add protection layers.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Full test suite must pass
|
|
101
|
+
./gradlew test
|
|
102
|
+
|
|
103
|
+
# Integration tests specifically
|
|
104
|
+
./gradlew integrationTest 2>/dev/null || ./gradlew test -Dmicronaut.environments=test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Check:
|
|
108
|
+
- [ ] Fix addresses root cause, not symptom
|
|
109
|
+
- [ ] No regression in existing tests
|
|
110
|
+
- [ ] Edge cases covered in new test
|
|
111
|
+
- [ ] Similar patterns in codebase checked and fixed if needed
|
|
112
|
+
- [ ] Logging/observability added if this was hard to debug
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Output: Debug Report
|
|
117
|
+
|
|
118
|
+
After completing all phases, produce a brief report:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
## Debug Report: [symptom]
|
|
122
|
+
|
|
123
|
+
**Root Cause:** [exact cause in one sentence]
|
|
124
|
+
|
|
125
|
+
**Why it happened:**
|
|
126
|
+
[2-3 sentences explaining the chain of events]
|
|
127
|
+
|
|
128
|
+
**Fix:**
|
|
129
|
+
[what was changed and why it fixes the root cause]
|
|
130
|
+
|
|
131
|
+
**Test added:**
|
|
132
|
+
[name of the regression test]
|
|
133
|
+
|
|
134
|
+
**Similar patterns checked:**
|
|
135
|
+
[files checked / changes made]
|
|
136
|
+
|
|
137
|
+
**Prevention:**
|
|
138
|
+
[what could prevent this class of bug in future — linting rule, convention, etc.]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Commit with:
|
|
142
|
+
```
|
|
143
|
+
fix([scope]): [root cause description]
|
|
144
|
+
|
|
145
|
+
- Root cause: [one line]
|
|
146
|
+
- Add regression test: [test name]
|
|
147
|
+
- Checked [N] similar patterns
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Rules
|
|
151
|
+
|
|
152
|
+
- Follow the 4 phases in order — don't skip to fixing
|
|
153
|
+
- Never guess — every hypothesis must have evidence
|
|
154
|
+
- Write a failing test before writing the fix
|
|
155
|
+
- Change as little as possible — minimal fix, not refactor
|
|
156
|
+
- Check for similar patterns in the codebase after fixing
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spartan:deep-dive
|
|
3
|
+
description: "Go deep on a validated idea: market research + competitor teardowns (Stage 3)"
|
|
4
|
+
argument-hint: "[project name or idea]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Deep Dive: {{ args[0] | default: "your idea" }}
|
|
8
|
+
|
|
9
|
+
Runs Stage 3: deep market research and competitor teardowns.
|
|
10
|
+
Only do this AFTER validation says GO or TEST MORE.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
### Check Prior Work
|
|
15
|
+
1. Find the project folder in `projects/`
|
|
16
|
+
2. Read everything in `01-brainstorm/` and `03-validation/`
|
|
17
|
+
3. Pull out: the idea, target user, competitors found, market signals
|
|
18
|
+
|
|
19
|
+
### Market Research
|
|
20
|
+
4. Use the `market-research` skill
|
|
21
|
+
5. Run market sizing (TAM/SAM/SOM with math shown)
|
|
22
|
+
6. Find industry data, reports, trends
|
|
23
|
+
7. Check demand signals: search volume, forum posts, review complaints
|
|
24
|
+
8. Look for tailwinds (new regulation, tech shift, behavior change)
|
|
25
|
+
9. Save to `02-research/market-research-{date}.md`
|
|
26
|
+
|
|
27
|
+
### Competitor Teardowns
|
|
28
|
+
10. Use the `competitive-teardown` skill
|
|
29
|
+
11. Identify top 3-5 competitors from validation step
|
|
30
|
+
12. For each competitor:
|
|
31
|
+
- Product teardown (what they do, pricing, strengths, weaknesses)
|
|
32
|
+
- Business teardown (funding, team, traction)
|
|
33
|
+
- User feedback (reviews, Reddit, forums)
|
|
34
|
+
13. Save each to `02-research/teardown-{competitor}-{date}.md`
|
|
35
|
+
|
|
36
|
+
### Synthesis
|
|
37
|
+
14. Create a summary that connects everything:
|
|
38
|
+
- Market size and growth
|
|
39
|
+
- Competitor landscape (table comparison)
|
|
40
|
+
- The gap: what nobody does well
|
|
41
|
+
- Our positioning: where we win
|
|
42
|
+
- Biggest risks
|
|
43
|
+
15. Save to `02-research/synthesis-{date}.md`
|
|
44
|
+
|
|
45
|
+
### Gate 3 Check
|
|
46
|
+
16. Show findings to user
|
|
47
|
+
17. If strong signals: "This looks worth building. Want me to run /spartan:fundraise?"
|
|
48
|
+
18. If weak signals: "Here's what's concerning: [X]. Still want to go forward?"
|
|
49
|
+
19. If dead: "I'd archive this. Here's why: [X]"
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- Read ALL prior work before starting. Don't re-research what we already know.
|
|
54
|
+
- If validation was TEST MORE, ask what test the user ran and what happened.
|
|
55
|
+
- Be honest if the data kills the idea. Better now than after building.
|