@opendirectory.dev/skills 0.1.36 → 0.1.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendirectory.dev/skills",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
package/registry.json CHANGED
@@ -149,6 +149,14 @@
149
149
  "version": "1.0.0",
150
150
  "path": "skills/llms-txt-generator"
151
151
  },
152
+ {
153
+ "name": "map-your-market",
154
+ "description": ">-",
155
+ "tags": [],
156
+ "author": "opendirectory",
157
+ "version": "0.0.1",
158
+ "path": "skills/map-your-market"
159
+ },
152
160
  {
153
161
  "name": "meeting-brief-generator",
154
162
  "description": "Takes a company name and optional contact, runs targeted research via Tavily, synthesizes a 1-page pre-call brief with Gemini, and optionally saves...",
@@ -279,6 +287,18 @@
279
287
  "version": "1.0.0",
280
288
  "path": "skills/schema-markup-generator"
281
289
  },
290
+ {
291
+ "name": "sdk-adoption-tracker",
292
+ "description": "Given your SDK or library name, searches GitHub code search for public repos that import or require it, classifies each repo as company org, affili...",
293
+ "tags": [
294
+ "SEO",
295
+ "Branding",
296
+ "Developer Tools"
297
+ ],
298
+ "author": "opendirectory",
299
+ "version": "0.0.1",
300
+ "path": "skills/sdk-adoption-tracker"
301
+ },
282
302
  {
283
303
  "name": "show-hn-writer",
284
304
  "description": "Draft a Show HN post backed by real HN performance data. Uses observed patterns from 250 top HN posts to maximise score.",
@@ -0,0 +1,3 @@
1
+ GITHUB_TOKEN= # optional -- github.com/settings/tokens (no scopes needed for public repos)
2
+ # Without it: GitHub search runs at 60 req/hr (enough for most runs)
3
+ # With it: 5000 req/hr -- use if running frequently or scanning many competitors
@@ -0,0 +1,147 @@
1
+ # map-your-market
2
+
3
+ Give this skill a product description, category keywords, or competitor names. It searches Reddit, Hacker News, GitHub Issues, G2, and Google Trends for real pain signals from your market -- then builds a complete positioning framework: who your ICP is, what they say out loud, and how to talk to them.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npx "@opendirectory.dev/skills" install map-your-market --target claude
9
+ ```
10
+
11
+ ### Video Tutorial
12
+ Watch this quick video to see how it's done:
13
+
14
+ https://github.com/user-attachments/assets/ee98a1b5-ebc4-452f-bbfb-c434f2935067
15
+
16
+ ### Step 1: Download the skill from GitHub
17
+ 1. Copy the URL of this specific skill folder from your browser's address bar.
18
+ 2. Go to [download-directory.github.io](https://download-directory.github.io/).
19
+ 3. Paste the URL and click **Enter** to download.
20
+
21
+ ### Step 2: Install the Skill in Claude
22
+ 1. Open your **Claude desktop app**.
23
+ 2. Go to the sidebar on the left side and click on the **Customize** section.
24
+ 3. Click on the **Skills** tab, then click on the **+** (plus) icon button to create a new skill.
25
+ 4. Choose the option to **Upload a skill**, and drag and drop the `.zip` file (or you can extract it and drop the folder, both work).
26
+
27
+ > **Note:** For some skills (like `position-me`), the `SKILL.md` file might be located inside a subfolder. Always make sure you are uploading the specific folder that contains the `SKILL.md` file!
28
+
29
+ ## What It Does
30
+
31
+ - Accepts any combination of: product description, category keywords, competitor names
32
+ - Auto-detects relevant subreddits from the category
33
+ - Searches Reddit public JSON API for pain posts (top posts, last 12 months)
34
+ - Searches Hacker News Algolia API for stories and Ask HN threads
35
+ - Searches GitHub Issues on competitor repos for high-reaction complaints
36
+ - Scrapes G2 category pages for vendor count and top products
37
+ - Fetches Google Trends direction (up / flat / down) for the category
38
+ - Scores every signal by source weight and recency (GitHub issues score 3x Reddit -- more deliberate signal)
39
+ - Clusters top 60 signals into 5-7 named pain themes
40
+ - Extracts ICP from subreddit and post metadata (not just content)
41
+ - Generates a positioning framework with messaging angles using verbatim market language
42
+ - Saves output to `docs/market-maps/[category]-[date].md` + JSON snapshot
43
+
44
+ ## Requirements
45
+
46
+ | Requirement | Purpose | How to Set Up |
47
+ |---|---|---|
48
+ | GITHUB_TOKEN | Optional -- improves GitHub Issues rate limit from 60/hr to 5000/hr | github.com/settings/tokens (no scopes needed for public repos) |
49
+
50
+ No other API keys required.
51
+
52
+ ## Setup
53
+
54
+ ```bash
55
+ cp .env.example .env
56
+ # Add GITHUB_TOKEN if you want higher GitHub rate limits
57
+ ```
58
+
59
+ ## How to Use
60
+
61
+ ```
62
+ "Map my market: I build developer observability tools"
63
+ "Who is my ICP? Competitors: Datadog, Grafana, New Relic"
64
+ "What are the top pains in the HR software market?"
65
+ "Find messaging angles for my B2B analytics tool"
66
+ "Map the CRM market. What are people complaining about?"
67
+ "I build payment APIs. Who should I be selling to?"
68
+ ```
69
+
70
+ Include competitor names for richer GitHub Issues data. Include a product description for tailored messaging angles.
71
+
72
+ ## Why This Instead of Manual Research
73
+
74
+ A founder doing this manually would spend 2-3 days:
75
+ - Reading Reddit threads, taking notes
76
+ - Scrolling HN "Ask HN" posts
77
+ - Checking G2 review counts per vendor
78
+ - Looking up Google Trends
79
+ - Synthesizing into a document
80
+
81
+ This skill does the same sweep in 3 minutes and returns verbatim quotes, not paraphrased summaries. The messaging framework uses the exact language your market uses -- not marketing copy you invented.
82
+
83
+ ## The Pain Score
84
+
85
+ `pain_score = base * recency_factor`
86
+
87
+ - GitHub issue reactions: `reactions * 3` -- a developer deliberately clicking +1 is the strongest signal
88
+ - Reddit: `upvotes + (comments * 0.3)` -- upvotes count more than comments (comments include noise)
89
+ - HN: `points + (comments * 0.3)` -- same structure
90
+
91
+ Score tiers: critical (200+), high (50-199), medium (10-49), noise (<10, filtered out).
92
+
93
+ ## Velocity Tracking
94
+
95
+ Run the skill every quarter. JSON snapshots in `docs/market-maps/` let you compare pain cluster rankings over time. A pain that was #3 last quarter and is #1 this quarter is accelerating -- a stronger positioning bet.
96
+
97
+ ## Cost Per Run
98
+
99
+ - Reddit, HN, Google Trends: free, no auth
100
+ - GitHub Issues: free with optional token
101
+ - G2 scrape: free HTML fetch
102
+ - AI analysis: uses the model already running the skill
103
+ - Total: free
104
+
105
+ ## Standalone Script
106
+
107
+ Run data collection without Claude. Useful when you want the raw signals first, then bring them to any AI for analysis.
108
+
109
+ ```bash
110
+ # Basic usage
111
+ python3 scripts/fetch.py "developer observability"
112
+
113
+ # With competitors
114
+ python3 scripts/fetch.py "developer observability" --competitors "Datadog,Grafana,New Relic"
115
+
116
+ # With product context
117
+ python3 scripts/fetch.py "B2B analytics" --context "We help ops teams track spend"
118
+
119
+ # Print to stdout
120
+ python3 scripts/fetch.py "devops tooling" --stdout | jq '.summary'
121
+
122
+ # With GitHub token for higher rate limits
123
+ GITHUB_TOKEN=your_token python3 scripts/fetch.py "CRM software" --competitors "Salesforce,HubSpot" --output results.json
124
+ ```
125
+
126
+ The script writes a JSON file with all raw signals. Open that file with Claude and ask: "Generate a market map and positioning framework from this data."
127
+
128
+ ## Project Structure
129
+
130
+ ```
131
+ map-your-market/
132
+ ├── SKILL.md
133
+ ├── README.md
134
+ ├── .env.example
135
+ ├── scripts/
136
+ │ └── fetch.py standalone data collector
137
+ ├── evals/
138
+ │ └── evals.json
139
+ └── references/
140
+ ├── subreddit-map.md category to subreddit mapping
141
+ ├── pain-scoring.md scoring formula and tier thresholds
142
+ └── icp-signals.md how to extract ICP from post metadata
143
+ ```
144
+
145
+ ## License
146
+
147
+ MIT
@@ -0,0 +1,469 @@
1
+ ---
2
+ name: map-your-market
3
+ description: >-
4
+ Given a product description, category keywords, or competitor names (any combination), searches
5
+ Reddit, Hacker News, GitHub Issues, G2, and Google Trends for the real pains your market
6
+ experiences -- then synthesizes everything into a positioning framework showing who your ICP is,
7
+ what they say out loud, and exactly how to talk to them. Use when asked to understand a market,
8
+ find ICP pain points, map competitors, build a positioning doc, find messaging angles, or answer
9
+ who is my customer and what do they actually care about. Trigger when a user says map my market,
10
+ who is my ICP, what pains does my market have, understand my market, find my target customer,
11
+ what are the top complaints in X space, help me position my product, or who should I be selling to.
12
+ compatibility: [claude-code, gemini-cli, github-copilot]
13
+ ---
14
+
15
+ # Map Your Market
16
+
17
+ Take a product description, category keywords, or competitor names. Search Reddit, HN, GitHub Issues, G2, and Google Trends for real pain signals. Score and cluster them. Build a complete positioning framework: ICP definition, ranked pain themes with verbatim quotes, market size signals, and messaging angles derived from actual language people use.
18
+
19
+ ---
20
+
21
+ **Critical rule:** Every pain quote in the output must exist verbatim in the raw data collected by the script. Every vendor name in the market map must come from G2 scrape results or GitHub search results. Market size must say "signals suggest" -- never estimate a dollar figure from thin proxies. If a source returns 0 results, report 0 -- do not supplement with invented examples.
22
+
23
+ ---
24
+
25
+ ## Common Mistakes
26
+
27
+ | The agent will want to... | Why that's wrong |
28
+ |---|---|
29
+ | Invent pain points or market size numbers | Every pain quote must be verbatim from raw data. Market size must cite signals found. Never estimate "typical" market size. |
30
+ | Score by post count instead of pain_score | A post with 2,000 upvotes about pricing is stronger than 50 posts with 10 upvotes each. Use the pain_score formula from references/pain-scoring.md. |
31
+ | Use the same subreddits for every category | r/politics adds noise to a devops search. Auto-detect relevant subreddits from the category and competitor names before searching. |
32
+ | Send all raw signals to AI without scoring | Score locally first. Send only the top 60 high-pain-score signals to AI clustering. Saves tokens and improves cluster quality. |
33
+ | Skip ICP extraction from post metadata | Subreddit, flair, author bio (HN), and GitHub org type are richer ICP signals than post content. Always capture and report them. |
34
+ | Conflate vendor count with market size | "47 vendors on G2" means competitive, not large. Present all signals as directional indicators, not hard numbers. |
35
+
36
+ ---
37
+
38
+ ## Step 1: Setup Check
39
+
40
+ ```bash
41
+ echo "GITHUB_TOKEN: ${GITHUB_TOKEN:-not set -- GitHub Issues search runs at 60 req/hr unauthenticated}"
42
+ echo "No other API keys required."
43
+ echo ""
44
+ echo "Data sources this run will use:"
45
+ echo " Reddit public JSON (no auth, 10 req/min)"
46
+ echo " HN Algolia API (no auth, free)"
47
+ echo " GitHub Issues API (${GITHUB_TOKEN:+authenticated, }60-5000 req/hr)"
48
+ echo " G2 category scrape (no auth, HTML parse)"
49
+ echo " Google Trends (no auth, unofficial endpoint)"
50
+ ```
51
+
52
+ If `GITHUB_TOKEN` is not set: continue. Unauthenticated GitHub search is 60 req/hr -- enough for a standard run. For repeated use, add a token at github.com/settings/tokens (no scopes needed for public repos).
53
+
54
+ ---
55
+
56
+ ## Step 2: Parse Input
57
+
58
+ Collect from the conversation:
59
+ - `category` -- keyword(s) describing the market space (e.g. "developer observability", "B2B analytics", "devops tooling")
60
+ - `competitors` -- optional list of competitor product names or domains (e.g. "Datadog, New Relic, Grafana")
61
+ - `product_context` -- optional: what the user's product does (helps tailor messaging angles)
62
+
63
+ If the user provides only a product description with no category keyword: extract 2-3 category keywords from it yourself.
64
+
65
+ If the user provides only competitor names with no category: infer the category by looking up competitors.
66
+
67
+ Write the parsed input:
68
+
69
+ ```bash
70
+ python3 << 'PYEOF'
71
+ import json, os
72
+
73
+ data = {
74
+ "category": "CATEGORY_HERE",
75
+ "competitors": ["COMP_1", "COMP_2"],
76
+ "product_context": "PRODUCT_CONTEXT_HERE"
77
+ }
78
+
79
+ with open("/tmp/mym-input.json", "w") as f:
80
+ json.dump(data, f, indent=2)
81
+ print("Input written to /tmp/mym-input.json")
82
+ print(f"Category: {data['category']}")
83
+ print(f"Competitors: {', '.join(data['competitors']) if data['competitors'] else 'none provided'}")
84
+ PYEOF
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Step 3: Run the Standalone Data Collection Script
90
+
91
+ The script handles all data collection. Check if it exists first:
92
+
93
+ ```bash
94
+ ls scripts/fetch.py 2>/dev/null && echo "script available" || echo "not found"
95
+ ```
96
+
97
+ If available, run it:
98
+
99
+ ```bash
100
+ GITHUB_TOKEN="${GITHUB_TOKEN:-}" python3 scripts/fetch.py \
101
+ "$(python3 -c "import json; d=json.load(open('/tmp/mym-input.json')); print(d['category'])")" \
102
+ --competitors "$(python3 -c "import json; d=json.load(open('/tmp/mym-input.json')); print(','.join(d['competitors']))")" \
103
+ --context "$(python3 -c "import json; d=json.load(open('/tmp/mym-input.json')); print(d['product_context'])")" \
104
+ --output /tmp/mym-raw.json
105
+ ```
106
+
107
+ Wait for completion (allow up to 4 minutes -- Reddit + HN searches take ~90 seconds total).
108
+
109
+ Verify output:
110
+ ```bash
111
+ python3 -c "
112
+ import json
113
+ with open('/tmp/mym-raw.json') as f:
114
+ d = json.load(f)
115
+ print(f'Reddit signals: {d[\"market_signals\"][\"reddit_signals_found\"]}')
116
+ print(f'HN signals: {d[\"market_signals\"][\"hn_signals_found\"]}')
117
+ print(f'GitHub signals: {d[\"market_signals\"][\"github_issue_signals\"]}')
118
+ print(f'G2 vendors: {d[\"market_signals\"][\"vendor_count_g2\"]}')
119
+ print(f'Trends: {d[\"market_signals\"][\"trends_direction\"]}')
120
+ print(f'Total signals: {d[\"summary\"][\"total_pain_signals\"]}')
121
+ "
122
+ ```
123
+
124
+ If total signals < 10: stop. Tell the user: "Fewer than 10 pain signals found for this category. The market may be too niche for Reddit/HN coverage, or the category keywords need adjustment. Try broader keywords or add competitor names."
125
+
126
+ ---
127
+
128
+ ## Step 4: AI Pain Clustering
129
+
130
+ Print the top 60 pain signals for AI analysis:
131
+
132
+ ```bash
133
+ python3 -c "
134
+ import json
135
+ with open('/tmp/mym-raw.json') as f:
136
+ d = json.load(f)
137
+ top60 = sorted(d['raw_pains'], key=lambda x: x['pain_score'], reverse=True)[:60]
138
+ print(json.dumps(top60, indent=2))
139
+ "
140
+ ```
141
+
142
+ You now have the top 60 pain signals. Analyze them and produce pain clusters.
143
+
144
+ **Instructions for AI analysis:**
145
+ - Identify 5-7 recurring pain themes across all sources
146
+ - For each theme: pick a name that uses the market's own language (not your words)
147
+ - Aggregate the pain_score of all signals in each cluster
148
+ - Select the 3-5 best verbatim quotes for each theme (highest score, most specific language)
149
+ - Note which sources and subreddits each theme concentrates in
150
+ - Flag any theme that appears only in one source (lower confidence)
151
+
152
+ Write the clusters to `/tmp/mym-clusters.json`:
153
+
154
+ ```json
155
+ {
156
+ "clusters": [
157
+ {
158
+ "theme": "exact language from the data",
159
+ "total_score": 847,
160
+ "signal_count": 34,
161
+ "sources": {"reddit": 18, "hn": 12, "github_issue": 4},
162
+ "top_subreddits": ["devops", "sysadmin"],
163
+ "verbatim_quotes": [
164
+ {"text": "exact quote", "source": "reddit", "score": 234, "url": "..."},
165
+ {"text": "exact quote", "source": "hn", "score": 87, "url": "..."}
166
+ ],
167
+ "who_has_this_pain": "description of who is posting about this"
168
+ }
169
+ ]
170
+ }
171
+ ```
172
+
173
+ ```bash
174
+ python3 -c "
175
+ import json, os
176
+ # Confirm clusters file was written
177
+ with open('/tmp/mym-clusters.json') as f:
178
+ d = json.load(f)
179
+ print(f'Clusters written: {len(d[\"clusters\"])}')
180
+ for c in d['clusters']:
181
+ print(f' {c[\"theme\"]} -- score: {c[\"total_score\"]}, signals: {c[\"signal_count\"]}')
182
+ "
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Step 5: ICP Profiling
188
+
189
+ Print the ICP signals from the raw data:
190
+
191
+ ```bash
192
+ python3 -c "
193
+ import json
194
+ with open('/tmp/mym-raw.json') as f:
195
+ d = json.load(f)
196
+ print('ICP signals:')
197
+ print(json.dumps(d['icp_signals'], indent=2))
198
+ print()
199
+ print('Subreddit distribution:')
200
+ sub_counts = {}
201
+ for p in d['raw_pains']:
202
+ s = p.get('subreddit', '')
203
+ if s:
204
+ sub_counts[s] = sub_counts.get(s, 0) + 1
205
+ for sub, count in sorted(sub_counts.items(), key=lambda x: -x[1])[:10]:
206
+ print(f' r/{sub}: {count} signals')
207
+ "
208
+ ```
209
+
210
+ Using the ICP signals and subreddit distribution above, synthesize the ICP profile. Write it to `/tmp/mym-clusters.json` by adding an `icp` key:
211
+
212
+ ```json
213
+ {
214
+ "icp": {
215
+ "who_they_are": "2-3 sentence profile using language from the data",
216
+ "where_they_live": ["r/devops (89 posts)", "r/sysadmin (67 posts)", "HN ask-hn (34 threads)"],
217
+ "what_they_say": ["verbatim quote 1", "verbatim quote 2", "verbatim quote 3"],
218
+ "what_they_have_tried": ["alternative tools or approaches mentioned in the data"],
219
+ "confidence": "high|medium|low -- based on signal volume and source diversity"
220
+ }
221
+ }
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Step 6: Market Size Synthesis
227
+
228
+ Print the market signals:
229
+
230
+ ```bash
231
+ python3 -c "
232
+ import json
233
+ with open('/tmp/mym-raw.json') as f:
234
+ d = json.load(f)
235
+ ms = d['market_signals']
236
+ print('Market signals:')
237
+ print(f' G2 vendors: {ms[\"vendor_count_g2\"]}')
238
+ print(f' Trends direction: {ms[\"trends_direction\"]}')
239
+ print(f' HN signals (12mo): {ms[\"hn_signals_found\"]}')
240
+ print(f' Reddit signals: {ms[\"reddit_signals_found\"]}')
241
+ print(f' G2 top vendors: {json.dumps(ms.get(\"top_vendors\", []), indent=4)}')
242
+ "
243
+ ```
244
+
245
+ Synthesize a directional market size assessment using only these signals. Do not estimate a dollar figure. Use language like:
246
+ - "Signals suggest a competitive, growing market" (many vendors + trends up)
247
+ - "Signals suggest an early market" (few vendors + low signal volume)
248
+ - "Signals suggest a saturated market" (many vendors + flat/down trends)
249
+
250
+ Add the assessment to `/tmp/mym-clusters.json` as a `market_size` key.
251
+
252
+ ---
253
+
254
+ ## Step 7: Positioning Framework
255
+
256
+ Using the clusters (Step 4), ICP (Step 5), and market size (Step 6), generate the positioning framework.
257
+
258
+ **Instructions:**
259
+ - Pick the top 3 pain clusters as the primary positioning angles
260
+ - For each angle: write one positioning statement using verbatim language from the data (not paraphrased)
261
+ - Generate 3 landing page headlines that use the exact phrases people use in the pain data
262
+ - Generate 3 cold email subject lines based on the pain language
263
+ - Do NOT use banned words: powerful, robust, seamless, innovative, game-changing, streamline, leverage, transform, revolutionize
264
+
265
+ Write the full positioning framework to `/tmp/mym-output.json`:
266
+
267
+ ```json
268
+ {
269
+ "positioning_angles": [
270
+ {
271
+ "pain": "theme name",
272
+ "statement": "one-line positioning using market language",
273
+ "headline": "landing page headline using verbatim pain language",
274
+ "cold_email_subject": "subject line"
275
+ }
276
+ ],
277
+ "icp_card": {
278
+ "one_liner": "one sentence: who they are + what they care about",
279
+ "where_to_find_them": [...],
280
+ "how_to_talk_to_them": "tone + vocabulary notes from the data"
281
+ },
282
+ "market_map": [...top vendors from G2 with positioning notes...]
283
+ }
284
+ ```
285
+
286
+ ---
287
+
288
+ ## Step 8: Self-QA and Save Output
289
+
290
+ Run self-QA checks:
291
+
292
+ ```bash
293
+ python3 -c "
294
+ import json
295
+
296
+ # Load all outputs
297
+ with open('/tmp/mym-raw.json') as f:
298
+ raw = json.load(f)
299
+ with open('/tmp/mym-clusters.json') as f:
300
+ clusters = json.load(f)
301
+ with open('/tmp/mym-output.json') as f:
302
+ output = json.load(f)
303
+
304
+ raw_texts = set()
305
+ for p in raw['raw_pains']:
306
+ raw_texts.add(p.get('title', ''))
307
+ raw_texts.add(p.get('body_excerpt', ''))
308
+
309
+ # Check 1: No em dashes
310
+ import json as j
311
+ full_text = j.dumps(output)
312
+ if '—' in full_text:
313
+ print('FAIL: em dash found in output')
314
+ else:
315
+ print('PASS: no em dashes')
316
+
317
+ # Check 2: No banned words
318
+ banned = ['powerful', 'robust', 'seamless', 'innovative', 'game-changing',
319
+ 'streamline', 'leverage', 'transform', 'revolutionize']
320
+ found = [w for w in banned if w.lower() in full_text.lower()]
321
+ if found:
322
+ print(f'FAIL: banned words found: {found}')
323
+ else:
324
+ print('PASS: no banned words')
325
+
326
+ # Check 3: Market size language check
327
+ if 'billion' in full_text.lower() or 'trillion' in full_text.lower() or 'worth \$' in full_text.lower():
328
+ print('FAIL: hard market size estimate found -- use directional language only')
329
+ else:
330
+ print('PASS: no hard market size estimates')
331
+
332
+ # Check 4: Signal counts match
333
+ total = raw['summary']['total_pain_signals']
334
+ print(f'PASS: {total} total pain signals in raw data')
335
+
336
+ print('Self-QA complete.')
337
+ "
338
+ ```
339
+
340
+ Fix any failures before saving.
341
+
342
+ Save the final report:
343
+
344
+ ```bash
345
+ python3 << 'PYEOF'
346
+ import json, re
347
+ from datetime import datetime
348
+
349
+ with open('/tmp/mym-input.json') as f:
350
+ inp = json.load(f)
351
+ with open('/tmp/mym-raw.json') as f:
352
+ raw = json.load(f)
353
+ with open('/tmp/mym-clusters.json') as f:
354
+ clusters = json.load(f)
355
+ with open('/tmp/mym-output.json') as f:
356
+ output = json.load(f)
357
+
358
+ slug = re.sub(r'[^a-z0-9]+', '-', inp['category'].lower()).strip('-')
359
+ date = datetime.now().strftime('%Y-%m-%d')
360
+ outpath_md = f"docs/market-maps/{slug}-{date}.md"
361
+ outpath_json = f"docs/market-maps/{slug}-{date}.json"
362
+
363
+ # Build markdown report
364
+ ms = raw['market_signals']
365
+ icp = clusters.get('icp', {})
366
+ market_assessment = clusters.get('market_size', {})
367
+ angles = output.get('positioning_angles', [])
368
+ icp_card = output.get('icp_card', {})
369
+ market_map = output.get('market_map', [])
370
+
371
+ lines = [
372
+ f"# Market Map: {inp['category'].title()}",
373
+ f"Date: {date} | Signals analyzed: {raw['summary']['total_pain_signals']} | Sources: Reddit ({ms['reddit_signals_found']}) + HN ({ms['hn_signals_found']}) + GitHub Issues ({ms['github_issue_signals']})",
374
+ "",
375
+ "---",
376
+ "",
377
+ "## Market Size Signals",
378
+ f"Vendors on G2: {ms['vendor_count_g2']} | Google Trends: {ms['trends_direction'].upper()} | Market stage: {market_assessment.get('stage', 'see signals below')}",
379
+ "",
380
+ market_assessment.get('summary', ''),
381
+ "",
382
+ "---",
383
+ "",
384
+ "## Your ICP",
385
+ "",
386
+ f"**Who they are:** {icp.get('who_they_are', '')}",
387
+ "",
388
+ f"**Where they live:** {', '.join(icp.get('where_they_live', []))}",
389
+ "",
390
+ "**What they say:**",
391
+ ]
392
+ for q in icp.get('what_they_say', []):
393
+ lines.append(f'> "{q}"')
394
+ lines += ["", "---", "", "## Top Pains (ranked by signal strength)", ""]
395
+
396
+ for i, c in enumerate(clusters.get('clusters', []), 1):
397
+ lines.append(f"### Pain {i}: {c['theme']} [score: {c['total_score']}]")
398
+ sources = c.get('sources', {})
399
+ source_str = " + ".join(f"{src} ({cnt})" for src, cnt in sources.items())
400
+ lines.append(f"{c['signal_count']} signals | Sources: {source_str}")
401
+ lines.append(f"Who has this pain: {c.get('who_has_this_pain', '')}")
402
+ lines.append("")
403
+ lines.append("Verbatim:")
404
+ for q in c.get('verbatim_quotes', [])[:4]:
405
+ lines.append(f'> "{q[\"text\"]}" ({q["source"]}, score: {q["score"]})')
406
+ lines.append("")
407
+
408
+ lines += ["---", "", "## Market Map (Key Players)", ""]
409
+ if market_map:
410
+ lines.append("| Vendor | Positioning |")
411
+ lines.append("|---|---|")
412
+ for v in market_map:
413
+ lines.append(f"| {v.get('name','')} | {v.get('positioning','')} |")
414
+ else:
415
+ top = ms.get('top_vendors', [])
416
+ if top:
417
+ lines.append("| Vendor | G2 Reviews | Rating |")
418
+ lines.append("|---|---|---|")
419
+ for v in top:
420
+ lines.append(f"| {v.get('name','')} | {v.get('review_count','')} | {v.get('rating','')} |")
421
+
422
+ lines += ["", "---", "", "## Messaging Framework", ""]
423
+ for a in angles:
424
+ lines.append(f"**{a['pain']}:** {a['statement']}")
425
+ lines.append(f"Headline: \"{a['headline']}\"")
426
+ lines.append(f"Cold email subject: \"{a['cold_email_subject']}\"")
427
+ lines.append("")
428
+
429
+ lines += ["---", "", "## ICP Card", "",
430
+ f"**One liner:** {icp_card.get('one_liner', '')}",
431
+ "",
432
+ f"**Find them at:** {', '.join(icp_card.get('where_to_find_them', []))}",
433
+ "",
434
+ f"**How to talk to them:** {icp_card.get('how_to_talk_to_them', '')}",
435
+ "",
436
+ "---",
437
+ "",
438
+ "## Data Quality Notes",
439
+ f"- All pain quotes are verbatim from raw signals",
440
+ f"- All vendor names from G2 scrape",
441
+ f"- Market size is directional only (no dollar estimates)",
442
+ f"- Sources: Reddit ({ms['reddit_signals_found']}), HN ({ms['hn_signals_found']}), GitHub Issues ({ms['github_issue_signals']}), G2 ({ms['vendor_count_g2']} vendors)",
443
+ "",
444
+ f"Saved to: {outpath_md}",
445
+ f"JSON snapshot: {outpath_json}",
446
+ ]
447
+
448
+ with open(outpath_md, 'w') as f:
449
+ f.write('\n'.join(lines))
450
+
451
+ # Save JSON snapshot
452
+ snapshot = {"input": inp, "market_signals": ms, "clusters": clusters.get('clusters', []),
453
+ "icp": icp, "market_size": market_assessment, "positioning": output, "date": date}
454
+ with open(outpath_json, 'w') as f:
455
+ json.dump(snapshot, f, indent=2)
456
+
457
+ print(f"Report saved: {outpath_md}")
458
+ print(f"JSON snapshot: {outpath_json}")
459
+ PYEOF
460
+ ```
461
+
462
+ Clean up temp files:
463
+
464
+ ```bash
465
+ rm -f /tmp/mym-input.json /tmp/mym-raw.json /tmp/mym-clusters.json /tmp/mym-output.json
466
+ echo "Done. Market map saved to docs/market-maps/"
467
+ ```
468
+
469
+ Present the full contents of the saved `.md` file to the user.