mcpField
R
reddit-icp-monitor

reddit-icp-monitor

github.com/varnan-tech营销与增长68753 次安装2 周前更新
代码仓库

关于 reddit-icp-monitor

reddit-icp-monitor 是一项技能,用于查找描述目标客户痛点的 Reddit 帖子、评估相关性并起草回复。它根据 ICP 文件开展搜索,并限制虚构帖子和未经请求的推广。

主要功能

  1. 01按痛点短语搜索 subreddit
  2. 02依据 ICP 文件匹配帖子
  3. 03使用 Gemini 评估候选帖子
  4. 04起草并审核最多 5 条回复
  5. 05保存带日期的监测报告

适用场景

  1. 01查找近期讨论客户痛点的 Reddit 帖子
  2. 02筛选所选社区中的相关帖子
  3. 03为高相关帖子准备非推广式回复

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/varnan-tech/opendirectory --skill reddit-icp-monitor

安装后在 Claude Code 中输入/reddit-icp-monitor确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

.env.example
README.md
evals/
evals.json
references/
icp-format.md
reply-rules.md

详细介绍

Reddit ICP 监控器

监控各个 subreddit,寻找描述你所解决问题的用户。评估其相关性,并为每个匹配项拟写一条有帮助的回复。


**关键规则:**绝不虚构帖子的 URL、标题或内容。输出中的每个帖子都必须来自 Reddit 搜索结果。没有结果的部分标记为“No matches found.”绝不为搜索未返回的帖子拟写回复。

**反垃圾规则:**除非帖子明确要求推荐工具,否则拟写的回复绝不能提及你的产品或公司名称。要像从业者,而不是营销人员。


第 1 步:检查设置

echo "GEMINI_API_KEY: ${GEMINI_API_KEY:+set}"
echo "REDDIT_CLIENT_ID: ${REDDIT_CLIENT_ID:-not set, using public endpoints (10 RPM)}"

如果缺少 GEMINI_API_KEY: 停止。告知用户:“GEMINI_API_KEY is required. Get it at aistudio.google.com. Add it to your .env file.”

如果缺少 Reddit 凭据: 继续。使用 Reddit 的公开 JSON 端点(无需身份验证,限速为 10 RPM)。对于大多数包含 3-6 次 subreddit 搜索的监控任务,这已足够。

如果设置了 REDDIT_CLIENT_ID: 使用 OAuth,限速为 60 RPM。先获取令牌:

TOKEN=$(curl -s -X POST \
  -d "grant_type=password&username=$REDDIT_USERNAME&password=$REDDIT_PASSWORD" \
  --user "$REDDIT_CLIENT_ID:$REDDIT_CLIENT_SECRET" \
  -H "User-Agent: varnan-skills/1.0" \
  https://www.reddit.com/api/v1/access_token \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")

后续所有请求均使用 Authorization: Bearer $TOKEN,并以 https://oauth.reddit.com 作为基础 URL。


第 2 步:加载 ICP

检查是否存在 ICP 文件:

ls docs/icp.md 2>/dev/null && echo "icp found" || echo "icp missing"

**如果 docs/icp.md 存在:**读取该文件并提取:

  • product:一句话产品描述
  • pain_points:痛点短语列表(使用买家的原话)
  • anti_keywords:排除帖子的短语
  • subreddits:要搜索的 subreddit 列表

**如果 docs/icp.md 不存在:**提出以下 3 个问题。全部得到回答后再继续:

  1. 你的产品有什么作用?(一句话)
  2. 你的 ICP 会在哪些 subreddit 发帖?(用逗号分隔,例如 devops、startups、SaaS)
  3. 哪些痛点短语应触发匹配?(用买家自己的话写 3-5 个短语,例如“onboarding takes forever”“can't see why users churn”)

收集完回答后,按照 references/icp-format.md 中的规范格式保存到 docs/icp.md。确认:“ICP saved to docs/icp.md. It will be used automatically in future runs.”

阅读 references/icp-format.md,了解规范格式以及优质与不佳痛点短语的示例。


第 3 步:搜索 Reddit

针对 subreddit 和痛点短语的每种组合,执行一次搜索。除非已设置 OAuth 凭据,否则使用公开端点。

不使用 OAuth(公开端点):

curl -s \
  -H "User-Agent: varnan-skills/1.0" \
  "https://www.reddit.com/r/{SUBREDDIT}/search.json?q={PHRASE}&sort=new&t=week&limit=25&restrict_sr=true" \
  | python3 -c "
import sys, json
d = json.load(sys.stdin)
posts = d.get('data', {}).get('children', [])
for p in posts:
    data = p['data']
    print(json.dumps({
        'id': data['id'],
        'title': data['title'],
        'body': data.get('selftext', '')[:600],
        'url': 'https://reddit.com' + data['permalink'],
        'score': data['score'],
        'comments': data['num_comments'],
        'subreddit': data['subreddit'],
        'created_utc': data['created_utc']
    }))
"

使用 OAuth: 将 https://www.reddit.com 替换为 https://oauth.reddit.com,并添加 -H "Authorization: Bearer $TOKEN"。

在插入查询字符串前,对短语进行 URL 编码:

ENCODED=$(python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "{PHRASE}")

默认时间范围:

  • 默认:t=week(过去 7 天)
  • 用户说“今天”或“过去 24 小时”:t=day
  • 用户说“本月”:t=month

完成所有搜索后:

  • 将所有帖子收集到一个列表中
  • 按帖子 ID 去重。同一帖子匹配多个短语时,只保留一次,并注明所有匹配短语。
  • 如果搜索返回 0 个帖子:记录下来并继续。不要停止。

评分前说明候选帖子总数:“Found X candidate posts across Y subreddits.”


第 4 步:使用 Gemini 评估相关性

将所有候选帖子和 ICP 上下文写入临时文件,然后评分:

cat > /tmp/reddit-score-request.json << 'ENDJSON'
{
  "system_instruction": {
    "parts": [{
      "text": "You are a GTM analyst identifying Reddit posts where someone is experiencing the exact pain point that a specific product solves. For each post provided, output a JSON object with these fields: id (the post id), score (integer 1-5), reason (one sentence explaining the score). Scoring rubric: 5 = person clearly has the problem AND is actively seeking help or venting frustration about it; 4 = strong signal, problem is present but less explicit; 3 = possible match, uncertain; 2 = tangentially related but not the core pain; 1 = unrelated. Output only a JSON array of score objects. No commentary before or after the array."
    }]
  },
  "contents": [{
    "parts": [{
      "text": "POSTS_AND_ICP_CONTEXT_HERE"
    }]
  }],
  "generationConfig": {
    "temperature": 0.2,
    "maxOutputTokens": 2048
  }
}
ENDJSON
curl -s -X POST \
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d @/tmp/reddit-score-request.json \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['candidates'][0]['content']['parts'][0]['text'])"

将 POSTS_AND_ICP_CONTEXT_HERE 替换为:

  • 第 2 步中的产品描述和痛点短语
  • 每个候选帖子:id、标题、正文摘要
  • ICP 中的排除关键词(Gemini 应降低这些帖子的评分)

仅保留评分 >= 4 的帖子以拟写回复。

说明:“X posts scored 4 or 5. Drafting replies.”

如果评分 >= 4 的帖子为 0:输出第 7 步中的零结果消息并停止。不要拟写空回复。


步骤 5:使用 Gemini 起草回复

起草前请阅读 references/reply-rules.md。确定每篇高分帖子的类型(Mode 1、2 或 3),并将模式传递给 Gemini。

对于每篇得分 >= 4 的帖子,起草一条回复(每次会话最多 5 条回复):

cat > /tmp/reddit-reply-request.json << 'ENDJSON'
{
  "system_instruction": {
    "parts": [{
      "text": "You are a practitioner who has personally solved the exact problem being described in this Reddit post. Write a helpful reply that: (1) directly addresses what the person asked or is frustrated about, (2) shares a specific, useful insight from real experience, (3) does NOT mention any product, tool, or company by name unless the post explicitly asks for tool recommendations, (4) is 2-5 sentences, written in plain conversational prose with no headers or bullet lists, (5) optionally ends with a low-pressure invitation to continue the conversation. Do not use marketing language. Do not use these words: game-changer, best-in-class, streamline, transform, revolutionize, leverage, seamless, robust, comprehensive, innovative. Sound like a real person."
    }]
  },
  "contents": [{
    "parts": [{
      "text": "POST_CONTENT_AND_MODE_HERE"
    }]
  }],
  "generationConfig": {
    "temperature": 0.7,
    "maxOutputTokens": 512
  }
}
ENDJSON
curl -s -X POST \
  "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d @/tmp/reddit-reply-request.json \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['candidates'][0]['content']['parts'][0]['text'])"

将 POST_CONTENT_AND_MODE_HERE 替换为:

  • 帖子的完整标题和正文
  • 回复模式(Mode 1:宣泄/沮丧;Mode 2:如何处理 X;Mode 3:工具推荐)
  • 产品描述(让 Gemini 知道在 Mode 1/2 中应避免提及什么)
  • 如果是 Mode 3:Gemini 可以提及该产品,且必须提及一个替代方案

步骤 6:自检

执行所有检查,并在提交前修正违规之处:

  • Mode 1 或 Mode 2 的回复中不得出现产品名称
  • 所有回复中不得出现禁用词:“game-changer”“best-in-class”“streamline”“transform”“revolutionize”“leverage”“seamless”“robust”“innovative”
  • 每条回复均为 2-5 句话(统计并注明)
  • 每条回复都直接回应帖子的具体问题或挫折
  • 输出中的所有 URL 都是搜索结果中的真实 Reddit URL(不是自行构造或猜测的)
  • 起草的回复总数不超过 5 条
  • Mode 3 回复至少提及一个替代方案(不能只提及产品)
  • 如果任何子版块在所有关键词搜索中均返回 0 条结果,请在输出中标明

提交前修正所有违规之处。


步骤 7:输出并保存

提交完整报告:

## Reddit ICP Monitor — [YYYY-MM-DD]

**Subreddits monitored:** r/[subreddit1], r/[subreddit2]
**Time window:** Last 7 days
**Keywords searched:** [phrase1], [phrase2], [phrase3]
**Candidates found:** X posts
**High-signal matches (score 4-5):** Y posts

---

### Match 1 — Score [N]/5
**Post:** [title](url)
**Subreddit:** r/[subreddit] | [N] upvotes | [N] comments
**Signal quote:** "[relevant excerpt from post body]"
**Matched keyword:** [phrase]
**Post type:** Mode [1/2/3]

**Drafted reply:**
[reply text]

**Reply word count:** N words

---

[repeat for each match]

---

**Subreddits with 0 results:** [list any that returned nothing]

如果得分 >= 4 的帖子数为 0: “过去 7 天内,在 [subreddits] 中未找到高信号匹配项。搜索的关键词:[list]。请尝试扩大时间范围(再次运行并输入‘last month’),或在 docs/icp.md 中扩大痛点短语的范围。”

保存到文件:

mkdir -p docs/reddit-intel
OUTFILE="docs/reddit-intel/$(date +%Y-%m-%d).md"
cat > "$OUTFILE" << 'EOF'
REPORT_CONTENT_HERE
EOF
echo "Saved to $OUTFILE"

评论

支持 Markdown