Communitygithub.com

Varnan-Tech/opendirectory

建立動畫循環 GIF,使用 CSS 動畫(預設)或 AI 影像轉影片。預設尺寸 800×800 像素,提供 6 種動畫類型、4 種樣式預設。當使用者說「建立一個動畫 GIF」、「製作一個循環 GIF」、「動畫橫幅」、「CSS 動畫 GIF」、「社群媒體動畫」、「讓這個循環」、「動畫圖形」或「動態圖形」時觸發。

opendirectory 是什麼?

此技能 (graphic-gif) 的目標是產生動畫循環的 GIF 檔案,不同於其他輸出靜態 PNG 或 PDF 的 graphic-* 技能。它提供兩種生成路徑:預設的 CSS 動畫路徑 (選項 A) 以及 AI 影像轉影片路徑 (選項 B)。CSS 路徑利用 Playwright 和 Web Animations API 逐幀擷取 CSS @keyframes 動畫,支援淡入、滑入、打字機、計數器、脈衝和循環滾動等六種動畫類型。AI 路徑則使用 Kling API 將靜態影像轉換為影片,再透過 ffmpeg 兩次調色盤處理轉為 GIF。此技能嚴格遵循一系列關鍵規則,包括 800×800 畫布、禁止使用 setTimeout 或 animation-delay 技巧、以及禁止佔位方塊。它支援在 Cursor、Codex 等平台上使用,開發者可以透過指定 animation_type、duration、fps、style 等參數來自訂輸出。生成流程包含設計方向確認、HTML 生成、自我 QA 檢查及最終匯出,確保輸出結果無閃爍、文字清晰且檔案大小適中。

相容平台✓Claude Code~Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/Varnan-Tech/opendirectory/tree/main/skills/graphic-gif

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

graphic-gif

從 CSS 動畫或 AI 影像轉影片 API 產生循環動畫 GIF。輸出:animation.gif。

不同於其他輸出靜態 PNG 或 PDF 的 graphic- 技能,此技能輸出的是動畫 .gif。它使用透過 Playwright 和 Web Animations API 逐幀擷取的 CSS @keyframes 動畫(選項 A,預設),或透過 Kling 的 AI 影像轉影片管道(選項 B)。


關鍵規則(每次生成前務必閱讀)

  1. 預設為 css-animated。 除非明確要求,否則絕不使用 ai-generated。
  2. 畫布為 800×800 像素正方形。 所有 clamp() 值以 800px 計算(1vw = 8px)。
  3. 單一目足 HTML。 所有 CSS 內嵌在 <style> 中。字型 CDN <link> 是唯一的外部依賴。
  4. 絕不在聊天中輸出 HTML。 儲存到檔案,僅顯示摘要。
  5. 影格擷取使用 Web Animations API 搜尋。 禁止使用 setTimeout 循環或 animation-delay 技巧。
  6. 精確影格數: Math.floor(duration_seconds * fps) 個影格。在 t=duration_ms 時的影格不得擷取——它會與 t=0 重複,導致循環點出現明顯的停頓。
  7. 無佔位方塊。 僅使用 CSS 生成的視覺元素。不包含「此處放置圖片」之類的元素。
  8. 較簡單的調色盤 = 較小的檔案。 使用:clean-slate、terminal、electric-burst、brutalist。
  9. 不要使用 animation-delay 來實現錯開效果。 將錯開效果直接寫入 @keyframes 的百分比——影格搜尋會處理時序。
  10. 在撰寫 CSS 之前先確定設計方向。 基調、標誌性元素、動感風格、令人難忘的細節——所有這些在編寫第一行程式碼之前就應決定。

步驟 1:接收輸入

必要參數: prompt(內容描述和動畫簡報)

可選參數(含預設值):

參數預設值選項
animation_typecss-animatedcss-animated / ai-generated
duration3.0秒
fps12每秒影格數
looptruetrue / false
styleclean-slateclean-slate / terminal / electric-burst / brutalist
dimensions800x800寬x高(像素)
optimizationbalancedquality / balanced / filesize

如果缺少 prompt 或缺少動作描述,請確切詢問:

「GIF 應該顯示什麼?請描述內容和動作(例如:'統計數字逐一增加:73% 的買家在購買前閱讀 3 篇以上的內容。打字機效果,一次一個字元。風格:terminal。3 秒,12fps。')

關鍵設定(皆為可選,顯示預設值):

  • animation_type:css-animated(預設)或 ai-generated
  • duration:3.0 秒
  • fps:12
  • loop:true
  • style:clean-slate(選項:clean-slate / terminal / electric-burst / brutalist)
  • dimensions:800x800
  • optimization:balanced(選項:quality / balanced / filesize)」

如果所有必要資訊都已提供 → 直接跳至步驟 2。


步驟 2:內部架構(不對使用者顯示)

針對 css-animated:

  1. 從以下動畫類型中選擇一種:fade-in、slide-in、typewriter、counter、pulse、loop-scroll
  2. 閱讀 references/animation-library.md — 找到所選類型的完整 HTML/CSS 規範
  3. 閱讀 references/style-presets.md — 載入所選樣式的 CSS token 區塊
  4. 計算影格數:Math.floor(duration_seconds * fps) — 記下這個數字
  5. 確定設計方向:
決策項目從何推導
基調目標受眾的情緒感受(機械化 / 溫暖 / 電光 / 專業)
標誌性元素一致使用的一種視覺裝置(游標閃爍、幽靈數字、掃描線疊加、強調邊框)
動感風格此類型的緩動曲線哲學(彈簧 / 線性 / 步進 / 緩入緩出)
令人難忘的細節觀看者對這個 GIF 會記住的「唯一一件事」

針對 ai-generated:

  1. 產生基本靜止影格 HTML(畫布的海報風格佈局)
  2. 使用螢幕截圖匯出為 PNG
  3. 呼叫 Kling API:POST https://api.klingai.com/v1/videos/image2video,附帶 image_url 和描述動作的 prompt
  4. 輪詢任務完成狀態
  5. 下載影片 → 使用 ffmpeg 轉換為 GIF:
    # 雙次調色盤以獲得最佳色彩品質
    ffmpeg -i input.mp4 -vf "fps=12,scale=800:800:flags=lanczos,palettegen=stats_mode=diff" palette.png
    ffmpeg -i input.mp4 -i palette.png -vf "fps=12,scale=800:800:flags=lanczos,paletteuse=dither=bayer:bayer_scale=5" output.gif
    

步驟 3:HTML 生成(css-animated 路徑)

在生成之前,請閱讀 references/animation-library.md 和 references/style-presets.md。

畫布基礎——每個 GIF 都需要:

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  width: 800px;
  height: 800px;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-body);
}

.canvas {
  width: 800px;
  height: 800px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

動畫規則:

  • 所有動畫元素設定 animation-fill-mode: forwards(或 both)
  • 各類型的時序函數:
    • typewriter → steps(N, end),其中 N = 精確字元數
    • counter → linear
    • fade-in → cubic-bezier(0.22, 1, 0.36, 1)(緩出)
    • slide-in → cubic-bezier(0.34, 1.56, 0.64, 1)(彈簧過衝)
    • pulse → ease-in-out 搭配 animation-iteration-count: infinite
    • loop-scroll → linear 搭配 animation-iteration-count: infinite
  • 對於一次性動畫(fade-in、slide-in、typewriter、counter):animation-iteration-count: 1——循環發生在 GIF 層級
  • 不要使用 animation-delay——錯開效果已寫入 @keyframes 百分比

打字機 N 的計算方式: 計算每個字元,包括空格、標點符號、數字:

  • 「73% of buyers」= 14 個字元 → steps(14, end)
  • 「Hello, World!」= 13 個字元 → steps(13, end)

計數器 CSS @property(計數器類型必須使用):

@property --num {
  syntax: '<integer>';
  inherits: false;
  initial-value: 0;
}
.counter {
  animation: countUp var(--duration) linear forwards;
  counter-reset: num var(--num);
}
.counter::after { content: counter(num); }
@keyframes countUp {
  from { --num: 0; }
  to   { --num: var(--target); }
}

循環滾動:內容必須複製:

<!-- 4 個原始項目 + 4 個重複項目 -->
<div class="ticker-track" style="--item-count: 4;">
  [item1][item2][item3][item4][item1][item2][item3][item4]
</div>

translateX(0 → -50%) 搭配 linear infinite。

設計品質規則(來自步驟 2 的確定事項):

  • 指定的標誌性元素必須存在於 CSS/HTML 中(不僅是描述)
  • 字體排版:顯示文字與輔助文字之間的字重對比至少 2:1(例如 700 比 400)
  • 背景:深色樣式不要使用純白色 #fff——請使用該預設的確切 --bg 值
  • 對於 terminal 風格:使用 ::after 添加掃描線疊加,搭配 repeating-linear-gradient,opacity: 0.03
  • 對於 brutalist:在關鍵元素上使用粗邊框 4px solid #000 或 4px solid var(--accent)
  • 令人難忘的細節:如果需要額外元素——立即添加

步驟 4:自我 QA(在步驟 5 之前修復所有失敗)

畫布:

  • body 和 .canvas 精確為 800×800px(或指定的尺寸)
  • body 和 .canvas 都設有 overflow: hidden
  • 沒有元素超出畫布邊界

動畫:

  • 任何地方都沒有 animation-delay——錯開效果已寫入 @keyframes 百分比
  • 所有動畫從 t=0 開始(Web Animations API 將從那裡搜尋)
  • 所有動畫元素設定 animation-fill-mode: forwards 或 both
  • 一次性動畫:animation-iteration-count: 1
  • 無限動畫(pulse、loop-scroll):animation-iteration-count: infinite

類型特定檢查:

  • 打字機:steps(N, end) 中的 N = 文字字串的精確字元數
  • 計數器:已宣告 @property --num,包含 syntax: '<integer>' 和 initial-value: 0
  • 計數器:已設定 counter-reset: num var(--num) 和 ::after { content: counter(num) }
  • 循環滾動:內容在 HTML 中精確複製一次

設計:

  • 無佔位方塊
  • 已根據 references/style-presets.md 套用樣式預設 token——沒有自由使用的十六進位顏色
  • 步驟 2 中命名的標誌性元素確實存在於 HTML/CSS 中
  • 步驟 2 中令人難忘的細節已實際實作
  • 所選風格的字型已引入字型 CDN <link>

步驟 5:匯出

根據 prompt 決定 slug(kebab-case,≤30 個字元)。建立輸出目錄:

mkdir -p [slug]

儲存 HTML:

[slug]/animation.html

在瀏覽器中開啟以進行快速視覺檢查:

open [slug]/animation.html

執行匯出腳本(將 [skill-root] 取代為此技能的實際路徑):

bash [skill-root]/scripts/export-gif.sh \
  [slug]/animation.html \
  [slug]/animation.gif \
  --duration [duration] \
  --fps [fps] \
  [--no-loop if loop=false] \
  --optimization [optimization] \
  --width [W] \
  --height [H]

此腳本會:

  1. 在暫存目錄中安裝 gifenc、sharp(或 jimp)和 playwright
  2. 如果尚未快取,則下載 Chromium
  3. 執行 capture-and-encode.mjs——暫停動畫、搜尋每個影格、螢幕截圖、組合 GIF
  4. 如果可用,執行 gifsicle 最佳化處理
  5. 報告檔案大小並開啟結果

如果在 [skill-root]/scripts/export-gif.sh 找不到匯出腳本,請檢查技能是否已安裝其完整的 scripts/ 資料夾。


步驟 6:輸出摘要

在成功匯出後顯示:

## GIF:[1 行描述]
日期:[YYYY-MM-DD] | 風格:[style] | 動畫類型:[type] | [duration]秒 @ [fps]fps
尺寸:[WxH] | 影格數:[N] | 循環:[true/false]

檔案
  原始檔:  [slug]/animation.html
  輸出檔:  [slug]/animation.gif
  大小:    [X] KB

檢查清單
- [ ] 預覽在起點/終點處能乾淨循環(無停頓)
- [ ] 在預期顯示尺寸下文字清晰可讀
- [ ] 檔案大小適當:電子郵件 <500KB / 社群媒體 <3MB

AI 生成路徑(選項 B)

僅在明確指定 animation_type: ai-generated 時使用。

需求:

  • 環境變數中存在 Kling API 金鑰:KLING_API_KEY(每天 66 個免費額度,免費層無需信用卡)
  • 本機安裝 ffmpeg 用於影片→GIF 轉換

工作流程:

  1. 產生符合 prompt 的基本靜止影格 HTML(指定尺寸的海報/圖形風格)
  2. 將靜止影格匯出為 PNG:
    # 透過 Playwright 快速截圖
    node -e "
      const { chromium } = require('playwright');
      (async () => {
        const browser = await chromium.launch();
        const page = await browser.newPage({ viewport: { width: W, height: H } });
        await page.goto('file://[slug]/animation.html');
        await page.screenshot({ path: '[slug]/base-frame.png' });
        await browser.close();
      })();
    "
    
  3. 上傳到 Kling 影像轉影片端點
  4. 使用 ffmpeg 雙次調色盤將結果轉換為 GIF
  5. 套用 gifsicle 最佳化

當 Kling 不可用時: 回退到 css-animated,並通知使用者:「AI 生成需要 Kling API 金鑰 (KLING_API_KEY)。正在回退到 css-animated。請設定金鑰以啟用 AI 生成。」


提示建議(當使用者尋求指導時顯示)

「請描述動作,而不僅僅是內容。『統計數字逐一增加』勝過『顯示統計數據』。」

「為減小檔案大小,請保持簡單。1–3 個動畫元素和一個純色背景即可。」

「以循環為思考出發點。動畫應能從結尾無縫流動回開頭。」

「明確指定動畫類型。typewriter 和 counter 對社群媒體最有效。」

✅ 良好範例:「建立一個動畫 GIF,css-animated,打字機效果。文字:'73% of B2B buyers read 3+ pieces of content before contacting sales.' 每個字元逐一打出。風格:terminal。3 秒,12fps,loop=true。」

❌ 不良範例:「製作一個行銷技巧的動畫 gif」

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Varnan-Tech/opendirectory

Use when the user asks to generate a blog cover image, thumbnail, or article header. Automatically uses modern typography, brand logos, and Google Search grounding to create beautiful 16:9 images with Gemini 3.1 Flash Image Preview.

Varnan-Tech/opendirectory

World-class brand strategist and naming expert. Uses an interrogation-led discovery phase to extract your brand's DNA, then applies scientific naming frameworks (Phonosemantics) and automated multi-TLD domain checking.

Varnan-Tech/opendirectory

Use when the user asks to generate or update a project's CLAUDE or AGENTS context file from a codebase scan. Writes a focused file under 100 lines containing only the non-obvious build commands, conventions, and gotchas Claude Code needs.

Varnan-Tech/opendirectory

Use when the user wants to verify cold emails, enrich a lead list, or autonomously guess email addresses from a CSV using ValidEmail.co or the open-source Reacher engine.

Varnan-Tech/opendirectory

Competitive intelligence orchestrator tracking companies across 8+ platforms (GitHub, Twitter, Reddit, HN, PH, YC Jobs) with heat scores and AI briefings.

Varnan-Tech/opendirectory

Give it your product URL or description. It finds your top 5 competitors, runs three-track PR research across all of them (editorial, podcasts, communities), identifies which channels appear most frequently, looks up the journalist or host for each, and returns a tiered outreach list with story angles and ready-to-send cold pitch drafts tailored to your product. Use when asked to find PR opportunities, discover where competitors got featured, build a media outreach list, find which journalists cover my space, or get pitch templates for press coverage.

Varnan-Tech/opendirectory

Generate high-converting, deep-dive growth case studies in MDX format. Use this skill when asked to write a case study or blog post about a company's growth, tech stack, or product-led strategy. It handles the full pipeline (researching the company via Tavily, generating a 16:9 cover image, quality checking the draft, uploading assets to cloud storage, and pushing directly to the target repository).

Varnan-Tech/opendirectory

Scans your project for outdated npm, pip, Cargo, Go, or Ruby packages. Runs a CVE security audit. Fetches changelogs, summarizes breaking changes with Gemini, and opens one PR per risk group (patch, minor, major). Includes Diagnosis Mode for install conflicts. Use when asked to update dependencies, check for outdated packages, open dependency PRs, scan for package updates, audit for CVEs, or flag breaking changes in upgrades. Trigger when a user says "check for outdated packages", "update my dependencies", "open PRs for dependency updates", "scan for CVEs", or "which packages need upgrading".

Varnan-Tech/opendirectory

Generates and updates README.md and API reference docs by reading your codebase's functions, routes, types, schemas, and architecture. Uses graphify to build a knowledge graph first, then writes accurate docs from it. Use when asked to write docs, generate a README, document an API, update stale docs, create an API reference from code, add an architecture section, or document a project in any language. Trigger when a user says their docs are missing, outdated, or wants to document their codebase without writing it manually.

Varnan-Tech/opendirectory

Evaluates expired domain candidates against a target niche, scores them by topical relevance, historical activity level, and history cleanliness, then outputs a ranked shortlist with explainable reasoning and risk flags.

Varnan-Tech/opendirectory

Brutally honest developer-experience audit for a GitHub repo. Scores 10 DX dimensions (time-to-first-success, README clarity, visual proof, install, quick-start, docs, examples, community, trust, marketing), writes a shareable roast in the requested tone (brutal/honest/kind), produces a prioritized action plan ranked by impact × effort, and sketches an ideal README. Trigger when user says "roast my repo", "audit my README", "dx audit", "developer experience review", "score my GitHub project", "before launch checklist", or "make my repo shareable".

Varnan-Tech/opendirectory

Drafts and designs a complete HTML email newsletter from a topic or content brief. Outputs paste-ready HTML for Loops, Mailchimp, Beehiiv, Resend, or any standard email platform. Includes subject line options and plain-text fallback. Trigger when a user says "write a newsletter", "draft an email newsletter", "create an HTML email", "design an email for my subscribers", or "write a newsletter about [topic]".

Varnan-Tech/opendirectory

Takes a GitHub PR URL or the current branch and writes a plain-English explanation of what it does and why, then posts it as a PR comment. Use when asked to explain a PR, summarize a pull request, write a plain-English description of a PR, add a summary comment to a PR, or understand what a PR changes. Trigger when a user says "explain this PR", "summarize this pull request", "what does this PR do", "add a comment explaining the PR", or shares a GitHub PR URL and asks what it does.

Varnan-Tech/opendirectory

Audit how often LLMs recommend your brand vs competitors and generate a GEO action plan.

Varnan-Tech/opendirectory

Takes a competitor's public GitHub repo URL, fetches their open issues via the GitHub REST API, filters noise locally, clusters issues into 6 demand categories, computes a demand score per issue and per cluster, and outputs a ranked demand gap report with a GTM messaging brief. Use when asked to scan a competitor's GitHub issues, find what their users are begging for, turn GitHub complaints into product positioning, identify competitor feature gaps, or generate messaging from real user demand. Trigger when a user says "scan competitor issues", "what are users asking for on X repo", "find demand gaps in Y", "turn GitHub issues into messaging", or "what should I build based on competitor complaints".

Varnan-Tech/opendirectory

Find recurring confusion in your repo's GitHub Discussions, rank it by urgency, and draft the actual docs fixes and content angles — with verbatim community quotes and source links as evidence.

Varnan-Tech/opendirectory

SEO keyword research workflow for blog generation using Google Trends data. Use when writing blog posts, planning content calendars, or optimizing articles for search engines. Finds breakout keywords, builds content structure, and generates SEO-optimized blog outlines targeting tech and developer audiences.

Varnan-Tech/opendirectory

Generates a professionally designed case study PDF for B2B SaaS sales and marketing. Supports 7 page layouts, 9 style presets, 1-4 page output. Trigger when user says "create a case study", "write a customer story", "make a case study PDF", "design a success story", "turn this customer win into a PDF".

Varnan-Tech/opendirectory

Generates data visualization charts (bar, line, area, pie, doughnut, scatter, radar, treemap) as PNG using Apache ECharts v6. 1080×1080px default, 5 style presets, highlight annotations. Trigger when user says "create a chart", "visualize data", "make a bar chart", "line graph", "pie chart", "data visualization", "chart this data", "plot", "graph", or "visualize these numbers".

Varnan-Tech/opendirectory

Fetches low-star App Store and Google Play reviews, clusters them into broken-promise patterns, and generates a ranked copy brief with positioning opportunities.

相關技能