Skip to content

Commit 433e33b

Browse files
Add Vercel React Best Practices Skill with Performance Optimization Rules
- Introduced metadata for the Vercel React Best Practices skill. - Created sections for performance optimization rules, categorized by impact. - Added templates for rule documentation. - Implemented various performance optimization rules including: - Avoiding waterfalls in async operations. - Optimizing bundle sizes and server-side performance. - Using `requestIdleCallback` for non-critical tasks. - Hoisting static I/O to module level to prevent repeated I/O per request. - Ensuring no shared module state for request data to avoid concurrency issues. - Implementing parallel nested data fetching to eliminate server-side waterfalls. - Added additional rules for rendering performance and JavaScript optimizations.
1 parent e024ad8 commit 433e33b

95 files changed

Lines changed: 20810 additions & 113 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/brainstorming/SKILL.md

Lines changed: 79 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ description: "You MUST use this before any creative work - creating features, bu
55

66
# Brainstorming Ideas Into Designs
77

8-
## Overview
9-
108
Help turn ideas into fully formed designs and specs through natural collaborative dialogue.
119

1210
Start by understanding the current project context, then ask questions one at a time to refine the idea. Once you understand what you're building, present the design and get user approval.
@@ -24,31 +22,44 @@ Every project goes through this process. A todo list, a single-function utility,
2422
You MUST create a task for each of these items and complete them in order:
2523

2624
1. **Explore project context** — check files, docs, recent commits
27-
2. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
28-
3. **Propose 2-3 approaches** — with trade-offs and your recommendation
29-
4. **Present design** — in sections scaled to their complexity, get user approval after each section
30-
5. **Write design doc** — save to `docs/plans/YYYY-MM-DD-<topic>-design.md` and commit
31-
6. **Transition to implementation** — invoke writing-plans skill to create implementation plan
25+
2. **Offer visual companion** (if topic will involve visual questions) — this is its own message, not combined with a clarifying question. See the Visual Companion section below.
26+
3. **Ask clarifying questions** — one at a time, understand purpose/constraints/success criteria
27+
4. **Propose 2-3 approaches** — with trade-offs and your recommendation
28+
5. **Present design** — in sections scaled to their complexity, get user approval after each section
29+
6. **Write design doc** — save to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md` and commit
30+
7. **Spec self-review** — quick inline check for placeholders, contradictions, ambiguity, scope (see below)
31+
8. **User reviews written spec** — ask user to review the spec file before proceeding
32+
9. **Transition to implementation** — invoke writing-plans skill to create implementation plan
3233

3334
## Process Flow
3435

3536
```dot
3637
digraph brainstorming {
3738
"Explore project context" [shape=box];
39+
"Visual questions ahead?" [shape=diamond];
40+
"Offer Visual Companion\n(own message, no other content)" [shape=box];
3841
"Ask clarifying questions" [shape=box];
3942
"Propose 2-3 approaches" [shape=box];
4043
"Present design sections" [shape=box];
4144
"User approves design?" [shape=diamond];
4245
"Write design doc" [shape=box];
46+
"Spec self-review\n(fix inline)" [shape=box];
47+
"User reviews spec?" [shape=diamond];
4348
"Invoke writing-plans skill" [shape=doublecircle];
4449
45-
"Explore project context" -> "Ask clarifying questions";
50+
"Explore project context" -> "Visual questions ahead?";
51+
"Visual questions ahead?" -> "Offer Visual Companion\n(own message, no other content)" [label="yes"];
52+
"Visual questions ahead?" -> "Ask clarifying questions" [label="no"];
53+
"Offer Visual Companion\n(own message, no other content)" -> "Ask clarifying questions";
4654
"Ask clarifying questions" -> "Propose 2-3 approaches";
4755
"Propose 2-3 approaches" -> "Present design sections";
4856
"Present design sections" -> "User approves design?";
4957
"User approves design?" -> "Present design sections" [label="no, revise"];
5058
"User approves design?" -> "Write design doc" [label="yes"];
51-
"Write design doc" -> "Invoke writing-plans skill";
59+
"Write design doc" -> "Spec self-review\n(fix inline)";
60+
"Spec self-review\n(fix inline)" -> "User reviews spec?";
61+
"User reviews spec?" -> "Write design doc" [label="changes requested"];
62+
"User reviews spec?" -> "Invoke writing-plans skill" [label="approved"];
5263
}
5364
```
5465

@@ -57,32 +68,70 @@ digraph brainstorming {
5768
## The Process
5869

5970
**Understanding the idea:**
71+
6072
- Check out the current project state first (files, docs, recent commits)
61-
- Ask questions one at a time to refine the idea
73+
- Before asking detailed questions, assess scope: if the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend questions refining details of a project that needs to be decomposed first.
74+
- If the project is too large for a single spec, help the user decompose into sub-projects: what are the independent pieces, how do they relate, what order should they be built? Then brainstorm the first sub-project through the normal design flow. Each sub-project gets its own spec → plan → implementation cycle.
75+
- For appropriately-scoped projects, ask questions one at a time to refine the idea
6276
- Prefer multiple choice questions when possible, but open-ended is fine too
6377
- Only one question per message - if a topic needs more exploration, break it into multiple questions
6478
- Focus on understanding: purpose, constraints, success criteria
6579

6680
**Exploring approaches:**
81+
6782
- Propose 2-3 different approaches with trade-offs
6883
- Present options conversationally with your recommendation and reasoning
6984
- Lead with your recommended option and explain why
7085

7186
**Presenting the design:**
87+
7288
- Once you believe you understand what you're building, present the design
7389
- Scale each section to its complexity: a few sentences if straightforward, up to 200-300 words if nuanced
7490
- Ask after each section whether it looks right so far
7591
- Cover: architecture, components, data flow, error handling, testing
7692
- Be ready to go back and clarify if something doesn't make sense
7793

94+
**Design for isolation and clarity:**
95+
96+
- Break the system into smaller units that each have one clear purpose, communicate through well-defined interfaces, and can be understood and tested independently
97+
- For each unit, you should be able to answer: what does it do, how do you use it, and what does it depend on?
98+
- Can someone understand what a unit does without reading its internals? Can you change the internals without breaking consumers? If not, the boundaries need work.
99+
- Smaller, well-bounded units are also easier for you to work with - you reason better about code you can hold in context at once, and your edits are more reliable when files are focused. When a file grows large, that's often a signal that it's doing too much.
100+
101+
**Working in existing codebases:**
102+
103+
- Explore the current structure before proposing changes. Follow existing patterns.
104+
- Where existing code has problems that affect the work (e.g., a file that's grown too large, unclear boundaries, tangled responsibilities), include targeted improvements as part of the design - the way a good developer improves code they're working in.
105+
- Don't propose unrelated refactoring. Stay focused on what serves the current goal.
106+
78107
## After the Design
79108

80109
**Documentation:**
81-
- Write the validated design to `docs/plans/YYYY-MM-DD-<topic>-design.md`
110+
111+
- Write the validated design (spec) to `docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md`
112+
- (User preferences for spec location override this default)
82113
- Use elements-of-style:writing-clearly-and-concisely skill if available
83114
- Commit the design document to git
84115

116+
**Spec Self-Review:**
117+
After writing the spec document, look at it with fresh eyes:
118+
119+
1. **Placeholder scan:** Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them.
120+
2. **Internal consistency:** Do any sections contradict each other? Does the architecture match the feature descriptions?
121+
3. **Scope check:** Is this focused enough for a single implementation plan, or does it need decomposition?
122+
4. **Ambiguity check:** Could any requirement be interpreted two different ways? If so, pick one and make it explicit.
123+
124+
Fix any issues inline. No need to re-review — just fix and move on.
125+
126+
**User Review Gate:**
127+
After the spec review loop passes, ask the user to review the written spec before proceeding:
128+
129+
> "Spec written and committed to `<path>`. Please review it and let me know if you want to make any changes before we start writing out the implementation plan."
130+
131+
Wait for the user's response. If they request changes, make them and re-run the spec review loop. Only proceed once the user approves.
132+
85133
**Implementation:**
134+
86135
- Invoke the writing-plans skill to create a detailed implementation plan
87136
- Do NOT invoke any other skill. writing-plans is the next step.
88137

@@ -94,3 +143,22 @@ digraph brainstorming {
94143
- **Explore alternatives** - Always propose 2-3 approaches before settling
95144
- **Incremental validation** - Present design, get approval before moving on
96145
- **Be flexible** - Go back and clarify when something doesn't make sense
146+
147+
## Visual Companion
148+
149+
A browser-based companion for showing mockups, diagrams, and visual options during brainstorming. Available as a tool — not a mode. Accepting the companion means it's available for questions that benefit from visual treatment; it does NOT mean every question goes through the browser.
150+
151+
**Offering the companion:** When you anticipate that upcoming questions will involve visual content (mockups, layouts, diagrams), offer it once for consent:
152+
> "Some of what we're working on might be easier to explain if I can show it to you in a web browser. I can put together mockups, diagrams, comparisons, and other visuals as we go. This feature is still new and can be token-intensive. Want to try it? (Requires opening a local URL)"
153+
154+
**This offer MUST be its own message.** Do not combine it with clarifying questions, context summaries, or any other content. The message should contain ONLY the offer above and nothing else. Wait for the user's response before continuing. If they decline, proceed with text-only brainstorming.
155+
156+
**Per-question decision:** Even after the user accepts, decide FOR EACH QUESTION whether to use the browser or the terminal. The test: **would the user understand this better by seeing it than reading it?**
157+
158+
- **Use the browser** for content that IS visual — mockups, wireframes, layout comparisons, architecture diagrams, side-by-side visual designs
159+
- **Use the terminal** for content that is text — requirements questions, conceptual choices, tradeoff lists, A/B/C/D text options, scope decisions
160+
161+
A question about a UI topic is not automatically a visual question. "What does personality mean in this context?" is a conceptual question — use the terminal. "Which wizard layout works better?" is a visual question — use the browser.
162+
163+
If they agree to the companion, read the detailed guide before proceeding:
164+
`skills/brainstorming/visual-companion.md`
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Superpowers Brainstorming</title>
6+
<style>
7+
/*
8+
* BRAINSTORM COMPANION FRAME TEMPLATE
9+
*
10+
* This template provides a consistent frame with:
11+
* - OS-aware light/dark theming
12+
* - Fixed header and selection indicator bar
13+
* - Scrollable main content area
14+
* - CSS helpers for common UI patterns
15+
*
16+
* Content is injected via placeholder comment in #claude-content.
17+
*/
18+
19+
* { box-sizing: border-box; margin: 0; padding: 0; }
20+
html, body { height: 100%; overflow: hidden; }
21+
22+
/* ===== THEME VARIABLES ===== */
23+
:root {
24+
--bg-primary: #f5f5f7;
25+
--bg-secondary: #ffffff;
26+
--bg-tertiary: #e5e5e7;
27+
--border: #d1d1d6;
28+
--text-primary: #1d1d1f;
29+
--text-secondary: #86868b;
30+
--text-tertiary: #aeaeb2;
31+
--accent: #0071e3;
32+
--accent-hover: #0077ed;
33+
--success: #34c759;
34+
--warning: #ff9f0a;
35+
--error: #ff3b30;
36+
--selected-bg: #e8f4fd;
37+
--selected-border: #0071e3;
38+
}
39+
40+
@media (prefers-color-scheme: dark) {
41+
:root {
42+
--bg-primary: #1d1d1f;
43+
--bg-secondary: #2d2d2f;
44+
--bg-tertiary: #3d3d3f;
45+
--border: #424245;
46+
--text-primary: #f5f5f7;
47+
--text-secondary: #86868b;
48+
--text-tertiary: #636366;
49+
--accent: #0a84ff;
50+
--accent-hover: #409cff;
51+
--selected-bg: rgba(10, 132, 255, 0.15);
52+
--selected-border: #0a84ff;
53+
}
54+
}
55+
56+
body {
57+
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
58+
background: var(--bg-primary);
59+
color: var(--text-primary);
60+
display: flex;
61+
flex-direction: column;
62+
line-height: 1.5;
63+
}
64+
65+
/* ===== FRAME STRUCTURE ===== */
66+
.header {
67+
background: var(--bg-secondary);
68+
padding: 0.5rem 1.5rem;
69+
display: flex;
70+
justify-content: space-between;
71+
align-items: center;
72+
border-bottom: 1px solid var(--border);
73+
flex-shrink: 0;
74+
}
75+
.header h1 { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
76+
.header .status { font-size: 0.7rem; color: var(--success); display: flex; align-items: center; gap: 0.4rem; }
77+
.header .status::before { content: ''; width: 6px; height: 6px; background: var(--success); border-radius: 50%; }
78+
79+
.main { flex: 1; overflow-y: auto; }
80+
#claude-content { padding: 2rem; min-height: 100%; }
81+
82+
.indicator-bar {
83+
background: var(--bg-secondary);
84+
border-top: 1px solid var(--border);
85+
padding: 0.5rem 1.5rem;
86+
flex-shrink: 0;
87+
text-align: center;
88+
}
89+
.indicator-bar span {
90+
font-size: 0.75rem;
91+
color: var(--text-secondary);
92+
}
93+
.indicator-bar .selected-text {
94+
color: var(--accent);
95+
font-weight: 500;
96+
}
97+
98+
/* ===== TYPOGRAPHY ===== */
99+
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
100+
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
101+
.subtitle { color: var(--text-secondary); margin-bottom: 1.5rem; }
102+
.section { margin-bottom: 2rem; }
103+
.label { font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
104+
105+
/* ===== OPTIONS (for A/B/C choices) ===== */
106+
.options { display: flex; flex-direction: column; gap: 0.75rem; }
107+
.option {
108+
background: var(--bg-secondary);
109+
border: 2px solid var(--border);
110+
border-radius: 12px;
111+
padding: 1rem 1.25rem;
112+
cursor: pointer;
113+
transition: all 0.15s ease;
114+
display: flex;
115+
align-items: flex-start;
116+
gap: 1rem;
117+
}
118+
.option:hover { border-color: var(--accent); }
119+
.option.selected { background: var(--selected-bg); border-color: var(--selected-border); }
120+
.option .letter {
121+
background: var(--bg-tertiary);
122+
color: var(--text-secondary);
123+
width: 1.75rem; height: 1.75rem;
124+
border-radius: 6px;
125+
display: flex; align-items: center; justify-content: center;
126+
font-weight: 600; font-size: 0.85rem; flex-shrink: 0;
127+
}
128+
.option.selected .letter { background: var(--accent); color: white; }
129+
.option .content { flex: 1; }
130+
.option .content h3 { font-size: 0.95rem; margin-bottom: 0.15rem; }
131+
.option .content p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; }
132+
133+
/* ===== CARDS (for showing designs/mockups) ===== */
134+
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
135+
.card {
136+
background: var(--bg-secondary);
137+
border: 1px solid var(--border);
138+
border-radius: 12px;
139+
overflow: hidden;
140+
cursor: pointer;
141+
transition: all 0.15s ease;
142+
}
143+
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
144+
.card.selected { border-color: var(--selected-border); border-width: 2px; }
145+
.card-image { background: var(--bg-tertiary); aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }
146+
.card-body { padding: 1rem; }
147+
.card-body h3 { margin-bottom: 0.25rem; }
148+
.card-body p { color: var(--text-secondary); font-size: 0.85rem; }
149+
150+
/* ===== MOCKUP CONTAINER ===== */
151+
.mockup {
152+
background: var(--bg-secondary);
153+
border: 1px solid var(--border);
154+
border-radius: 12px;
155+
overflow: hidden;
156+
margin-bottom: 1.5rem;
157+
}
158+
.mockup-header {
159+
background: var(--bg-tertiary);
160+
padding: 0.5rem 1rem;
161+
font-size: 0.75rem;
162+
color: var(--text-secondary);
163+
border-bottom: 1px solid var(--border);
164+
}
165+
.mockup-body { padding: 1.5rem; }
166+
167+
/* ===== SPLIT VIEW (side-by-side comparison) ===== */
168+
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
169+
@media (max-width: 700px) { .split { grid-template-columns: 1fr; } }
170+
171+
/* ===== PROS/CONS ===== */
172+
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
173+
.pros, .cons { background: var(--bg-secondary); border-radius: 8px; padding: 1rem; }
174+
.pros h4 { color: var(--success); font-size: 0.85rem; margin-bottom: 0.5rem; }
175+
.cons h4 { color: var(--error); font-size: 0.85rem; margin-bottom: 0.5rem; }
176+
.pros ul, .cons ul { margin-left: 1.25rem; font-size: 0.85rem; color: var(--text-secondary); }
177+
.pros li, .cons li { margin-bottom: 0.25rem; }
178+
179+
/* ===== PLACEHOLDER (for mockup areas) ===== */
180+
.placeholder {
181+
background: var(--bg-tertiary);
182+
border: 2px dashed var(--border);
183+
border-radius: 8px;
184+
padding: 2rem;
185+
text-align: center;
186+
color: var(--text-tertiary);
187+
}
188+
189+
/* ===== INLINE MOCKUP ELEMENTS ===== */
190+
.mock-nav { background: var(--accent); color: white; padding: 0.75rem 1rem; display: flex; gap: 1.5rem; font-size: 0.9rem; }
191+
.mock-sidebar { background: var(--bg-tertiary); padding: 1rem; min-width: 180px; }
192+
.mock-content { padding: 1.5rem; flex: 1; }
193+
.mock-button { background: var(--accent); color: white; border: none; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.85rem; }
194+
.mock-input { background: var(--bg-primary); border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem; width: 100%; }
195+
</style>
196+
</head>
197+
<body>
198+
<div class="header">
199+
<h1><a href="https://github.com/obra/superpowers" style="color: inherit; text-decoration: none;">Superpowers Brainstorming</a></h1>
200+
<div class="status">Connected</div>
201+
</div>
202+
203+
<div class="main">
204+
<div id="claude-content">
205+
<!-- CONTENT -->
206+
</div>
207+
</div>
208+
209+
<div class="indicator-bar">
210+
<span id="indicator-text">Click an option above, then return to the terminal</span>
211+
</div>
212+
213+
</body>
214+
</html>

0 commit comments

Comments
 (0)