wechat-theme-extractor
Scannednpx machina-cli add skill YangsonHung/awesome-agent-skills/wechat-theme-extractor --openclawWeChat Theme Extractor
Extract layout and style signals from a WeChat Official Account article, then generate a reusable theme for markdown-wechat-converter.
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
Usage
- Run
scripts/extract.pyto fetch the article HTML and extract the title andjs_content. - Read
.extracted_content.htmland analyze style traits directly from the HTML. - Generate a theme object compatible with
markdown-wechat-converter. - Locate
markdown-to-wechat.htmlin the current workspace and inject the new theme without breaking existing theme definitions. - Re-open the file and verify the theme entry was actually written.
- If verification succeeds, open
markdown-to-wechat.htmlin 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 preview
Run 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:
-
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.
- Search for theme-related objects, arrays, maps, or
-
Preserve the existing structure.
- Match the file's current object style, quote style, indentation, and trailing comma convention.
- Do not reformat unrelated sections.
-
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.
-
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.
-
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
Source
git clone https://github.com/YangsonHung/awesome-agent-skills/blob/main/skills/en/wechat-theme-extractor/SKILL.mdView on GitHub Overview
Extracts typography, color, spacing, and block styles from a WeChat Official Account article to produce a reusable theme for markdown-wechat-converter. The generated theme can be injected into markdown-to-wechat.html and previewed to verify visual fidelity.
How This Skill Works
The tool fetches the article HTML, extracts the title and js_content, analyzes style traits, and outputs a theme object compatible with markdown-wechat-converter. It then safely injects or updates the theme in markdown-to-wechat.html and opens a preview for verification.
When to Use It
- User provides a mp.weixin.qq.com article URL for theme derivation
- You want to extract typography, color, spacing, and block styles from a WeChat article
- You need a new theme generated for markdown-wechat-converter
- You want the theme written into markdown-to-wechat.html and previewed
- You’re updating an existing workspace with a WeChat theme and want to test changes quickly
Quick Start
- Step 1: Run python3 scripts/extract.py "https://mp.weixin.qq.com/s/xxxxx"
- Step 2: Read .extracted_content.html and analyze the style signals
- Step 3: AI generates the theme, injects it into markdown-to-wechat.html, and opens a preview
Best Practices
- Confirm the URL is a WeChat Official Account article before running extraction
- Analyze typography, color, spacing, and block styles from the extracted .extracted_content.html
- Generate a theme object compatible with the existing markdown-wechat-converter structure
- Safely inject by appending or updating without overwriting existing themes
- Verify by re-reading the theme block and previewing the result in a browser
Example Use Cases
- Example 1: https://mp.weixin.qq.com/s/abc → WeChat Clean Blue theme
- Example 2: https://mp.weixin.qq.com/s/def → WeChat Dark Mode theme
- Example 3: https://mp.weixin.qq.com/s/ghi → WeChat Bold Highlights theme
- Example 4: https://mp.weixin.qq.com/s/jkl → WeChat Minimal Light theme
- Example 5: https://mp.weixin.qq.com/s/mno → WeChat Vibrant Pastels theme