agy-superpowers 5.0.6 → 5.0.8
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/README.md +23 -0
- package/package.json +1 -1
- package/template/agent/config.yml +9 -0
- package/template/agent/patches/skills-patches.md +74 -0
- package/template/agent/skills/api-design/SKILL.md +193 -0
- package/template/agent/skills/app-store-optimizer/SKILL.md +127 -0
- package/template/agent/skills/auth-and-identity/SKILL.md +167 -0
- package/template/agent/skills/backend-developer/SKILL.md +148 -0
- package/template/agent/skills/brainstorming/SKILL.md +3 -1
- package/template/agent/skills/community-manager/SKILL.md +115 -0
- package/template/agent/skills/content-marketer/SKILL.md +111 -0
- package/template/agent/skills/conversion-optimizer/SKILL.md +142 -0
- package/template/agent/skills/copywriter/SKILL.md +114 -0
- package/template/agent/skills/cto-architect/SKILL.md +133 -0
- package/template/agent/skills/customer-success-manager/SKILL.md +126 -0
- package/template/agent/skills/data-analyst/SKILL.md +147 -0
- package/template/agent/skills/devops-engineer/SKILL.md +117 -0
- package/template/agent/skills/email-infrastructure/SKILL.md +164 -0
- package/template/agent/skills/frontend-developer/SKILL.md +133 -0
- package/template/agent/skills/game-design/SKILL.md +194 -0
- package/template/agent/skills/game-developer/SKILL.md +175 -0
- package/template/agent/skills/growth-hacker/SKILL.md +122 -0
- package/template/agent/skills/i18n-localization/SKILL.md +126 -0
- package/template/agent/skills/influencer-marketer/SKILL.md +141 -0
- package/template/agent/skills/mobile-developer/SKILL.md +142 -0
- package/template/agent/skills/monetization-strategist/SKILL.md +119 -0
- package/template/agent/skills/paid-acquisition-specialist/SKILL.md +119 -0
- package/template/agent/skills/product-manager/SKILL.md +105 -0
- package/template/agent/skills/real-time-features/SKILL.md +194 -0
- package/template/agent/skills/retention-specialist/SKILL.md +123 -0
- package/template/agent/skills/saas-architect/SKILL.md +139 -0
- package/template/agent/skills/security-engineer/SKILL.md +133 -0
- package/template/agent/skills/seo-specialist/SKILL.md +130 -0
- package/template/agent/skills/subagent-driven-development/SKILL.md +7 -3
- package/template/agent/skills/subscription-billing/SKILL.md +179 -0
- package/template/agent/skills/ux-designer/SKILL.md +128 -0
- package/template/agent/workflows/update-superpowers.md +27 -8
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: product-manager
|
|
3
|
+
description: Use when defining product requirements, prioritizing features, planning a roadmap, validating user problems, or making build/buy/don't-build decisions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Product Manager Lens
|
|
7
|
+
|
|
8
|
+
> **Philosophy:** Build outcomes, not outputs. Ship learning, not just features.
|
|
9
|
+
> The best feature is often the one you decide not to build.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## ⚠️ ASK BEFORE ASSUMING
|
|
14
|
+
|
|
15
|
+
| What | Why it matters |
|
|
16
|
+
|------|----------------|
|
|
17
|
+
| **Stage?** Pre-PMF / Post-PMF / Scaling | Changes everything about what to build |
|
|
18
|
+
| **Who is the user?** | Can't prioritize without knowing whose problem |
|
|
19
|
+
| **What outcome matters?** Revenue / retention / activation | Determines what "done" looks like |
|
|
20
|
+
| **Existing data?** | Don't hypothesize what you can measure |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Core Instincts
|
|
25
|
+
|
|
26
|
+
- **Jobs-to-be-done (JTBD)** — users don't want features; they want to make progress in their lives
|
|
27
|
+
- **Outcome over output** — "MAU +20%" beats "shipped 10 features"
|
|
28
|
+
- **Pareto ruthlessness** — 20% of features deliver 80% of value; cut the rest
|
|
29
|
+
- **Small bets, fast learning** — ship to learn, not to finish
|
|
30
|
+
- **Pre-PMF: talk to users; post-PMF: read the data**
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Prioritization Frameworks
|
|
35
|
+
|
|
36
|
+
| Framework | When to use |
|
|
37
|
+
|-----------|-------------|
|
|
38
|
+
| **ICE** (Impact × Confidence × Ease) | Quick scoring across many ideas |
|
|
39
|
+
| **RICE** (Reach × Impact × Confidence ÷ Effort) | When reach varies significantly |
|
|
40
|
+
| **MoSCoW** (Must/Should/Could/Won't) | Scoping a release |
|
|
41
|
+
| **Opportunity Scoring** | When you have survey data on importance vs satisfaction |
|
|
42
|
+
|
|
43
|
+
**Indie hacker rule:** If a feature doesn't directly help activation, retention, or revenue — it's probably a "Won't" for now.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## ❌ Anti-Patterns to Avoid
|
|
48
|
+
|
|
49
|
+
| ❌ NEVER DO | Why | ✅ DO INSTEAD |
|
|
50
|
+
|------------|-----|--------------|
|
|
51
|
+
| Build based on one user request | 1 user ≠ your market | Find the pattern across 5+ interviews |
|
|
52
|
+
| Big bang launch | Months of work, one chance to be right | Shape → Bet → Ship → Learn loop |
|
|
53
|
+
| Vanity metrics as goals | Page views don't pay rent | Retention, activation, revenue |
|
|
54
|
+
| Feature factory (output focus) | Team ships but nothing improves | Set outcome targets, measure impact |
|
|
55
|
+
| Build before validating | Wasted dev weeks | Fake door test, landing page, prototype first |
|
|
56
|
+
| Roadmap spans > 3 months | World changes faster than plans | 6-week cycles max for indie hackers |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Questions You Always Ask
|
|
61
|
+
|
|
62
|
+
**When defining a feature:**
|
|
63
|
+
- What job is the user trying to get done? What's the progress they want to make?
|
|
64
|
+
- What's the smallest thing we can ship to learn whether this matters?
|
|
65
|
+
- How will we know if this worked? What metric moves?
|
|
66
|
+
- What do we NOT build as a result of building this?
|
|
67
|
+
|
|
68
|
+
**When reviewing a backlog:**
|
|
69
|
+
- Is this tied to a measurable outcome?
|
|
70
|
+
- Have we talked to users about this problem recently?
|
|
71
|
+
- What happens if we don't build this?
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Red Flags
|
|
76
|
+
|
|
77
|
+
**Must address:**
|
|
78
|
+
- [ ] No acceptance criteria on tickets ("done" is undefined)
|
|
79
|
+
- [ ] Features queued without a linked success metric
|
|
80
|
+
- [ ] No user research backing a major feature bet
|
|
81
|
+
- [ ] Roadmap has no "don't build" list
|
|
82
|
+
|
|
83
|
+
**Should address:**
|
|
84
|
+
- [ ] Sprint reviews with no outcome data (only feature demos)
|
|
85
|
+
- [ ] No documented JTBD for core user segments
|
|
86
|
+
- [ ] Team can't articulate current North Star Metric
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Who to Pair With
|
|
91
|
+
- `copywriter` — to translate features into user-facing language
|
|
92
|
+
- `growth-hacker` — for activation and acquisition loop design
|
|
93
|
+
- `data-analyst` — for outcome measurement and funnel analysis
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Key Formulas
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
North Star Metric = 1 metric that best represents delivered value to users
|
|
101
|
+
|
|
102
|
+
Activation rate = users who hit "aha moment" / total signups
|
|
103
|
+
Retention = users still active at day N / users who signed up N days ago
|
|
104
|
+
PMF signal = >40% of users would be "very disappointed" if product disappeared (Sean Ellis test)
|
|
105
|
+
```
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: real-time-features
|
|
3
|
+
description: Use when implementing WebSockets, Server-Sent Events (SSE), live collaboration, presence indicators, real-time notifications, or choosing between real-time transport options
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Real-Time Features Lens
|
|
7
|
+
|
|
8
|
+
> **Philosophy:** Real-time is expensive infrastructure. Use it only where it's perceptibly better than polling.
|
|
9
|
+
> The cheapest real-time solution is a fast refresh interval with good UX.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Core Instincts
|
|
14
|
+
|
|
15
|
+
- **Start with polling** — 5-second polling covers 90% of "live" use cases with zero infra complexity
|
|
16
|
+
- **SSE before WebSockets** — SSE is simpler, HTTP/2-compatible, easy to scale; use WebSockets only for bidirectional needs
|
|
17
|
+
- **Connection lifecycle is state** — track connect/disconnect, handle reconnects, never assume connection is alive
|
|
18
|
+
- **Scale out = sticky sessions or pub/sub** — WebSockets break horizontal scaling without Redis Pub/Sub or a broker
|
|
19
|
+
- **Real-time is optional** — always design a fallback (last-write-wins, reconciliation on reconnect)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Technology Selection
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
Which real-time tech to use?
|
|
27
|
+
|
|
28
|
+
Need bidirectional (client AND server send)?
|
|
29
|
+
├── YES → WebSocket
|
|
30
|
+
│ (chat, collaborative editing, gaming, live cursors)
|
|
31
|
+
└── NO → Server-Sent Events (SSE) or Polling
|
|
32
|
+
│
|
|
33
|
+
└── Data changes frequently + immediate delivery matters?
|
|
34
|
+
├── YES → SSE
|
|
35
|
+
│ (live notifications, dashboards, feeds)
|
|
36
|
+
└── NO → Long polling or periodic polling
|
|
37
|
+
(< 5 changes/min: just poll every 5s)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Technology Comparison
|
|
43
|
+
|
|
44
|
+
| Feature | Polling | SSE | WebSocket |
|
|
45
|
+
|---------|---------|-----|-----------|
|
|
46
|
+
| Complexity | ⭐ Low | ⭐⭐ Medium | ⭐⭐⭐ High |
|
|
47
|
+
| Bidirectional | ❌ | ❌ | ✅ |
|
|
48
|
+
| HTTP/2 compatible | ✅ | ✅ | ❌ |
|
|
49
|
+
| Horizontal scaling | ✅ Easy | ⚠️ Sticky sessions | ⚠️ Redis Pub/Sub needed |
|
|
50
|
+
| Firewall / proxy friendly | ✅ | ✅ | ⚠️ Sometimes blocked |
|
|
51
|
+
| Browser reconnect | N/A | ✅ Automatic (EventSource) | Manual |
|
|
52
|
+
| Use case | Dashboards, status | Notifications, feeds | Chat, collab |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## SSE Implementation Pattern
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
// Server (Node.js / Express)
|
|
60
|
+
app.get('/events', (req, res) => {
|
|
61
|
+
// Auth first!
|
|
62
|
+
if (!req.user) return res.sendStatus(401);
|
|
63
|
+
|
|
64
|
+
res.writeHead(200, {
|
|
65
|
+
'Content-Type': 'text/event-stream',
|
|
66
|
+
'Cache-Control': 'no-cache',
|
|
67
|
+
'Connection': 'keep-alive',
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Send keepalive every 15s (prevents proxy timeout at 30s)
|
|
71
|
+
const keepalive = setInterval(() => res.write(': keepalive\n\n'), 15000);
|
|
72
|
+
|
|
73
|
+
// Register client
|
|
74
|
+
clients.set(req.user.id, res);
|
|
75
|
+
|
|
76
|
+
// Cleanup on disconnect
|
|
77
|
+
req.on('close', () => {
|
|
78
|
+
clearInterval(keepalive);
|
|
79
|
+
clients.delete(req.user.id);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
// Push to client
|
|
84
|
+
function pushToUser(userId, event, data) {
|
|
85
|
+
const client = clients.get(userId);
|
|
86
|
+
if (client) client.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## WebSocket Scaling Pattern
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Single server: Direct WebSocket connection works fine
|
|
96
|
+
Multi-server: Client connects to Server A, event fires on Server B
|
|
97
|
+
→ Server B can't reach Server A's client
|
|
98
|
+
→ Solution: Redis Pub/Sub
|
|
99
|
+
|
|
100
|
+
Architecture:
|
|
101
|
+
[Client] ←WS→ [Server A] ←→ [Redis Pub/Sub] ←→ [Server B] ←WS→ [Client]
|
|
102
|
+
|
|
103
|
+
Server publishes to Redis channel:
|
|
104
|
+
await redis.publish(`user:${userId}`, JSON.stringify(event))
|
|
105
|
+
|
|
106
|
+
Server subscribes on connect:
|
|
107
|
+
await redis.subscribe(`user:${userId}`, (message) => {
|
|
108
|
+
ws.send(message)
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Reconnection & State Reconciliation
|
|
115
|
+
|
|
116
|
+
```javascript
|
|
117
|
+
// Client-side: always implement reconnect with backoff
|
|
118
|
+
const MAX_RETRIES = 5;
|
|
119
|
+
let retries = 0;
|
|
120
|
+
|
|
121
|
+
function connect() {
|
|
122
|
+
const ws = new WebSocket(url);
|
|
123
|
+
|
|
124
|
+
ws.onopen = () => { retries = 0; };
|
|
125
|
+
|
|
126
|
+
ws.onclose = () => {
|
|
127
|
+
if (retries < MAX_RETRIES) {
|
|
128
|
+
setTimeout(connect, Math.min(1000 * 2 ** retries, 30000));
|
|
129
|
+
retries++;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Server-side: on reconnect, send missed events since lastEventId
|
|
135
|
+
// SSE: browser sends Last-Event-ID header automatically
|
|
136
|
+
// WebSocket: client sends lastEventId on connect message
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## ❌ Anti-Patterns to Avoid
|
|
142
|
+
|
|
143
|
+
| ❌ NEVER DO | Why | ✅ DO INSTEAD |
|
|
144
|
+
|------------|-----|--------------|
|
|
145
|
+
| WebSocket for unidirectional updates | SSE is simpler for same use case | Use SSE for server→client only |
|
|
146
|
+
| In-memory client registry | Breaks on horizontal scale | Redis Pub/Sub for multi-instance |
|
|
147
|
+
| No keepalive messages | Proxy kills idle connections at 30–60s | Send `: keepalive` every 15s |
|
|
148
|
+
| No reconnect logic on client | Single network hiccup = broken UI | Exponential backoff reconnect |
|
|
149
|
+
| Auth skipped on WebSocket handshake | WS connections are permanent — auth must be first | Auth during HTTP upgrade (before WS established) |
|
|
150
|
+
| Sending all state on every event | Expensive; clients drift on missed events | Send diffs; reconcile on reconnect |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Questions You Always Ask
|
|
155
|
+
|
|
156
|
+
**When choosing real-time:**
|
|
157
|
+
- Does this require bidirectional communication, or is server→client enough?
|
|
158
|
+
- Would polling every 5–10 seconds give acceptable UX?
|
|
159
|
+
- How many concurrent connections do we expect at peak? (Connection limit planning)
|
|
160
|
+
|
|
161
|
+
**When implementing:**
|
|
162
|
+
- Is there auth on the WebSocket handshake/SSE endpoint?
|
|
163
|
+
- Is there a keepalive to prevent proxy timeouts?
|
|
164
|
+
- What's the reconnection strategy on the client?
|
|
165
|
+
- How is this scaled across multiple server instances?
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Red Flags
|
|
170
|
+
|
|
171
|
+
**Must fix:**
|
|
172
|
+
- [ ] No auth on WebSocket / SSE endpoint
|
|
173
|
+
- [ ] In-memory client registry on multi-instance deployment
|
|
174
|
+
- [ ] No keepalive (proxy will terminate idle connections)
|
|
175
|
+
|
|
176
|
+
**Should fix:**
|
|
177
|
+
- [ ] No reconnect logic on client
|
|
178
|
+
- [ ] WebSocket used where SSE would suffice
|
|
179
|
+
- [ ] No strategy for clients that miss events while disconnected
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Who to Pair With
|
|
184
|
+
- `backend-developer` — for server architecture and Redis Pub/Sub
|
|
185
|
+
- `frontend-developer` — for client-side connection management
|
|
186
|
+
- `devops-engineer` — for WebSocket-aware load balancer config
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Tools
|
|
191
|
+
**Managed:** Supabase Realtime · Pusher · Ably · Liveblocks (collaboration)
|
|
192
|
+
**Self-hosted:** Socket.IO (WebSocket + SSE fallback) · ws (raw WebSocket)
|
|
193
|
+
**Browser:** `EventSource` (SSE, built-in) · `WebSocket` (built-in)
|
|
194
|
+
**Scaling:** Upstash Redis · Redis with ioredis
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: retention-specialist
|
|
3
|
+
description: Use when improving user retention, designing onboarding flows, reducing churn, analyzing engagement, or building re-engagement campaigns
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Retention Specialist Lens
|
|
7
|
+
|
|
8
|
+
> **Philosophy:** Retention is the multiplier on everything else. Double retention = double LTV.
|
|
9
|
+
> Acquisition brings users in; retention determines if your business exists in 12 months.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Core Instincts
|
|
14
|
+
|
|
15
|
+
- **Retention is a product problem, not a marketing problem** — you can't lifecycle-email your way out of a bad product
|
|
16
|
+
- **Find the aha moment first** — the single action most correlated with long-term retention
|
|
17
|
+
- **Day 1 retention is the most important** — users who don't return on Day 1 rarely return at all
|
|
18
|
+
- **Habit formation takes 21–66 days** — retention strategy must operate over weeks, not days
|
|
19
|
+
- **Segment by engagement tier** — power users, casual users, and at-risk users need different interventions
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Retention Benchmarks
|
|
24
|
+
|
|
25
|
+
### Mobile Apps (by category) — 2024 benchmarks
|
|
26
|
+
|
|
27
|
+
| Category | D1 (good) | D7 (good) | D30 (good) |
|
|
28
|
+
|----------|-----------|-----------|------------|
|
|
29
|
+
| Games | > 28% | > 12% | > 6% |
|
|
30
|
+
| Finance / Fintech | > 25% | > 16% | > 10% |
|
|
31
|
+
| Education | > 26% | > 16% | > 7% |
|
|
32
|
+
| Entertainment | > 27% | > 16% | > 5% |
|
|
33
|
+
| Health & Fitness | > 25% | > 10% | > 5% |
|
|
34
|
+
| Social / Messaging | > 27% | > 11% | > 6% |
|
|
35
|
+
| Productivity / Utilities | > 24% | > 15% | > 5% |
|
|
36
|
+
|
|
37
|
+
**Context:** Industry-wide D1 average is ~25–28%; D7 ~13–18%; D30 ~5–8%. Apps hitting D30 > 15% are genuinely strong performers.
|
|
38
|
+
**General rule:** D30 < 5% = investigate immediately. D30 > 12% = strong. D30 > 20% = exceptional.
|
|
39
|
+
|
|
40
|
+
### SaaS / Web Apps — 2024 benchmarks
|
|
41
|
+
| Metric | Poor | Average | Good |
|
|
42
|
+
|--------|------|---------|------|
|
|
43
|
+
| Monthly churn (B2B SaaS) | > 8% | 3.5–5% | < 2% |
|
|
44
|
+
| Monthly churn (B2C / consumer) | > 10% | 5–8% | < 3% |
|
|
45
|
+
| Annual churn (B2B) | > 60% | 30–50% | < 20% |
|
|
46
|
+
| NPS | < 20 | 30–50 | > 50 |
|
|
47
|
+
|
|
48
|
+
**Context:** Industry average B2B SaaS monthly churn is ~4.2% (Recurly 2024). "< 2% monthly" is excellent / enterprise-level, not just "good".
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Push Notification Benchmarks
|
|
53
|
+
|
|
54
|
+
| Platform | Average open rate | Good open rate |
|
|
55
|
+
|----------|------------------|---------------|
|
|
56
|
+
| iOS | 3–5% | > 7% |
|
|
57
|
+
| Android | 4–7% | > 10% |
|
|
58
|
+
| Email re-engagement | 10–15% | > 20% |
|
|
59
|
+
|
|
60
|
+
**Push notification rules:**
|
|
61
|
+
- Personalized > generic (2–3× higher open rate)
|
|
62
|
+
- Time-based (sent at user's local peak usage time) > blast sends
|
|
63
|
+
- Opt-in rate drops if you send > 1 notification/day
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## ❌ Anti-Patterns to Avoid
|
|
68
|
+
|
|
69
|
+
| ❌ NEVER DO | Why | ✅ DO INSTEAD |
|
|
70
|
+
|------------|-----|--------------|
|
|
71
|
+
| Lifecycle emails before finding aha moment | Emails can't fix a broken product | Find and shorten path to aha moment first |
|
|
72
|
+
| Generic "come back" push notifications | Low open rate, high unsubscribe | Trigger-based, personalized context |
|
|
73
|
+
| Daily active user target only | DAU ignores depth of engagement | Track DAU + session depth + feature usage |
|
|
74
|
+
| Ignore Day 1 drop-off | 60–80% of users churn on Day 1 | Instrument and fix Day 1 experience first |
|
|
75
|
+
| Same onboarding for all user types | Different users need different paths | Personalize onboarding from first question |
|
|
76
|
+
| Cancel flow with no save attempt | 20–40% of cancellers are saveable | Offer pause, downgrade, or discount before cancel |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Questions You Always Ask
|
|
81
|
+
|
|
82
|
+
**When diagnosing retention:**
|
|
83
|
+
- What does the Day 1/7/30 retention curve look like? Where's the steepest drop?
|
|
84
|
+
- What's the aha moment, and what % of users reach it in session 1?
|
|
85
|
+
- What do retained users do differently from churned users in week 1?
|
|
86
|
+
|
|
87
|
+
**When designing retention interventions:**
|
|
88
|
+
- Is this a product problem (users don't understand value) or a habit problem (value understood, not habitual)?
|
|
89
|
+
- What's the churn reason? (Run exit survey — "I didn't use it enough" vs "too expensive" vs "found alternative")
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Red Flags
|
|
94
|
+
|
|
95
|
+
**Must fix:**
|
|
96
|
+
- [ ] Day 1 retention < 20% (broken first experience)
|
|
97
|
+
- [ ] No aha moment defined or instrumented
|
|
98
|
+
- [ ] Monthly churn > 8% with no active investigation
|
|
99
|
+
- [ ] No exit survey / churn reason tracking
|
|
100
|
+
|
|
101
|
+
**Should fix:**
|
|
102
|
+
- [ ] No push notification strategy (relying only on email)
|
|
103
|
+
- [ ] No in-app re-engagement for users inactive > 7 days
|
|
104
|
+
- [ ] Onboarding identical for all user segments
|
|
105
|
+
- [ ] No cancel flow / save attempt
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Who to Pair With
|
|
110
|
+
- `product-manager` — for aha moment and activation event design
|
|
111
|
+
- `growth-hacker` — for AARRR funnel optimization
|
|
112
|
+
- `data-analyst` — for cohort analysis and retention curve modeling
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Key Formulas
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
Retention rate (Day N) = users_still_active_on_day_N / users_who_signed_up_N_days_ago
|
|
120
|
+
Monthly churn = churned_users_this_month / users_at_start_of_month
|
|
121
|
+
Annual churn ≈ 1 - (1 - monthly_churn)^12
|
|
122
|
+
NPS = % Promoters (9–10) - % Detractors (0–6)
|
|
123
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: saas-architect
|
|
3
|
+
description: Use when designing multi-tenant SaaS architecture, tenant isolation, data models, or making core infrastructure decisions for a SaaS product
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SaaS Architect Lens
|
|
7
|
+
|
|
8
|
+
> **Philosophy:** Multi-tenancy is not a feature — it's a fundamental architectural constraint.
|
|
9
|
+
> Every design decision must answer: "Is this tenant-safe?"
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Core Instincts
|
|
14
|
+
|
|
15
|
+
- **Tenant isolation first** — data leaking between tenants is an existential business risk
|
|
16
|
+
- **Design for the tenant, not the user** — every entity in the data model has a `tenant_id`
|
|
17
|
+
- **Shared infrastructure, isolated data** — the sweet spot for indie hackers
|
|
18
|
+
- **Plan the upgrade path** — schema-per-tenant → RLS → shared schema: picking wrong is expensive to change
|
|
19
|
+
- **Hard-delete rarely; soft-delete by default** — audit trails matter in B2B
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Tenancy Isolation Models
|
|
24
|
+
|
|
25
|
+
| Model | Isolation | Cost | Complexity | Best for |
|
|
26
|
+
|-------|-----------|------|------------|----------|
|
|
27
|
+
| **Separate database per tenant** | ✅ Strongest | 💰 Highest | High | Enterprise, regulated industries |
|
|
28
|
+
| **Schema per tenant** (PostgreSQL) | ✅ Strong | 💰 Medium | Medium | Mid-market SaaS |
|
|
29
|
+
| **Row-level security (RLS)** | ✅ Good | 💰 Low | Medium | Indie hacker / SMB SaaS |
|
|
30
|
+
| **Application-level filtering** | ⚠️ Weakest | 💰 Lowest | Low | Prototype only — never production |
|
|
31
|
+
|
|
32
|
+
**Recommended for indie hackers:** Row-Level Security (RLS) on PostgreSQL (Supabase, Neon). Strong isolation at low cost.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Tenant Data Model Pattern
|
|
37
|
+
|
|
38
|
+
```sql
|
|
39
|
+
-- Every table must have tenant_id
|
|
40
|
+
CREATE TABLE projects (
|
|
41
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
42
|
+
tenant_id UUID NOT NULL REFERENCES tenants(id) ON DELETE CASCADE,
|
|
43
|
+
name TEXT NOT NULL,
|
|
44
|
+
created_at TIMESTAMPTZ DEFAULT now(),
|
|
45
|
+
deleted_at TIMESTAMPTZ -- soft delete
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
-- RLS: tenant can only see their own rows
|
|
49
|
+
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
|
|
50
|
+
CREATE POLICY tenant_isolation ON projects
|
|
51
|
+
USING (tenant_id = current_setting('app.tenant_id')::UUID);
|
|
52
|
+
|
|
53
|
+
-- Index tenant_id on EVERY tenant-scoped table
|
|
54
|
+
CREATE INDEX ON projects(tenant_id);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Tenant Routing Patterns
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Option 1: Subdomain routing
|
|
63
|
+
acme.myapp.com → tenant lookup by subdomain → set tenant_id context
|
|
64
|
+
|
|
65
|
+
Option 2: Path routing
|
|
66
|
+
myapp.com/acme → extract slug from path → set tenant_id context
|
|
67
|
+
|
|
68
|
+
Option 3: Custom domain
|
|
69
|
+
app.acme.com → CNAME → myapp.com → DNS lookup → set tenant_id context
|
|
70
|
+
|
|
71
|
+
Recommended for indie hackers: Start with subdomain routing; add custom domains when users ask.
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## ❌ Anti-Patterns to Avoid
|
|
77
|
+
|
|
78
|
+
| ❌ NEVER DO | Why | ✅ DO INSTEAD |
|
|
79
|
+
|------------|-----|--------------|
|
|
80
|
+
| Application-level tenant filtering only | One missing WHERE clause = data breach | RLS at DB level = defense in depth |
|
|
81
|
+
| Tenant ID in JWT payload, enforced only in app | Bypassed by direct DB access | DB-level enforcement (RLS or schema) |
|
|
82
|
+
| Hard-delete tenant data immediately | Chargebacks, disputes, legal holds | Soft-delete + 30-day retention before purge |
|
|
83
|
+
| No tenant_id index | Full table scan at scale | `CREATE INDEX ON every_table(tenant_id)` |
|
|
84
|
+
| Single shared sequence for IDs | Enumerable IDs expose tenant data volume | UUIDs (v4 or v7) always |
|
|
85
|
+
| Storing cross-tenant references | Breaks isolation, schema nightmare | Denormalize data within tenant boundary |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Tenant Lifecycle Management
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Sign up → Create tenant record → Create owner user → Provision trial subscription
|
|
93
|
+
↓
|
|
94
|
+
Active → Upgrade → Downgrade → Cancel → Grace period (30 days) → Purge
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Required tenant states:** `trialing`, `active`, `past_due`, `canceled`, `suspended`
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Questions You Always Ask
|
|
102
|
+
|
|
103
|
+
**When adding a new model:**
|
|
104
|
+
- Does every record in this table belong to a tenant? → Add `tenant_id`
|
|
105
|
+
- Is there an index on `tenant_id`?
|
|
106
|
+
- Does the RLS policy cover this table?
|
|
107
|
+
- What happens when the tenant is deleted/canceled?
|
|
108
|
+
|
|
109
|
+
**When reviewing a query:**
|
|
110
|
+
- Is `tenant_id` in the WHERE clause? (Even with RLS, explicit filtering = clarity)
|
|
111
|
+
- Could this query return data from another tenant?
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Red Flags
|
|
116
|
+
|
|
117
|
+
**Must fix:**
|
|
118
|
+
- [ ] Tables with user data but no `tenant_id`
|
|
119
|
+
- [ ] Application-level tenant filtering without DB-level enforcement
|
|
120
|
+
- [ ] No index on `tenant_id` columns
|
|
121
|
+
- [ ] Hard-delete on tenant cancellation (no retention period)
|
|
122
|
+
|
|
123
|
+
**Should fix:**
|
|
124
|
+
- [ ] No soft-delete strategy for tenant-scoped records
|
|
125
|
+
- [ ] Cross-tenant foreign key references
|
|
126
|
+
- [ ] Tenant ID stored as integer (enumerable — use UUID)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Who to Pair With
|
|
131
|
+
- `backend-developer` — for query patterns and migration execution
|
|
132
|
+
- `auth-and-identity` — for tenant-scoped authentication
|
|
133
|
+
- `security-engineer` — for data isolation audit
|
|
134
|
+
- `devops-engineer` — for per-tenant resource provisioning
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Tools
|
|
139
|
+
Supabase (RLS built-in) · Neon (branching per tenant possible) · PlanetScale (separate DBs) · Drizzle ORM / Prisma (schema management) · Zod (runtime tenant_id validation)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-engineer
|
|
3
|
+
description: Use when reviewing app security, setting up authentication, handling user data, ensuring GDPR/App Store compliance, or conducting security audits
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Security Engineer Lens
|
|
7
|
+
|
|
8
|
+
> **Philosophy:** Security is not a feature you add later — it's a constraint you design around from day one.
|
|
9
|
+
> The cost of a breach is always higher than the cost of prevention.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Core Instincts
|
|
14
|
+
|
|
15
|
+
- **Principle of least privilege** — every system, user, and API key should have only the permissions it needs
|
|
16
|
+
- **Defense in depth** — multiple layers of security; no single point of failure
|
|
17
|
+
- **Never trust input** — validate and sanitize everything, regardless of source
|
|
18
|
+
- **Secrets are not config** — credentials never live in code, git history, or logs
|
|
19
|
+
- **Privacy by design** — collect only what you need; retain only as long as required
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## OWASP Top 10 (Most Common Vulnerabilities)
|
|
24
|
+
|
|
25
|
+
| Rank | Vulnerability | Prevention |
|
|
26
|
+
|------|--------------|------------|
|
|
27
|
+
| A01 | **Broken Access Control** | Enforce auth on every endpoint; deny by default |
|
|
28
|
+
| A02 | **Cryptographic Failures** | Use TLS everywhere; bcrypt/argon2 for passwords |
|
|
29
|
+
| A03 | **Injection** (SQL, NoSQL, OS) | Parameterized queries; never string-concatenate user input into queries |
|
|
30
|
+
| A04 | **Insecure Design** | Threat model during design, not after |
|
|
31
|
+
| A05 | **Security Misconfiguration** | Disable debug in prod; update defaults; least privilege |
|
|
32
|
+
| A06 | **Vulnerable Components** | `npm audit` / `pip audit` regularly; automate with Dependabot |
|
|
33
|
+
| A07 | **Identification and Authentication Failures** | bcrypt cost ≥12; JWT short expiry; PKCE for mobile |
|
|
34
|
+
| A08 | **Software Integrity Failures** | Verify 3rd-party scripts; use SRI for CDN assets |
|
|
35
|
+
| A09 | **Security Logging and Monitoring Failures** | Log security events; never log passwords/tokens/PII |
|
|
36
|
+
| A10 | **SSRF** | Validate/allowlist outbound URLs; block internal network access |
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Auth Security Rules
|
|
41
|
+
|
|
42
|
+
| Concern | Requirement |
|
|
43
|
+
|---------|-------------|
|
|
44
|
+
| Password hashing | `bcrypt` (cost ≥ 12; OWASP minimum is 10, 12 recommended) or `argon2id` — never MD5, SHA1, SHA256 |
|
|
45
|
+
| JWT access token expiry | 15 minutes – 1 hour |
|
|
46
|
+
| JWT refresh token expiry | 7–30 days; rotate on use |
|
|
47
|
+
| Session cookies | `HttpOnly` + `Secure` + `SameSite=Strict` |
|
|
48
|
+
| OAuth for mobile apps | PKCE required (no client_secret in mobile apps) |
|
|
49
|
+
| API keys at rest | Store as SHA-256 hash; show plaintext only at creation |
|
|
50
|
+
| Password reset tokens | Single-use, expire in 15–60 minutes |
|
|
51
|
+
| Rate limiting auth endpoints | Max 5 failed attempts / 15 minutes per IP |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Data Privacy Requirements
|
|
56
|
+
|
|
57
|
+
### GDPR (EU users)
|
|
58
|
+
- Legal basis required for every data collection (consent, legitimate interest, contract)
|
|
59
|
+
- Privacy policy must be clear, plain language, accessible before sign-up
|
|
60
|
+
- Right to erasure: must be able to delete all user data on request
|
|
61
|
+
- Data breach notification: 72 hours to supervisory authority, "without undue delay" to users
|
|
62
|
+
- Data minimization: only collect what's needed for stated purpose
|
|
63
|
+
|
|
64
|
+
### App Store (Apple)
|
|
65
|
+
- Privacy Nutrition Label: declare all data collected and its purpose
|
|
66
|
+
- ATT (App Tracking Transparency): required prompt before any cross-app tracking
|
|
67
|
+
- Data linked to user: justify every category collected
|
|
68
|
+
- No collecting device data beyond stated purpose
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ❌ Anti-Patterns to Avoid
|
|
73
|
+
|
|
74
|
+
| ❌ NEVER DO | Why | ✅ DO INSTEAD |
|
|
75
|
+
|------------|-----|--------------|
|
|
76
|
+
| `SELECT *` or raw string SQL | SQL injection risk | Parameterized queries / ORM always |
|
|
77
|
+
| Secrets in `.env` committed to git | git history = permanent leak | `.env.example` only; real secrets in secret manager |
|
|
78
|
+
| MD5 or SHA1 for passwords | Crackable in minutes with rainbow tables | `bcrypt` cost ≥12 or `argon2id` |
|
|
79
|
+
| JWT stored in `localStorage` | XSS attack can steal it | Use `HttpOnly` cookies for JWTs |
|
|
80
|
+
| Disable CORS entirely | Any site can make authenticated requests as your user | Configure CORS allowlist carefully |
|
|
81
|
+
| Verbose error messages in prod | Leaks implementation details | Generic messages to clients; full details in server logs only |
|
|
82
|
+
| No dependency vulnerability scanning | CVEs accumulate silently | Dependabot / Snyk / `npm audit` in CI |
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Security Audit Checklist for Indie Hackers
|
|
87
|
+
|
|
88
|
+
**Authentication:**
|
|
89
|
+
- [ ] Passwords hashed with bcrypt (cost ≥12) or argon2id
|
|
90
|
+
- [ ] Rate limiting on login + password reset endpoints
|
|
91
|
+
- [ ] JWT access tokens expire in < 1 hour
|
|
92
|
+
- [ ] HTTPS enforced everywhere (redirect HTTP → HTTPS)
|
|
93
|
+
|
|
94
|
+
**Data:**
|
|
95
|
+
- [ ] No PII in logs (emails, names, IP addresses)
|
|
96
|
+
- [ ] User data deletion endpoint exists and works
|
|
97
|
+
- [ ] Database not publicly accessible (behind VPC/firewall)
|
|
98
|
+
- [ ] Backups encrypted at rest
|
|
99
|
+
|
|
100
|
+
**Dependencies:**
|
|
101
|
+
- [ ] `npm audit` / `pip audit` / `bundle audit` in CI pipeline
|
|
102
|
+
- [ ] No known critical CVEs in production dependencies
|
|
103
|
+
|
|
104
|
+
**App Store / Privacy:**
|
|
105
|
+
- [ ] Privacy Nutrition Label accurate (iOS)
|
|
106
|
+
- [ ] ATT prompt implemented if tracking cross-app (iOS)
|
|
107
|
+
- [ ] Privacy policy live and linked from app/store listing
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Questions You Always Ask
|
|
112
|
+
|
|
113
|
+
**When adding auth:**
|
|
114
|
+
- What's the token storage strategy? (Avoid localStorage for JWTs)
|
|
115
|
+
- Is the password reset flow single-use and time-limited?
|
|
116
|
+
- Are failed login attempts rate-limited per IP?
|
|
117
|
+
|
|
118
|
+
**When handling user data:**
|
|
119
|
+
- Is there a legal basis for collecting this data?
|
|
120
|
+
- Can a user request deletion of all their data?
|
|
121
|
+
- Is this data encrypted at rest and in transit?
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Who to Pair With
|
|
126
|
+
- `backend-developer` — for auth implementation and API security
|
|
127
|
+
- `devops-engineer` — for infrastructure security and secret management
|
|
128
|
+
- `cto-architect` — for threat modeling and security architecture
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Tools
|
|
133
|
+
OWASP ZAP (free scanner) · Snyk · Dependabot · Burp Suite (manual testing) · HaveIBeenPwned API (compromised password check) · Neon / Supabase (managed DB with encryption at rest)
|