$npx -y skills add Dianel555/DSkills --skill github-trending-analyzerCrawl GitHub trending repositories, analyze with LLM for Chinese insights, categorize by themes, compute diffs against history, and generate briefing plus detailed reports in Markdown. Supports incremental gap-filling and selective re-analysis with caching.
| 1 | # GitHub Trending Analyzer |
| 2 | |
| 3 | A workflow protocol for tracking GitHub trending repositories with LLM-powered analysis. Fetches trending projects, enriches each with structured Chinese insights (what/analogy/help/who), classifies by themes, compares against historical snapshots, and generates dual-format reports (briefing + detailed). |
| 4 | |
| 5 | ## Trigger Signals |
| 6 | |
| 7 | - GitHub trending analysis |
| 8 | - Weekly tech trend report |
| 9 | - Repository discovery automation |
| 10 | - Incremental analysis refresh |
| 11 | - Theme-based repo categorization |
| 12 | |
| 13 | ## Preconditions |
| 14 | |
| 15 | - HTTP access to github.com/trending (no auth required for public trending) |
| 16 | - LLM backend capable of JSON-structured output (for the 4-field analysis schema) |
| 17 | - File system access for memory cache and report output |
| 18 | - HTML parsing capability (regex or DOM parser) |
| 19 | |
| 20 | ## Strategy |
| 21 | |
| 22 | Run the five-step pipeline in order. |
| 23 | |
| 24 | ### Step 1: Fetch trending HTML |
| 25 | |
| 26 | Construct the URL with time range and optional language filter: |
| 27 | ``` |
| 28 | https://github.com/trending[/{language}]?since={daily|weekly|monthly} |
| 29 | ``` |
| 30 | |
| 31 | Fetch with a browser User-Agent to avoid bot detection. Parse the HTML to extract: |
| 32 | - `name` (org/repo) |
| 33 | - `url` (full GitHub link) |
| 34 | - `desc` (one-line description from the page) |
| 35 | - `lang` (primary language) |
| 36 | - `stars` (total stargazers count) |
| 37 | - `today_stars` (increment for this period) |
| 38 | |
| 39 | **Regex patterns** (reference from source): |
| 40 | - Project name: `<h2[^>]*>.*?<a href="/([^"]+)"` |
| 41 | - Description: `<p class="[^"]*col-9[^"]*"[^>]*>\s*(.*?)\s*</p>` |
| 42 | - Language: `<span itemprop="programmingLanguage">([^<]+)</span>` |
| 43 | - Stars: parse from `/stargazers` link text after stripping HTML tags |
| 44 | - Today increment: `([\d,]+)\s*stars?\s*(?:this|today)` (case-insensitive) |
| 45 | |
| 46 | ### Step 2: Batch LLM analysis |
| 47 | |
| 48 | For each batch of 5 projects (to avoid token limits), send this prompt to your LLM: |
| 49 | |
| 50 | ``` |
| 51 | Analyze the following {N} GitHub Trending projects. Output strict JSON array. |
| 52 | Each project needs 4 fields: |
| 53 | - what: What it is (≤30 Chinese characters) |
| 54 | - analogy: Life analogy (one sentence) |
| 55 | - help: What it helps you do (2 items, each ≤40 chars, array) |
| 56 | - who: Who needs it (one sentence, ≤30 chars) |
| 57 | |
| 58 | Project list: |
| 59 | 1. org/repo (Language) — description... |
| 60 | 2. ... |
| 61 | |
| 62 | Output ONLY the JSON array, no other text. Example: |
| 63 | [{"name":"org/repo","what":"...","analogy":"...","help":["...","..."],"who":"..."}] |
| 64 | ``` |
| 65 | |
| 66 | **Parse the response**: |
| 67 | 1. Strip markdown code fences (` ```json ` / ` ``` `) |
| 68 | 2. Clean trailing commas: `,\s*([\]}])` → `\1` |
| 69 | 3. Extract the JSON array via regex: `\[.*\]` (DOTALL) |
| 70 | 4. Decode with `json.loads()` or equivalent |
| 71 | 5. Match results back to projects by name suffix (case-insensitive) |
| 72 | |
| 73 | **Fallback**: If array parsing fails, extract individual objects via bracket-counting and parse one by one. |
| 74 | |
| 75 | **Deep mode** (optional): Use longer limits (what ≤50 chars, help 3 items) for richer analysis. |
| 76 | |
| 77 | ### Step 3: Theme classification |
| 78 | |
| 79 | Load the bundled `theme_rules.json`. For each project: |
| 80 | 1. Concatenate `name + " " + desc` and lowercase |
| 81 | 2. Iterate themes by priority order |
| 82 | 3. Check if any keyword from the theme appears in the text |
| 83 | 4. Assign to first matching theme |
| 84 | 5. Default to "🌐 其他" if no match |
| 85 | |
| 86 | Result: `{theme_name: [projects...]}` dictionary. |
| 87 | |
| 88 | ### Step 4: Compute diff (optional) |
| 89 | |
| 90 | If you maintain a memory cache (JSON file storing past runs): |
| 91 | ```json |
| 92 | [ |
| 93 | { |
| 94 | "date": "2026-06-19", |
| 95 | "since": "weekly", |
| 96 | "lang": "python", |
| 97 | "repos": [{"name":"...", "url":"...", "desc":"...", "lang":"...", "stars":..., "today_stars":..., "analysis":{...}}] |
| 98 | } |
| 99 | ] |
| 100 | ``` |
| 101 | |
| 102 | Compare current repos against the latest entry with the same `since` value: |
| 103 | - **new**: projects in current but not in last |
| 104 | - **hot**: projects in both |
| 105 | - **dropped**: projects in last but not in current |
| 106 | - **last_date**: baseline timestamp |
| 107 | |
| 108 | ### Step 5: Generate reports |
| 109 | |
| 110 | #### Briefing (compact, for quick scan) |
| 111 | |
| 112 | Structure: |
| 113 | ```markdown |
| 114 | # GitHub 热门趋势简报 - {date} |
| 115 | |
| 116 | > 生成日期: {date} |
| 117 | > 来源: github.com/trending?since={since} |
| 118 | > 对比基准: {baseline_date} |
| 119 | |
| 120 | ## 🔥 新上榜 |
| 121 | | 排名 | 项目 | 语言 | ⭐ Stars | 📈 今日新增 | 一句话说明 | |
| 122 | |
| 123 | ## ⭐ 持续热门 |
| 124 | | 项目 | 语言 | ⭐ Stars | 📈 今日新增 | 为什么值得关注 | |
| 125 | |
| 126 | ## 📉 掉出榜单 |
| 127 | | 项目 | 可能意味着什么 | |
| 128 | |
| 129 | ## 🎯 趋势主题 |
| 130 | **{theme}** (N个): repo1(+stars), repo2(+stars), ... |
| 131 | |
| 132 | ## 💡 趋势解读 |
| 133 | {LLM-generated trend insight based on all "what" summaries} |
| 134 | ``` |
| 135 | |
| 136 | **Trend insight prompt**: |
| 137 | ``` |
| 138 | 基于以下GitHub Trending项目摘要,用3-5句话分析当前最强技术趋势和驱动力: |
| 139 | {list of "name: what" for all projects} |
| 140 | ``` |
| 141 | |
| 142 | #### Detailed (one section per project) |
| 143 | |
| 144 | Structure: |
| 145 | ```markdown |
| 146 | # GitHub 详细分析 - {date} |
| 147 | |
| 148 | ## {Project Name} |
| 149 | |
| 150 | **Stars**: {total} (+{increment}) |
| 151 | **Language**: {lang} |
| 152 | **URL**: {github_url} |
| 153 | |
| 154 | ### 这是什么 |
| 155 | {analysis.what} |
| 156 | |
| 157 | ### 生活化类比 |
| 158 | {analysis.analogy} |
| 159 | |
| 160 | ### 它能帮你做什么 |
| 161 | 1. {analysis.help[0]} |
| 162 | 2. {analysis.help[1]} |
| 163 | |
| 164 | ### 谁需要它 |
| 165 | {analysis.who} |
| 166 | |
| 167 | --- |
| 168 | ``` |
| 169 | |
| 170 | Save both to files with date-stamped names (e.g. `tre |