analytics-collector
Skill3 starsChanged 6 months agoMITView on GitHub
Collect X and LinkedIn post metrics for the Genfeed content loop and emit normalized Metric JSON for feedback scoring.
- Reads credentials
In this repository60 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ad-copy-creatorSkill
- ad-performance-analyzerSkill
- blog-content-creatorSkill
- brand-architectSkill
- brand-os-architectSkill
- channel-validatorSkill
- cinematic-promptingSkill
- competitive-intelligence-analystSkill
- competitor-analyzerSkill
- constraint-eliminatorSkill
- content-atomizerSkill
- content-factory-operatorSkill
- content-geo-optimizerSkill
- content-loop-orchestratorSkill
- content-reviewerSkill
- content-seo-optimizerSkill
- content-strategistSkill
- copywriterSkill
- email-finderSkill
- expert-architectSkill
- expert-validatorSkill
- funnel-architectSkill
- funnel-validatorSkill
- genfeed-brand-osSkill
- genfeed-connectorSkill
- humanizerSkill
- image-prompt-engineerSkill
- instagram-content-creatorSkill
- instagram-warmupSkill
- internal-commsSkill
- launch-copy-creatorSkill
- lead-channel-optimizerSkill
- leads-researcherSkill
- linkedin-content-creatorSkill
- linkedin-warmupSkill
- media-forgeSkill
- newsletter-creatorSkill
- offer-architectSkill
- offer-validatorSkill
- outbound-optimizerSkill
- partnership-builderSkill
- positioning-anglesSkill
- pricing-strategistSkill
- prompt-generatorSkill
- retention-engineSkill
- search-domain-validatorSkill
- social-posterSkill
- startup-icp-definerSkill
- support-systems-architectSkill
- tiktok-warmupSkill
- traffic-architectSkill
- traffic-validatorSkill
- trend-scoutSkill
- visual-brand-kitSkill
- x-content-creatorSkill
- x-warmupSkill
- youtube-content-creatorSkill
- youtube-video-analystSkill
- youtube-warmupSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 105
All calls are read-only GETs against the platform analytics endpoints.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Analytics Collector
You measure what happened after publishing. Given the ids of posts that went out, you pull their engagement from X and LinkedIn and normalize each to one Metric. You are the analytic in trend -> remix -> produce -> post -> analytic -> repeat.
This is where the loop closes. The orchestrator pipes each Metric you emit into gf record-metric <id>; the connector recomputes that item's feedbackScore; and gf feedback <term> turns those scores into a multiplier that lifts previously-successful themes to the top of the next trend scan. You produce the raw measurement that makes the factory learn.
Pure worker: reads one token from the environment, persists nothing, writes no manifest itself.
Run It
bun run scripts/collect.ts --platform x --ids 1799111,1799222
bun run scripts/collect.ts --platform linkedin --ids "urn:li:share:6844785523593134080"A ContentItem (or an array of {platform, postId}) on stdin is an alternative to --ids — every derivative with a postId is collected:
bun run ../genfeed-connector/gf.ts get <id> \
| bun run scripts/collect.ts --platform xRequires Bun 1.1+. Zero dependencies — only Node built-ins and global fetch.
Platforms
X
- Endpoint:
GET https://api.x.com/2/tweets?ids=...&tweet.fields=public_metrics,organic_metrics,non_public_metrics. public_metricsworks with an app-only or user token;organic_metrics/non_public_metrics(impressions, link clicks) need a user-context token for the author. If the richer fields are denied, it automatically retries withpublic_metricsalone.- Mapping:
impressions <- impression_count,likes <- like_count,comments <- reply_count,shares <- retweet_count + quote_count,clicks <- url_link_clicks.
- Endpoint:
GET https://api.linkedin.com/rest/socialActions/<urn>withLinkedIn-Version+X-Restli-Protocol-Version: 2.0.0. - Mapping:
likes <- likesSummary.totalLikes,comments <- commentsSummary.aggregatedTotalComments. - Impressions/clicks for member posts require organization analytics scopes and are left undefined here.
Per-id failures warn to stderr and are skipped; the run returns whatever it could collect.
Output
{
"count": 1,
"metrics": [
{
"platform": "x",
"postId": "1799111",
"impressions": 10400,
"likes": 612,
"comments": 41,
"shares": 88,
"clicks": 230,
"capturedAt": "2026-06-08T12:00:00.000Z"
}
]
}Each metric matches the Metric shape in genfeed-connector/lib/schema.ts.
How It Closes The Loop
export X_BEARER_TOKEN="$(bun run ../genfeed-connector/gf.ts token x)"
# 1. measure
bun run scripts/collect.ts --platform x --ids "$POST_ID" > metrics.json
# 2. record each metric — this recomputes feedbackScore on the item
jq -c '.metrics[]' metrics.json | while read -r m; do
bun run ../genfeed-connector/gf.ts record-metric "$ITEM_ID" <<<"$m"
done
# 3. next cycle: trend-scout's raw scores are multiplied by (1 + feedback),
# so themes that performed before rise to the top
bun run ../genfeed-connector/gf.ts feedback "ai agents" # -> { "term": "ai agents", "multiplier": 0.74 }collect measures, the connector remembers, trend-scout re-ranks. That three-skill cycle is the locked loop.
Security
- Tokens (
X_BEARER_TOKEN,LINKEDIN_ACCESS_TOKEN) are read from the environment, used in memory, and never written anywhere. Resolve them through the connector. - All calls are read-only GETs against the platform analytics endpoints; this worker never posts, edits, or deletes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

