Add X Tweet

bklit/bklit-ui/.agents/skills/add-x-tweet

作者 bklit5d699897b2dde26374cf15501dbaadbc52cea982無授權條款1.7K 個星標收錄於 2026年10月9日更新於 2026年10月9日儲存庫13 天前更新

Add X (Twitter) testimonials to the bklit homepage. Fetches username, avatar, and tweet text from a status URL and appends an entry to apps/web/lib/testimonials.ts. Use when the user shares an x.com/twitter.com tweet URL to add or replace a testimonial.

AI 產生的概覽

抓取 X(Twitter)推文中介資料,並將該推文以推薦語條目附加到專案的推薦語檔案中。

功能
這個技能會接收一個或多個 x.com 或 twitter.com 狀態連結,執行內附的 Node 指令碼來取得推文作者名稱、帳號、頭像和內文,然後編輯 apps/web/lib/testimonials.ts,新增或取代一筆推薦語條目。它也說明了首頁瀑布流版面的排序規則、頭像網址升級方式,以及用 TypeScript 型別檢查來驗證。最終產出是 bklit 網頁應用程式中更新後的推薦語原始檔。
適用情境
當使用者分享 X 或 Twitter 狀態連結,並希望將其加入為首頁推薦語,或要求取代、優先排序、重新排列現有推薦語時使用。
執行需求
需要 Node.js 來執行內附的 scripts/fetch-tweet.mjs,需要存取 FxTwitter API 或 Twitter oEmbed 的網路權限,以及包含 apps/web/lib/testimonials.ts 的程式碼倉庫。不需要 API 金鑰;驗證使用 npx tsc。

Add X Tweet Testimonial

Add social proof tweets to the homepage testimonial grid.

When to use

  • User provides one or more https://x.com/.../status/... URLs
  • User asks to replace, prioritize, or reorder testimonials
  • User says "add tweet", "new testimonial", or similar

Workflow

1. Fetch tweet metadata

Run the fetch script from the repo root (requires network):

bash
node .agents/skills/add-x-tweet/scripts/fetch-tweet.mjs "https://x.com/user/status/123..."

For multiple URLs, pass each URL or run once per URL.

The script prints JSON:

json
{  "id": "123...",  "url": "https://x.com/user/status/123...",  "author": { "name": "...", "handle": "@user", "avatar": "https://pbs.twimg.com/...", "verified": true },  "content": "tweet text without @uixmat prefix"}

Fallback: If the script fails, use Twitter oEmbed:

bash
curl -sL "https://publish.twitter.com/oembed?url=TWEET_URL&omit_script=1"

Parse author_name and HTML <p> for text. Avatar still needs fxtwitter or manual profile image URL.

2. Edit apps/web/lib/testimonials.ts

  • Use status id as id (numeric string from URL)
  • Set url to the canonical tweet URL (no query params)
  • Run avatar through twitterAvatarUrl() (upgrades _200x200 → _400x400)
  • Strip leading @uixmat from content; trim whitespace
  • Shorten very long tweets if they include trailing promo links (keep the praise, drop link-only tails)

3. Ordering rules

Masonry uses CSS columns (top-to-bottom per column). On lg, indices 0–2 = column 1 top 3, 3–5 = column 2 top 3, 6–8 = column 3 top 3.

  • Prioritize when asked: place in the next open slot among indices 0–8 without duplicating ids
  • Replace when asked: remove the old entry (match by handle or old id) before adding the new one
  • Set author.verified from script output (author.verification.verified via FxTwitter)

4. Collapsed grid

The homepage shows testimonialCollapsedCount (6) cards before See more. No change needed when adding tweets unless the user asks to change visible rows.

5. Verify

bash
cd apps/web && npx tsc --noEmit -p tsconfig.json

Open homepage — grid is 3 columns, bottom fade + See more expands max-height.

Data source

Primary: FxTwitter API https://api.fxtwitter.com/{user}/status/{id} — returns author name, screen_name, avatar_url, and text.

Do not commit API keys; the public endpoint is used by the script only at add-tweet time.

Example entry

ts
{  id: "2056717453816729751",  url: "https://x.com/jordienr/status/2056717453816729751",  author: {    name: "jordi",    handle: "@jordienr",    avatar: twitterAvatarUrl(      "https://pbs.twimg.com/profile_images/2053541405121769475/TUDez6zL_200x200.jpg"    ),    verified: true,  },  content: "bklit saved my marriage",},

來源與署名

來源:bklit/bklit-ui位於.agents/skills/add-x-tweet提交5d69989

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架