Frontend Style Guide Generator Skill
This skill provides a tool to identify existing frontend styles, UI and UX patterns from a representative page or set of pages/components, and to derive a set of standardized styles, UI & UX norms that can be used as an authoritative frontend guidance document.
AI Agent Analysis Workflow
This workflow is designed for an AI agent to perform frontend style analysis using its available tools.
Step 1: Fetch Page Content
- Use
view_text_website:- Call
view_text_websitewith the target URL to get the full HTML content of the page.
- Call
Step 2: Extract Stylesheets
Identify Stylesheet Links:
- Parse the HTML to find all
<link rel="stylesheet" ...>tags and extract theirhrefattributes. - Also, find all
<style>tags and extract their content.
- Parse the HTML to find all
Fetch Stylesheet Content:
- For each external stylesheet URL, use
view_text_websiteto fetch its content. - Combine the content of all external and inline stylesheets into a single text file (e.g.,
styles.css).
- For each external stylesheet URL, use
Step 3: Analyze CSS
Identify Common Properties:
- Use
grepto find all occurrences of common CSS properties:grep "color:" styles.cssgrep "background-color:" styles.cssgrep "font-family:" styles.cssgrep "font-size:" styles.cssgrep "margin:" styles.cssgrep "padding:" styles.css
- Use
Count Frequencies:
- For each property, use shell commands (
sort,uniq -c,sort -nr) to count the frequencies of the different values. For example:grep "color:" styles.css | awk -F ':' '{print $2}' | sort | uniq -c | sort -nr > color_frequencies.txt
- For each property, use shell commands (
Step 4: Synthesize and Document
Create a Markdown Document:
- Start a new Markdown file (e.g.,
STYLE_GUIDE.md).
- Start a new Markdown file (e.g.,
Document Findings:
- Colors: Based on the frequency counts, list the most common colors.
- Typography: List the most common font families and sizes.
- Spacing: List the most common margin and padding values.
Automated Script
For a quicker, automated analysis, you can use the provided Python script.
generate_style_guide.py
Analyzes a web page's CSS to find common colors, fonts, and spacing, and then generates a STYLE_GUIDE.md document summarizing these frontend norms.
Usage:
python generate_style_guide.py <url>
The output will be a STYLE_GUIDE.md file in the current directory.