@opendirectory.dev/skills 0.1.37 → 0.1.39

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.37",
3
+ "version": "0.1.39",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": {
package/registry.json CHANGED
@@ -149,6 +149,18 @@
149
149
  "version": "1.0.0",
150
150
  "path": "skills/llms-txt-generator"
151
151
  },
152
+ {
153
+ "name": "map-your-market",
154
+ "description": "Given a product description, category keywords, or competitor names (any combination), searches Reddit, Hacker News, GitHub Issues, G2, and Google...",
155
+ "tags": [
156
+ "SEO",
157
+ "Branding",
158
+ "Developer Tools"
159
+ ],
160
+ "author": "opendirectory",
161
+ "version": "0.0.1",
162
+ "path": "skills/map-your-market"
163
+ },
152
164
  {
153
165
  "name": "meeting-brief-generator",
154
166
  "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...",
@@ -331,6 +343,16 @@
331
343
  "version": "0.0.1",
332
344
  "path": "skills/vc-finder"
333
345
  },
346
+ {
347
+ "name": "where-your-customer-lives",
348
+ "description": "Given a product utility and ICP, researches the internet to find the specific channels.",
349
+ "tags": [
350
+ "SEO"
351
+ ],
352
+ "author": "opendirectory",
353
+ "version": "0.0.1",
354
+ "path": "skills/where-your-customer-lives"
355
+ },
334
356
  {
335
357
  "name": "yc-intent-radar-skill",
336
358
  "description": "Scrape daily job listings from YCombinator's Workatastartup platform without duplicates.",
@@ -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,461 @@
1
+ ---
2
+ name: map-your-market
3
+ description: Given a product description, category keywords, or competitor names (any combination), searches Reddit, Hacker News, GitHub Issues, G2, and Google Trends for the real pains your market experiences, then synthesizes everything into a positioning framework showing who your ICP is, what they say out loud, and exactly how to talk to them. Use when asked to understand a market, find ICP pain points, map competitors, build a positioning doc, find messaging angles, or answer who is my customer and what do they actually care about. Trigger when a user says map my market, who is my ICP, what pains does my market have, understand my market, find my target customer, what are the top complaints in X space, help me position my product, or who should I be selling to.
4
+ compatibility: [claude-code, gemini-cli, github-copilot]
5
+ ---
6
+
7
+ # Map Your Market
8
+
9
+ 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.
10
+
11
+ ---
12
+
13
+ **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.
14
+
15
+ ---
16
+
17
+ ## Common Mistakes
18
+
19
+ | The agent will want to... | Why that's wrong |
20
+ |---|---|
21
+ | 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. |
22
+ | 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. |
23
+ | 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. |
24
+ | 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. |
25
+ | 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. |
26
+ | Conflate vendor count with market size | "47 vendors on G2" means competitive, not large. Present all signals as directional indicators, not hard numbers. |
27
+
28
+ ---
29
+
30
+ ## Step 1: Setup Check
31
+
32
+ ```bash
33
+ echo "GITHUB_TOKEN: ${GITHUB_TOKEN:-not set -- GitHub Issues search runs at 60 req/hr unauthenticated}"
34
+ echo "No other API keys required."
35
+ echo ""
36
+ echo "Data sources this run will use:"
37
+ echo " Reddit public JSON (no auth, 10 req/min)"
38
+ echo " HN Algolia API (no auth, free)"
39
+ echo " GitHub Issues API (${GITHUB_TOKEN:+authenticated, }60-5000 req/hr)"
40
+ echo " G2 category scrape (no auth, HTML parse)"
41
+ echo " Google Trends (no auth, unofficial endpoint)"
42
+ ```
43
+
44
+ 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).
45
+
46
+ ---
47
+
48
+ ## Step 2: Parse Input
49
+
50
+ Collect from the conversation:
51
+ - `category` -- keyword(s) describing the market space (e.g. "developer observability", "B2B analytics", "devops tooling")
52
+ - `competitors` -- optional list of competitor product names or domains (e.g. "Datadog, New Relic, Grafana")
53
+ - `product_context` -- optional: what the user's product does (helps tailor messaging angles)
54
+
55
+ If the user provides only a product description with no category keyword: extract 2-3 category keywords from it yourself.
56
+
57
+ If the user provides only competitor names with no category: infer the category by looking up competitors.
58
+
59
+ Write the parsed input:
60
+
61
+ ```bash
62
+ python3 << 'PYEOF'
63
+ import json, os
64
+
65
+ data = {
66
+ "category": "CATEGORY_HERE",
67
+ "competitors": ["COMP_1", "COMP_2"],
68
+ "product_context": "PRODUCT_CONTEXT_HERE"
69
+ }
70
+
71
+ with open("/tmp/mym-input.json", "w") as f:
72
+ json.dump(data, f, indent=2)
73
+ print("Input written to /tmp/mym-input.json")
74
+ print(f"Category: {data['category']}")
75
+ print(f"Competitors: {', '.join(data['competitors']) if data['competitors'] else 'none provided'}")
76
+ PYEOF
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Step 3: Run the Standalone Data Collection Script
82
+
83
+ The script handles all data collection. Check if it exists first:
84
+
85
+ ```bash
86
+ ls scripts/fetch.py 2>/dev/null && echo "script available" || echo "not found"
87
+ ```
88
+
89
+ If available, run it:
90
+
91
+ ```bash
92
+ GITHUB_TOKEN="${GITHUB_TOKEN:-}" python3 scripts/fetch.py \
93
+ "$(python3 -c "import json; d=json.load(open('/tmp/mym-input.json')); print(d['category'])")" \
94
+ --competitors "$(python3 -c "import json; d=json.load(open('/tmp/mym-input.json')); print(','.join(d['competitors']))")" \
95
+ --context "$(python3 -c "import json; d=json.load(open('/tmp/mym-input.json')); print(d['product_context'])")" \
96
+ --output /tmp/mym-raw.json
97
+ ```
98
+
99
+ Wait for completion (allow up to 4 minutes -- Reddit + HN searches take ~90 seconds total).
100
+
101
+ Verify output:
102
+ ```bash
103
+ python3 -c "
104
+ import json
105
+ with open('/tmp/mym-raw.json') as f:
106
+ d = json.load(f)
107
+ print(f'Reddit signals: {d[\"market_signals\"][\"reddit_signals_found\"]}')
108
+ print(f'HN signals: {d[\"market_signals\"][\"hn_signals_found\"]}')
109
+ print(f'GitHub signals: {d[\"market_signals\"][\"github_issue_signals\"]}')
110
+ print(f'G2 vendors: {d[\"market_signals\"][\"vendor_count_g2\"]}')
111
+ print(f'Trends: {d[\"market_signals\"][\"trends_direction\"]}')
112
+ print(f'Total signals: {d[\"summary\"][\"total_pain_signals\"]}')
113
+ "
114
+ ```
115
+
116
+ 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."
117
+
118
+ ---
119
+
120
+ ## Step 4: AI Pain Clustering
121
+
122
+ Print the top 60 pain signals for AI analysis:
123
+
124
+ ```bash
125
+ python3 -c "
126
+ import json
127
+ with open('/tmp/mym-raw.json') as f:
128
+ d = json.load(f)
129
+ top60 = sorted(d['raw_pains'], key=lambda x: x['pain_score'], reverse=True)[:60]
130
+ print(json.dumps(top60, indent=2))
131
+ "
132
+ ```
133
+
134
+ You now have the top 60 pain signals. Analyze them and produce pain clusters.
135
+
136
+ **Instructions for AI analysis:**
137
+ - Identify 5-7 recurring pain themes across all sources
138
+ - For each theme: pick a name that uses the market's own language (not your words)
139
+ - Aggregate the pain_score of all signals in each cluster
140
+ - Select the 3-5 best verbatim quotes for each theme (highest score, most specific language)
141
+ - Note which sources and subreddits each theme concentrates in
142
+ - Flag any theme that appears only in one source (lower confidence)
143
+
144
+ Write the clusters to `/tmp/mym-clusters.json`:
145
+
146
+ ```json
147
+ {
148
+ "clusters": [
149
+ {
150
+ "theme": "exact language from the data",
151
+ "total_score": 847,
152
+ "signal_count": 34,
153
+ "sources": {"reddit": 18, "hn": 12, "github_issue": 4},
154
+ "top_subreddits": ["devops", "sysadmin"],
155
+ "verbatim_quotes": [
156
+ {"text": "exact quote", "source": "reddit", "score": 234, "url": "..."},
157
+ {"text": "exact quote", "source": "hn", "score": 87, "url": "..."}
158
+ ],
159
+ "who_has_this_pain": "description of who is posting about this"
160
+ }
161
+ ]
162
+ }
163
+ ```
164
+
165
+ ```bash
166
+ python3 -c "
167
+ import json, os
168
+ # Confirm clusters file was written
169
+ with open('/tmp/mym-clusters.json') as f:
170
+ d = json.load(f)
171
+ print(f'Clusters written: {len(d[\"clusters\"])}')
172
+ for c in d['clusters']:
173
+ print(f' {c[\"theme\"]} -- score: {c[\"total_score\"]}, signals: {c[\"signal_count\"]}')
174
+ "
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Step 5: ICP Profiling
180
+
181
+ Print the ICP signals from the raw data:
182
+
183
+ ```bash
184
+ python3 -c "
185
+ import json
186
+ with open('/tmp/mym-raw.json') as f:
187
+ d = json.load(f)
188
+ print('ICP signals:')
189
+ print(json.dumps(d['icp_signals'], indent=2))
190
+ print()
191
+ print('Subreddit distribution:')
192
+ sub_counts = {}
193
+ for p in d['raw_pains']:
194
+ s = p.get('subreddit', '')
195
+ if s:
196
+ sub_counts[s] = sub_counts.get(s, 0) + 1
197
+ for sub, count in sorted(sub_counts.items(), key=lambda x: -x[1])[:10]:
198
+ print(f' r/{sub}: {count} signals')
199
+ "
200
+ ```
201
+
202
+ Using the ICP signals and subreddit distribution above, synthesize the ICP profile. Write it to `/tmp/mym-clusters.json` by adding an `icp` key:
203
+
204
+ ```json
205
+ {
206
+ "icp": {
207
+ "who_they_are": "2-3 sentence profile using language from the data",
208
+ "where_they_live": ["r/devops (89 posts)", "r/sysadmin (67 posts)", "HN ask-hn (34 threads)"],
209
+ "what_they_say": ["verbatim quote 1", "verbatim quote 2", "verbatim quote 3"],
210
+ "what_they_have_tried": ["alternative tools or approaches mentioned in the data"],
211
+ "confidence": "high|medium|low -- based on signal volume and source diversity"
212
+ }
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Step 6: Market Size Synthesis
219
+
220
+ Print the market signals:
221
+
222
+ ```bash
223
+ python3 -c "
224
+ import json
225
+ with open('/tmp/mym-raw.json') as f:
226
+ d = json.load(f)
227
+ ms = d['market_signals']
228
+ print('Market signals:')
229
+ print(f' G2 vendors: {ms[\"vendor_count_g2\"]}')
230
+ print(f' Trends direction: {ms[\"trends_direction\"]}')
231
+ print(f' HN signals (12mo): {ms[\"hn_signals_found\"]}')
232
+ print(f' Reddit signals: {ms[\"reddit_signals_found\"]}')
233
+ print(f' G2 top vendors: {json.dumps(ms.get(\"top_vendors\", []), indent=4)}')
234
+ "
235
+ ```
236
+
237
+ Synthesize a directional market size assessment using only these signals. Do not estimate a dollar figure. Use language like:
238
+ - "Signals suggest a competitive, growing market" (many vendors + trends up)
239
+ - "Signals suggest an early market" (few vendors + low signal volume)
240
+ - "Signals suggest a saturated market" (many vendors + flat/down trends)
241
+
242
+ Add the assessment to `/tmp/mym-clusters.json` as a `market_size` key.
243
+
244
+ ---
245
+
246
+ ## Step 7: Positioning Framework
247
+
248
+ Using the clusters (Step 4), ICP (Step 5), and market size (Step 6), generate the positioning framework.
249
+
250
+ **Instructions:**
251
+ - Pick the top 3 pain clusters as the primary positioning angles
252
+ - For each angle: write one positioning statement using verbatim language from the data (not paraphrased)
253
+ - Generate 3 landing page headlines that use the exact phrases people use in the pain data
254
+ - Generate 3 cold email subject lines based on the pain language
255
+ - Do NOT use banned words: powerful, robust, seamless, innovative, game-changing, streamline, leverage, transform, revolutionize
256
+
257
+ Write the full positioning framework to `/tmp/mym-output.json`:
258
+
259
+ ```json
260
+ {
261
+ "positioning_angles": [
262
+ {
263
+ "pain": "theme name",
264
+ "statement": "one-line positioning using market language",
265
+ "headline": "landing page headline using verbatim pain language",
266
+ "cold_email_subject": "subject line"
267
+ }
268
+ ],
269
+ "icp_card": {
270
+ "one_liner": "one sentence: who they are + what they care about",
271
+ "where_to_find_them": [...],
272
+ "how_to_talk_to_them": "tone + vocabulary notes from the data"
273
+ },
274
+ "market_map": [...top vendors from G2 with positioning notes...]
275
+ }
276
+ ```
277
+
278
+ ---
279
+
280
+ ## Step 8: Self-QA and Save Output
281
+
282
+ Run self-QA checks:
283
+
284
+ ```bash
285
+ python3 -c "
286
+ import json
287
+
288
+ # Load all outputs
289
+ with open('/tmp/mym-raw.json') as f:
290
+ raw = json.load(f)
291
+ with open('/tmp/mym-clusters.json') as f:
292
+ clusters = json.load(f)
293
+ with open('/tmp/mym-output.json') as f:
294
+ output = json.load(f)
295
+
296
+ raw_texts = set()
297
+ for p in raw['raw_pains']:
298
+ raw_texts.add(p.get('title', ''))
299
+ raw_texts.add(p.get('body_excerpt', ''))
300
+
301
+ # Check 1: No em dashes
302
+ import json as j
303
+ full_text = j.dumps(output)
304
+ if '—' in full_text:
305
+ print('FAIL: em dash found in output')
306
+ else:
307
+ print('PASS: no em dashes')
308
+
309
+ # Check 2: No banned words
310
+ banned = ['powerful', 'robust', 'seamless', 'innovative', 'game-changing',
311
+ 'streamline', 'leverage', 'transform', 'revolutionize']
312
+ found = [w for w in banned if w.lower() in full_text.lower()]
313
+ if found:
314
+ print(f'FAIL: banned words found: {found}')
315
+ else:
316
+ print('PASS: no banned words')
317
+
318
+ # Check 3: Market size language check
319
+ if 'billion' in full_text.lower() or 'trillion' in full_text.lower() or 'worth \$' in full_text.lower():
320
+ print('FAIL: hard market size estimate found -- use directional language only')
321
+ else:
322
+ print('PASS: no hard market size estimates')
323
+
324
+ # Check 4: Signal counts match
325
+ total = raw['summary']['total_pain_signals']
326
+ print(f'PASS: {total} total pain signals in raw data')
327
+
328
+ print('Self-QA complete.')
329
+ "
330
+ ```
331
+
332
+ Fix any failures before saving.
333
+
334
+ Save the final report:
335
+
336
+ ```bash
337
+ python3 << 'PYEOF'
338
+ import json, re
339
+ from datetime import datetime
340
+
341
+ with open('/tmp/mym-input.json') as f:
342
+ inp = json.load(f)
343
+ with open('/tmp/mym-raw.json') as f:
344
+ raw = json.load(f)
345
+ with open('/tmp/mym-clusters.json') as f:
346
+ clusters = json.load(f)
347
+ with open('/tmp/mym-output.json') as f:
348
+ output = json.load(f)
349
+
350
+ slug = re.sub(r'[^a-z0-9]+', '-', inp['category'].lower()).strip('-')
351
+ date = datetime.now().strftime('%Y-%m-%d')
352
+ outpath_md = f"docs/market-maps/{slug}-{date}.md"
353
+ outpath_json = f"docs/market-maps/{slug}-{date}.json"
354
+
355
+ # Build markdown report
356
+ ms = raw['market_signals']
357
+ icp = clusters.get('icp', {})
358
+ market_assessment = clusters.get('market_size', {})
359
+ angles = output.get('positioning_angles', [])
360
+ icp_card = output.get('icp_card', {})
361
+ market_map = output.get('market_map', [])
362
+
363
+ lines = [
364
+ f"# Market Map: {inp['category'].title()}",
365
+ 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']})",
366
+ "",
367
+ "---",
368
+ "",
369
+ "## Market Size Signals",
370
+ f"Vendors on G2: {ms['vendor_count_g2']} | Google Trends: {ms['trends_direction'].upper()} | Market stage: {market_assessment.get('stage', 'see signals below')}",
371
+ "",
372
+ market_assessment.get('summary', ''),
373
+ "",
374
+ "---",
375
+ "",
376
+ "## Your ICP",
377
+ "",
378
+ f"**Who they are:** {icp.get('who_they_are', '')}",
379
+ "",
380
+ f"**Where they live:** {', '.join(icp.get('where_they_live', []))}",
381
+ "",
382
+ "**What they say:**",
383
+ ]
384
+ for q in icp.get('what_they_say', []):
385
+ lines.append(f'> "{q}"')
386
+ lines += ["", "---", "", "## Top Pains (ranked by signal strength)", ""]
387
+
388
+ for i, c in enumerate(clusters.get('clusters', []), 1):
389
+ lines.append(f"### Pain {i}: {c['theme']} [score: {c['total_score']}]")
390
+ sources = c.get('sources', {})
391
+ source_str = " + ".join(f"{src} ({cnt})" for src, cnt in sources.items())
392
+ lines.append(f"{c['signal_count']} signals | Sources: {source_str}")
393
+ lines.append(f"Who has this pain: {c.get('who_has_this_pain', '')}")
394
+ lines.append("")
395
+ lines.append("Verbatim:")
396
+ for q in c.get('verbatim_quotes', [])[:4]:
397
+ lines.append(f'> "{q[\"text\"]}" ({q["source"]}, score: {q["score"]})')
398
+ lines.append("")
399
+
400
+ lines += ["---", "", "## Market Map (Key Players)", ""]
401
+ if market_map:
402
+ lines.append("| Vendor | Positioning |")
403
+ lines.append("|---|---|")
404
+ for v in market_map:
405
+ lines.append(f"| {v.get('name','')} | {v.get('positioning','')} |")
406
+ else:
407
+ top = ms.get('top_vendors', [])
408
+ if top:
409
+ lines.append("| Vendor | G2 Reviews | Rating |")
410
+ lines.append("|---|---|---|")
411
+ for v in top:
412
+ lines.append(f"| {v.get('name','')} | {v.get('review_count','')} | {v.get('rating','')} |")
413
+
414
+ lines += ["", "---", "", "## Messaging Framework", ""]
415
+ for a in angles:
416
+ lines.append(f"**{a['pain']}:** {a['statement']}")
417
+ lines.append(f"Headline: \"{a['headline']}\"")
418
+ lines.append(f"Cold email subject: \"{a['cold_email_subject']}\"")
419
+ lines.append("")
420
+
421
+ lines += ["---", "", "## ICP Card", "",
422
+ f"**One liner:** {icp_card.get('one_liner', '')}",
423
+ "",
424
+ f"**Find them at:** {', '.join(icp_card.get('where_to_find_them', []))}",
425
+ "",
426
+ f"**How to talk to them:** {icp_card.get('how_to_talk_to_them', '')}",
427
+ "",
428
+ "---",
429
+ "",
430
+ "## Data Quality Notes",
431
+ f"- All pain quotes are verbatim from raw signals",
432
+ f"- All vendor names from G2 scrape",
433
+ f"- Market size is directional only (no dollar estimates)",
434
+ f"- Sources: Reddit ({ms['reddit_signals_found']}), HN ({ms['hn_signals_found']}), GitHub Issues ({ms['github_issue_signals']}), G2 ({ms['vendor_count_g2']} vendors)",
435
+ "",
436
+ f"Saved to: {outpath_md}",
437
+ f"JSON snapshot: {outpath_json}",
438
+ ]
439
+
440
+ with open(outpath_md, 'w') as f:
441
+ f.write('\n'.join(lines))
442
+
443
+ # Save JSON snapshot
444
+ snapshot = {"input": inp, "market_signals": ms, "clusters": clusters.get('clusters', []),
445
+ "icp": icp, "market_size": market_assessment, "positioning": output, "date": date}
446
+ with open(outpath_json, 'w') as f:
447
+ json.dump(snapshot, f, indent=2)
448
+
449
+ print(f"Report saved: {outpath_md}")
450
+ print(f"JSON snapshot: {outpath_json}")
451
+ PYEOF
452
+ ```
453
+
454
+ Clean up temp files:
455
+
456
+ ```bash
457
+ rm -f /tmp/mym-input.json /tmp/mym-raw.json /tmp/mym-clusters.json /tmp/mym-output.json
458
+ echo "Done. Market map saved to docs/market-maps/"
459
+ ```
460
+
461
+ Present the full contents of the saved `.md` file to the user.