@slamb2k/mad-skills 2.0.7 → 2.0.9

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.
@@ -1,11 +1,8 @@
1
1
  ---
2
2
  name: sync
3
- description: >
4
- Sync local repository with origin/main. Use before starting new work, after
5
- completing a PR, or when needing latest upstream changes. Safely stashes
6
- uncommitted changes, fetches and pulls origin/main, restores stash, and cleans
7
- up stale local branches (merged or with deleted remotes). Invoke when switching
8
- contexts or preparing for new feature work.
3
+ description: Sync local repository with origin/main. Use before starting new work, after completing a PR, or when needing latest upstream changes. Safely stashes uncommitted changes, fetches and pulls origin/main, restores stash, and cleans up stale local branches (merged or with deleted remotes). Invoke when switching contexts or preparing for new feature work.
4
+ argument-hint: --no-stash, --no-cleanup, --no-rebase (optional flags)
5
+ allowed-tools: Bash
9
6
  ---
10
7
 
11
8
  # Sync - Repository Synchronization
@@ -35,20 +32,181 @@ Taglines:
35
32
  - 🔁 Rebase, merge, rinse, repeat!
36
33
  - 🎬 Previously on main...
37
34
 
38
- Follow instructions in: [instructions.md](instructions.md)
39
-
40
- ## Subagent Architecture
35
+ ---
41
36
 
42
- Single **Bash** subagent with **haiku** model. Pure git commands no code
43
- analysis needed, so the cheapest/fastest model is used. All git output stays
44
- in the subagent context; the primary agent only sees the structured SYNC_REPORT.
37
+ Synchronize local repository with the remote default branch using a single
38
+ Bash subagent to isolate all git operations from the primary conversation.
45
39
 
46
40
  ## Flags
47
41
 
48
- - `--no-stash` Skip auto-stashing uncommitted changes
49
- - `--no-cleanup` Skip deleting stale local branches
50
- - `--no-rebase` Use merge instead of rebase on feature branches
42
+ Parse optional flags from the request:
43
+ - `--no-stash`: Don't auto-stash uncommitted changes
44
+ - `--no-cleanup`: Don't delete stale local branches
45
+ - `--no-rebase`: Use merge instead of rebase when on a feature branch
46
+
47
+ ---
48
+
49
+ ## Pre-flight
50
+
51
+ Before starting, check all dependencies in this table:
52
+
53
+ | Dependency | Type | Check | Required | Resolution | Detail |
54
+ |-----------|------|-------|----------|------------|--------|
55
+ | git | cli | `git --version` | yes | stop | Install from https://git-scm.com |
56
+
57
+ For each row, in order:
58
+ 1. Run the Check command (for cli/npm) or test file existence (for agent/skill)
59
+ 2. If found: continue silently
60
+ 3. If missing: apply Resolution strategy
61
+ - **stop**: notify user with Detail, halt execution
62
+ - **url**: notify user with Detail (install link), halt execution
63
+ - **install**: notify user, run the command in Detail, continue if successful
64
+ - **ask**: notify user, offer to run command in Detail, continue either way (or halt if required)
65
+ - **fallback**: notify user with Detail, continue with degraded behavior
66
+ 4. After all checks: summarize what's available and what's degraded
67
+
68
+ ---
69
+
70
+ ## Pre-flight Detection
71
+
72
+ Before launching the subagent, detect the remote and default branch:
73
+
74
+ ```
75
+ REMOTE=$(git remote | head -1) # usually "origin"
76
+ DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/$REMOTE/HEAD 2>/dev/null | sed 's|.*/||')
77
+ ```
78
+
79
+ Fallback chain if `symbolic-ref` fails:
80
+ 1. Check `git show-ref --verify refs/heads/main` → use `main`
81
+ 2. Check `git show-ref --verify refs/heads/master` → use `master`
82
+ 3. If neither exists, report error and stop
83
+
84
+ Pass `{REMOTE}` and `{DEFAULT_BRANCH}` into the subagent prompt.
85
+
86
+ ---
87
+
88
+ ## Execution
89
+
90
+ Launch a **Bash subagent** (haiku — pure git commands, no code analysis needed):
91
+
92
+ ```
93
+ Task(
94
+ subagent_type: "Bash",
95
+ model: "haiku",
96
+ description: "Sync repo with {DEFAULT_BRANCH}",
97
+ prompt: <see prompt below>
98
+ )
99
+ ```
100
+
101
+ ### Subagent Prompt
51
102
 
52
- ## Safety
103
+ ```
104
+ Synchronize this git repository with {REMOTE}/{DEFAULT_BRANCH}. Execute the
105
+ following steps in order and report results.
106
+
107
+ Limit SYNC_REPORT to 15 lines maximum.
108
+
109
+ FLAGS: {flags from request, or "none"}
110
+
111
+ ## Steps
112
+
113
+ 1. **Check state**
114
+ BRANCH=$(git branch --show-current 2>/dev/null || echo "DETACHED")
115
+ CHANGES=$(git status --porcelain | head -20)
116
+ Record: current_branch=$BRANCH, has_changes=(non-empty CHANGES)
117
+
118
+ If BRANCH == "DETACHED":
119
+ Record error: "Detached HEAD — cannot sync. Checkout a branch first."
120
+ Skip to Output.
121
+
122
+ 2. **Stash changes** (skip if --no-stash or no changes)
123
+ If has_changes and not --no-stash:
124
+ git stash push -m "sync-auto-stash-$(date +%Y%m%d-%H%M%S)"
125
+ Record: stash_created=true
126
+
127
+ 3. **Sync {DEFAULT_BRANCH}**
128
+ git fetch {REMOTE}
129
+ If BRANCH != "{DEFAULT_BRANCH}":
130
+ git checkout {DEFAULT_BRANCH}
131
+ git pull {REMOTE} {DEFAULT_BRANCH} --ff-only
132
+ If pull fails (diverged):
133
+ git pull {REMOTE} {DEFAULT_BRANCH} --rebase
134
+ Record: main_commit=$(git rev-parse --short HEAD)
135
+ Record: main_message=$(git log -1 --format=%s)
136
+
137
+ 4. **Return to branch and update** (skip if already on {DEFAULT_BRANCH})
138
+ If current_branch != "{DEFAULT_BRANCH}":
139
+ git checkout $BRANCH
140
+ If --no-rebase:
141
+ git merge {DEFAULT_BRANCH} --no-edit
142
+ Else:
143
+ git rebase {DEFAULT_BRANCH}
144
+ If rebase fails:
145
+ git rebase --abort
146
+ Record: rebase_status="conflict — aborted, branch unchanged"
147
+
148
+ 5. **Restore stash** (if created in step 2)
149
+ If stash_created:
150
+ git stash pop
151
+ If pop fails (conflict):
152
+ Record: stash="conflict — run 'git stash show' to inspect"
153
+ Else:
154
+ Record: stash="restored"
155
+
156
+ 6. **Cleanup branches** (skip if --no-cleanup)
157
+ git fetch --prune
158
+
159
+ # Delete branches whose remote is gone
160
+ for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do
161
+ if [ "$branch" != "$BRANCH" ]; then
162
+ git branch -d "$branch" 2>/dev/null && echo "Deleted: $branch"
163
+ fi
164
+ done
165
+
166
+ # Delete branches fully merged into {DEFAULT_BRANCH} (except current)
167
+ for branch in $(git branch --merged {DEFAULT_BRANCH} | grep -v '^\*' | grep -v '{DEFAULT_BRANCH}'); do
168
+ branch=$(echo "$branch" | xargs)
169
+ if [ "$branch" != "$BRANCH" ] && [ -n "$branch" ]; then
170
+ git branch -d "$branch" 2>/dev/null && echo "Deleted: $branch"
171
+ fi
172
+ done
173
+
174
+ Record: branches_cleaned={list of deleted branches, or "none"}
175
+
176
+ 7. **Final state**
177
+ echo "Branch: $(git branch --show-current)"
178
+ echo "HEAD: $(git log -1 --format='%h %s')"
179
+ echo "Status: $(git status --short | wc -l) modified files"
180
+
181
+ ## Output Format
182
+
183
+ SYNC_REPORT:
184
+ - status: success|failed
185
+ - remote: {REMOTE}
186
+ - default_branch: {DEFAULT_BRANCH}
187
+ - main_updated_to: {commit} - {message}
188
+ - current_branch: {branch}
189
+ - stash: restored|none|conflict
190
+ - rebase: success|conflict|skipped
191
+ - branches_cleaned: {list or "none"}
192
+ - errors: {any errors encountered}
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Report to User
198
+
199
+ Parse the subagent's SYNC_REPORT and present a clean summary:
200
+
201
+ ```
202
+ Sync complete
203
+ Main: {commit} - {message}
204
+ Branch: {current_branch}
205
+ Stash: {status}
206
+ Cleaned: {branches or "none"}
207
+ ```
53
208
 
54
- Safe by default: detached HEAD, rebase conflicts, and stash conflicts are detected and reported without destructive action.
209
+ If errors occurred, report them clearly with suggested resolution:
210
+ - Detached HEAD → suggest `git checkout <branch>`
211
+ - Rebase conflict → suggest `git rebase {DEFAULT_BRANCH}` manually and resolve
212
+ - Stash conflict → suggest `git stash show` and `git stash pop` manually
package/commands/brace.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- description: Initialize project with GOTCHA/BRACE framework
3
- argument-hint: [--no-brace] [--force]
4
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion
5
- ---
6
-
7
- Flags: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/brace/instructions.md
package/commands/build.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- description: Context-isolated feature development pipeline
3
- argument-hint: <detailed design/plan to implement> [--skip-questions] [--skip-review] [--no-ship] [--parallel-impl]
4
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion
5
- ---
6
-
7
- Arguments: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/build/instructions.md
@@ -1,9 +0,0 @@
1
- ---
2
- description: Generate multiple unique web design variations for any website or web application
3
- argument-hint: <count> --port <port> [--spec <path>] [--favorites <1,2,3>]
4
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep, WebFetch
5
- ---
6
-
7
- Arguments: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/distil/instructions.md
package/commands/prime.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- description: Load project context for informed decisions
3
- argument-hint: security, routing, adhd, dashboard, office, memory, tasks, channels (comma-separated)
4
- allowed-tools: Read, Glob, Grep, LS
5
- ---
6
-
7
- Domain argument: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/prime/instructions.md
package/commands/rig.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- description: Bootstrap repo with standard dev tools - lefthook, commit templates, PR templates, CI
3
- argument-hint: --skip-system-check (optional)
4
- allowed-tools: Bash, Read, Write, Edit, Glob, Grep, AskUserQuestion
5
- ---
6
-
7
- Flags: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/rig/instructions.md
package/commands/ship.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- description: Ship changes - commit, push, create PR, wait for checks, merge, cleanup
3
- argument-hint: --pr-only, --no-squash, --keep-branch (optional flags)
4
- allowed-tools: Bash, Read, Glob, Grep, Skill
5
- ---
6
-
7
- Flags: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/ship/instructions.md
package/commands/sync.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- description: Sync with origin/main, stash/restore changes, clean up stale branches
3
- argument-hint: --no-stash, --no-cleanup, --no-rebase (optional flags)
4
- allowed-tools: Bash
5
- ---
6
-
7
- Flags: $ARGUMENTS
8
-
9
- Follow instructions in: ~/.claude/skills/sync/instructions.md
@@ -1,229 +0,0 @@
1
- # Brace Instructions
2
-
3
- Initialize any project directory with the GOTCHA/BRACE framework. Idempotent —
4
- safe to re-run on existing projects. Content templates and subagent prompts
5
- are in `references/`.
6
-
7
- **Key principle:** Scan first, present plan, get approval, then act.
8
-
9
- Phase prompts: `references/phase-prompts.md`
10
- Scaffold manifest: `references/scaffold-manifest.md`
11
- Report format: `references/report-template.md`
12
-
13
- ---
14
-
15
- ## Flags
16
-
17
- Parse optional flags from the request:
18
- - `--no-brace` — Skip BRACE build methodology (goals/build_app.md)
19
- - `--force` — Overwrite existing files without prompting
20
-
21
- ---
22
-
23
- ## Pre-flight
24
-
25
- Before starting, check all dependencies in this table:
26
-
27
- | Dependency | Type | Check | Required | Resolution | Detail |
28
- |-----------|------|-------|----------|------------|--------|
29
- | claude-mem | plugin | — | no | ask | `claude plugin install claude-mem` |
30
-
31
- For each row, in order:
32
- 1. Run the Check command (for cli/npm) or test file existence (for agent/skill)
33
- 2. If found: continue silently
34
- 3. If missing: apply Resolution strategy
35
- - **stop**: notify user with Detail, halt execution
36
- - **url**: notify user with Detail (install link), halt execution
37
- - **install**: notify user, run the command in Detail, continue if successful
38
- - **ask**: notify user, offer to run command in Detail, continue either way (or halt if required)
39
- - **fallback**: notify user with Detail, continue with degraded behavior
40
- 4. After all checks: summarize what's available and what's degraded
41
-
42
- 1. Capture **FLAGS** from the user's request
43
- 2. Create a task list tracking all 5 phases
44
-
45
- ---
46
-
47
- ## Phase 1: Directory Scan
48
-
49
- Launch **Bash** subagent (**haiku**):
50
-
51
- ```
52
- Task(
53
- subagent_type: "Bash",
54
- model: "haiku",
55
- description: "Scan directory for existing GOTCHA structure",
56
- prompt: <read from references/phase-prompts.md#phase-1>
57
- )
58
- ```
59
-
60
- Parse SCAN_REPORT. Extract:
61
- - `directory_name` (used as default project name)
62
- - `existing_dirs` / `missing_dirs`
63
- - `existing_files` / `missing_files`
64
- - `has_claude_md` / `has_gitignore`
65
- - `has_atlas` (legacy ATLAS naming detected)
66
- - `has_forge` (legacy FORGE naming detected)
67
-
68
- ---
69
-
70
- ## Phase 1b: Legacy Upgrade Detection
71
-
72
- **Skip if neither `has_atlas` nor `has_forge` is true.**
73
-
74
- If SCAN_REPORT shows `has_atlas: true` or `has_forge: true`, ask the user via AskUserQuestion:
75
-
76
- Question: "Legacy naming detected. Upgrade to BRACE?"
77
- Options:
78
- - "Yes, upgrade to BRACE" — Replace legacy references with BRACE equivalents
79
- - "No, leave as-is" — Keep existing naming
80
-
81
- Store result as `upgrade_legacy: true|false` in USER_CONFIG.
82
-
83
- ---
84
-
85
- ## Phase 2: Project Inquiry
86
-
87
- **Runs on primary thread** (user interaction required).
88
-
89
- 1. Derive default project name from SCAN_REPORT `directory_name`
90
- 2. Present via AskUserQuestion:
91
-
92
- Question: "What to include in GOTCHA setup?"
93
- Options:
94
- - "Full GOTCHA + BRACE (Recommended)"
95
- - "GOTCHA structure only (no BRACE methodology)"
96
- - "Cancel"
97
-
98
- 3. If not cancelled, ask for project description (one sentence) via
99
- AskUserQuestion with free text.
100
-
101
- 4. Ask installation level via AskUserQuestion:
102
-
103
- Question: "Where should global preferences and universal principles go?"
104
- Options:
105
- - "Both — global + project (Recommended)" → portable AND global coverage
106
- - "Global (~/.claude/CLAUDE.md) only" → applies to all projects
107
- - "Project level only" → self-contained, portable
108
-
109
- 5. Store as USER_CONFIG:
110
- - project_name: from directory name or user override
111
- - description: from user input
112
- - include_brace: true/false (based on selection and `--no-brace`)
113
- - install_level: "both" | "global" | "project"
114
-
115
- **If cancelled, stop here.**
116
-
117
- ---
118
-
119
- ## Phase 3: Present Plan & Approve
120
-
121
- Build the ACTION_PLAN from SCAN_REPORT + USER_CONFIG + FLAGS.
122
-
123
- For each item in `references/scaffold-manifest.md`:
124
- - If component not selected in USER_CONFIG → status: "not selected"
125
- - If item already exists (from SCAN_REPORT) and no `--force` → status: "skip"
126
- - If item exists and `--force` → status: "overwrite"
127
- - If CLAUDE.md exists → status: "merge" (append GOTCHA section)
128
- - If .gitignore exists → status: "merge" (append missing entries)
129
- - Otherwise → status: "create"
130
-
131
- If `upgrade_legacy` is true in USER_CONFIG, set status "upgrade" for:
132
- - CLAUDE.md (replaces "merge" or "skip" — upgrade takes priority)
133
- - goals/build_app.md (replaces "skip")
134
- - goals/manifest.md (replaces "skip")
135
-
136
- Present plan summary to user via AskUserQuestion:
137
-
138
- ```
139
- GOTCHA Framework Setup for: {project_name}
140
-
141
- Will create: {list of items with status "create"}
142
- Will merge: {list of items with status "merge"}
143
- Will upgrade: {list of items with status "upgrade" — legacy → BRACE}
144
- Will skip: {count} existing items
145
- Not selected: {count} items
146
- Global config: {install_level description}
147
-
148
- Proceed?
149
- ```
150
-
151
- Options: "Yes, proceed" / "Cancel"
152
-
153
- **If cancelled, stop here.**
154
-
155
- ---
156
-
157
- ## Phase 4: Scaffold Structure
158
-
159
- Launch **general-purpose** subagent:
160
-
161
- ```
162
- Task(
163
- subagent_type: "general-purpose",
164
- description: "Create GOTCHA framework structure",
165
- prompt: <read from references/phase-prompts.md#phase-4>
166
- )
167
- ```
168
-
169
- Before sending the prompt, substitute these variables:
170
- - `{ACTION_PLAN}` — the action plan from Phase 3
171
- - `{PROJECT_NAME}` — from USER_CONFIG
172
- - `{PROJECT_DESCRIPTION}` — from USER_CONFIG
173
- - `{INSTALL_LEVEL}` — from USER_CONFIG ("both", "global", or "project")
174
- - `{CLAUDE_MD_TEMPLATE}` — read from `references/claude-md-template.md`
175
- (the section between BEGIN TEMPLATE and END TEMPLATE)
176
- - `{GITIGNORE_CONTENT}` — read from `assets/gitignore-template`
177
- - `{GOALS_MANIFEST}` — read from `references/scaffold-manifest.md`
178
- (the goals/manifest.md content block)
179
- - `{TOOLS_MANIFEST}` — read from `references/scaffold-manifest.md`
180
- (the tools/manifest.md content block)
181
- - `{BRACE_WORKFLOW}` — read from `references/brace-workflow.md`
182
- (the section after the header, used for goals/build_app.md)
183
- - `{GLOBAL_PREFERENCES_CONTENT}` — read from `assets/global-preferences-template.md`
184
- (the section between BEGIN TEMPLATE and END TEMPLATE)
185
-
186
- Parse SCAFFOLD_REPORT. If status is "failed", report to user and stop.
187
-
188
- ---
189
-
190
- ## Phase 5: Verification & Report
191
-
192
- Launch **Bash** subagent (**haiku**):
193
-
194
- ```
195
- Task(
196
- subagent_type: "Bash",
197
- model: "haiku",
198
- description: "Verify GOTCHA structure",
199
- prompt: <read from references/phase-prompts.md#phase-5>
200
- )
201
- ```
202
-
203
- Parse VERIFY_REPORT. Present the final summary using the format in
204
- `references/report-template.md`.
205
-
206
- ---
207
-
208
- ## Idempotency Rules
209
-
210
- - **Skip** directories and files that already exist (unless `--force`)
211
- - **Merge** CLAUDE.md: append GOTCHA section if file exists but lacks it
212
- - **Merge** .gitignore: append missing entries only
213
- - **Never delete** user content
214
- - **Never overwrite** without `--force` or explicit user approval
215
-
216
- ---
217
-
218
- ## Error Handling
219
-
220
- Standard escalation pattern:
221
- 1. If retryable (permission issue after mkdir): retry once
222
- 2. If persistent: report to user with specific error
223
- 3. Offer: skip and continue / abort
224
- 4. Never silently swallow errors
225
-
226
- Common issues:
227
- - Permission denied → report, suggest checking directory permissions
228
- - CLAUDE.md merge conflict → show both versions, let user choose
229
- - Directory is read-only → abort with clear message