@complexthings/superpowers-agent 8.1.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 (123) hide show
  1. package/.agents/docs/SUPERPOWERS.md +108 -0
  2. package/.agents/prompts/001-copilot-tool-mapping-do/001-copilot-tool-mapping-do.md +116 -0
  3. package/.agents/prompts/001-copilot-tool-mapping-do/SUMMARY.md +72 -0
  4. package/.agents/prompts/001-copilot-tool-mapping-do/copilot-tool-mapping-do-output.md +83 -0
  5. package/.agents/prompts/001-release-management-do/001-release-management-do.md +161 -0
  6. package/.agents/prompts/001-release-management-do/SUMMARY.md +19 -0
  7. package/.agents/prompts/001-release-management-do/completed/001-release-management-do.md +161 -0
  8. package/.agents/prompts/002-pull-command-do/SUMMARY.md +28 -0
  9. package/.agents/prompts/002-pull-command-do/completed/002-pull-command-do.md +122 -0
  10. package/.agents/prompts/002-pull-command-do/pull-command-do-output.md +174 -0
  11. package/.agents/prompts/command_updates_prompt.md +69 -0
  12. package/.agents/prompts/current_prompt.md +8 -0
  13. package/.agents/prompts/refactor.prompt.md +57 -0
  14. package/.agents/skills/.gitkeep +0 -0
  15. package/.agents/superpowers-agent +355 -0
  16. package/.agents/superpowers-bootstrap.md +42 -0
  17. package/.agents/templates/AGENTS.md.template +40 -0
  18. package/.agents/templates/SUPERPOWERS.md.template +108 -0
  19. package/.agents/templates/TOOLS.md.template +15 -0
  20. package/.github/workflows/main.yaml +32 -0
  21. package/AGENTS.md +60 -0
  22. package/LICENSE +21 -0
  23. package/README.md +724 -0
  24. package/hooks/hooks.json +15 -0
  25. package/hooks/session-start.sh +27 -0
  26. package/package.json +51 -0
  27. package/skills/architecture/ABOUT.md +20 -0
  28. package/skills/architecture/preserving-productive-tensions/SKILL.md +146 -0
  29. package/skills/architecture/preserving-productive-tensions/skill.json +9 -0
  30. package/skills/collaboration/brainstorming/SKILL.md +166 -0
  31. package/skills/collaboration/brainstorming/skill.json +9 -0
  32. package/skills/collaboration/brainstorming/spec-document-reviewer-prompt.md +50 -0
  33. package/skills/collaboration/brainstorming/visual-companion.md +277 -0
  34. package/skills/collaboration/dispatching-parallel-agents/SKILL.md +174 -0
  35. package/skills/collaboration/dispatching-parallel-agents/skill.json +9 -0
  36. package/skills/collaboration/executing-plans/SKILL.md +130 -0
  37. package/skills/collaboration/executing-plans/skill.json +9 -0
  38. package/skills/collaboration/finishing-a-development-branch/SKILL.md +261 -0
  39. package/skills/collaboration/finishing-a-development-branch/skill.json +9 -0
  40. package/skills/collaboration/leveraging-cli-tools/SKILL.md +132 -0
  41. package/skills/collaboration/leveraging-cli-tools/skill.json +9 -0
  42. package/skills/collaboration/receiving-code-review/SKILL.md +233 -0
  43. package/skills/collaboration/receiving-code-review/skill.json +9 -0
  44. package/skills/collaboration/requesting-code-review/SKILL.md +110 -0
  45. package/skills/collaboration/requesting-code-review/code-reviewer.md +146 -0
  46. package/skills/collaboration/requesting-code-review/skill.json +12 -0
  47. package/skills/collaboration/subagent-driven-development/SKILL.md +255 -0
  48. package/skills/collaboration/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  49. package/skills/collaboration/subagent-driven-development/implementer-prompt.md +113 -0
  50. package/skills/collaboration/subagent-driven-development/skill.json +15 -0
  51. package/skills/collaboration/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  52. package/skills/collaboration/using-git-worktrees/SKILL.md +366 -0
  53. package/skills/collaboration/using-git-worktrees/skill.json +9 -0
  54. package/skills/collaboration/writing-plans/SKILL.md +121 -0
  55. package/skills/collaboration/writing-plans/plan-document-reviewer-prompt.md +52 -0
  56. package/skills/collaboration/writing-plans/skill.json +9 -0
  57. package/skills/debugging/defense-in-depth/SKILL.md +380 -0
  58. package/skills/debugging/defense-in-depth/skill.json +9 -0
  59. package/skills/debugging/root-cause-tracing/SKILL.md +361 -0
  60. package/skills/debugging/root-cause-tracing/find-polluter.sh +63 -0
  61. package/skills/debugging/root-cause-tracing/skill.json +12 -0
  62. package/skills/debugging/systematic-debugging/SKILL.md +299 -0
  63. package/skills/debugging/systematic-debugging/condition-based-waiting-example.ts +158 -0
  64. package/skills/debugging/systematic-debugging/condition-based-waiting.md +115 -0
  65. package/skills/debugging/systematic-debugging/defense-in-depth.md +122 -0
  66. package/skills/debugging/systematic-debugging/find-polluter.sh +63 -0
  67. package/skills/debugging/systematic-debugging/root-cause-tracing.md +169 -0
  68. package/skills/debugging/systematic-debugging/skill.json +9 -0
  69. package/skills/debugging/systematic-debugging/test-academic.md +14 -0
  70. package/skills/debugging/systematic-debugging/test-pressure-1.md +58 -0
  71. package/skills/debugging/systematic-debugging/test-pressure-2.md +68 -0
  72. package/skills/debugging/systematic-debugging/test-pressure-3.md +69 -0
  73. package/skills/debugging/verification-before-completion/SKILL.md +143 -0
  74. package/skills/debugging/verification-before-completion/skill.json +9 -0
  75. package/skills/finding-skills/SKILL.md +101 -0
  76. package/skills/finding-skills/skill.json +8 -0
  77. package/skills/meta/create-skill-json/SKILL.md +370 -0
  78. package/skills/meta/create-skill-json/skill.json +9 -0
  79. package/skills/meta/create-skill-json/test-scenarios.md +29 -0
  80. package/skills/meta/creating-prompts/SKILL.md +349 -0
  81. package/skills/meta/creating-prompts/examples/do-example.md +65 -0
  82. package/skills/meta/creating-prompts/examples/plan-example.md +75 -0
  83. package/skills/meta/creating-prompts/examples/refine-example.md +65 -0
  84. package/skills/meta/creating-prompts/examples/research-example.md +63 -0
  85. package/skills/meta/creating-prompts/scripts/get-next-number.sh +27 -0
  86. package/skills/meta/creating-prompts/skill.json +20 -0
  87. package/skills/meta/creating-prompts/templates/do-template.md +59 -0
  88. package/skills/meta/creating-prompts/templates/plan-template.md +58 -0
  89. package/skills/meta/creating-prompts/templates/refine-template.md +54 -0
  90. package/skills/meta/creating-prompts/templates/research-template.md +56 -0
  91. package/skills/meta/using-superpowers/SKILL.md +122 -0
  92. package/skills/meta/using-superpowers/skill.json +5 -0
  93. package/skills/meta/writing-prompts/SKILL.md +345 -0
  94. package/skills/meta/writing-prompts/skill.json +9 -0
  95. package/skills/problem-solving/ABOUT.md +40 -0
  96. package/skills/problem-solving/collision-zone-thinking/SKILL.md +188 -0
  97. package/skills/problem-solving/collision-zone-thinking/references/historical-examples.md +393 -0
  98. package/skills/problem-solving/collision-zone-thinking/skill.json +9 -0
  99. package/skills/problem-solving/inversion-exercise/SKILL.md +174 -0
  100. package/skills/problem-solving/inversion-exercise/skill.json +9 -0
  101. package/skills/problem-solving/meta-pattern-recognition/SKILL.md +116 -0
  102. package/skills/problem-solving/meta-pattern-recognition/skill.json +9 -0
  103. package/skills/problem-solving/scale-game/SKILL.md +222 -0
  104. package/skills/problem-solving/scale-game/skill.json +9 -0
  105. package/skills/problem-solving/simplification-cascades/SKILL.md +113 -0
  106. package/skills/problem-solving/simplification-cascades/skill.json +9 -0
  107. package/skills/problem-solving/when-stuck/SKILL.md +69 -0
  108. package/skills/problem-solving/when-stuck/skill.json +9 -0
  109. package/skills/research/ABOUT.md +20 -0
  110. package/skills/research/tracing-knowledge-lineages/SKILL.md +241 -0
  111. package/skills/research/tracing-knowledge-lineages/skill.json +9 -0
  112. package/skills/setup-skills/SKILL.md +47 -0
  113. package/skills/testing/condition-based-waiting/SKILL.md +359 -0
  114. package/skills/testing/condition-based-waiting/example.ts +158 -0
  115. package/skills/testing/condition-based-waiting/skill.json +12 -0
  116. package/skills/testing/test-driven-development/SKILL.md +434 -0
  117. package/skills/testing/test-driven-development/skill.json +9 -0
  118. package/skills/testing/testing-anti-patterns/SKILL.md +298 -0
  119. package/skills/testing/testing-anti-patterns/skill.json +9 -0
  120. package/skills/testing/verification-before-completion/SKILL.md +246 -0
  121. package/skills/testing/verification-before-completion/skill.json +10 -0
  122. package/skills/using-a-skill/SKILL.md +101 -0
  123. package/skills/using-a-skill/skill.json +8 -0
@@ -0,0 +1,349 @@
1
+ ---
2
+ name: creating-prompts
3
+ description: Create structured prompts for Do/Plan/Research/Refine workflows with dependency management
4
+ metadata:
5
+ when_to_use: when you need to create focused, reusable prompts for specific tasks, research, planning, or refinement workflows
6
+ version: 5.1.0
7
+ languages: all
8
+ ---
9
+
10
+ # Creating Prompts
11
+
12
+ ## Overview
13
+
14
+ Create structured, reusable prompts for agent workflows. Prompts are focused instructions for specific tasks (Do), strategic planning (Plan), information gathering (Research), or iterative improvement (Refine).
15
+
16
+ **Core principle:** Prompts are lightweight, self-contained instructions that can be chained together through dependencies.
17
+
18
+ **Announce at start:** "I'm using the Creating Prompts skill to create a {purpose} prompt."
19
+
20
+ ## When to Use
21
+
22
+ **Use this skill when:**
23
+ - Creating focused task instructions for agents
24
+ - Building multi-stage workflows (research → plan → implement)
25
+ - Need reusable prompts that can be executed independently
26
+ - Want to chain prompts with explicit dependencies
27
+
28
+ **When NOT to use:**
29
+ - For comprehensive implementation plans (use `writing-plans` skill instead)
30
+ - For features >100 LOC (use `writing-plans` for full roadmaps)
31
+ - One-off instructions (just give the instruction directly)
32
+
33
+ **Decision flowchart:**
34
+
35
+ ```
36
+ Need instructions for agent?
37
+ ├─ One-time task → Give instruction directly
38
+ ├─ <100 LOC, focused → Create Prompt (this skill)
39
+ └─ >100 LOC, comprehensive → Use writing-plans skill
40
+ ```
41
+
42
+ ## Integration with Other Skills
43
+
44
+ **Before creating prompts:**
45
+ - For complex features → Use `brainstorming` skill to refine requirements first
46
+ - Unsure of approach → Start with Research prompt, then Plan, then Do
47
+
48
+ **After creating prompts:**
49
+ - Validate clarity → Use `testing-skills-with-subagents` to verify prompt works
50
+ - Execute prompts → Follow execution guidance (see below)
51
+
52
+ **Prompts vs Plans:**
53
+ - **Prompts**: Lightweight, focused, single-purpose (this skill)
54
+ - **Plans**: Comprehensive, multi-phase, detailed implementation (`writing-plans`)
55
+
56
+ See skills/collaboration/writing-plans for full implementation plans.
57
+ See skills/collaboration/brainstorming for design refinement before prompting.
58
+
59
+ ## Configuration
60
+
61
+ Prompts are saved to configured directory (default: `.agents/prompts/`).
62
+
63
+ **Read config:**
64
+ ```bash
65
+ superpowers-agent get-config prompts_dir
66
+ ```
67
+
68
+ **Override globally:** `~/.agents/config.json`
69
+ ```json
70
+ {
71
+ "prompts_dir": "custom/prompts"
72
+ }
73
+ ```
74
+
75
+ **Override per-project:** `.agents/config.json`
76
+ ```json
77
+ {
78
+ "prompts_dir": ".my-prompts"
79
+ }
80
+ ```
81
+
82
+ Priority: Project config > Global config > Default (`.agents/prompts/`)
83
+
84
+ ## Prompt Types
85
+
86
+ ### 1. DO Prompts - Execute and Produce
87
+
88
+ **When:** Implement feature, fix bug, create document, build component
89
+
90
+ **Output:** Code files, documentation, configurations, designs
91
+
92
+ **Template:** `skills/meta/creating-prompts/templates/do-template.md`
93
+
94
+ **Example:** `skills/meta/creating-prompts/examples/do-example.md`
95
+
96
+ ### 2. PLAN Prompts - Strategy and Roadmap
97
+
98
+ **When:** Design architecture, plan refactoring, decide approach
99
+
100
+ **Output:** Structured plans with phases, dependencies, decisions
101
+
102
+ **Template:** `skills/meta/creating-prompts/templates/plan-template.md`
103
+
104
+ **Example:** `skills/meta/creating-prompts/examples/plan-example.md`
105
+
106
+ ### 3. RESEARCH Prompts - Gather Information
107
+
108
+ **When:** Understand library, explore patterns, analyze options
109
+
110
+ **Output:** Findings with confidence levels, recommendations, open questions
111
+
112
+ **Template:** `skills/meta/creating-prompts/templates/research-template.md`
113
+
114
+ **Example:** `skills/meta/creating-prompts/examples/research-example.md`
115
+
116
+ ### 4. REFINE Prompts - Iterative Improvement
117
+
118
+ **When:** Deepen research, strengthen plan, address gaps
119
+
120
+ **Output:** Updated version with changelog, archived previous version
121
+
122
+ **Template:** `skills/meta/creating-prompts/templates/refine-template.md`
123
+
124
+ **Example:** `skills/meta/creating-prompts/examples/refine-example.md`
125
+
126
+ ## Quick Reference
127
+
128
+ | Prompt Type | Purpose | Output | Common Chain |
129
+ |-------------|---------|--------|--------------|
130
+ | Research | Gather info | Findings + recommendations | Research → Plan → Do |
131
+ | Plan | Strategy | Phases + decisions | Plan → Do |
132
+ | Do | Execute | Artifacts (code/docs) | Standalone or after Plan |
133
+ | Refine | Improve | Updated version | After any type |
134
+
135
+ ## Workflow Checklist
136
+
137
+ **IMPORTANT: Use TodoWrite to create todos for EACH checklist item below.**
138
+
139
+ ### Phase 1: Preparation
140
+ - [ ] Determine prompt purpose (Do/Plan/Research/Refine)
141
+ - [ ] If complex feature → Consider using `/brainstorm` first
142
+ - [ ] If >100 LOC implementation → Consider `writing-plans` skill instead
143
+ - [ ] Identify topic for naming (kebab-case: auth, stripe-integration)
144
+ - [ ] Check for existing prompts to reference (creates dependencies)
145
+
146
+ ### Phase 2: Creation
147
+ - [ ] Get next number: `skills/meta/creating-prompts/scripts/get-next-number.sh`
148
+ - [ ] Get prompts directory: `superpowers-agent get-config prompts_dir`
149
+ - [ ] Load appropriate template from `skills/meta/creating-prompts/templates/`
150
+ - [ ] Fill in template with specific details (no placeholders)
151
+ - [ ] Add frontmatter metadata (number, topic, purpose, dependencies)
152
+ - [ ] Reference existing outputs with `@` syntax if chained
153
+
154
+ ### Phase 3: Quality Checks
155
+ - [ ] Objective is clear and specific (not vague)
156
+ - [ ] Context includes all necessary background
157
+ - [ ] Requirements are testable/verifiable
158
+ - [ ] Output specification is concrete
159
+ - [ ] Success criteria are measurable
160
+ - [ ] For Research/Plan: includes confidence/assumptions/open questions
161
+
162
+ ### Phase 4: Validation (Recommended)
163
+ - [ ] Test prompt with subagent (see `testing-skills-with-subagents`)
164
+ - [ ] Verify subagent understands requirements
165
+ - [ ] Check output matches expected structure
166
+
167
+ ### Phase 5: Save and Execute
168
+ - [ ] Create directory: `{prompts_dir}/{number}-{topic}-{purpose}/`
169
+ - [ ] Create `completed/` subdirectory
170
+ - [ ] Save prompt: `{number}-{topic}-{purpose}.md`
171
+ - [ ] Execute prompt (agent reads and follows instructions)
172
+ - [ ] Agent creates output: `{topic}-{purpose}-output.md`
173
+ - [ ] Agent creates `SUMMARY.md` with findings/decisions/next steps
174
+ - [ ] Move prompt to `completed/` after execution
175
+
176
+ ## File Structure
177
+
178
+ ```
179
+ .agents/prompts/ # Configured location
180
+ ├── 001-auth-research/
181
+ │ ├── 001-auth-research.md # The prompt
182
+ │ ├── completed/
183
+ │ │ └── 001-auth-research.md # After execution
184
+ │ ├── auth-research-output.md # Agent's output
185
+ │ └── SUMMARY.md # Executive summary
186
+ ├── 002-auth-plan/
187
+ │ ├── 002-auth-plan.md
188
+ │ ├── completed/
189
+ │ ├── auth-plan-output.md
190
+ │ └── SUMMARY.md
191
+ └── 003-auth-do/
192
+ ├── 003-auth-do.md
193
+ ├── completed/
194
+ ├── auth-do-output.md
195
+ └── SUMMARY.md
196
+ ```
197
+
198
+ ## Naming Convention
199
+
200
+ **Format:** `{number}-{topic}-{purpose}.md`
201
+
202
+ **Examples:**
203
+ - `001-auth-research.md` - Research authentication options
204
+ - `002-auth-plan.md` - Plan auth implementation
205
+ - `003-stripe-integration-do.md` - Implement Stripe
206
+ - `004-auth-research-refine.md` - Deepen auth research
207
+
208
+ **Topic naming:**
209
+ - Use kebab-case
210
+ - Be specific but concise
211
+ - Examples: `auth`, `stripe-integration`, `user-profile`, `api-refactor`
212
+
213
+ ## Dependency Detection
214
+
215
+ Prompts can reference other prompt outputs to create chains.
216
+
217
+ **Syntax:** `@.agents/prompts/{folder}/{file}-output.md`
218
+
219
+ **Example in prompt:**
220
+ ```markdown
221
+ <context>
222
+ Based on research: @.agents/prompts/001-auth-research/auth-research-output.md
223
+ Based on plan: @.agents/prompts/002-auth-plan/auth-plan-output.md
224
+ </context>
225
+ ```
226
+
227
+ **Frontmatter dependencies:**
228
+ ```yaml
229
+ ---
230
+ number: 003
231
+ topic: auth-do
232
+ purpose: do
233
+ dependencies: [001, 002] # Must execute 001 and 002 first
234
+ created: 2025-11-21
235
+ ---
236
+ ```
237
+
238
+ ## SUMMARY.md Template
239
+
240
+ Every prompt execution should create a `SUMMARY.md`:
241
+
242
+ ```markdown
243
+ # {Topic} {Purpose} Summary
244
+
245
+ **One-liner:** [Substantive description of outcome, not generic]
246
+
247
+ ## Key Findings
248
+ - [Actionable takeaway 1]
249
+ - [Actionable takeaway 2]
250
+ - [Actionable takeaway 3]
251
+
252
+ ## Decisions Needed
253
+ - [What requires user input or approval]
254
+ - Or: "None"
255
+
256
+ ## Blockers
257
+ - [External impediments preventing progress]
258
+ - Or: "None"
259
+
260
+ ## Next Step
261
+ [Concrete forward action - what to do next]
262
+ ```
263
+
264
+ ## Execution Guidance
265
+
266
+ **How agents execute prompts:**
267
+
268
+ 1. **Read the prompt** - Load `{number}-{topic}-{purpose}.md`
269
+ 2. **Check dependencies** - Ensure referenced prompts completed first
270
+ 3. **Follow instructions** - Execute according to prompt sections
271
+ 4. **Create output** - Save to `{topic}-{purpose}-output.md`
272
+ 5. **Create summary** - Save `SUMMARY.md` with findings
273
+ 6. **Archive prompt** - Move to `completed/` subfolder
274
+
275
+ **For agents with Task/subagent capabilities:**
276
+ - Spawn fresh agent with prompt as instruction
277
+ - Agent produces output and summary
278
+ - Main agent reviews and archives
279
+
280
+ **For manual execution:**
281
+ - Open prompt in editor
282
+ - Follow instructions step-by-step
283
+ - Create output and summary files
284
+ - Move prompt to completed/
285
+
286
+ ## Common Mistakes
287
+
288
+ ### ❌ Vague objectives
289
+ ```markdown
290
+ <objective>
291
+ Research authentication
292
+ </objective>
293
+ ```
294
+
295
+ ### ✅ Specific objectives
296
+ ```markdown
297
+ <objective>
298
+ Research JWT authentication libraries for Node.js Express API to determine best option for TypeScript project with security focus
299
+ </objective>
300
+ ```
301
+
302
+ ### ❌ Missing context
303
+ ```markdown
304
+ <context>
305
+ Current codebase
306
+ </context>
307
+ ```
308
+
309
+ ### ✅ Concrete context
310
+ ```markdown
311
+ <context>
312
+ Express API in src/server.js, routes in src/routes/
313
+ Currently no authentication, all endpoints public
314
+ Must integrate with existing PostgreSQL user table
315
+ @src/server.js
316
+ @src/routes/api.js
317
+ </context>
318
+ ```
319
+
320
+ ### ❌ Generic requirements
321
+ ```markdown
322
+ <requirements>
323
+ Should work well
324
+ Be secure
325
+ </requirements>
326
+ ```
327
+
328
+ ### ✅ Testable requirements
329
+ ```markdown
330
+ <requirements>
331
+ - Verify JWT tokens in Authorization header
332
+ - Return 401 for invalid tokens
333
+ - Return 403 for expired tokens
334
+ - Extract user ID and attach to req.user
335
+ - No performance impact >10ms per request
336
+ </requirements>
337
+ ```
338
+
339
+ ## Credits
340
+
341
+ This skill is an agent-agnostic adaptation of TÂCHES' excellent [`create-meta-prompts` skill](https://github.com/glittercowboy/taches-cc-resources/tree/main/skills/create-meta-prompts).
342
+
343
+ TÂCHES pioneered the concept of structured prompt-to-prompt workflows with dependency management and multi-stage execution. This adaptation maintains the core concepts while making them accessible across all AI coding assistants (OpenCode, GitHub Copilot, Cursor, Gemini, Claude, etc.).
344
+
345
+ **Original author:** TÂCHES ([@glittercowboy](https://github.com/glittercowboy))
346
+
347
+ **Original repository:** https://github.com/glittercowboy/taches-cc-resources
348
+
349
+ Thank you to TÂCHES for the innovative work on meta-prompt patterns!
@@ -0,0 +1,65 @@
1
+ ---
2
+ number: 003
3
+ topic: auth-middleware
4
+ purpose: do
5
+ dependencies: [002]
6
+ created: 2025-11-21
7
+ ---
8
+
9
+ # Auth Middleware - Do
10
+
11
+ <objective>
12
+ Implement JWT authentication middleware for Express API
13
+
14
+ Purpose: Protect API routes from unauthorized access, enable user authentication
15
+ Output: Express middleware function with error handling
16
+ </objective>
17
+
18
+ <context>
19
+ Based on plan: @.agents/prompts/002-auth-plan/auth-plan-output.md
20
+
21
+ Current API structure:
22
+ - Express app in src/server.js
23
+ - Routes in src/routes/
24
+ - Using jose library for JWT (from research)
25
+ </context>
26
+
27
+ <requirements>
28
+ - Verify JWT token from Authorization header
29
+ - Extract user ID from token payload
30
+ - Attach user to request object
31
+ - Return 401 for missing/invalid tokens
32
+ - Return 403 for expired tokens
33
+ - Log authentication failures
34
+ </requirements>
35
+
36
+ <implementation>
37
+ Use jose library for verification (don't use jsonwebtoken)
38
+ Load JWT secret from environment variable
39
+ Handle all error cases explicitly
40
+ Don't catch generic errors - let Express error handler manage them
41
+
42
+ Integration: Apply to protected routes in src/routes/api.js
43
+ </implementation>
44
+
45
+ <output>
46
+ Create files:
47
+ - `src/middleware/auth.js` - Main middleware function
48
+ - `src/middleware/auth.test.js` - Unit tests
49
+
50
+ Modify:
51
+ - `src/routes/api.js` - Apply middleware to protected routes
52
+ </output>
53
+
54
+ <verification>
55
+ Before declaring complete:
56
+ - Run: `npm test src/middleware/auth.test.js` - all tests pass
57
+ - Test invalid token returns 401
58
+ - Test expired token returns 403
59
+ - Test valid token attaches user to req.user
60
+ - Start server and hit /api/protected with curl - verify 401 without token
61
+ </verification>
62
+
63
+ <summary_requirements>
64
+ Create `SUMMARY.md` in same directory with outcome, files created, any decisions needed, and next steps.
65
+ </summary_requirements>
@@ -0,0 +1,75 @@
1
+ ---
2
+ number: 002
3
+ topic: auth
4
+ purpose: plan
5
+ dependencies: [001]
6
+ created: 2025-11-21
7
+ ---
8
+
9
+ # Auth - Plan
10
+
11
+ <objective>
12
+ Create implementation plan for JWT authentication system based on research findings
13
+ </objective>
14
+
15
+ <context>
16
+ Research findings: @.agents/prompts/001-auth-research/auth-research-output.md
17
+
18
+ Recommendation: jose library with httpOnly cookies
19
+ Current state: No authentication, all routes publicly accessible
20
+ Constraints: Must work with existing Express API, minimal breaking changes
21
+ </context>
22
+
23
+ <requirements>
24
+ Plan must address:
25
+ - JWT generation and verification
26
+ - Refresh token rotation
27
+ - Cookie configuration (httpOnly, secure, sameSite)
28
+ - Error handling for expired/invalid tokens
29
+ - Migration path from no-auth to auth
30
+ - Testing strategy
31
+
32
+ Decision points to resolve:
33
+ - Token expiry times (access vs refresh)
34
+ - Where to store refresh tokens (DB vs memory)
35
+ </requirements>
36
+
37
+ <output_structure>
38
+ Create plan with:
39
+
40
+ ## Phases
41
+ - Phase 1: Core JWT utilities (jose integration, token generation/verification)
42
+ - Phase 2: Authentication middleware (verify tokens, attach user to request)
43
+ - Phase 3: Refresh token system (rotation, secure storage)
44
+ - Phase 4: Route protection (apply middleware, update tests)
45
+
46
+ ## Dependencies
47
+ - Phase 2 needs Phase 1 JWT utilities
48
+ - Phase 3 needs Phase 2 middleware
49
+ - Phase 4 needs all previous phases
50
+
51
+ ## Decision Points
52
+ - **Token expiry**: Access 15min, Refresh 7 days (OWASP standard) vs Access 1hr, Refresh 30 days (more convenient)
53
+ - Recommendation: Start with OWASP standard, gather feedback
54
+
55
+ - **Refresh storage**: PostgreSQL table vs Redis
56
+ - Recommendation: PostgreSQL for simplicity (already in stack)
57
+
58
+ ## Risk Assessment
59
+ - Breaking existing clients: Gradual rollout, auth optional initially
60
+ - Token compromise: Short expiry + rotation mitigates
61
+ - Performance: JWT verification is fast, minimal impact
62
+
63
+ ## Success Metrics
64
+ - All protected routes return 401 without valid token
65
+ - Refresh rotation working (old tokens invalidated)
66
+ - Zero security warnings from npm audit
67
+ </output_structure>
68
+
69
+ <summary_requirements>
70
+ Create `SUMMARY.md` with:
71
+ - One-liner: 4-phase implementation plan with OWASP-compliant token expiry
72
+ - Key Findings: Critical insights about approach
73
+ - Decisions Needed: Approve token expiry times
74
+ - Next Step: Implement Phase 1
75
+ </summary_requirements>
@@ -0,0 +1,65 @@
1
+ ---
2
+ number: 004
3
+ topic: auth-research
4
+ purpose: refine
5
+ dependencies: [001]
6
+ created: 2025-11-21
7
+ ---
8
+
9
+ # Auth Research - Refine
10
+
11
+ <objective>
12
+ Deepen auth research to address refresh token storage question from @.agents/prompts/001-auth-research/auth-research-output.md
13
+ </objective>
14
+
15
+ <current_gaps>
16
+ Original research left open: "Where to store refresh tokens server-side?"
17
+ Need to compare DB vs Redis vs in-memory storage
18
+ Security implications unclear
19
+ Performance impact unknown
20
+ </current_gaps>
21
+
22
+ <preserve>
23
+ Original findings on jose library selection
24
+ httpOnly cookie recommendation
25
+ Refresh rotation requirement
26
+ All original key findings remain valid
27
+ </preserve>
28
+
29
+ <refinement_focus>
30
+ Research refresh token storage options:
31
+ - PostgreSQL table: persistence, scalability, already in stack
32
+ - Redis: speed, built-in expiry, requires new dependency
33
+ - In-memory: fast, simple, lost on restart
34
+
35
+ Compare:
36
+ - Security implications of each
37
+ - Performance characteristics
38
+ - Operational complexity
39
+ - Cost of adding Redis vs using existing DB
40
+ </refinement_focus>
41
+
42
+ <output>
43
+ Update @.agents/prompts/001-auth-research/auth-research-output.md with:
44
+
45
+ ## What Changed
46
+ - Added: Comprehensive refresh token storage analysis
47
+ - Added: Performance benchmarks (DB vs Redis)
48
+ - Strengthened: Security section with storage implications
49
+ - Clarified: Recommendation includes storage strategy
50
+
51
+ ## Changelog
52
+ - v2: 2025-11-21 - Added refresh token storage analysis, resolved open question
53
+ - v1: 2025-11-20 - Initial JWT library and cookie research
54
+
55
+ Archive previous version to archive/auth-research-v1.md
56
+ </output>
57
+
58
+ <summary_requirements>
59
+ Update `SUMMARY.md` with:
60
+ - One-liner: JWT with jose library, httpOnly cookies, PostgreSQL for refresh tokens
61
+ - Key Findings: Include new storage recommendation
62
+ - Version: v2
63
+ - Decisions Needed: None - storage question resolved
64
+ - Next Step: Proceed with planning phase
65
+ </summary_requirements>
@@ -0,0 +1,63 @@
1
+ ---
2
+ number: 001
3
+ topic: auth
4
+ purpose: research
5
+ dependencies: []
6
+ created: 2025-11-21
7
+ ---
8
+
9
+ # Auth - Research
10
+
11
+ <objective>
12
+ Research JWT authentication approaches for Node.js Express API to inform implementation decision
13
+ </objective>
14
+
15
+ <focus_areas>
16
+ - Compare JWT libraries: jsonwebtoken vs jose vs paseto
17
+ - httpOnly cookies vs localStorage for token storage
18
+ - Refresh token patterns and rotation strategies
19
+ - Security best practices (OWASP recommendations)
20
+ </focus_areas>
21
+
22
+ <sources>
23
+ OWASP JWT Cheat Sheet
24
+ NPM package comparisons (downloads, maintenance, TypeScript support)
25
+ Existing code: @src/server.js, @src/routes/
26
+ Security advisories for JWT libraries
27
+ </sources>
28
+
29
+ <output_requirements>
30
+ Provide research findings with:
31
+
32
+ ## Key Findings
33
+ - jose library: Better TypeScript support, actively maintained, smaller bundle
34
+ - jsonwebtoken: More popular but older patterns, maintenance concerns
35
+ - httpOnly cookies required (localStorage vulnerable to XSS)
36
+ - Refresh rotation is OWASP standard (invalidate old tokens on refresh)
37
+
38
+ ## Confidence Level
39
+ High - Multiple authoritative sources agree on best practices
40
+ Medium - jose vs jsonwebtoken (both work, jose has better DX)
41
+
42
+ ## Recommendations
43
+ - Use jose library for JWT operations
44
+ - Store tokens in httpOnly cookies (never localStorage)
45
+ - Implement refresh token rotation
46
+ - Use short access token expiry (15min recommended by OWASP)
47
+
48
+ ## Open Questions
49
+ - Where to store refresh tokens server-side? (DB vs Redis vs memory)
50
+ - Token expiry times: strict (15min) vs convenient (1hr)?
51
+
52
+ ## Assumptions
53
+ - Express API will continue using cookies (not going full SPA)
54
+ - PostgreSQL available for refresh token storage if needed
55
+ </output_requirements>
56
+
57
+ <summary_requirements>
58
+ Create `SUMMARY.md` with:
59
+ - One-liner: JWT with jose library and httpOnly cookies recommended
60
+ - Key Findings: jose outperforms, cookies required, rotation is standard
61
+ - Decisions Needed: None - clear recommendation
62
+ - Next Step: Create implementation plan
63
+ </summary_requirements>
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ # Get the next prompt number based on existing prompts
3
+
4
+ # Get configured prompts directory
5
+ PROMPTS_DIR=$(.agents/superpowers-agent get-config prompts_dir 2>/dev/null || echo ".agents/prompts")
6
+
7
+ # If prompts directory doesn't exist, start at 001
8
+ if [ ! -d "$PROMPTS_DIR" ]; then
9
+ echo "001"
10
+ exit 0
11
+ fi
12
+
13
+ # Find highest number from existing prompt directories
14
+ HIGHEST=$(find "$PROMPTS_DIR" -maxdepth 1 -type d -name '[0-9][0-9][0-9]-*' 2>/dev/null | \
15
+ sed 's/.*\/\([0-9][0-9][0-9]\)-.*/\1/' | \
16
+ sort -n | \
17
+ tail -1)
18
+
19
+ # If no prompts exist yet, start at 001
20
+ if [ -z "$HIGHEST" ]; then
21
+ echo "001"
22
+ exit 0
23
+ fi
24
+
25
+ # Increment and format with leading zeros
26
+ NEXT=$((10#$HIGHEST + 1))
27
+ printf "%03d\n" $NEXT
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "5.1.0",
3
+ "name": "superpowers:meta/creating-prompts",
4
+ "title": "Creating Prompts",
5
+ "helpers": [
6
+ "scripts/get-next-number.sh",
7
+ "examples/do-example.md",
8
+ "examples/plan-example.md",
9
+ "examples/refine-example.md",
10
+ "examples/research-example.md",
11
+ "templates/do-template.md",
12
+ "templates/plan-template.md",
13
+ "templates/refine-template.md",
14
+ "templates/research-template.md"
15
+ ],
16
+ "aliases": [
17
+ "creating-prompts",
18
+ "meta/creating-prompts"
19
+ ]
20
+ }