opencode-metis 0.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.
- package/README.md +140 -0
- package/dist/cli.cjs +63 -0
- package/dist/mcp-server.cjs +51 -0
- package/dist/plugin.cjs +4 -0
- package/dist/worker.cjs +224 -0
- package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
- package/opencode/agent/the-analyst/market-research.md +77 -0
- package/opencode/agent/the-analyst/project-coordination.md +81 -0
- package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
- package/opencode/agent/the-architect/compatibility-review.md +138 -0
- package/opencode/agent/the-architect/complexity-review.md +137 -0
- package/opencode/agent/the-architect/quality-review.md +67 -0
- package/opencode/agent/the-architect/security-review.md +127 -0
- package/opencode/agent/the-architect/system-architecture.md +119 -0
- package/opencode/agent/the-architect/system-documentation.md +83 -0
- package/opencode/agent/the-architect/technology-research.md +85 -0
- package/opencode/agent/the-chief.md +79 -0
- package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
- package/opencode/agent/the-designer/design-foundation.md +74 -0
- package/opencode/agent/the-designer/interaction-architecture.md +75 -0
- package/opencode/agent/the-designer/user-research.md +70 -0
- package/opencode/agent/the-meta-agent.md +155 -0
- package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
- package/opencode/agent/the-platform-engineer/containerization.md +106 -0
- package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
- package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
- package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
- package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
- package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
- package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
- package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
- package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
- package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
- package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
- package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
- package/opencode/agent/the-software-engineer/api-development.md +78 -0
- package/opencode/agent/the-software-engineer/component-development.md +79 -0
- package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
- package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
- package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
- package/opencode/command/analyze.md +149 -0
- package/opencode/command/constitution.md +178 -0
- package/opencode/command/debug.md +194 -0
- package/opencode/command/document.md +178 -0
- package/opencode/command/implement.md +225 -0
- package/opencode/command/refactor.md +207 -0
- package/opencode/command/review.md +229 -0
- package/opencode/command/simplify.md +267 -0
- package/opencode/command/specify.md +191 -0
- package/opencode/command/validate.md +224 -0
- package/opencode/skill/accessibility-design/SKILL.md +566 -0
- package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
- package/opencode/skill/agent-coordination/SKILL.md +224 -0
- package/opencode/skill/api-contract-design/SKILL.md +550 -0
- package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
- package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
- package/opencode/skill/architecture-design/SKILL.md +160 -0
- package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
- package/opencode/skill/architecture-design/template.md +749 -0
- package/opencode/skill/architecture-design/validation.md +99 -0
- package/opencode/skill/architecture-selection/SKILL.md +522 -0
- package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
- package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
- package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
- package/opencode/skill/code-quality-review/SKILL.md +337 -0
- package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
- package/opencode/skill/code-quality-review/reference.md +322 -0
- package/opencode/skill/code-review/SKILL.md +363 -0
- package/opencode/skill/code-review/reference.md +450 -0
- package/opencode/skill/codebase-analysis/SKILL.md +139 -0
- package/opencode/skill/codebase-navigation/SKILL.md +227 -0
- package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
- package/opencode/skill/coding-conventions/SKILL.md +178 -0
- package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
- package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
- package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
- package/opencode/skill/constitution-validation/SKILL.md +315 -0
- package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
- package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
- package/opencode/skill/constitution-validation/template.md +115 -0
- package/opencode/skill/context-preservation/SKILL.md +445 -0
- package/opencode/skill/data-modeling/SKILL.md +385 -0
- package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
- package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
- package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
- package/opencode/skill/documentation-extraction/SKILL.md +259 -0
- package/opencode/skill/documentation-sync/SKILL.md +431 -0
- package/opencode/skill/domain-driven-design/SKILL.md +509 -0
- package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
- package/opencode/skill/domain-driven-design/reference.md +465 -0
- package/opencode/skill/drift-detection/SKILL.md +383 -0
- package/opencode/skill/drift-detection/reference.md +340 -0
- package/opencode/skill/error-recovery/SKILL.md +162 -0
- package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
- package/opencode/skill/feature-prioritization/SKILL.md +419 -0
- package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
- package/opencode/skill/feature-prioritization/reference.md +256 -0
- package/opencode/skill/git-workflow/SKILL.md +453 -0
- package/opencode/skill/implementation-planning/SKILL.md +215 -0
- package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
- package/opencode/skill/implementation-planning/template.md +220 -0
- package/opencode/skill/implementation-planning/validation.md +88 -0
- package/opencode/skill/implementation-verification/SKILL.md +272 -0
- package/opencode/skill/knowledge-capture/SKILL.md +265 -0
- package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
- package/opencode/skill/knowledge-capture/reference.md +444 -0
- package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
- package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
- package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
- package/opencode/skill/observability-design/SKILL.md +291 -0
- package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
- package/opencode/skill/pattern-detection/SKILL.md +171 -0
- package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
- package/opencode/skill/performance-analysis/SKILL.md +266 -0
- package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
- package/opencode/skill/requirements-analysis/SKILL.md +139 -0
- package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
- package/opencode/skill/requirements-analysis/template.md +177 -0
- package/opencode/skill/requirements-analysis/validation.md +69 -0
- package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
- package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
- package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
- package/opencode/skill/safe-refactoring/SKILL.md +312 -0
- package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
- package/opencode/skill/security-assessment/SKILL.md +421 -0
- package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
- package/opencode/skill/specification-management/SKILL.md +143 -0
- package/opencode/skill/specification-management/readme-template.md +32 -0
- package/opencode/skill/specification-management/reference.md +115 -0
- package/opencode/skill/specification-management/spec.py +229 -0
- package/opencode/skill/specification-validation/SKILL.md +397 -0
- package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
- package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
- package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
- package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
- package/opencode/skill/task-delegation/SKILL.md +607 -0
- package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
- package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
- package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
- package/opencode/skill/task-delegation/reference.md +825 -0
- package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
- package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
- package/opencode/skill/technical-writing/SKILL.md +190 -0
- package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
- package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
- package/opencode/skill/test-design/SKILL.md +464 -0
- package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
- package/opencode/skill/testing/SKILL.md +213 -0
- package/opencode/skill/testing/examples/test-pyramid.md +724 -0
- package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
- package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
- package/opencode/skill/user-research/SKILL.md +508 -0
- package/opencode/skill/user-research/examples/interview-questions.md +265 -0
- package/opencode/skill/user-research/examples/personas.md +267 -0
- package/opencode/skill/vibe-security/SKILL.md +654 -0
- package/package.json +45 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
# Reference: Profiling Tools
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Comprehensive reference for profiling and performance measurement tools organized by language, platform, and profiling type.
|
|
6
|
+
|
|
7
|
+
## Quick Reference
|
|
8
|
+
|
|
9
|
+
| Category | Tool | Best For |
|
|
10
|
+
|----------|------|----------|
|
|
11
|
+
| Node.js CPU | `--prof`, `clinic.js` | V8 profiling, flame graphs |
|
|
12
|
+
| Node.js Memory | `--inspect`, `memwatch` | Heap snapshots, leak detection |
|
|
13
|
+
| Python CPU | `cProfile`, `py-spy` | Function timing, live profiling |
|
|
14
|
+
| Python Memory | `memory_profiler`, `tracemalloc` | Allocation tracking |
|
|
15
|
+
| Java/JVM | JFR, async-profiler | Low-overhead production profiling |
|
|
16
|
+
| Go | `pprof` | Built-in profiling |
|
|
17
|
+
| Browser | DevTools, Lighthouse | Client-side performance |
|
|
18
|
+
| Database | EXPLAIN, pg_stat | Query optimization |
|
|
19
|
+
| System | `perf`, `htop`, `iotop` | Resource utilization |
|
|
20
|
+
|
|
21
|
+
## Node.js Profiling
|
|
22
|
+
|
|
23
|
+
### CPU Profiling
|
|
24
|
+
|
|
25
|
+
**Built-in V8 Profiler**
|
|
26
|
+
```bash
|
|
27
|
+
# Generate V8 profiling log
|
|
28
|
+
node --prof app.js
|
|
29
|
+
|
|
30
|
+
# Process the log into readable format
|
|
31
|
+
node --prof-process isolate-*.log > profile.txt
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Clinic.js Suite**
|
|
35
|
+
```bash
|
|
36
|
+
# Install
|
|
37
|
+
npm install -g clinic
|
|
38
|
+
|
|
39
|
+
# Doctor - overall health check
|
|
40
|
+
clinic doctor -- node app.js
|
|
41
|
+
|
|
42
|
+
# Flame - flame graphs
|
|
43
|
+
clinic flame -- node app.js
|
|
44
|
+
|
|
45
|
+
# Bubbleprof - async operations
|
|
46
|
+
clinic bubbleprof -- node app.js
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**0x - Flame Graphs**
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g 0x
|
|
52
|
+
0x app.js
|
|
53
|
+
# Opens flame graph in browser
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Memory Profiling
|
|
57
|
+
|
|
58
|
+
**Chrome DevTools (via --inspect)**
|
|
59
|
+
```bash
|
|
60
|
+
node --inspect app.js
|
|
61
|
+
# Open chrome://inspect in Chrome
|
|
62
|
+
# Take heap snapshots, record allocations
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**heapdump Module**
|
|
66
|
+
```javascript
|
|
67
|
+
const heapdump = require('heapdump');
|
|
68
|
+
heapdump.writeSnapshot('/tmp/heap-' + Date.now() + '.heapsnapshot');
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**memwatch-next**
|
|
72
|
+
```javascript
|
|
73
|
+
const memwatch = require('memwatch-next');
|
|
74
|
+
|
|
75
|
+
memwatch.on('leak', (info) => {
|
|
76
|
+
console.log('Memory leak detected:', info);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
memwatch.on('stats', (stats) => {
|
|
80
|
+
console.log('GC stats:', stats);
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### APM Solutions
|
|
85
|
+
|
|
86
|
+
| Tool | Description |
|
|
87
|
+
|------|-------------|
|
|
88
|
+
| New Relic | Full-stack APM with Node.js agent |
|
|
89
|
+
| Datadog | APM with distributed tracing |
|
|
90
|
+
| Dynatrace | AI-powered APM |
|
|
91
|
+
| AppSignal | Lightweight APM for Node.js |
|
|
92
|
+
|
|
93
|
+
## Python Profiling
|
|
94
|
+
|
|
95
|
+
### CPU Profiling
|
|
96
|
+
|
|
97
|
+
**cProfile (Built-in)**
|
|
98
|
+
```bash
|
|
99
|
+
# Profile entire script
|
|
100
|
+
python -m cProfile -o output.prof script.py
|
|
101
|
+
|
|
102
|
+
# Analyze results
|
|
103
|
+
python -m pstats output.prof
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import cProfile
|
|
108
|
+
import pstats
|
|
109
|
+
|
|
110
|
+
profiler = cProfile.Profile()
|
|
111
|
+
profiler.enable()
|
|
112
|
+
# ... code to profile ...
|
|
113
|
+
profiler.disable()
|
|
114
|
+
stats = pstats.Stats(profiler).sort_stats('cumtime')
|
|
115
|
+
stats.print_stats(10) # Top 10 functions
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**py-spy (Low Overhead)**
|
|
119
|
+
```bash
|
|
120
|
+
pip install py-spy
|
|
121
|
+
|
|
122
|
+
# Sample running process
|
|
123
|
+
py-spy top --pid 12345
|
|
124
|
+
|
|
125
|
+
# Generate flame graph
|
|
126
|
+
py-spy record -o profile.svg --pid 12345
|
|
127
|
+
|
|
128
|
+
# Profile script directly
|
|
129
|
+
py-spy record -o profile.svg -- python script.py
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**line_profiler**
|
|
133
|
+
```python
|
|
134
|
+
# Decorate functions to profile
|
|
135
|
+
@profile
|
|
136
|
+
def slow_function():
|
|
137
|
+
pass
|
|
138
|
+
|
|
139
|
+
# Run with kernprof
|
|
140
|
+
# kernprof -l -v script.py
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Memory Profiling
|
|
144
|
+
|
|
145
|
+
**memory_profiler**
|
|
146
|
+
```python
|
|
147
|
+
from memory_profiler import profile
|
|
148
|
+
|
|
149
|
+
@profile
|
|
150
|
+
def memory_intensive():
|
|
151
|
+
large_list = [i for i in range(1000000)]
|
|
152
|
+
return large_list
|
|
153
|
+
|
|
154
|
+
# Run: python -m memory_profiler script.py
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**tracemalloc (Built-in)**
|
|
158
|
+
```python
|
|
159
|
+
import tracemalloc
|
|
160
|
+
|
|
161
|
+
tracemalloc.start()
|
|
162
|
+
# ... code to profile ...
|
|
163
|
+
snapshot = tracemalloc.take_snapshot()
|
|
164
|
+
top_stats = snapshot.statistics('lineno')
|
|
165
|
+
|
|
166
|
+
for stat in top_stats[:10]:
|
|
167
|
+
print(stat)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**objgraph**
|
|
171
|
+
```python
|
|
172
|
+
import objgraph
|
|
173
|
+
|
|
174
|
+
# Show most common types
|
|
175
|
+
objgraph.show_most_common_types()
|
|
176
|
+
|
|
177
|
+
# Find reference chains to objects
|
|
178
|
+
objgraph.show_backrefs(objgraph.by_type('MyClass')[0])
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Java/JVM Profiling
|
|
182
|
+
|
|
183
|
+
### Java Flight Recorder (JFR)
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Start recording
|
|
187
|
+
java -XX:StartFlightRecording=duration=60s,filename=recording.jfr MyApp
|
|
188
|
+
|
|
189
|
+
# Analyze with JDK Mission Control
|
|
190
|
+
jmc recording.jfr
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### async-profiler
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Attach to running process
|
|
197
|
+
./profiler.sh -d 30 -f profile.html <pid>
|
|
198
|
+
|
|
199
|
+
# Profile specific events
|
|
200
|
+
./profiler.sh -e cpu -d 30 -f cpu.html <pid>
|
|
201
|
+
./profiler.sh -e alloc -d 30 -f alloc.html <pid>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### VisualVM
|
|
205
|
+
|
|
206
|
+
- Connect to local or remote JVM
|
|
207
|
+
- CPU and memory profiling
|
|
208
|
+
- Heap dump analysis
|
|
209
|
+
- Thread monitoring
|
|
210
|
+
|
|
211
|
+
### JVM Flags for Profiling
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# GC logging
|
|
215
|
+
-Xlog:gc*:file=gc.log
|
|
216
|
+
|
|
217
|
+
# Heap dump on OOM
|
|
218
|
+
-XX:+HeapDumpOnOutOfMemoryError
|
|
219
|
+
-XX:HeapDumpPath=/tmp/heapdump.hprof
|
|
220
|
+
|
|
221
|
+
# JFR continuous recording
|
|
222
|
+
-XX:StartFlightRecording=disk=true,maxsize=500m
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Go Profiling
|
|
226
|
+
|
|
227
|
+
### pprof (Built-in)
|
|
228
|
+
|
|
229
|
+
```go
|
|
230
|
+
import (
|
|
231
|
+
"net/http"
|
|
232
|
+
_ "net/http/pprof"
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
func main() {
|
|
236
|
+
go func() {
|
|
237
|
+
http.ListenAndServe("localhost:6060", nil)
|
|
238
|
+
}()
|
|
239
|
+
// ... application code ...
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# CPU profile
|
|
245
|
+
go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
|
|
246
|
+
|
|
247
|
+
# Memory profile
|
|
248
|
+
go tool pprof http://localhost:6060/debug/pprof/heap
|
|
249
|
+
|
|
250
|
+
# Interactive commands
|
|
251
|
+
(pprof) top10
|
|
252
|
+
(pprof) web # Generates SVG
|
|
253
|
+
(pprof) list main # Source annotation
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Benchmarking
|
|
257
|
+
|
|
258
|
+
```go
|
|
259
|
+
func BenchmarkFunction(b *testing.B) {
|
|
260
|
+
for i := 0; i < b.N; i++ {
|
|
261
|
+
FunctionToTest()
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Run benchmarks with profiling
|
|
268
|
+
go test -bench=. -cpuprofile=cpu.prof -memprofile=mem.prof
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Browser/Frontend Profiling
|
|
272
|
+
|
|
273
|
+
### Chrome DevTools
|
|
274
|
+
|
|
275
|
+
**Performance Tab**
|
|
276
|
+
- Record page load or interaction
|
|
277
|
+
- Flame chart of JavaScript execution
|
|
278
|
+
- Layout and paint events
|
|
279
|
+
- Memory timeline
|
|
280
|
+
|
|
281
|
+
**Memory Tab**
|
|
282
|
+
- Heap snapshots
|
|
283
|
+
- Allocation timeline
|
|
284
|
+
- Allocation profiler
|
|
285
|
+
|
|
286
|
+
**Lighthouse**
|
|
287
|
+
- Core Web Vitals measurement
|
|
288
|
+
- Performance scoring
|
|
289
|
+
- Optimization recommendations
|
|
290
|
+
|
|
291
|
+
### Key Metrics
|
|
292
|
+
|
|
293
|
+
| Metric | Target | Description |
|
|
294
|
+
|--------|--------|-------------|
|
|
295
|
+
| LCP | < 2.5s | Largest Contentful Paint |
|
|
296
|
+
| FID | < 100ms | First Input Delay |
|
|
297
|
+
| CLS | < 0.1 | Cumulative Layout Shift |
|
|
298
|
+
| INP | < 200ms | Interaction to Next Paint |
|
|
299
|
+
| TTFB | < 800ms | Time to First Byte |
|
|
300
|
+
|
|
301
|
+
### Bundle Analysis
|
|
302
|
+
|
|
303
|
+
**webpack-bundle-analyzer**
|
|
304
|
+
```bash
|
|
305
|
+
npm install --save-dev webpack-bundle-analyzer
|
|
306
|
+
|
|
307
|
+
# In webpack config
|
|
308
|
+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
309
|
+
plugins: [new BundleAnalyzerPlugin()]
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
**source-map-explorer**
|
|
313
|
+
```bash
|
|
314
|
+
npm install -g source-map-explorer
|
|
315
|
+
source-map-explorer bundle.js
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## Database Profiling
|
|
319
|
+
|
|
320
|
+
### PostgreSQL
|
|
321
|
+
|
|
322
|
+
**EXPLAIN ANALYZE**
|
|
323
|
+
```sql
|
|
324
|
+
EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT)
|
|
325
|
+
SELECT * FROM users WHERE email = 'user@example.com';
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**pg_stat_statements**
|
|
329
|
+
```sql
|
|
330
|
+
-- Enable extension
|
|
331
|
+
CREATE EXTENSION pg_stat_statements;
|
|
332
|
+
|
|
333
|
+
-- View slow queries
|
|
334
|
+
SELECT query, calls, total_time, mean_time
|
|
335
|
+
FROM pg_stat_statements
|
|
336
|
+
ORDER BY total_time DESC
|
|
337
|
+
LIMIT 20;
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**pg_stat_user_tables**
|
|
341
|
+
```sql
|
|
342
|
+
-- Check index usage
|
|
343
|
+
SELECT relname, seq_scan, idx_scan, n_tup_ins, n_tup_upd
|
|
344
|
+
FROM pg_stat_user_tables;
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### MySQL
|
|
348
|
+
|
|
349
|
+
**EXPLAIN**
|
|
350
|
+
```sql
|
|
351
|
+
EXPLAIN FORMAT=JSON SELECT * FROM users WHERE email = 'user@example.com';
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Performance Schema**
|
|
355
|
+
```sql
|
|
356
|
+
-- Enable statement history
|
|
357
|
+
UPDATE performance_schema.setup_consumers
|
|
358
|
+
SET enabled = 'YES'
|
|
359
|
+
WHERE name = 'events_statements_history';
|
|
360
|
+
|
|
361
|
+
-- Query digest
|
|
362
|
+
SELECT DIGEST_TEXT, COUNT_STAR, AVG_TIMER_WAIT/1000000000 as avg_ms
|
|
363
|
+
FROM performance_schema.events_statements_summary_by_digest
|
|
364
|
+
ORDER BY AVG_TIMER_WAIT DESC
|
|
365
|
+
LIMIT 10;
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Slow Query Log**
|
|
369
|
+
```ini
|
|
370
|
+
# my.cnf
|
|
371
|
+
slow_query_log = 1
|
|
372
|
+
slow_query_log_file = /var/log/mysql/slow.log
|
|
373
|
+
long_query_time = 1
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### MongoDB
|
|
377
|
+
|
|
378
|
+
**explain()**
|
|
379
|
+
```javascript
|
|
380
|
+
db.collection.find({email: "user@example.com"}).explain("executionStats")
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Profiler**
|
|
384
|
+
```javascript
|
|
385
|
+
// Enable profiling for slow queries (> 100ms)
|
|
386
|
+
db.setProfilingLevel(1, { slowms: 100 })
|
|
387
|
+
|
|
388
|
+
// View profiler output
|
|
389
|
+
db.system.profile.find().sort({ ts: -1 }).limit(5)
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
## System Profiling
|
|
393
|
+
|
|
394
|
+
### Linux Tools
|
|
395
|
+
|
|
396
|
+
**perf**
|
|
397
|
+
```bash
|
|
398
|
+
# CPU profiling
|
|
399
|
+
perf record -g ./app
|
|
400
|
+
perf report
|
|
401
|
+
|
|
402
|
+
# Flame graph generation
|
|
403
|
+
perf script | ./stackcollapse-perf.pl | ./flamegraph.pl > perf.svg
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
**htop**
|
|
407
|
+
- Interactive process viewer
|
|
408
|
+
- CPU, memory per process
|
|
409
|
+
- Thread view
|
|
410
|
+
|
|
411
|
+
**iotop**
|
|
412
|
+
```bash
|
|
413
|
+
# Disk I/O per process
|
|
414
|
+
iotop -o # Only show processes doing I/O
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**nethogs**
|
|
418
|
+
```bash
|
|
419
|
+
# Network usage per process
|
|
420
|
+
nethogs eth0
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**vmstat**
|
|
424
|
+
```bash
|
|
425
|
+
# System resource statistics
|
|
426
|
+
vmstat 1 # Every 1 second
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Tracing
|
|
430
|
+
|
|
431
|
+
**strace**
|
|
432
|
+
```bash
|
|
433
|
+
# System calls
|
|
434
|
+
strace -c ./app # Summary
|
|
435
|
+
strace -e open ./app # Specific syscalls
|
|
436
|
+
strace -p <pid> # Attach to process
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**ltrace**
|
|
440
|
+
```bash
|
|
441
|
+
# Library calls
|
|
442
|
+
ltrace ./app
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
## Distributed Tracing
|
|
446
|
+
|
|
447
|
+
### OpenTelemetry
|
|
448
|
+
|
|
449
|
+
Standard for traces, metrics, and logs across services.
|
|
450
|
+
|
|
451
|
+
| Tool | Description |
|
|
452
|
+
|------|-------------|
|
|
453
|
+
| Jaeger | Open-source distributed tracing |
|
|
454
|
+
| Zipkin | Distributed tracing system |
|
|
455
|
+
| Tempo | Grafana's tracing backend |
|
|
456
|
+
| Honeycomb | Observability platform |
|
|
457
|
+
|
|
458
|
+
### Key Concepts
|
|
459
|
+
|
|
460
|
+
- **Trace**: End-to-end request journey
|
|
461
|
+
- **Span**: Individual operation within a trace
|
|
462
|
+
- **Context propagation**: Passing trace IDs across services
|
|
463
|
+
|
|
464
|
+
## Load Testing Tools
|
|
465
|
+
|
|
466
|
+
| Tool | Best For |
|
|
467
|
+
|------|----------|
|
|
468
|
+
| k6 | JavaScript-based, CI-friendly |
|
|
469
|
+
| Apache JMeter | Complex scenarios, GUI |
|
|
470
|
+
| Locust | Python-based, distributed |
|
|
471
|
+
| Gatling | Scala-based, detailed reports |
|
|
472
|
+
| wrk | Simple HTTP benchmarking |
|
|
473
|
+
| ab (ApacheBench) | Quick HTTP benchmarks |
|
|
474
|
+
|
|
475
|
+
### k6 Example
|
|
476
|
+
|
|
477
|
+
```javascript
|
|
478
|
+
import http from 'k6/http';
|
|
479
|
+
import { check, sleep } from 'k6';
|
|
480
|
+
|
|
481
|
+
export const options = {
|
|
482
|
+
vus: 100,
|
|
483
|
+
duration: '30s',
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
export default function () {
|
|
487
|
+
const res = http.get('https://api.example.com/');
|
|
488
|
+
check(res, { 'status was 200': (r) => r.status === 200 });
|
|
489
|
+
sleep(1);
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## External Resources
|
|
494
|
+
|
|
495
|
+
- [Brendan Gregg's Performance Tools](http://www.brendangregg.com/linuxperf.html) - Linux performance analysis
|
|
496
|
+
- [Flame Graphs](http://www.brendangregg.com/flamegraphs.html) - Visualization technique
|
|
497
|
+
- [web.dev Performance](https://web.dev/performance/) - Web performance guides
|
|
498
|
+
- [USE Method](http://www.brendangregg.com/usemethod.html) - Resource analysis methodology
|
|
499
|
+
- [Node.js Performance Guide](https://nodejs.org/en/docs/guides/dont-block-the-event-loop/) - Event loop optimization
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requirements-analysis
|
|
3
|
+
description: "Provides methodology for creating and validating product requirements documents (PRD) with iterative cycle patterns, multi-angle review, and validation checklists"
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
metadata:
|
|
7
|
+
category: analysis
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Requirements Analysis
|
|
12
|
+
|
|
13
|
+
Roleplay as a product requirements specialist that creates and validates PRDs focusing on WHAT needs to be built and WHY it matters.
|
|
14
|
+
|
|
15
|
+
RequirementsAnalysis {
|
|
16
|
+
Activation {
|
|
17
|
+
When to use this skill:
|
|
18
|
+
- Create a new PRD from the template
|
|
19
|
+
- Complete sections in an existing product-requirements.md
|
|
20
|
+
- Validate PRD completeness and quality
|
|
21
|
+
- Review requirements from multiple perspectives
|
|
22
|
+
- Work on any `product-requirements.md` file in docs/specs/
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
Template {
|
|
26
|
+
Constraints {
|
|
27
|
+
1. The PRD template is at [template.md](template.md) -- use this structure exactly
|
|
28
|
+
2. Read the template from this skill's directory
|
|
29
|
+
3. Write to spec directory: `docs/specs/[NNN]-[name]/product-requirements.md`
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
PRDFocusAreas {
|
|
34
|
+
WhenWorkingOnPRD {
|
|
35
|
+
Focus on:
|
|
36
|
+
- **WHAT** needs to be built (features, capabilities)
|
|
37
|
+
- **WHY** it matters (problem, value proposition)
|
|
38
|
+
- **WHO** uses it (personas, journeys)
|
|
39
|
+
- **WHEN** it succeeds (metrics, acceptance criteria)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
KeepInSDD {
|
|
43
|
+
These belong in the Solution Design Document (SDD), not PRD:
|
|
44
|
+
- Technical implementation details
|
|
45
|
+
- Architecture decisions
|
|
46
|
+
- Database schemas
|
|
47
|
+
- API specifications
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
CyclePattern {
|
|
52
|
+
DiscoveryPhase {
|
|
53
|
+
- Identify ALL activities needed based on missing information
|
|
54
|
+
- Launch parallel specialist agents to investigate:
|
|
55
|
+
- Market analysis for competitive landscape
|
|
56
|
+
- User research for personas and journeys
|
|
57
|
+
- Requirements clarification for edge cases
|
|
58
|
+
- Consider relevant research areas, best practices, success criteria
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
DocumentationPhase {
|
|
62
|
+
- Update the PRD with research findings
|
|
63
|
+
- Replace [NEEDS CLARIFICATION] markers with actual content
|
|
64
|
+
- Focus only on current section being processed
|
|
65
|
+
- Follow template structure exactly -- preserve all sections as defined
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ReviewPhase {
|
|
69
|
+
- Present ALL agent findings to user (complete responses, not summaries)
|
|
70
|
+
- Show conflicting information or recommendations
|
|
71
|
+
- Present proposed content based on research
|
|
72
|
+
- Highlight questions needing user clarification
|
|
73
|
+
- Wait for user confirmation before next cycle
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
SelfCheck {
|
|
77
|
+
Ask yourself each cycle:
|
|
78
|
+
1. Have I identified ALL activities needed for this section?
|
|
79
|
+
2. Have I launched parallel specialist agents to investigate?
|
|
80
|
+
3. Have I updated the PRD according to findings?
|
|
81
|
+
4. Have I presented COMPLETE agent responses to the user?
|
|
82
|
+
5. Have I received user confirmation before proceeding?
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
MultiAngleFinalValidation {
|
|
87
|
+
ContextReview {
|
|
88
|
+
Verify:
|
|
89
|
+
- Problem statement clarity - is it specific and measurable?
|
|
90
|
+
- User persona completeness - do we understand our users?
|
|
91
|
+
- Value proposition strength - is it compelling?
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
GapAnalysis {
|
|
95
|
+
Identify:
|
|
96
|
+
- Gaps in user journeys
|
|
97
|
+
- Missing edge cases
|
|
98
|
+
- Unclear acceptance criteria
|
|
99
|
+
- Contradictions between sections
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
UserInput {
|
|
103
|
+
Based on gaps found:
|
|
104
|
+
- Formulate specific questions for the user
|
|
105
|
+
- Probe alternative scenarios
|
|
106
|
+
- Validate priority trade-offs
|
|
107
|
+
- Confirm success criteria
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
CoherenceValidation {
|
|
111
|
+
Confirm:
|
|
112
|
+
- Requirements completeness
|
|
113
|
+
- Feasibility assessment
|
|
114
|
+
- Alignment with stated goals
|
|
115
|
+
- Edge case coverage
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
ValidationChecklist {
|
|
120
|
+
See [validation.md](validation.md) for the complete checklist. Key gates:
|
|
121
|
+
- [ ] All required sections are complete
|
|
122
|
+
- [ ] No [NEEDS CLARIFICATION] markers remain
|
|
123
|
+
- [ ] Problem statement is specific and measurable
|
|
124
|
+
- [ ] Problem is validated by evidence (not assumptions)
|
|
125
|
+
- [ ] Context to Problem to Solution flow makes sense
|
|
126
|
+
- [ ] Every persona has at least one user journey
|
|
127
|
+
- [ ] All MoSCoW categories addressed (Must/Should/Could/Won't)
|
|
128
|
+
- [ ] Every feature has testable acceptance criteria
|
|
129
|
+
- [ ] Every metric has corresponding tracking events
|
|
130
|
+
- [ ] No feature redundancy (check for duplicates)
|
|
131
|
+
- [ ] No contradictions between sections
|
|
132
|
+
- [ ] No technical implementation details included
|
|
133
|
+
- [ ] A new team member could understand this PRD
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
Examples {
|
|
137
|
+
See [examples/good-prd.md](examples/good-prd.md) for reference on well-structured PRDs.
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Example: Well-Structured PRD
|
|
2
|
+
|
|
3
|
+
This example demonstrates a properly completed PRD section for reference.
|
|
4
|
+
|
|
5
|
+
## Product Overview (Example)
|
|
6
|
+
|
|
7
|
+
### Vision
|
|
8
|
+
Enable small business owners to accept payments anywhere, anytime, without complex setup or expensive hardware.
|
|
9
|
+
|
|
10
|
+
### Problem Statement
|
|
11
|
+
Small business owners lose an average of $2,400 annually in sales because they can only accept cash or checks. 73% of consumers prefer card payments, and businesses without card acceptance miss 1 in 4 sales opportunities. The existing solutions require expensive hardware ($300+), complex contracts, and take 2-3 weeks to set up.
|
|
12
|
+
|
|
13
|
+
### Value Proposition
|
|
14
|
+
Instant mobile payment acceptance with just a smartphone. No hardware needed, no long-term contracts, and setup takes under 5 minutes. Businesses can start accepting payments today at a flat 2.5% rate with next-day deposits.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## User Personas (Example)
|
|
19
|
+
|
|
20
|
+
### Primary Persona: Sarah the Solo Entrepreneur
|
|
21
|
+
- **Demographics:** Age 28-45, runs a service business (cleaning, tutoring, personal training), moderate tech comfort, uses smartphone daily
|
|
22
|
+
- **Goals:** Accept payments immediately after service, look professional to clients, minimize time spent on admin tasks
|
|
23
|
+
- **Pain Points:** Loses clients who don't carry cash, awkward payment conversations, delayed payments hurt cash flow
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Feature Requirements (Example)
|
|
28
|
+
|
|
29
|
+
### Must Have Features
|
|
30
|
+
|
|
31
|
+
#### Feature 1: One-Tap Payment Request
|
|
32
|
+
- **User Story:** As Sarah, I want to send a payment request with one tap so that I can get paid immediately after finishing a service
|
|
33
|
+
- **Acceptance Criteria:**
|
|
34
|
+
- [ ] Can create payment request in under 10 seconds
|
|
35
|
+
- [ ] Customer receives request via SMS or email
|
|
36
|
+
- [ ] Payment completes within 30 seconds of customer action
|
|
37
|
+
- [ ] Confirmation shown to both parties immediately
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Success Metrics (Example)
|
|
42
|
+
|
|
43
|
+
### Key Performance Indicators
|
|
44
|
+
- **Adoption:** 10,000 active merchants in first 6 months (merchants who process at least 1 payment/month)
|
|
45
|
+
- **Engagement:** Average 8 transactions per merchant per month
|
|
46
|
+
- **Quality:** Payment success rate > 98%, support ticket rate < 2%
|
|
47
|
+
- **Business Impact:** $50M monthly payment volume by month 12
|
|
48
|
+
|
|
49
|
+
### Tracking Requirements
|
|
50
|
+
| Event | Properties | Purpose |
|
|
51
|
+
|-------|------------|---------|
|
|
52
|
+
| payment_request_created | amount, merchant_id, request_method | Measure adoption and behavior |
|
|
53
|
+
| payment_completed | amount, time_to_complete, payment_method | Measure success and speed |
|
|
54
|
+
| payment_failed | error_code, step_failed | Identify friction points |
|
|
55
|
+
| merchant_churned | last_active_date, total_processed | Understand retention |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## What Makes This PRD Good
|
|
60
|
+
|
|
61
|
+
1. **Specific Problem Statement** - Includes data (73%, $2,400, 1 in 4 sales)
|
|
62
|
+
2. **Clear Personas** - Demographics, goals, and pain points defined
|
|
63
|
+
3. **Testable Acceptance Criteria** - Time limits, specific actions, measurable outcomes
|
|
64
|
+
4. **Measurable KPIs** - Numbers and timeframes specified
|
|
65
|
+
5. **No Technical Details** - Doesn't mention databases, APIs, or architecture
|
|
66
|
+
6. **User-Centric Language** - Written from user perspective
|