social-media-analyzer by borghei/claude-skills
npx skills add https://github.com/borghei/claude-skills --skill social-media-analyzer通过互动指标、投资回报率计算和平台基准进行广告活动表现分析。
分析社交媒体广告活动表现:
| 字段 | 必需 | 描述 |
|---|---|---|
| platform | 是 | instagram, facebook, twitter, linkedin, tiktok |
| posts[] | 是 | 帖子数据数组 |
| posts[].likes | 是 | 点赞/反应数 |
| posts[].comments |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 是 |
| 评论数 |
| posts[].reach | 是 | 覆盖的独立用户数 |
| posts[].impressions | 否 | 总浏览量 |
| posts[].shares | 否 | 分享/转发数 |
| posts[].saves | 否 | 保存/收藏数 |
| posts[].clicks | 否 | 链接点击量 |
| total_spend | 否 | 广告支出(用于计算投资回报率) |
分析前,请验证:
Engagement Rate = (Likes + Comments + Shares + Saves) / Reach × 100
| 指标 | 公式 | 解释 |
|---|---|---|
| Engagement Rate | Engagements / Reach × 100 | 受众互动水平 |
| CTR | Clicks / Impressions × 100 | 内容点击吸引力 |
| Reach Rate | Reach / Followers × 100 | 内容分发情况 |
| Virality Rate | Shares / Impressions × 100 | 分享价值 |
| Save Rate | Saves / Reach × 100 | 内容价值 |
| 评级 | 互动率 | 行动 |
|---|---|---|
| Excellent | > 6% | 扩大规模并复制 |
| Good | 3-6% | 优化并扩展 |
| Average | 1-3% | 测试改进 |
| Poor | < 1% | 分析并调整方向 |
计算广告支出回报率:
| 指标 | 公式 |
|---|---|
| Cost Per Engagement (CPE) | Total Spend / Total Engagements |
| Cost Per Click (CPC) | Total Spend / Total Clicks |
| Cost Per Thousand (CPM) | (Spend / Impressions) × 1000 |
| Return on Ad Spend (ROAS) | Revenue / Ad Spend |
| 行动 | 价值 | 依据 |
|---|---|---|
| Like | $0.50 | 品牌知名度 |
| Comment | $2.00 | 主动互动 |
| Share | $5.00 | 内容放大 |
| Save | $3.00 | 意向信号 |
| Click | $1.50 | 流量价值 |
| 投资回报率 % | 评级 | 建议 |
|---|
500% | Excellent | 大幅增加预算
200-500% | Good | 适度增加预算
100-200% | Acceptable | 优化后再扩大规模
0-100% | Break-even | 检查定位和创意
< 0% | Negative | 暂停并重组
| 平台 | 平均 | 良好 | 优秀 |
|---|---|---|---|
| 1.22% | 3-6% | >6% | |
| 0.07% | 0.5-1% | >1% | |
| Twitter/X | 0.05% | 0.1-0.5% | >0.5% |
| 2.0% | 3-5% | >5% | |
| TikTok | 5.96% | 8-15% | >15% |
| 平台 | 平均 | 良好 | 优秀 |
|---|---|---|---|
| 0.22% | 0.5-1% | >1% | |
| 0.90% | 1.5-2.5% | >2.5% | |
| 0.44% | 1-2% | >2% | |
| TikTok | 0.30% | 0.5-1% | >1% |
| 平台 | 平均 | 良好 |
|---|---|---|
| $0.97 | <$0.50 | |
| $1.20 | <$0.70 | |
| $5.26 | <$3.00 | |
| TikTok | $1.00 | <$0.50 |
完整的基准数据请参见 references/platform-benchmarks.md。
python scripts/calculate_metrics.py assets/sample_input.json
计算每条帖子的互动率、点击率、覆盖率和广告活动总计。
python scripts/analyze_performance.py assets/sample_input.json
生成包含投资回报率、基准比较和建议的完整表现分析。
输出包括:
参见 assets/sample_input.json:
{
"platform": "instagram",
"total_spend": 500,
"posts": [
{
"post_id": "post_001",
"content_type": "image",
"likes": 342,
"comments": 28,
"shares": 15,
"saves": 45,
"reach": 5200,
"impressions": 8500,
"clicks": 120
}
]
}
参见 assets/expected_output.json:
{
"campaign_metrics": {
"total_engagements": 1521,
"avg_engagement_rate": 8.36,
"ctr": 1.55
},
"roi_metrics": {
"total_spend": 500.0,
"cost_per_engagement": 0.33,
"roi_percentage": 660.5
},
"insights": {
"overall_health": "excellent",
"benchmark_comparison": {
"engagement_status": "excellent",
"engagement_benchmark": "1.22%",
"engagement_actual": "8.36%"
}
}
}
示例广告活动显示:
references/platform-benchmarks.md 包含:
| 当您请求... | 您将获得... |
|---|---|
| "社交媒体审计" | 跨平台表现分析与基准比较 |
| "哪些内容表现好?" | 最佳内容分析,包含模式和建议 |
| "竞争对手社交媒体分析" | 竞争对手社交媒体比较,识别差距 |
| "广告活动投资回报率" | 包含互动价值估算的完整投资回报率计算 |
所有输出均通过质量验证:
| 问题 | 可能原因 | 解决方案 |
|---|---|---|
| 互动率看起来不切实际地高(>50%) | 相对于互动数,覆盖人数值过低,或者覆盖人数/展示量数据混淆 | 验证 reach 代表覆盖的独立用户数(而非展示量)。互动率 = (点赞 + 评论 + 分享 + 收藏) / 覆盖人数。如果使用 2025 年以后的 Instagram 数据,请注意 Instagram 已将主要指标从"展示量"转为"观看次数"——确保使用正确的字段 |
| 基准比较显示 "no_benchmark_available" | 输入 JSON 中的平台名称与预期值不匹配 | 使用确切的小写平台名称:instagram, facebook, twitter, linkedin, tiktok。分析器会与这些精确字符串进行匹配 |
| 尽管互动良好,但投资回报率计算显示为负值 | 互动价值估算对您所在行业来说过于保守 | 默认的互动价值模型使用 $0.50/点赞、$2.00/评论、$5.00/分享、$3.00/收藏、$1.50/点击。针对您特定的垂直领域,在 calculate_metrics.py 中调整这些值。B2B 公司通常比 B2C 公司具有更高的每次互动价值 |
| 与基准相比,TikTok 指标显示互动率较低 | 在一个以观看次数为基础指标的平台上使用了基于覆盖人数的计算 | TikTok 2026 年 2.50-3.70% 的基准互动率是针对观看次数计算的,而非覆盖人数。为确保准确比较,请确保您的 TikTok 数据在 reach 字段中使用视频观看次数。TikTok 互动率在 2025 年同比增长了 49% |
| LinkedIn 互动率低于预期 | 与过时的基准进行比较 | LinkedIn 2026 年的互动率中位数约为 3.85-6.1%,显著高于其他平台。轮播/文档帖子获得最高的互动率(中位数高达 21.77%)。如果您的互动率低于 2%,请专注于能引发对话的内容,而非公司公告 |
| 尽管内容质量一致,但 Instagram 指标下降 | 2025-2026 年算法和指标定义的变更 | Instagram 已将所有格式(Reels、Stories、帖子)的主要指标转为"观看次数",取代了"展示量"和"播放次数"。轮播帖子现在获得最多的互动。Meta 计划在 2026 年 6 月前在 Graph API 中用"观看者"指标取代覆盖人数。请相应调整您的数据收集方式 |
| 广告活动分析的帖子数量太少,无法获得可靠的见解 | 样本量小导致平均值不可靠 | 建议至少 10 个帖子进行有意义的分析。analyze_performance.py 脚本会标记帖子数少于 10 的广告活动。为了统计可靠性,每个分析周期应包含 30 个以上的帖子 |
范围内:
范围外:
平台 API 变更(2025-2026):
| 集成 | 目的 | 连接方式 |
|---|---|---|
| Meta Business Suite | 导出 Instagram 和 Facebook 广告活动数据 | 将帖子级别指标(点赞、评论、分享、覆盖人数、展示量、点击量)导出为 JSON,供 calculate_metrics.py 和 analyze_performance.py 使用。注意:"观看次数"将在 2026 年取代"展示量" |
| LinkedIn Campaign Manager | 导出 LinkedIn 广告和自然表现数据 | 导出每条帖子的互动指标。LinkedIn 原生分析现在包含"观看者"人口统计数据和 AI 搜索可见性数据 |
| TikTok Business Center | 导出 TikTok 广告活动表现数据 | 导出视频级别指标。将视频观看次数用作计算互动率的覆盖人数等效值 |
| Google Analytics 4 (GA4) | 跟踪您网站上的社交流量和转化 | 将社交媒体广告活动的 UTM 参数连接到 GA4,以衡量下游转化。使用 campaign-analytics 技能进行完整归因 |
| campaign-analytics 技能 | 跨渠道投资回报率比较 | 将社交媒体投资回报率数据与其他渠道的数据一起输入 campaign_roi_calculator.py,进行统一的组合分析 |
| content-creator 技能 | 基于表现数据的内容优化 | 使用表现最佳帖子的分析来指导内容策略。应用 brand_voice_analyzer.py 确保社交媒体内容符合品牌声音 |
| marketing-demand-acquisition 技能 | 社交媒体作为潜在客户获取渠道 | 将社交媒体表现数据整合到潜在客户获取渠道组合评估中。将社交媒体的客户获取成本数据与其他获取渠道的数据结合使用 |
类型: Python 库(导入使用,非命令行界面)
类:
SocialMediaMetricsCalculator(campaign_data: Dict)构造函数输入: {"platform": "instagram", "total_spend": 500, "posts": [{"post_id": "str", "content_type": "str", "likes": int, "comments": int, "shares": int, "saves": int, "reach": int, "impressions": int, "clicks": int}]}
关键方法:
| 方法 | 参数 | 返回值 |
|---|---|---|
calculate_engagement_rate() | post: Dict (likes, comments, shares, saves, reach) | 互动率百分比(浮点数)。公式:(likes + comments + shares + saves) / reach * 100 |
calculate_ctr() | clicks: int, impressions: int | 点击率百分比(浮点数) |
calculate_campaign_metrics() | None(使用构造函数数据) | 包含 platform, total_posts, total_engagements, total_reach, total_impressions, total_clicks, avg_engagement_rate, ctr 的字典 |
calculate_roi_metrics() | None(使用构造函数数据) | 包含 total_spend, cost_per_engagement, cost_per_click, estimated_value(默认 $2.50/互动), roi_percentage 的字典 |
identify_top_posts() | metric: str = 'engagement_rate', limit: int = 5 | 按指定指标排序的顶部帖子列表。支持的指标:engagement_rate, likes, comments, shares, clicks |
analyze_all() | None | 包含 campaign_metrics, roi_metrics, 和 top_posts 的组合字典 |
类型: Python 库(导入使用,非命令行界面)
类:
PerformanceAnalyzer(campaign_metrics: Dict, roi_metrics: Dict)内置基准: 针对 facebook, instagram, twitter, linkedin, tiktok 的互动率和点击率基准。
关键方法:
| 方法 | 参数 | 返回值 |
|---|---|---|
benchmark_performance() | None | 包含 engagement_status, engagement_benchmark, engagement_actual, ctr_status, ctr_benchmark, ctr_actual 的字典。状态值:excellent(>=1.5x 基准),good(>=基准),below_average |
generate_recommendations() | None | 基于互动率、点击率、每次点击成本、投资回报率和帖子数量阈值的可操作建议字符串列表 |
generate_insights() | None | 包含 overall_health(excellent/good/needs_improvement), benchmark_comparison, recommendations, key_strengths, areas_for_improvement 的字典 |
每周安装次数
73
仓库
GitHub 星标数
51
首次出现
2026年2月23日
安全审计
安装于
github-copilot59
gemini-cli59
cline59
codex59
opencode59
cursor59
Campaign performance analysis with engagement metrics, ROI calculations, and platform benchmarks.
Analyze social media campaign performance:
| Field | Required | Description |
|---|---|---|
| platform | Yes | instagram, facebook, twitter, linkedin, tiktok |
| posts[] | Yes | Array of post data |
| posts[].likes | Yes | Like/reaction count |
| posts[].comments | Yes | Comment count |
| posts[].reach | Yes | Unique users reached |
| posts[].impressions | No | Total views |
| posts[].shares | No | Share/retweet count |
| posts[].saves | No | Save/bookmark count |
| posts[].clicks | No | Link clicks |
| total_spend | No | Ad spend (for ROI) |
Before analysis, verify:
Engagement Rate = (Likes + Comments + Shares + Saves) / Reach × 100
| Metric | Formula | Interpretation |
|---|---|---|
| Engagement Rate | Engagements / Reach × 100 | Audience interaction level |
| CTR | Clicks / Impressions × 100 | Content click appeal |
| Reach Rate | Reach / Followers × 100 | Content distribution |
| Virality Rate | Shares / Impressions × 100 | Share-worthiness |
| Save Rate | Saves / Reach × 100 | Content value |
| Rating | Engagement Rate | Action |
|---|---|---|
| Excellent | > 6% | Scale and replicate |
| Good | 3-6% | Optimize and expand |
| Average | 1-3% | Test improvements |
| Poor | < 1% | Analyze and pivot |
Calculate return on ad spend:
| Metric | Formula |
|---|---|
| Cost Per Engagement (CPE) | Total Spend / Total Engagements |
| Cost Per Click (CPC) | Total Spend / Total Clicks |
| Cost Per Thousand (CPM) | (Spend / Impressions) × 1000 |
| Return on Ad Spend (ROAS) | Revenue / Ad Spend |
| Action | Value | Rationale |
|---|---|---|
| Like | $0.50 | Brand awareness |
| Comment | $2.00 | Active engagement |
| Share | $5.00 | Amplification |
| Save | $3.00 | Intent signal |
| Click | $1.50 | Traffic value |
| ROI % | Rating | Recommendation |
|---|
500% | Excellent | Scale budget significantly
200-500% | Good | Increase budget moderately
100-200% | Acceptable | Optimize before scaling
0-100% | Break-even | Review targeting and creative
< 0% | Negative | Pause and restructure
| Platform | Average | Good | Excellent |
|---|---|---|---|
| 1.22% | 3-6% | >6% | |
| 0.07% | 0.5-1% | >1% | |
| Twitter/X | 0.05% | 0.1-0.5% | >0.5% |
| 2.0% | 3-5% | >5% | |
| TikTok | 5.96% | 8-15% | >15% |
| Platform | Average | Good | Excellent |
|---|---|---|---|
| 0.22% | 0.5-1% | >1% | |
| 0.90% | 1.5-2.5% | >2.5% | |
| 0.44% | 1-2% | >2% | |
| TikTok | 0.30% | 0.5-1% | >1% |
| Platform | Average | Good |
|---|---|---|
| $0.97 | <$0.50 | |
| $1.20 | <$0.70 | |
| $5.26 | <$3.00 | |
| TikTok | $1.00 | <$0.50 |
See references/platform-benchmarks.md for complete benchmark data.
python scripts/calculate_metrics.py assets/sample_input.json
Calculates engagement rate, CTR, reach rate for each post and campaign totals.
python scripts/analyze_performance.py assets/sample_input.json
Generates full performance analysis with ROI, benchmarks, and recommendations.
Output includes:
See assets/sample_input.json:
{
"platform": "instagram",
"total_spend": 500,
"posts": [
{
"post_id": "post_001",
"content_type": "image",
"likes": 342,
"comments": 28,
"shares": 15,
"saves": 45,
"reach": 5200,
"impressions": 8500,
"clicks": 120
}
]
}
See assets/expected_output.json:
{
"campaign_metrics": {
"total_engagements": 1521,
"avg_engagement_rate": 8.36,
"ctr": 1.55
},
"roi_metrics": {
"total_spend": 500.0,
"cost_per_engagement": 0.33,
"roi_percentage": 660.5
},
"insights": {
"overall_health": "excellent",
"benchmark_comparison": {
"engagement_status": "excellent",
"engagement_benchmark": "1.22%",
"engagement_actual": "8.36%"
}
}
}
The sample campaign shows:
references/platform-benchmarks.md contains:
| When you ask for... | You get... |
|---|---|
| "Social media audit" | Performance analysis across platforms with benchmarks |
| "What's performing?" | Top content analysis with patterns and recommendations |
| "Competitor social analysis" | Competitive social media comparison with gaps |
| "Campaign ROI" | Full ROI calculation with engagement value estimates |
All output passes quality verification:
| Problem | Likely Cause | Solution |
|---|---|---|
| Engagement rate appears unrealistically high (>50%) | Reach value is too low relative to engagements, or reach/impressions data is swapped | Verify that reach represents unique users reached (not impressions). Engagement rate = (likes + comments + shares + saves) / reach. If using Instagram data from 2025+, note that Instagram shifted from "impressions" to "views" as primary metric -- ensure you are using the correct field |
| Benchmark comparison shows "no_benchmark_available" | Platform name in input JSON does not match expected values | Use exact lowercase platform names: instagram, facebook, twitter, linkedin, tiktok. The analyzer matches against these exact strings |
In Scope:
Out of Scope:
Platform API Changes (2025-2026):
| Integration | Purpose | How to Connect |
|---|---|---|
| Meta Business Suite | Export Instagram and Facebook campaign data | Export post-level metrics (likes, comments, shares, reach, impressions, clicks) as JSON for calculate_metrics.py and analyze_performance.py. Note: "Views" is replacing "Impressions" in 2026 |
| LinkedIn Campaign Manager | Export LinkedIn ad and organic performance data | Export engagement metrics per post. LinkedIn's native analytics now includes "Viewer" demographics and AI search visibility data |
| TikTok Business Center | Export TikTok campaign performance data | Export video-level metrics. Use video views as the reach equivalent for engagement rate calculation |
| Google Analytics 4 (GA4) | Track social traffic and conversions on your website | Connect social campaign UTM parameters to GA4 to measure downstream conversions. Use campaign-analytics skill for full attribution |
Type: Python library (imported, not CLI)
Classes:
SocialMediaMetricsCalculator(campaign_data: Dict)Constructor Input: {"platform": "instagram", "total_spend": 500, "posts": [{"post_id": "str", "content_type": "str", "likes": int, "comments": int, "shares": int, "saves": int, "reach": int, "impressions": int, "clicks": int}]}
Key Methods:
| Method | Parameters | Returns |
|---|---|---|
calculate_engagement_rate() | post: Dict (likes, comments, shares, saves, reach) | Engagement rate as percentage (float). Formula: (likes + comments + shares + saves) / reach * 100 |
calculate_ctr() | clicks: int, impressions: int | CTR as percentage (float) |
calculate_campaign_metrics() | None (uses constructor data) | Dict with platform, total_posts, total_engagements, total_reach, total_impressions, total_clicks, avg_engagement_rate, ctr |
Type: Python library (imported, not CLI)
Classes:
PerformanceAnalyzer(campaign_metrics: Dict, roi_metrics: Dict)Built-in Benchmarks: Engagement rate and CTR benchmarks for facebook, instagram, twitter, linkedin, tiktok.
Key Methods:
| Method | Parameters | Returns |
|---|---|---|
benchmark_performance() | None | Dict with engagement_status, engagement_benchmark, engagement_actual, ctr_status, ctr_benchmark, ctr_actual. Status values: excellent (>=1.5x benchmark), good (>=benchmark), below_average |
generate_recommendations() | None | List of actionable recommendation strings based on engagement rate, CTR, CPC, ROI, and post volume thresholds |
generate_insights() | None | Dict with overall_health (//), benchmark_comparison, recommendations, key_strengths, areas_for_improvement |
Weekly Installs
73
Repository
GitHub Stars
51
First Seen
Feb 23, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot59
gemini-cli59
cline59
codex59
opencode59
cursor59
Python PDF处理教程:合并拆分、提取文本表格、创建PDF文件
65,000 周安装
| ROI calculation shows negative despite good engagement | Engagement value estimates are too conservative for your industry | The default engagement value model uses $0.50/like, $2.00/comment, $5.00/share, $3.00/save, $1.50/click. Adjust these values in calculate_metrics.py for your specific vertical. B2B companies typically have higher per-engagement values than B2C |
| TikTok metrics show low engagement compared to benchmarks | Using reach-based calculation on a platform where view-based metrics are standard | TikTok's 2026 benchmark engagement rate of 2.50-3.70% is calculated against views, not reach. Ensure your TikTok data uses video views in the reach field for accurate comparison. TikTok engagement rates rose 49% YoY in 2025 |
| LinkedIn engagement appears lower than expected | Comparing against outdated benchmarks | LinkedIn's 2026 median engagement rate is approximately 3.85-6.1%, significantly higher than other platforms. Carousel/document posts earn the highest engagement (up to 21.77% median). If your rate is below 2%, focus on conversation-starting content rather than corporate announcements |
| Instagram metrics declining despite consistent content quality | Algorithm and metric definition changes in 2025-2026 | Instagram shifted to "Views" as its primary metric across all formats (Reels, Stories, posts), replacing "Impressions" and "Plays." Carousel posts now earn the most engagement. Meta plans to replace reach with "Viewers" metric in Graph API by June 2026. Adapt your data collection accordingly |
| Campaign analysis has too few posts for reliable insights | Small sample size produces unreliable averages | Minimum 10 posts recommended for meaningful analysis. The analyze_performance.py script flags campaigns with fewer than 10 posts. For statistical reliability, aim for 30+ posts per analysis period |
| campaign-analytics skill | Cross-channel ROI comparison | Feed social media ROI data into campaign_roi_calculator.py alongside other channels for unified portfolio analysis |
| content-creator skill | Content optimization based on performance data | Use top-performing post analysis to inform content strategy. Apply brand_voice_analyzer.py to ensure social content matches brand voice |
| marketing-demand-acquisition skill | Social as demand gen channel | Integrate social performance data into demand gen channel mix evaluation. Use CAC data from social alongside other acquisition channels |
calculate_roi_metrics() | None (uses constructor data) | Dict with total_spend, cost_per_engagement, cost_per_click, estimated_value (at $2.50/engagement default), roi_percentage |
identify_top_posts() | metric: str = 'engagement_rate', limit: int = 5 | Sorted list of top posts by specified metric. Supported metrics: engagement_rate, likes, comments, shares, clicks |
analyze_all() | None | Combined dict of campaign_metrics, roi_metrics, and top_posts |
excellentgoodneeds_improvement