pmx-canvas 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.
Files changed (226) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/LICENSE +21 -0
  3. package/Readme.md +865 -0
  4. package/dist/canvas/global.css +3173 -0
  5. package/dist/canvas/index.js +183 -0
  6. package/dist/json-render/index.css +2 -0
  7. package/dist/json-render/index.js +389 -0
  8. package/dist/types/cli/agent.d.ts +13 -0
  9. package/dist/types/cli/index.d.ts +2 -0
  10. package/dist/types/cli/watch.d.ts +5 -0
  11. package/dist/types/client/App.d.ts +1 -0
  12. package/dist/types/client/canvas/AttentionHistory.d.ts +1 -0
  13. package/dist/types/client/canvas/AttentionToast.d.ts +1 -0
  14. package/dist/types/client/canvas/CanvasNode.d.ts +8 -0
  15. package/dist/types/client/canvas/CanvasViewport.d.ts +8 -0
  16. package/dist/types/client/canvas/CommandPalette.d.ts +4 -0
  17. package/dist/types/client/canvas/ContextMenu.d.ts +24 -0
  18. package/dist/types/client/canvas/ContextPinBar.d.ts +1 -0
  19. package/dist/types/client/canvas/ContextPinHud.d.ts +1 -0
  20. package/dist/types/client/canvas/DockedNode.d.ts +4 -0
  21. package/dist/types/client/canvas/EdgeLayer.d.ts +8 -0
  22. package/dist/types/client/canvas/ExpandedNodeOverlay.d.ts +1 -0
  23. package/dist/types/client/canvas/FocusFieldLayer.d.ts +1 -0
  24. package/dist/types/client/canvas/Minimap.d.ts +23 -0
  25. package/dist/types/client/canvas/SelectionBar.d.ts +1 -0
  26. package/dist/types/client/canvas/ShortcutOverlay.d.ts +3 -0
  27. package/dist/types/client/canvas/SnapshotPanel.d.ts +7 -0
  28. package/dist/types/client/canvas/snap-guides.d.ts +23 -0
  29. package/dist/types/client/canvas/use-node-drag.d.ts +15 -0
  30. package/dist/types/client/canvas/use-node-resize.d.ts +15 -0
  31. package/dist/types/client/canvas/use-pan-zoom.d.ts +16 -0
  32. package/dist/types/client/ext-app/bridge.d.ts +161 -0
  33. package/dist/types/client/icons.d.ts +70 -0
  34. package/dist/types/client/index.d.ts +1 -0
  35. package/dist/types/client/nodes/ContextNode.d.ts +34 -0
  36. package/dist/types/client/nodes/ExtAppFrame.d.ts +18 -0
  37. package/dist/types/client/nodes/FileNode.d.ts +5 -0
  38. package/dist/types/client/nodes/GroupNode.d.ts +6 -0
  39. package/dist/types/client/nodes/ImageNode.d.ts +10 -0
  40. package/dist/types/client/nodes/InlineFormatBar.d.ts +7 -0
  41. package/dist/types/client/nodes/InlineMarkdownEditor.d.ts +14 -0
  42. package/dist/types/client/nodes/LedgerNode.d.ts +4 -0
  43. package/dist/types/client/nodes/MarkdownNode.d.ts +6 -0
  44. package/dist/types/client/nodes/McpAppNode.d.ts +4 -0
  45. package/dist/types/client/nodes/MdFormatBar.d.ts +8 -0
  46. package/dist/types/client/nodes/PromptNode.d.ts +5 -0
  47. package/dist/types/client/nodes/ResponseNode.d.ts +5 -0
  48. package/dist/types/client/nodes/StatusNode.d.ts +4 -0
  49. package/dist/types/client/nodes/StatusSummary.d.ts +4 -0
  50. package/dist/types/client/nodes/TraceNode.d.ts +4 -0
  51. package/dist/types/client/nodes/WebpageNode.d.ts +5 -0
  52. package/dist/types/client/nodes/image-warnings.d.ts +6 -0
  53. package/dist/types/client/nodes/inline-editor-commands.d.ts +11 -0
  54. package/dist/types/client/nodes/md-format.d.ts +25 -0
  55. package/dist/types/client/state/attention-bridge.d.ts +3 -0
  56. package/dist/types/client/state/attention-store.d.ts +25 -0
  57. package/dist/types/client/state/canvas-store.d.ts +74 -0
  58. package/dist/types/client/state/intent-bridge.d.ts +158 -0
  59. package/dist/types/client/state/sse-bridge.d.ts +5 -0
  60. package/dist/types/client/theme/tokens.d.ts +27 -0
  61. package/dist/types/client/types.d.ts +40 -0
  62. package/dist/types/client/utils/ext-app-tool-result.d.ts +1 -0
  63. package/dist/types/client/utils/placement.d.ts +1 -0
  64. package/dist/types/client/utils/platform.d.ts +2 -0
  65. package/dist/types/json-render/catalog.d.ts +815 -0
  66. package/dist/types/json-render/charts/components.d.ts +54 -0
  67. package/dist/types/json-render/charts/definitions.d.ts +103 -0
  68. package/dist/types/json-render/charts/extra-components.d.ts +58 -0
  69. package/dist/types/json-render/charts/extra-definitions.d.ts +181 -0
  70. package/dist/types/json-render/renderer/index.d.ts +16 -0
  71. package/dist/types/json-render/schema.d.ts +46 -0
  72. package/dist/types/json-render/server.d.ts +55 -0
  73. package/dist/types/mcp/server.d.ts +22 -0
  74. package/dist/types/server/agent-context.d.ts +21 -0
  75. package/dist/types/server/artifact-paths.d.ts +3 -0
  76. package/dist/types/server/canvas-operations.d.ts +154 -0
  77. package/dist/types/server/canvas-provenance.d.ts +13 -0
  78. package/dist/types/server/canvas-schema.d.ts +49 -0
  79. package/dist/types/server/canvas-serialization.d.ts +25 -0
  80. package/dist/types/server/canvas-state.d.ts +174 -0
  81. package/dist/types/server/canvas-validation.d.ts +33 -0
  82. package/dist/types/server/chart-template.d.ts +29 -0
  83. package/dist/types/server/code-graph.d.ts +67 -0
  84. package/dist/types/server/context-cards.d.ts +24 -0
  85. package/dist/types/server/diagram-presets.d.ts +28 -0
  86. package/dist/types/server/ext-app-call-registry.d.ts +16 -0
  87. package/dist/types/server/ext-app-tool-result.d.ts +1 -0
  88. package/dist/types/server/file-watcher.d.ts +16 -0
  89. package/dist/types/server/index.d.ts +243 -0
  90. package/dist/types/server/mcp-app-candidate.d.ts +25 -0
  91. package/dist/types/server/mcp-app-host.d.ts +65 -0
  92. package/dist/types/server/mcp-app-runtime.d.ts +47 -0
  93. package/dist/types/server/mutation-history.d.ts +105 -0
  94. package/dist/types/server/placement.d.ts +37 -0
  95. package/dist/types/server/server.d.ts +103 -0
  96. package/dist/types/server/spatial-analysis.d.ts +87 -0
  97. package/dist/types/server/trace-manager.d.ts +48 -0
  98. package/dist/types/server/web-artifacts.d.ts +50 -0
  99. package/dist/types/server/webpage-node.d.ts +25 -0
  100. package/dist/types/shared/auto-arrange.d.ts +29 -0
  101. package/dist/types/shared/ext-app-tool-result.d.ts +9 -0
  102. package/dist/types/shared/placement.d.ts +26 -0
  103. package/dist/types/shared/semantic-attention.d.ts +97 -0
  104. package/package.json +109 -0
  105. package/skills/data-analysis/SKILL.md +324 -0
  106. package/skills/doc-coauthoring/SKILL.md +375 -0
  107. package/skills/frontend-design/SKILL.md +45 -0
  108. package/skills/json-render-codegen/SKILL.md +112 -0
  109. package/skills/json-render-core/SKILL.md +265 -0
  110. package/skills/json-render-ink/SKILL.md +273 -0
  111. package/skills/json-render-mcp/SKILL.md +132 -0
  112. package/skills/json-render-react/SKILL.md +264 -0
  113. package/skills/json-render-shadcn/SKILL.md +159 -0
  114. package/skills/playwright-cli/SKILL.md +67 -0
  115. package/skills/pmx-canvas/SKILL.md +668 -0
  116. package/skills/pmx-canvas/evals/evals.json +186 -0
  117. package/skills/pmx-canvas-testing/SKILL.md +78 -0
  118. package/skills/published-consumer-e2e/SKILL.md +43 -0
  119. package/skills/published-consumer-e2e/scripts/run-published-consumer-e2e.sh +241 -0
  120. package/skills/web-artifacts-builder/SKILL.md +80 -0
  121. package/skills/web-artifacts-builder/scripts/bundle-artifact.sh +167 -0
  122. package/skills/web-artifacts-builder/scripts/init-artifact.sh +425 -0
  123. package/skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
  124. package/skills/web-design-guidelines/SKILL.md +39 -0
  125. package/src/cli/agent.ts +2144 -0
  126. package/src/cli/index.ts +622 -0
  127. package/src/cli/watch.ts +88 -0
  128. package/src/client/App.tsx +507 -0
  129. package/src/client/canvas/AttentionHistory.tsx +81 -0
  130. package/src/client/canvas/AttentionToast.tsx +19 -0
  131. package/src/client/canvas/CanvasNode.tsx +363 -0
  132. package/src/client/canvas/CanvasViewport.tsx +590 -0
  133. package/src/client/canvas/CommandPalette.tsx +302 -0
  134. package/src/client/canvas/ContextMenu.tsx +601 -0
  135. package/src/client/canvas/ContextPinBar.tsx +25 -0
  136. package/src/client/canvas/ContextPinHud.tsx +22 -0
  137. package/src/client/canvas/DockedNode.tsx +66 -0
  138. package/src/client/canvas/EdgeLayer.tsx +280 -0
  139. package/src/client/canvas/ExpandedNodeOverlay.tsx +260 -0
  140. package/src/client/canvas/FocusFieldLayer.tsx +107 -0
  141. package/src/client/canvas/Minimap.tsx +301 -0
  142. package/src/client/canvas/SelectionBar.tsx +69 -0
  143. package/src/client/canvas/ShortcutOverlay.tsx +69 -0
  144. package/src/client/canvas/SnapshotPanel.tsx +236 -0
  145. package/src/client/canvas/snap-guides.ts +170 -0
  146. package/src/client/canvas/use-node-drag.ts +51 -0
  147. package/src/client/canvas/use-node-resize.ts +59 -0
  148. package/src/client/canvas/use-pan-zoom.ts +191 -0
  149. package/src/client/ext-app/bridge.ts +542 -0
  150. package/src/client/icons.tsx +424 -0
  151. package/src/client/index.tsx +7 -0
  152. package/src/client/nodes/ContextNode.tsx +412 -0
  153. package/src/client/nodes/ExtAppFrame.tsx +509 -0
  154. package/src/client/nodes/FileNode.tsx +256 -0
  155. package/src/client/nodes/GroupNode.tsx +39 -0
  156. package/src/client/nodes/ImageNode.tsx +160 -0
  157. package/src/client/nodes/InlineFormatBar.tsx +169 -0
  158. package/src/client/nodes/InlineMarkdownEditor.tsx +123 -0
  159. package/src/client/nodes/LedgerNode.tsx +37 -0
  160. package/src/client/nodes/MarkdownNode.tsx +359 -0
  161. package/src/client/nodes/McpAppNode.tsx +85 -0
  162. package/src/client/nodes/MdFormatBar.tsx +109 -0
  163. package/src/client/nodes/PromptNode.tsx +597 -0
  164. package/src/client/nodes/ResponseNode.tsx +153 -0
  165. package/src/client/nodes/StatusNode.tsx +84 -0
  166. package/src/client/nodes/StatusSummary.tsx +38 -0
  167. package/src/client/nodes/TraceNode.tsx +120 -0
  168. package/src/client/nodes/WebpageNode.tsx +288 -0
  169. package/src/client/nodes/image-warnings.ts +95 -0
  170. package/src/client/nodes/inline-editor-commands.ts +37 -0
  171. package/src/client/nodes/md-format.ts +206 -0
  172. package/src/client/state/attention-bridge.ts +328 -0
  173. package/src/client/state/attention-store.ts +73 -0
  174. package/src/client/state/canvas-store.ts +631 -0
  175. package/src/client/state/intent-bridge.ts +315 -0
  176. package/src/client/state/sse-bridge.ts +965 -0
  177. package/src/client/theme/global.css +3173 -0
  178. package/src/client/theme/tokens.ts +72 -0
  179. package/src/client/types-shims.d.ts +5 -0
  180. package/src/client/types.ts +81 -0
  181. package/src/client/utils/ext-app-tool-result.ts +4 -0
  182. package/src/client/utils/placement.ts +4 -0
  183. package/src/client/utils/platform.ts +2 -0
  184. package/src/json-render/catalog.ts +256 -0
  185. package/src/json-render/charts/components.tsx +198 -0
  186. package/src/json-render/charts/definitions.ts +81 -0
  187. package/src/json-render/charts/extra-components.tsx +267 -0
  188. package/src/json-render/charts/extra-definitions.ts +145 -0
  189. package/src/json-render/renderer/index.css +174 -0
  190. package/src/json-render/renderer/index.tsx +86 -0
  191. package/src/json-render/schema.ts +62 -0
  192. package/src/json-render/server.ts +597 -0
  193. package/src/mcp/server.ts +1377 -0
  194. package/src/server/agent-context.ts +242 -0
  195. package/src/server/artifact-paths.ts +17 -0
  196. package/src/server/canvas-operations.ts +1279 -0
  197. package/src/server/canvas-provenance.ts +243 -0
  198. package/src/server/canvas-schema.ts +432 -0
  199. package/src/server/canvas-serialization.ts +95 -0
  200. package/src/server/canvas-state.ts +1134 -0
  201. package/src/server/canvas-validation.ts +114 -0
  202. package/src/server/chart-template.ts +449 -0
  203. package/src/server/code-graph.ts +370 -0
  204. package/src/server/context-cards.ts +31 -0
  205. package/src/server/diagram-presets.ts +71 -0
  206. package/src/server/ext-app-call-registry.ts +77 -0
  207. package/src/server/ext-app-tool-result.ts +4 -0
  208. package/src/server/file-watcher.ts +121 -0
  209. package/src/server/index.ts +647 -0
  210. package/src/server/mcp-app-candidate.ts +174 -0
  211. package/src/server/mcp-app-host.ts +814 -0
  212. package/src/server/mcp-app-runtime.ts +459 -0
  213. package/src/server/mutation-history.ts +350 -0
  214. package/src/server/placement.ts +125 -0
  215. package/src/server/server.ts +3846 -0
  216. package/src/server/spatial-analysis.ts +356 -0
  217. package/src/server/trace-manager.ts +333 -0
  218. package/src/server/web-artifacts/scripts/bundle-artifact.sh +167 -0
  219. package/src/server/web-artifacts/scripts/init-artifact.sh +426 -0
  220. package/src/server/web-artifacts/scripts/shadcn-components.tar.gz +0 -0
  221. package/src/server/web-artifacts.ts +442 -0
  222. package/src/server/webpage-node.ts +328 -0
  223. package/src/shared/auto-arrange.ts +439 -0
  224. package/src/shared/ext-app-tool-result.ts +76 -0
  225. package/src/shared/placement.ts +81 -0
  226. package/src/shared/semantic-attention.ts +598 -0
@@ -0,0 +1,324 @@
1
+ ---
2
+ name: data-analysis
3
+ description: Analytics synthesis with visualizations from engineering and product data sources
4
+ version: 0.1.0
5
+ author: pmx
6
+ tags: [analytics, data, charts, visualization, metrics]
7
+ tools: [dx-data-cloud, jira/linear, github, workiq]
8
+ inputs:
9
+ - name: question
10
+ description: The analysis question to answer (e.g. "How has PR cycle time changed over the last quarter?")
11
+ required: true
12
+ - name: data_sources
13
+ description: Array of MCP server names to query for data
14
+ required: false
15
+ default: [dx-data-cloud]
16
+ - name: format
17
+ description: Output format for the analysis
18
+ required: false
19
+ default: markdown
20
+ enum: [markdown, html]
21
+ - name: include_charts
22
+ description: Whether to include visual charts in the output
23
+ required: false
24
+ default: true
25
+ outputs:
26
+ - name: analysis
27
+ description: Data analysis with findings, tables, charts (if HTML), interpretation, and recommendations
28
+ ---
29
+
30
+ # Data Analysis
31
+
32
+ Perform analytics synthesis across engineering and product data sources. Answer questions about trends, correlations, comparisons, and distributions by querying MCP servers, analyzing the data, and presenting findings with visualizations.
33
+
34
+ In `pmx-canvas`, prefer `canvas_add_graph_node` for charts and trend lines and
35
+ `canvas_add_json_render_node` when the analysis should land as a richer dashboard or table inside
36
+ the canvas.
37
+
38
+ ## When to Use
39
+
40
+ - Answering quantitative questions about engineering performance, delivery, or team health
41
+ - Trend analysis: "How has X changed over time?"
42
+ - Correlation analysis: "Is there a relationship between X and Y?"
43
+ - Comparison analysis: "How does team A compare to team B?"
44
+ - Distribution analysis: "What is the breakdown of X by Y?"
45
+ - Preparing data-backed arguments for planning, retrospectives, or leadership updates
46
+ - Any request that starts with "analyze", "compare", "show me the trend", "what is the distribution"
47
+
48
+ ## How It Works
49
+
50
+ ### Step 1: Parse the Question
51
+
52
+ Analyze the user's question to determine:
53
+
54
+ 1. **Analysis type**: trend, correlation, comparison, distribution, or summary
55
+ 2. **Metrics needed**: What data points are required (cycle time, velocity, bug count, etc.)
56
+ 3. **Time range**: What period to analyze (last quarter, last 4 sprints, this year, etc.)
57
+ 4. **Grouping**: How to segment the data (by team, by sprint, by week, by component, etc.)
58
+ 5. **Data sources**: Which MCP servers have the required data
59
+
60
+ If the question is ambiguous, ask clarifying questions before proceeding.
61
+
62
+ ### Step 2: Pull Data
63
+
64
+ Query the relevant MCP servers:
65
+
66
+ #### DX Data Cloud (DX MCP `queryData` tool in current session)
67
+ Primary source for engineering metrics:
68
+ - DORA metrics (deployment frequency, lead time, change failure rate, MTTR)
69
+ - DX Index (DXI) survey results
70
+ - Cycle time breakdowns
71
+ - Throughput and flow metrics
72
+ - Team-level aggregations
73
+
74
+ Query using SQL against the DX Data Cloud PostgreSQL database. Tool prefixes vary by deployment (`dx-data-cloud` vs `dx-mcp`), so select the available DX `queryData` tool at runtime. Start with `information_schema` if unsure of available tables and columns.
75
+
76
+ #### Jira/Linear
77
+ Issue and sprint data:
78
+ - Sprint velocity over time
79
+ - Issue type distribution
80
+ - Bug rates and trends
81
+ - Epic completion rates
82
+ - Cycle time (issue-level)
83
+
84
+ #### GitHub
85
+ Code and collaboration data:
86
+ - PR cycle time (open to merge)
87
+ - PR size distribution
88
+ - Review turnaround time
89
+ - Merge frequency
90
+ - Contributor activity
91
+
92
+ #### WorkIQ
93
+ Collaboration and time data:
94
+ - Meeting hours per week
95
+ - Focus time trends
96
+ - Collaboration patterns
97
+ - Context switching indicators
98
+
99
+ ### Step 3: Perform Analysis
100
+
101
+ Based on the analysis type identified in Step 1:
102
+
103
+ #### Trend Analysis
104
+ - Calculate the metric value for each time period (week, sprint, month)
105
+ - Compute week-over-week or period-over-period change
106
+ - Identify the overall trend direction (improving, declining, stable)
107
+ - Calculate the rate of change
108
+ - Identify inflection points or anomalies
109
+ - Project forward if asked ("at this rate, when will we reach X?")
110
+
111
+ #### Correlation Analysis
112
+ - Pull both metrics for the same time periods
113
+ - Calculate correlation coefficient (Pearson r)
114
+ - Interpret strength: |r| > 0.7 strong, 0.4-0.7 moderate, < 0.4 weak
115
+ - Note: correlation does not imply causation (always state this)
116
+ - Show a scatter plot description or data table
117
+
118
+ #### Comparison Analysis
119
+ - Pull the same metric for different groups (teams, sprints, projects)
120
+ - Calculate absolute and percentage differences
121
+ - Rank groups by performance
122
+ - Identify outliers (groups significantly above or below average)
123
+ - Apply statistical context (is the difference significant or within normal variation?)
124
+
125
+ #### Distribution Analysis
126
+ - Group data by the specified dimension
127
+ - Calculate counts and percentages for each group
128
+ - Identify the dominant category and any long tails
129
+ - Show as a table and describe what a pie/bar chart would look like
130
+
131
+ ### Step 4: Generate Output
132
+
133
+ #### Markdown Format
134
+
135
+ ```markdown
136
+ # Analysis: [Question Restated]
137
+
138
+ **Period**: [time range]
139
+ **Data Sources**: [list of sources queried]
140
+ **Generated**: [timestamp]
141
+
142
+ ## Key Findings
143
+
144
+ 1. [Finding 1 - the most important insight]
145
+ 2. [Finding 2]
146
+ 3. [Finding 3]
147
+
148
+ ## Data
149
+
150
+ ### [Metric Name] Over Time
151
+
152
+ | Period | Value | Change |
153
+ |--------|-------|--------|
154
+ | Week 1 | X | - |
155
+ | Week 2 | Y | +Z% |
156
+ | ... | ... | ... |
157
+
158
+ ### Summary Statistics
159
+
160
+ - Mean: X
161
+ - Median: Y
162
+ - Min: Z (period)
163
+ - Max: W (period)
164
+ - Standard Deviation: V
165
+
166
+ ## Interpretation
167
+
168
+ [What the data means in plain language. Connect findings to
169
+ business context. Explain why the trends matter.]
170
+
171
+ ## Recommendations
172
+
173
+ 1. [Actionable recommendation based on the data]
174
+ 2. [Another recommendation]
175
+
176
+ ## Methodology
177
+
178
+ [Brief note on data sources, time ranges, and any caveats
179
+ about data quality or completeness]
180
+ ```
181
+
182
+ #### HTML Format
183
+
184
+ Generate a self-contained HTML file with:
185
+
186
+ - **Chart.js visualizations**:
187
+ - Line charts for trends
188
+ - Bar charts for comparisons
189
+ - Scatter plots for correlations
190
+ - Pie/doughnut charts for distributions
191
+ - **Interactive features**: Hover tooltips, legend toggles
192
+ - **Data tables**: Below each chart with the raw numbers
193
+ - **Styled sections**: Clean typography, responsive layout
194
+ - **Print-friendly**: CSS media queries for clean printing
195
+
196
+ Include Chart.js via CDN link in the HTML head.
197
+
198
+ ### Analysis Framework: Numbers First, Then Interpretation
199
+
200
+ Following the PMX vibe rules, always present data in this order:
201
+
202
+ 1. **Numbers**: Show the raw data and calculations first
203
+ 2. **Pattern**: Describe what the data shows (trend, correlation, distribution)
204
+ 3. **Interpretation**: Explain what it means in context
205
+ 4. **Recommendation**: Suggest action based on the findings
206
+
207
+ Never lead with interpretation. Let the numbers speak first.
208
+
209
+ ## Examples
210
+
211
+ ### Example 1: Trend Analysis
212
+ **Prompt**: "How has our PR cycle time changed over the last quarter?"
213
+
214
+ Expected behavior:
215
+ 1. Query DX Data Cloud for PR cycle time, weekly, last 12 weeks
216
+ 2. Calculate week-over-week changes
217
+ 3. Identify overall trend (improving/declining)
218
+ 4. Generate markdown with data table and findings
219
+ 5. If HTML, include a line chart
220
+
221
+ Output includes:
222
+ - Weekly cycle time values
223
+ - Average, min, max
224
+ - Trend direction and rate of change
225
+ - Comparison to team goals if defined in context.md
226
+
227
+ ### Example 2: Correlation Analysis
228
+ **Prompt**: "Analyze the correlation between meeting load and developer productivity"
229
+
230
+ Expected behavior:
231
+ 1. Query WorkIQ for meeting hours per developer per week
232
+ 2. Query DX Data Cloud or Jira for productivity proxy (throughput, cycle time, or velocity)
233
+ 3. Align time periods
234
+ 4. Calculate correlation coefficient
235
+ 5. Present scatter data and interpretation
236
+ 6. Note: "Correlation does not imply causation"
237
+
238
+ ### Example 3: Comparison Analysis
239
+ **Prompt**: "Compare velocity across the last 4 sprints"
240
+
241
+ Expected behavior:
242
+ 1. Query Jira/Linear for sprint velocity (story points completed) for last 4 sprints
243
+ 2. Calculate average, identify best and worst sprints
244
+ 3. Show sprint-over-sprint changes
245
+ 4. Identify contributing factors (scope changes, team changes, holidays)
246
+ 5. Present as comparison table and bar chart description
247
+
248
+ ### Example 4: Distribution Analysis
249
+ **Prompt**: "What is the breakdown of issues by type this quarter?"
250
+
251
+ Expected behavior:
252
+ 1. Query Jira/Linear for all issues created this quarter
253
+ 2. Group by type (feature, bug, task, spike, etc.)
254
+ 3. Calculate counts and percentages
255
+ 4. Present as table and describe pie chart
256
+ 5. Compare to previous quarter if useful
257
+
258
+ ### Example 5: Multi-Source Analysis
259
+ **Prompt**: "Is there a relationship between our deployment frequency and bug reports?"
260
+
261
+ Expected behavior:
262
+ 1. Query DX Data Cloud for deployment frequency (weekly)
263
+ 2. Query Jira/Linear for bug count (weekly, created date)
264
+ 3. Align time periods
265
+ 4. Calculate correlation
266
+ 5. Present findings with appropriate caveats
267
+
268
+ ### Example 6: Team Health Dashboard
269
+ **Prompt**: "Give me an overview of engineering health metrics"
270
+
271
+ Expected behavior:
272
+ 1. Pull DORA metrics from DX Data Cloud
273
+ 2. Pull DXI from DX Data Cloud
274
+ 3. Pull velocity from Jira/Linear
275
+ 4. Pull meeting load from WorkIQ
276
+ 5. Present dashboard-style summary with all metrics, trends, and RAG indicators
277
+
278
+ ## Statistical Methods
279
+
280
+ ### Trend Detection
281
+ - Calculate linear regression slope over the period
282
+ - Positive slope = improving (for metrics where higher is better)
283
+ - Negative slope = improving (for metrics where lower is better, like cycle time)
284
+ - Classify: strong improvement (>10% change), slight improvement (2-10%), stable (-2% to 2%), slight decline, strong decline
285
+
286
+ ### Correlation
287
+ - Pearson correlation coefficient for linear relationships
288
+ - Report r value and interpretation
289
+ - Minimum 8 data points for meaningful correlation
290
+ - Always caveat: correlation is not causation
291
+
292
+ ### Outlier Detection
293
+ - Values beyond 2 standard deviations from the mean
294
+ - Flag as anomalies with potential explanations (holidays, incidents, team changes)
295
+
296
+ ### Comparison Significance
297
+ - For small sample sizes (< 10), note that differences may not be statistically significant
298
+ - Calculate percentage difference and absolute difference
299
+ - Provide context: "This is within/outside normal variation for this metric"
300
+
301
+ ## Data Source Discovery
302
+
303
+ If unsure which tables or columns are available in DX Data Cloud, start with:
304
+
305
+ ```sql
306
+ SELECT table_name, column_name, data_type
307
+ FROM information_schema.columns
308
+ WHERE table_schema = 'public'
309
+ ORDER BY table_name, ordinal_position;
310
+ ```
311
+
312
+ This helps discover the available data before writing analysis queries.
313
+
314
+ ## Notes
315
+
316
+ - Always show numbers first, then interpretation (this is a core PMX principle)
317
+ - Include data freshness: when was the data last updated?
318
+ - If a data source is unavailable, note it and proceed with available sources
319
+ - For time series, use consistent time buckets (don't mix weekly and monthly)
320
+ - Always state the time range explicitly in findings
321
+ - Round numbers appropriately: percentages to 1 decimal, days to 1 decimal, counts as integers
322
+ - For HTML output, ensure the file is self-contained (inline CSS/JS, CDN for Chart.js)
323
+ - When comparing teams, be sensitive: focus on systemic factors, not individual blame
324
+ - If the data is insufficient to answer the question, say so rather than speculating
@@ -0,0 +1,375 @@
1
+ ---
2
+ name: doc-coauthoring
3
+ description: Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
4
+ ---
5
+
6
+ # Doc Co-Authoring Workflow
7
+
8
+ This skill provides a structured workflow for guiding users through collaborative document creation. Act as an active guide, walking users through three stages: Context Gathering, Refinement & Structure, and Reader Testing.
9
+
10
+ ## When to Offer This Workflow
11
+
12
+ **Trigger conditions:**
13
+ - User mentions writing documentation: "write a doc", "draft a proposal", "create a spec", "write up"
14
+ - User mentions specific doc types: "PRD", "design doc", "decision doc", "RFC"
15
+ - User seems to be starting a substantial writing task
16
+
17
+ **Initial offer:**
18
+ Offer the user a structured workflow for co-authoring the document. Explain the three stages:
19
+
20
+ 1. **Context Gathering**: User provides all relevant context while Claude asks clarifying questions
21
+ 2. **Refinement & Structure**: Iteratively build each section through brainstorming and editing
22
+ 3. **Reader Testing**: Test the doc with a fresh Claude (no context) to catch blind spots before others read it
23
+
24
+ Explain that this approach helps ensure the doc works well when others read it (including when they paste it into Claude). Ask if they want to try this workflow or prefer to work freeform.
25
+
26
+ If user declines, work freeform. If user accepts, proceed to Stage 1.
27
+
28
+ ## Stage 1: Context Gathering
29
+
30
+ **Goal:** Close the gap between what the user knows and what Claude knows, enabling smart guidance later.
31
+
32
+ ### Initial Questions
33
+
34
+ Start by asking the user for meta-context about the document:
35
+
36
+ 1. What type of document is this? (e.g., technical spec, decision doc, proposal)
37
+ 2. Who's the primary audience?
38
+ 3. What's the desired impact when someone reads this?
39
+ 4. Is there a template or specific format to follow?
40
+ 5. Any other constraints or context to know?
41
+
42
+ Inform them they can answer in shorthand or dump information however works best for them.
43
+
44
+ **If user provides a template or mentions a doc type:**
45
+ - Ask if they have a template document to share
46
+ - If they provide a link to a shared document, use the appropriate integration to fetch it
47
+ - If they provide a file, read it
48
+
49
+ **If user mentions editing an existing shared document:**
50
+ - Use the appropriate integration to read the current state
51
+ - Check for images without alt-text
52
+ - If images exist without alt-text, explain that when others use Claude to understand the doc, Claude won't be able to see them. Ask if they want alt-text generated. If so, request they paste each image into chat for descriptive alt-text generation.
53
+
54
+ ### Info Dumping
55
+
56
+ Once initial questions are answered, encourage the user to dump all the context they have. Request information such as:
57
+ - Background on the project/problem
58
+ - Related team discussions or shared documents
59
+ - Why alternative solutions aren't being used
60
+ - Organizational context (team dynamics, past incidents, politics)
61
+ - Timeline pressures or constraints
62
+ - Technical architecture or dependencies
63
+ - Stakeholder concerns
64
+
65
+ Advise them not to worry about organizing it - just get it all out. Offer multiple ways to provide context:
66
+ - Info dump stream-of-consciousness
67
+ - Point to team channels or threads to read
68
+ - Link to shared documents
69
+
70
+ **If integrations are available** (e.g., Slack, Teams, Google Drive, SharePoint, or other MCP servers), mention that these can be used to pull in context directly.
71
+
72
+ **If no integrations are detected and in Claude.ai or Claude app:** Suggest they can enable connectors in their Claude settings to allow pulling context from messaging apps and document storage directly.
73
+
74
+ Inform them clarifying questions will be asked once they've done their initial dump.
75
+
76
+ **During context gathering:**
77
+
78
+ - If user mentions team channels or shared documents:
79
+ - If integrations available: Inform them the content will be read now, then use the appropriate integration
80
+ - If integrations not available: Explain lack of access. Suggest they enable connectors in Claude settings, or paste the relevant content directly.
81
+
82
+ - If user mentions entities/projects that are unknown:
83
+ - Ask if connected tools should be searched to learn more
84
+ - Wait for user confirmation before searching
85
+
86
+ - As user provides context, track what's being learned and what's still unclear
87
+
88
+ **Asking clarifying questions:**
89
+
90
+ When user signals they've done their initial dump (or after substantial context provided), ask clarifying questions to ensure understanding:
91
+
92
+ Generate 5-10 numbered questions based on gaps in the context.
93
+
94
+ Inform them they can use shorthand to answer (e.g., "1: yes, 2: see #channel, 3: no because backwards compat"), link to more docs, point to channels to read, or just keep info-dumping. Whatever's most efficient for them.
95
+
96
+ **Exit condition:**
97
+ Sufficient context has been gathered when questions show understanding - when edge cases and trade-offs can be asked about without needing basics explained.
98
+
99
+ **Transition:**
100
+ Ask if there's any more context they want to provide at this stage, or if it's time to move on to drafting the document.
101
+
102
+ If user wants to add more, let them. When ready, proceed to Stage 2.
103
+
104
+ ## Stage 2: Refinement & Structure
105
+
106
+ **Goal:** Build the document section by section through brainstorming, curation, and iterative refinement.
107
+
108
+ **Instructions to user:**
109
+ Explain that the document will be built section by section. For each section:
110
+ 1. Clarifying questions will be asked about what to include
111
+ 2. 5-20 options will be brainstormed
112
+ 3. User will indicate what to keep/remove/combine
113
+ 4. The section will be drafted
114
+ 5. It will be refined through surgical edits
115
+
116
+ Start with whichever section has the most unknowns (usually the core decision/proposal), then work through the rest.
117
+
118
+ **Section ordering:**
119
+
120
+ If the document structure is clear:
121
+ Ask which section they'd like to start with.
122
+
123
+ Suggest starting with whichever section has the most unknowns. For decision docs, that's usually the core proposal. For specs, it's typically the technical approach. Summary sections are best left for last.
124
+
125
+ If user doesn't know what sections they need:
126
+ Based on the type of document and template, suggest 3-5 sections appropriate for the doc type.
127
+
128
+ Ask if this structure works, or if they want to adjust it.
129
+
130
+ **Once structure is agreed:**
131
+
132
+ Create the initial document structure with placeholder text for all sections.
133
+
134
+ **If access to artifacts is available:**
135
+ Use `create_file` to create an artifact. This gives both Claude and the user a scaffold to work from.
136
+
137
+ Inform them that the initial structure with placeholders for all sections will be created.
138
+
139
+ Create artifact with all section headers and brief placeholder text like "[To be written]" or "[Content here]".
140
+
141
+ Provide the scaffold link and indicate it's time to fill in each section.
142
+
143
+ **If no access to artifacts:**
144
+ Create a markdown file in the working directory. Name it appropriately (e.g., `decision-doc.md`, `technical-spec.md`).
145
+
146
+ Inform them that the initial structure with placeholders for all sections will be created.
147
+
148
+ Create file with all section headers and placeholder text.
149
+
150
+ Confirm the filename has been created and indicate it's time to fill in each section.
151
+
152
+ **For each section:**
153
+
154
+ ### Step 1: Clarifying Questions
155
+
156
+ Announce work will begin on the [SECTION NAME] section. Ask 5-10 clarifying questions about what should be included:
157
+
158
+ Generate 5-10 specific questions based on context and section purpose.
159
+
160
+ Inform them they can answer in shorthand or just indicate what's important to cover.
161
+
162
+ ### Step 2: Brainstorming
163
+
164
+ For the [SECTION NAME] section, brainstorm [5-20] things that might be included, depending on the section's complexity. Look for:
165
+ - Context shared that might have been forgotten
166
+ - Angles or considerations not yet mentioned
167
+
168
+ Generate 5-20 numbered options based on section complexity. At the end, offer to brainstorm more if they want additional options.
169
+
170
+ ### Step 3: Curation
171
+
172
+ Ask which points should be kept, removed, or combined. Request brief justifications to help learn priorities for the next sections.
173
+
174
+ Provide examples:
175
+ - "Keep 1,4,7,9"
176
+ - "Remove 3 (duplicates 1)"
177
+ - "Remove 6 (audience already knows this)"
178
+ - "Combine 11 and 12"
179
+
180
+ **If user gives freeform feedback** (e.g., "looks good" or "I like most of it but...") instead of numbered selections, extract their preferences and proceed. Parse what they want kept/removed/changed and apply it.
181
+
182
+ ### Step 4: Gap Check
183
+
184
+ Based on what they've selected, ask if there's anything important missing for the [SECTION NAME] section.
185
+
186
+ ### Step 5: Drafting
187
+
188
+ Use `str_replace` to replace the placeholder text for this section with the actual drafted content.
189
+
190
+ Announce the [SECTION NAME] section will be drafted now based on what they've selected.
191
+
192
+ **If using artifacts:**
193
+ After drafting, provide a link to the artifact.
194
+
195
+ Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
196
+
197
+ **If using a file (no artifacts):**
198
+ After drafting, confirm completion.
199
+
200
+ Inform them the [SECTION NAME] section has been drafted in [filename]. Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
201
+
202
+ **Key instruction for user (include when drafting the first section):**
203
+ Provide a note: Instead of editing the doc directly, ask them to indicate what to change. This helps learning of their style for future sections. For example: "Remove the X bullet - already covered by Y" or "Make the third paragraph more concise".
204
+
205
+ ### Step 6: Iterative Refinement
206
+
207
+ As user provides feedback:
208
+ - Use `str_replace` to make edits (never reprint the whole doc)
209
+ - **If using artifacts:** Provide link to artifact after each edit
210
+ - **If using files:** Just confirm edits are complete
211
+ - If user edits doc directly and asks to read it: mentally note the changes they made and keep them in mind for future sections (this shows their preferences)
212
+
213
+ **Continue iterating** until user is satisfied with the section.
214
+
215
+ ### Quality Checking
216
+
217
+ After 3 consecutive iterations with no substantial changes, ask if anything can be removed without losing important information.
218
+
219
+ When section is done, confirm [SECTION NAME] is complete. Ask if ready to move to the next section.
220
+
221
+ **Repeat for all sections.**
222
+
223
+ ### Near Completion
224
+
225
+ As approaching completion (80%+ of sections done), announce intention to re-read the entire document and check for:
226
+ - Flow and consistency across sections
227
+ - Redundancy or contradictions
228
+ - Anything that feels like "slop" or generic filler
229
+ - Whether every sentence carries weight
230
+
231
+ Read entire document and provide feedback.
232
+
233
+ **When all sections are drafted and refined:**
234
+ Announce all sections are drafted. Indicate intention to review the complete document one more time.
235
+
236
+ Review for overall coherence, flow, completeness.
237
+
238
+ Provide any final suggestions.
239
+
240
+ Ask if ready to move to Reader Testing, or if they want to refine anything else.
241
+
242
+ ## Stage 3: Reader Testing
243
+
244
+ **Goal:** Test the document with a fresh Claude (no context bleed) to verify it works for readers.
245
+
246
+ **Instructions to user:**
247
+ Explain that testing will now occur to see if the document actually works for readers. This catches blind spots - things that make sense to the authors but might confuse others.
248
+
249
+ ### Testing Approach
250
+
251
+ **If access to sub-agents is available (e.g., in Claude Code):**
252
+
253
+ Perform the testing directly without user involvement.
254
+
255
+ ### Step 1: Predict Reader Questions
256
+
257
+ Announce intention to predict what questions readers might ask when trying to discover this document.
258
+
259
+ Generate 5-10 questions that readers would realistically ask.
260
+
261
+ ### Step 2: Test with Sub-Agent
262
+
263
+ Announce that these questions will be tested with a fresh Claude instance (no context from this conversation).
264
+
265
+ For each question, invoke a sub-agent with just the document content and the question.
266
+
267
+ Summarize what Reader Claude got right/wrong for each question.
268
+
269
+ ### Step 3: Run Additional Checks
270
+
271
+ Announce additional checks will be performed.
272
+
273
+ Invoke sub-agent to check for ambiguity, false assumptions, contradictions.
274
+
275
+ Summarize any issues found.
276
+
277
+ ### Step 4: Report and Fix
278
+
279
+ If issues found:
280
+ Report that Reader Claude struggled with specific issues.
281
+
282
+ List the specific issues.
283
+
284
+ Indicate intention to fix these gaps.
285
+
286
+ Loop back to refinement for problematic sections.
287
+
288
+ ---
289
+
290
+ **If no access to sub-agents (e.g., claude.ai web interface):**
291
+
292
+ The user will need to do the testing manually.
293
+
294
+ ### Step 1: Predict Reader Questions
295
+
296
+ Ask what questions people might ask when trying to discover this document. What would they type into Claude.ai?
297
+
298
+ Generate 5-10 questions that readers would realistically ask.
299
+
300
+ ### Step 2: Setup Testing
301
+
302
+ Provide testing instructions:
303
+ 1. Open a fresh Claude conversation: https://claude.ai
304
+ 2. Paste or share the document content (if using a shared doc platform with connectors enabled, provide the link)
305
+ 3. Ask Reader Claude the generated questions
306
+
307
+ For each question, instruct Reader Claude to provide:
308
+ - The answer
309
+ - Whether anything was ambiguous or unclear
310
+ - What knowledge/context the doc assumes is already known
311
+
312
+ Check if Reader Claude gives correct answers or misinterprets anything.
313
+
314
+ ### Step 3: Additional Checks
315
+
316
+ Also ask Reader Claude:
317
+ - "What in this doc might be ambiguous or unclear to readers?"
318
+ - "What knowledge or context does this doc assume readers already have?"
319
+ - "Are there any internal contradictions or inconsistencies?"
320
+
321
+ ### Step 4: Iterate Based on Results
322
+
323
+ Ask what Reader Claude got wrong or struggled with. Indicate intention to fix those gaps.
324
+
325
+ Loop back to refinement for any problematic sections.
326
+
327
+ ---
328
+
329
+ ### Exit Condition (Both Approaches)
330
+
331
+ When Reader Claude consistently answers questions correctly and doesn't surface new gaps or ambiguities, the doc is ready.
332
+
333
+ ## Final Review
334
+
335
+ When Reader Testing passes:
336
+ Announce the doc has passed Reader Claude testing. Before completion:
337
+
338
+ 1. Recommend they do a final read-through themselves - they own this document and are responsible for its quality
339
+ 2. Suggest double-checking any facts, links, or technical details
340
+ 3. Ask them to verify it achieves the impact they wanted
341
+
342
+ Ask if they want one more review, or if the work is done.
343
+
344
+ **If user wants final review, provide it. Otherwise:**
345
+ Announce document completion. Provide a few final tips:
346
+ - Consider linking this conversation in an appendix so readers can see how the doc was developed
347
+ - Use appendices to provide depth without bloating the main doc
348
+ - Update the doc as feedback is received from real readers
349
+
350
+ ## Tips for Effective Guidance
351
+
352
+ **Tone:**
353
+ - Be direct and procedural
354
+ - Explain rationale briefly when it affects user behavior
355
+ - Don't try to "sell" the approach - just execute it
356
+
357
+ **Handling Deviations:**
358
+ - If user wants to skip a stage: Ask if they want to skip this and write freeform
359
+ - If user seems frustrated: Acknowledge this is taking longer than expected. Suggest ways to move faster
360
+ - Always give user agency to adjust the process
361
+
362
+ **Context Management:**
363
+ - Throughout, if context is missing on something mentioned, proactively ask
364
+ - Don't let gaps accumulate - address them as they come up
365
+
366
+ **Artifact Management:**
367
+ - Use `create_file` for drafting full sections
368
+ - Use `str_replace` for all edits
369
+ - Provide artifact link after every change
370
+ - Never use artifacts for brainstorming lists - that's just conversation
371
+
372
+ **Quality over Speed:**
373
+ - Don't rush through stages
374
+ - Each iteration should make meaningful improvements
375
+ - The goal is a document that actually works for readers