market-research
⚠️ 付费与数据使用声明(调用前必读)
本技能为按次付费技能,每次调用 0.20 元,通过微信支付 Agent Pay(X402 协议)收款。
数据处理披露(如实告知用户,不隐藏):本技能的结果由后端服务生成。在你确认付费之后,你本次提交的内容会被发送至本技能服务(
POST https://www.skill98.cn/api/resource)用于生成结果;外送范围仅限「你本次提交的这一段内容」,不涉及其他文件或个人隐私信息。未确认付费前,系统不会外送你的内容,也不会产生任何扣款。 本技能不收集、不存储与本技能功能无关的数据,也不向任何第三方转售数据。简单说:你提问题 → 系统提示需付 0.20 元 → 你确认付款 → 系统返回答案。不付费不会扣款,也不会返回完整内容。
本技能知识库与专业提示词已内嵌于本 SKILL.md(及包内 references/ 参考资料),执行前必须先查阅,禁止臆造。
Upstream market-research methodology: market sizing, survey/sampling design, and segmentation. The discipline here is method + assumptions: a TAM is never a single number, a survey is never powered only in aggregate, and a segment is never a demographic slice.
Purpose
Market-research analysts, product marketers, and strategy teams need rigorous evidence before anyone optimizes a campaign or sets a strategy. This skill structures three methodology decisions:
Three deterministic tools:
market_sizer.py— Computes TAM/SAM/SOM by both top-down and bottoms-up methods side-by-side, reports the divergence, and flags failed triangulation. Never returns a single number.sample_size_planner.py— Survey sample size from confidence, margin of error, and expected proportion, with the finite-population correction and per-segment minimums (a survey powered overall is not powered per reported segment).segmentation_scorer.py— Scores candidate segments against Kotler's five criteria and enforces a substantiality + accessibility gate; a slice that is too small or unreachable is dropped.
When to use
Invoke this skill when:
- A board or exec asks "how big is this market?" and you need a defensible, triangulated answer.
- You are fielding a survey and need a sample size that holds up per segment, not just overall.
- You have a list of candidate segments and need to know which are real markets vs demographic slices.
- You are synthesizing competitive intelligence and need a methodological backbone.
Do NOT use this skill to: measure a live campaign (attribution, ROAS, CPA → marketing-skill/campaign-analytics), build demand-gen / paid-media plans (marketing-skill/marketing-demand-acquisition), set positioning / GTM strategy (marketing-skill/marketing-strategy-pmm), or set pricing (commercial/pricing-strategist).
Workflow
- Write the brief — Fill
assets/market_research_brief_template.md(objective, the decision this informs, sizing approach, sampling plan, assumptions register). - Size the market — Run
market_sizer.py --input market.json --method both --profile {b2b-saas|consumer|enterprise|marketplace|hardware|services}. Reconcile the top-down/bottoms-up delta before quoting anything. - Plan the survey — Run
sample_size_planner.py --input survey.json. Fund the per-segment floors, not just the overall n. - Score the segments — Run
segmentation_scorer.py --input segments.json --profile <same>. Drop segments failing the substantiality/accessibility gate. - Assemble the evidence pack — Combine into a brief. Every number carries its method + assumptions + confidence.
Scripts
| Script | Purpose | Profiles |
|---|---|---|
| scripts/market_sizer.py | TAM/SAM/SOM top-down AND bottoms-up + triangulation flag | b2b-saas, consumer, enterprise, marketplace, hardware, services |
| scripts/sample_size_planner.py | Survey n + FPC + per-segment minima | n/a (parameter-driven) |
| scripts/segmentation_scorer.py | Kotler 5-criteria scoring + gate | b2b-saas, consumer, enterprise, marketplace, hardware, services |
All three: stdlib-only, --help, --sample, --output {human,json}.
Onboarding & customization
Run the onboarding questionnaire once before you start — it captures your defaults so every tool in this skill is pre-configured. Customization is the point: the answers actually change tool behavior.
python3 scripts/onboard.py # interactive (also: --defaults, --set key=value, --reset)
python3 scripts/onboard.py --show # see the questions + current effective config
Answers are saved to ~/.config/research-ops/market-research.json (global) or ./.research-ops/market-research.json (--scope project) and are read automatically by config_loader.py. They set the default market profile, the default survey confidence and margin of error, and the default sizing method. CLI flags always override saved config; RESEARCH_OPS_NO_CONFIG=1 ignores it.
The four questions: market profile · survey confidence · margin of error · sizing method.
Optimize with autoresearch (opt-in)
This skill ships an isolated, opt-in bridge to engineering/autoresearch-agent. Only when you ask to "optimize" / "reconcile the sizing" / "run a loop" does an autoresearch experiment iteratively reconcile your market model so top-down and bottoms-up triangulate. scripts/ar_evaluator.py is the ground-truth evaluator; it prints tam_divergence: <fraction> (lower is better).
/ar:setup --domain custom --name tam-triangulation \
--target market.json \
--eval "python3 ar_evaluator.py --target market.json" \
--metric tam_divergence --direction lower
/ar:loop custom/tam-triangulation
Isolated: no hard dependency — autoresearch runs only on demand, and the loop edits market.json, never the evaluator.
References
references/market_sizing_canon.md— TAM/SAM/SOM frameworks (Bessemer, a16z); top-down vs bottoms-up; Fermi estimation; market-model conventions; common sizing fallacies.references/survey_methodology.md— Cochran Sampling Techniques; Dillman Tailored Design Method; Groves Survey Methodology; question-wording bias (Schuman & Presser); AAPOR standards.references/segmentation_and_ci.md— Kotler segmentation criteria; needs-based vs firmographic; Porter Five Forces; SCIP ethics; Christensen JTBD; conjoint/MaxDiff primer.
Assumptions
- The sizer reports both methods but cannot validate your inputs — a top-down "1% of a $40B market" is only as good as the cited source and the serviceable fraction.
- Sample-size uses the conservative p=0.5 (maximum variance) unless you supply an expected proportion.
- Segment scores are inputs you provide; the tool enforces the gates and the weighting, it does not gather the underlying evidence.
- Competitive intelligence must follow the SCIP code of ethics — no misrepresentation, no protected information.
Anti-patterns
- A single TAM number with no method. Always triangulate top-down against bottoms-up.
- Spurious precision. Size to the decision's tolerance; "$3.7142B" implies a confidence you do not have.
- Powering only the total. Each reported segment needs its own sample floor.
- Leading or double-barreled survey questions. Pre-test wording against the bias literature.
- Calling a demographic slice a segment. It must be substantial AND accessible.
Distinct from
| Neighbor | Scope | Difference |
|---|---|---|
| marketing-skill/campaign-analytics | Attribution, ROAS, CPA, funnel of a live campaign | That measures spend deployed; this is upstream methodology |
| marketing-skill/marketing-demand-acquisition | Demand-gen, paid media, channel mix | That runs acquisition; this builds the evidence |
| marketing-skill/marketing-strategy-pmm | Positioning, GTM, category | That sets strategy; this sizes and segments the market |
| commercial/pricing-strategist | Pricing model + WTP + packaging | That sets price; this sizes the market |
| product-research (sibling) | User/product discovery methods | That studies users; this studies the market |
Quick examples
python3 scripts/market_sizer.py --sample
python3 scripts/sample_size_planner.py --population 62000 --confidence 0.95 --moe 0.05
python3 scripts/segmentation_scorer.py --sample --output json
The sample market triangulates a ~$1.47B top-down SAM against the bottoms-up figure and flags the divergence; the segmentation sample drops the "solopreneurs who might want analytics" slice for failing the substantiality and accessibility gates.
Forcing-question library (Matt Pocock grill discipline)
Walked one at a time by /cs:grill-research-ops or the orchestrator. Recommended answer + canon citation per question. Never bundled.
-
"Is your TAM top-down or bottoms-up — and have you computed it both ways to triangulate?" Recommended: both; reconcile the delta before quoting a number. Canon: Bessemer / a16z market-sizing; Fermi estimation.
-
"What decision will this market size actually drive — and at what precision does it matter?" Recommended: size to the decision's tolerance, not to a spurious-precision number. Canon: market-model conventions (Gartner/Forrester); decision-driven analysis.
-
"What's your target margin of error and confidence — and does your sample clear it per segment, not just overall?" Recommended: power each reported segment, not only the total. Canon: Cochran Sampling Techniques; AAPOR standards.
-
"Are your survey questions free of leading and double-barreled wording?" Recommended: pre-test the wording; cite the bias source. Canon: Schuman & Presser; Dillman Tailored Design Method.
-
"Do your segments pass measurable / substantial / accessible / actionable — or are they just demographic slices?" Recommended: drop segments that fail substantiality or accessibility. Canon: Kotler segmentation criteria.
Walk depth-first. Lock 1-2 before opening 3-5. After all are answered, invoke market_sizer.py → sample_size_planner.py → segmentation_scorer.py.
💳 微信 Agent Pay(X402)付费调用声明
📢 数据合规声明(对用户公开):本技能已向用户明确披露「按次付费 0.20 元/次」与「用户内容外送范围(仅本次提交的内容,用于生成结果)」,调用前请确保用户已知悉并同意。本技能不收集与本功能无关的数据,也不向任何第三方转售数据。
一、计费说明
本技能为付费技能,按次计费,单次 0.20 元/次,通过微信支付 Agent Pay(X402 协议)收款。
二、前置要求(🔴 必查)
调用前请确认当前运行环境已具备平台内置的微信 AI 支付能力(含 weixinpay_pay 工具),否则收到 402 响应后无法完成支付授权。请勿引导用户安装任何第三方插件或来源不明的程序包。
三、付费调用流程
第一步:请求资源(触发 402)
向本技能服务发起首次请求:
POST https://www.skill98.cn/api/resource
Content-Type: application/json
{"query": "<用户输入的内容>"}
未支付时服务返回 HTTP 402 Payment Required,并携带以下响应头:
| 响应头 | 含义 |
| --- | --- |
| WeixinPay-Required | 支付凭证 payment_code,交给 weixinpay_pay 申请支付授权 |
| X-Out-Trade-No | 本次订单号,第三步重试时需原样带回 |
响应体示例:
{"code":"PAYMENT_REQUIRED","message":"需要支付后才能获取内容","out_trade_no":"<订单号>","amount":"0.20","currency":"CNY"}
第二步:发起支付
取响应头 WeixinPay-Required 的值作为 paymentCode,调用 weixinpay_pay 向用户申请支付授权。用户确认并完成付款后进入第三步。
第三步:携订单号重试(🔴 支付后必须重新请求)
支付成功后重新发起同一请求,请求体与第一步完全一致,并在请求头带上第一步拿到的订单号:
POST https://www.skill98.cn/api/resource
Content-Type: application/json
X-Out-Trade-No: <第一步返回的订单号>
{"query": "<用户输入的内容>"}
服务校验订单已支付后,返回完整的技能结果。
四、异常处理
| 错误码 | 含义与处理 |
| --- | --- |
| NOT_PAID | 订单未支付:调用 weixinpay_pay 重新发起支付授权,支付后按第三步重试 |
| REFUNDED | 订单已退款:本单结果不可用;如仍需结果,请新发起一次调用(生成新订单) |
| FULFILL_AND_REFUND_FAILED | 履约失败且退款失败:保留订单号提示用户联系商家处理,不得重复扣款 |
| ORDER_NOT_FOUND | 订单号无效:不要用该订单号重试,直接回到第一步重新发起首次请求 |
幂等保证:同一订单号重复请求不会重复扣款;支付成功后凭同一订单号重试可稳定取回同一结果。
💳 付费能力声明(微信 Agent Pay / X402 协议 · Pay Skill)
本技能为 Pay Skill,按调用量计费:0.2 元/次(pricing: { model: per_call, amount_fen: 20 })。付费流程由平台微信 Agent Pay(X402)支付链路完成,费用直达商家微信商户号;本技能不自行收单、不收集、不存储任何支付密钥。
前置检查:当前环境是否支持微信 AI 支付
本 Skill 通过平台微信 Agent Pay(X402)支付链路收款,依赖运行环境内置的微信 AI 支付工具(如 mcp__weixinpay__weixinpay_register、mcp__weixinpay__weixinpay_retry_pay,工具名含 weixinpay_ 即视为具备)完成收款。
- 已具备:按下方流程正常调用。
- 未具备:如实向用户说明结论与解决办法,并终止本次下单。不要引导用户安装任何第三方插件、程序包或来源不明的脚本。 可按环境提示用户:
- 请将当前客户端升级到最新版本后重试;
- 或通过平台官方渠道了解微信 AI 支付的开通方式。
说明:以上检查过程与结论均可对用户公开,无任何需要隐瞒的内容。
支付响应与重试规范(必须严格遵守)
- 下单返回的
WeixinPay-Required字段,必须原样输出,不要改写、省略或总结。 - 若服务返回 HTTP 402(或 200 兼容模式)且带
WeixinPay-Required头,说明需要支付:- 取
WeixinPay-Required的值作为 paymentCode,调用mcp__weixinpay__weixinpay_retry_pay,参数为{ "paymentCode": "<值>" },触发微信支付弹卡; - 弹卡后等用户付款,用户回复「付好了」再继续。
- 取
- 用户在卡片完成支付后,带
payment_code二次调用(原样重试):- 请求 body 与首次一致,另加
payment_code字段(取自 402 响应的payment_code); - 后端会查单验真(trade_state=SUCCESS)后再履约;
- 不带
payment_code重试将永远拿不到付费内容。
- 请求 body 与首次一致,另加
- 支付凭证(payment_code)有效期 ≤ 15 分钟,过期需重新走下单流程。
支付凭据投递铁律
- 凭据必须出现在工具返回值里,靠模型复述不可靠;下单工具的输出要原样返回。
- 响应头与响应体中的凭据必须逐字节一致,不得截断、换行、转义或二次编码。
- 若平台不支持自定义状态码,用 200 兼容模式 +
WeixinPay-Required头。 - 若响应头在传输链路中被剥离,可通过响应体同步返回同一凭据(双通道投递),确保凭据不丢失。
异常处理与订单幂等
- 支付未完成/中断/超时:明确告知用户「当前未完成付费、未扣款」,绝不编造支付成功,绝不脱离平台支付链路交付付费内容。
- 同一订单(
out_trade_no/payment_code)只履约一次;重复重试不重复扣费、不重复交付。 - 支付成功后如需对账,输出中关联平台回传的订单号(
out_trade_no,≤32 位)。

Scan to join WeChat group