
Wechat Theme Extractor
- 40 installs
- 16 repo stars
- Updated July 13, 2026
- yangsonhung/awesome-agent-skills
Helps with ai & agent building tasks.
About
wechat-theme-extractor is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- wechat-theme-extractor
- AI & Agent Building
- AI-coding skill
Wechat Theme Extractor by the numbers
- 40 all-time installs (skills.sh)
- +2 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #8,266 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 1, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yangsonhung/awesome-agent-skills --skill wechat-theme-extractorAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 40 |
|---|---|
| repo stars | ★ 16 |
| Last updated | July 13, 2026 |
| Repository | yangsonhung/awesome-agent-skills ↗ |
What it does
Helps with ai & agent building tasks.
Files
WeChat Theme Extractor
Overview
Extract layout and style signals from a WeChat Official Account article, then generate a reusable theme for markdown-wechat-converter. The workflow derives typography, colors, spacing, and block styles from the article, writes the generated theme into markdown-to-wechat.html, and supports previewing the result.
When to Use
Use this skill when the user:
- Provides a
mp.weixin.qq.comarticle URL - Wants to extract typography, color, spacing, and block styles from a WeChat article
- Wants a new theme generated for
markdown-wechat-converter - Wants the theme written into
markdown-to-wechat.htmland previewed
Do not use
Do not use this skill when:
- The URL is not a WeChat Official Account article
- The user only wants article text extraction without theme analysis
- The target project does not contain
markdown-wechat-converterormarkdown-to-wechat.html
Instructions
1. Run scripts/extract.py to fetch the article HTML and extract the title and js_content. 2. Read .extracted_content.html and analyze style traits directly from the HTML. 3. Generate a theme object compatible with markdown-wechat-converter. 4. Locate markdown-to-wechat.html in the current workspace and inject the new theme without breaking existing theme definitions. 5. Re-open the file and verify the theme entry was actually written. 6. If verification succeeds, open markdown-to-wechat.html in the browser for preview.
Workflow
User provides URL
-> run extractor script
-> produce .extracted_content.html
-> analyze styles
-> generate theme config
-> write into markdown-to-wechat.html
-> verify write result
-> open previewRun the script
python3 scripts/extract.py "https://mp.weixin.qq.com/s/xxxxx"Script responsibilities
The Python script only:
- Fetches article HTML
- Extracts the article title
- Extracts the
js_contentbody fragment - Saves the result to
.extracted_content.html
The AI handles:
- Style analysis
- Theme generation
- Config injection
- Post-write verification
- Preview opening
Injection rules for markdown-to-wechat.html
When updating markdown-to-wechat.html, follow these rules:
1. Find the real theme source first.
- Search for theme-related objects, arrays, maps, or
constassignments before editing. - Do not assume a fixed variable name unless it exists in the file.
2. Preserve the existing structure.
- Match the file's current object style, quote style, indentation, and trailing comma convention.
- Do not reformat unrelated sections.
3. Add, do not overwrite blindly.
- If the new theme name does not exist, append a new entry in the existing theme collection.
- If the same theme name already exists, update only that entry instead of duplicating it.
4. Keep the change scoped.
- Only touch the theme definition block and any minimal registration hook required to make the theme selectable.
- Do not modify renderer logic, event handlers, or unrelated UI code unless the file structure requires a minimal wiring change.
5. Verify after writing.
- Re-read the edited section and confirm the theme key, title, and core style properties are present.
- If the theme block cannot be located safely, stop and report that the target file structure needs manual confirmation.
Example theme snippet
Generate a theme object that matches the target file's existing structure. Use this as a minimal reference shape:
{
id: "wechat-clean-blue",
name: "WeChat Clean Blue",
styles: {
body: {
fontFamily: "\"PingFang SC\", \"Helvetica Neue\", sans-serif",
fontSize: "16px",
color: "#2b2b2b",
lineHeight: "1.75",
backgroundColor: "#ffffff"
},
h1: {
fontSize: "24px",
fontWeight: "700",
textAlign: "center",
color: "#1f3a5f"
},
h2: {
fontSize: "20px",
fontWeight: "700",
color: "#1f3a5f",
borderBottom: "2px solid #9ec1ff"
},
blockquote: {
color: "#4a5568",
backgroundColor: "#f7fbff",
borderLeft: "4px solid #7fb3ff",
padding: "12px 16px"
}
}
}When writing:
- Match the real field names used in
markdown-to-wechat.html - Convert this shape if the target file uses arrays, maps, or nested registration
- Include at minimum the theme key, display name, and core typography styles
Output file
scripts/.extracted_content.html: extracted article body HTML with title and source URL comments at the top
Validation checklist
- The article HTML was fetched successfully
.extracted_content.htmlexists and is not empty- The title and
js_contentwere extracted - The new theme entry exists in
markdown-to-wechat.html - The preview page opens successfully
interface:
display_name: "WeChat Theme Extractor"
short_description: "Extract WeChat article styles into converter themes."
default_prompt: "Use $wechat-theme-extractor to extract a theme from this WeChat article URL and write it into markdown-to-wechat.html."
policy:
allow_implicit_invocation: true
#!/usr/bin/env python3
"""
Minimal WeChat article extractor.
Responsibility: fetch HTML, extract js_content and title.
The AI handles style analysis, theme generation, and config injection.
"""
import re
import subprocess
import sys
from pathlib import Path
def main():
if len(sys.argv) < 2:
print("Usage: python3 extract.py <wechat-article-url>")
sys.exit(1)
url = sys.argv[1]
print("Fetching WeChat article...")
user_agent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"
result = subprocess.run(
["curl", "-s", "-A", user_agent, url],
capture_output=True,
text=True,
)
if result.returncode != 0 or not result.stdout:
print("Failed to fetch article")
sys.exit(1)
html = result.stdout
print(f"Fetched successfully ({len(html):,} chars)")
title_match = re.search(
r'<h1[^>]*class="[^"]*rich_media_title[^"]*"[^>]*>(.*?)</h1>',
html,
re.DOTALL,
)
title = re.sub(r"<[^>]+>", "", title_match.group(1)).strip() if title_match else "Untitled"
print(f"Title: {title}")
print("Extracting js_content...")
content_match = re.search(
r'id="js_content"[^>]*>(.*?)</div>\s*</div>\s*<script',
html,
re.DOTALL,
)
if not content_match:
print("js_content not found")
sys.exit(1)
content = content_match.group(1)
print(f"Extracted successfully ({len(content):,} chars)")
if getattr(sys, "frozen", False):
skill_dir = Path(sys.executable).parent
else:
skill_dir = Path(__file__).parent
output_file = skill_dir / ".extracted_content.html"
with output_file.open("w", encoding="utf-8") as file:
file.write(f"<!-- Title: {title} -->\n")
file.write(f"<!-- URL: {url} -->\n")
file.write(content)
print(f"Saved to: {output_file}")
print()
print("Extraction complete. Ready for AI analysis.")
if __name__ == "__main__":
main()