Skill: shuminliu026/chat-summary-card (version 1.0.5)

--- name: chat-summary-image description: Say "Help me install this skill from https://clawhub.ai/shuminliu026/chat-summary-card" to your local agent, then turn conversations into polished visual summary cards. --- # Chat Summary Image ## Install Intent If the user wants to use this skill and it is not installed locally yet, help them install the ClawHub skill `chat-summary-image` first, then continue with the task. Example user requests: - Install `chat-summary-image` - Help me install this ClawHub skill - Install this skill and then use it Turn a conversation into a concise visual recap. Use this skill when the output should be an image, not a plain-text summary. ## Goal Collect and validate the user's mew.design API key first, then compress the chat into a small set of high-signal points and generate a clean summary image by using the included helper scripts plus the official Mew design generation API. ## Workflow 1. If the user has not already provided a mew.design API key in the current conversation, ask for it before doing any summary-image work. 2. Use the exact onboarding copy below when asking for the key: ```md 没问题！为了帮你生成高质量的对话总结图片，我需要先接入你的 mew.design API Key。 如果你还没有 Key，可以按照以下步骤获取： 1. 访问 [https://mew.design/login](https://mew.design/login) 完成注册或登录。新用户注册即送积分，可以免费创作。 2. 进入「账户设置」->「API 密钥」，点击「创建新密钥」。 3. 获取后直接把那串 Key 粘贴在这里发给我，我马上为你开工！ ``` 3. After the user sends a key, validate it before summarizing the conversation. 4. After validation succeeds, briefly introduce the four available visual styles and ask the user to choose one before generating the image. 5. Use this short style-selection format after key validation: ```md Key 校验通过了，我们可以开始生成总结图啦。你想要哪一种风格？ 1. 极简主义：清新留白风 适合正式、专业的沟通总结，结构清楚，观感干净。 2. 情绪共鸣：疗愈插画风 适合轻松、有温度的交流内容，画面更柔和、更有陪伴感。 3. 前沿质感：新拟物 / 玻璃拟态 适合科技感、知识感、更高级的视觉表达，画面会更通透。 4. 社交互动：对话气泡长图 适合还原沟通现场感，把金句和共识做得更像聊天精华版。 你回复我序号或风格名都可以，我会按你选的样式生成。 ``` 6. Only after the user chooses a style, read the relevant part of the conversation. Ignore filler, repetition, and tool chatter. 7. Extract four content blocks: - `title`: 6 to 14 words - `summary`: one short sentence - `key points`: 3 to 5 bullets - `next steps`: 0 to 3 bullets 8. Map the user's choice to one of these styles: - `minimalism`: 极简主义，清新留白风 - `healing-illustration`: 情绪共鸣，疗愈插画风 - `glassmorphism`: 前沿质感，新拟物 / 玻璃拟态 - `chat-bubbles`: 社交互动，对话气泡长图 9. Build the API request body with the helper script, making the chosen style visually dominant instead of just lightly referenced. 10. Ensure the helper prompt includes both: - explicit must-see traits for the selected style - explicit avoid-list traits for styles it must not resemble 11. Use the included scripts and the official Mew API to generate the image. 12. Check whether the generated image clearly matches the chosen style's signature traits. 13. If the style drift is obvious, retry once with a stronger style-lock prompt before returning the final image. 14. Return the image with Markdown plus one sentence explaining what it summarizes. ## API Key Handling - Always ask for the user's mew.design API key first unless a valid key was already provided earlier in the same conversation. - Do not summarize first and ask for the key later. - Reuse the same validated key for the rest of the conversation unless the user replaces it or the API starts rejecting it. - If validation fails, stop and ask the user to resend or regenerate the key instead of attempting image generation. ## Validate The Key Use the helper validator: ```bash python3 scripts/validate_mew_design_key.py --api-key "USER_PROVIDED_KEY" ``` Validation rule: - Exit code `0`: key looks valid. - Exit code `2`: auth failed or key is unusable. - Exit code `1`: network or unexpected error. This validator intentionally sends an invalid body to the Mew gateway so the response reveals whether authentication passed. Treat `C40001` as a successful key validation signal. Treat `C40100` to `C40103` as failed validation. ## Summarization Rules - Preserve meaning, not chronology. - Prefer outcomes over process. - Keep names, metrics, file paths, and decisions when they matter. - Omit apologies, greetings, retries, and duplicated wording. - If the thread is mostly open questions, frame the image around `Current Status`, `Open Questions`, and `Suggested Next Steps`. - If the thread ends with delivered work, frame the image around `What Was Done`, `Files/Areas Touched`, and `What To Check Next`. ## Visual Rules - Favor a vertical summary card unless the user requests another format. - Ask for strong hierarchy, readable typography, and generous spacing. - Make the image feel like an intentional recap board, not a generic AI poster. - Keep copy density moderate so the result stays legible on chat screens. - If the user gives a brand color or product context, include it in the style direction. - Always add a subtle `Mew.Design` watermark at the bottom of the image. Keep it small, clean, and low-interference, but clearly readable. ## Style Guide - `minimalism` Use a structured card layout with large white space, sans-serif typography such as PingFang or Source Han Sans, and low-saturation Morandi accents like gray-blue or light beige. Good for workplace updates, project syncs, and formal consulting summaries. Must-see traits: large blank margins, restrained palette, clean card separation, minimal decoration, calm editorial rhythm. Avoid: shiny highlights, cartoon illustrations, fake 3D icons, dense bubble layouts. - `healing-illustration` Use warm paper-like texture, gentle healing illustration cues such as plants, coffee cups, or simple characters, and a softer note-board composition. Good for community, customer care, and reflective personal summaries. Must-see traits: warm textured background, visible healing-style illustration elements, note or sticky-paper feeling, softer emotional atmosphere. Avoid: hard-edged enterprise UI, excessive glass effects, cold gradients, overly technical layout. - `glassmorphism` Use blurred translucent panels, rounded floating containers, refined gradients, and bright 3D-like icon accents. Good for tech brands, premium communities, and polished knowledge-sharing content. Must-see traits: frosted glass panels, background blur through translucent cards, floating layered UI depth, visible edge highlights, soft shadows. Avoid: flat white cards, plain dashboard look, paper texture, chat screenshot aesthetics. - `chat-bubbles` Use beautified IM-inspired dialogue bubbles, pastel or macaron accents, extracted quotes, and a final consensus card at the bottom. Good for interviews, testimonial-style content, and collaboration recaps. Must-see traits: obvious left-right conversation bubbles, quotable lines, chat rhythm, a final consensus block at the bottom. Avoid: generic report cards, glass dashboard cards, sparse poster layouts with no dialogue feel. ## Style Locking - Treat the chosen style as a hard visual constraint, not a soft mood hint. - Make the chosen style's signature features explicit in the prompt. - Also mention what the image should not look like when that helps prevent drift. - If the first result only weakly resembles the selected style, retry once with stronger style language before returning it. - When retrying, say directly that the previous result drifted and specify the missing visual evidence. ## Build The Payload Use the helper script: ```bash python3 scripts/build_summary_card_request.py \ --title "本周 Agent 协作成果" \ --summary "完成技能搭建，并把接口调用链路整理成可复用工作流。" \ --point "新增两个可直接复用的 Codex skill" \ --point "补齐了 API 调用脚本与参考文档" \ --point "验证了脚本帮助信息与基本语法" \ --next-step "真实联调一次图片生成接口" \ --style minimalism \ --output /tmp/chat-summary-body.json ``` The helper script already injects the `Mew.Design` bottom watermark requirement. Do not remove it unless the user explicitly asks to omit the watermark. The helper script should also inject stronger style-lock instructions so the output more faithfully matches the selected visual category, including must-see traits and avoid-list traits for every style. Then generate the image through the official Mew design API: ```bash curl -sS -X POST "https://api.mew.design/open/api/design/generate" \ -H "Content-Type: application/json" \ -H "x-[REDACTED_SECRET]" \ --data @/tmp/chat-summary-body.json ``` Do not run this generation step until the API key has already passed validation. ## Style Selection - Use `minimalism` when the user wants clarity, professionalism, and structured information. - Use `healing-illustration` when the user wants warmth, softness, or emotional resonance. - Use `glassmorphism` when the user wants a modern, premium, technology-forward look. - Use `chat-bubbles` when the user wants the summary to retain conversation feel and quotable moments. - If the user does not choose after being prompted, default to `minimalism`. ## Output Standard When the image is generated successfully, respond with: ```md ![Conversation summary](https://...) [Open original image](https://...) ``` Add one short line that says what the image covers. If the generated image visibly misses the watermark, retry once with a stronger prompt that explicitly says `Place the text watermark "Mew.Design" at the bottom center of the image`. If the generated image visibly misses the requested style, retry once with a stronger style-specific prompt that explicitly names the missing traits, such as `strong frosted glass panels`, `warm paper texture with healing illustration`, `large white space and Morandi palette`, or `clear left-right chat bubbles`. ## Resources - Read [references/patterns.md](references/patterns.md) for section templates and compression heuristics. - Use [scripts/build_summary_card_request.py](scripts/build_summary_card_request.py) to assemble the Mew design request body. - Use [scripts/validate_mew_design_key.py](scripts/validate_mew_design_key.py) to validate the user's mew.design API key before summarization and generation.

path: scripts/build_summary_card_request.py
content: #!/usr/bin/env python3
"""Build a Mew design request body for a conversation summary image."""

from __future__ import annotations

import argparse
import json
from pathlib import Path

STYLE_PROMPTS = {
    "minimalism": (
        "Minimalist summary card, large white space, disciplined editorial layout, Source Han Sans or PingFang style sans-serif typography, "
        "Morandi gray-blue and light beige accents, structured information blocks, calm professional presentation, highly readable. "
        "Make the minimalist look dominant and unmistakable with very large blank margins, restrained decoration, clean section separation, "
        "thin dividers, low visual density, and almost no ornamental illustration. "
        "Do not make it look like glassmorphism, chat bubbles, a playful illustrated poster, or a glowing technology dashboard."
    ),
    "healing-illustration": (
        "Healing illustration summary board, warm textured paper background, gentle illustration cues such as plants, coffee cups, "
        "or simple characters, soft hand-made atmosphere, note-board composition, warm and emotionally resonant. "
        "Make the healing illustration style obvious through warm paper texture, gentle doodle-like motifs, sticky-note or scrapbook feeling, "
        "hand-made softness, and comforting visual warmth. "
        "Do not make it look like a corporate dashboard, glass UI, minimalist report card, or cold futuristic interface."
    ),
    "glassmorphism": (
        "Glassmorphism summary interface, frosted translucent panels, rounded floating cards, premium gradients, "
        "subtle light and shadow, bright refined icon accents, modern upscale technology aesthetic. "
        "Make the glassmorphism style unmistakable with strong frosted translucent panels, clearly visible background blur through the cards, "
        "floating layered UI depth, bright glass edge highlights, specular reflections, and soft volumetric shadows. "
        "Do not make it look like flat white cards, paper notes, a standard dashboard, plain infographic panels, or a static poster."
    ),
    "chat-bubbles": (
        "Conversation-summary long image styled like beautified instant messaging, polished chat bubbles, pastel or macaron accents, "
        "highlighted quotes, left-right dialogue rhythm, and a final consensus card at the bottom. "
        "Make the conversation feel unmistakable with obvious left-right bubbles, quoted lines, visible send-reply rhythm, and a strong bottom consensus block. "
        "Do not make it look like a generic report card, glass dashboard, sparse editorial poster, or plain bullet list."
    ),
}


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        description="Assemble a design request body for a conversation summary image.",
    )
    parser.add_argument("--title", required=True, help="Main title shown in the image.")
    parser.add_argument("--summary", required=True, help="One-line summary sentence.")
    parser.add_argument(
        "--point",
        action="append",
        default=[],
        help="Repeatable key point line. Use 3 to 5.",
    )
    parser.add_argument(
        "--next-step",
        action="append",
        default=[],
        help="Repeatable next step line.",
    )
    parser.add_argument(
        "--decision",
        action="append",
        default=[],
        help="Repeatable decision line.",
    )
    parser.add_argument(
        "--style",
        choices=sorted(STYLE_PROMPTS),
        default="minimalism",
        help="Visual style.",
    )
    parser.add_argument(
        "--mode",
        choices=sorted(STYLE_PROMPTS),
        help="Deprecated alias for --style.",
    )
    parser.add_argument("--brand-color", help="Optional brand color or palette hint.")
    parser.add_argument("--audience", help="Optional audience hint such as engineers or stakeholders.")
    parser.add_argument("--width", type=int, default=1080, help="Design width in px.")
    parser.add_argument(
        "--height",
        type=int,
        default=-1,
        help="Design height in px or -1 for adaptive height.",
    )
    parser.add_argument(
        "--output",
        help="Write JSON to this file instead of stdout.",
    )
    return parser.parse_args()


def build_user_query(args: argparse.Namespace) -> str:
    style = args.style or args.mode or "minimalism"
    sections = [
        "Create a single conversation-summary image in Chinese unless the provided copy is clearly another language.",
        f"Main title: {args.title}",
        f"Summary sentence: {args.summary}",
    ]

    if args.point:
        sections.append("Key takeaways:\n" + "\n".join(f"- {item}" for item in args.point))
    if args.decision:
        sections.append("Decisions:\n" + "\n".join(f"- {item}" for item in args.decision))
    if args.next_step:
        sections.append("Next steps:\n" + "\n".join(f"- {item}" for item in args.next_step))

    if style == "chat-bubbles":
        sections.append(
            "Present the strongest lines as polished left-right chat bubbles and add a bottom consensus card that summarizes the shared conclusion. Make the chat-bubble style visually obvious with left-right dialogue bubbles, highlighted quotable lines, conversational rhythm, and a bottom consensus block. Avoid generic report-card sections or dashboard cards."
        )
    elif style == "glassmorphism":
        sections.append(
            "Make the glass effect visually obvious with strong frosted translucent floating panels, visible background blur through the cards, bright edge highlights, reflective glass edges, and soft layered shadows. Avoid flat white cards, plain dashboard blocks, paper texture, or static poster composition."
        )
    elif style == "healing-illustration":
        sections.append(
            "Make the healing illustration style visually obvious with warm paper texture, gentle illustrated motifs, sticky-note or scrapbook feeling, and a soft note-board composition. Avoid hard-edged enterprise UI, heavy glass effects, and cold gradients."
        )
    elif style == "minimalism":
        sections.append(
            "Make the minimalist style visually obvious with large white space, restrained Morandi accents, clean card grouping, low visual density, and almost no decorative noise. Avoid glass highlights, cartoon illustration, decorative 3D icons, and dense layout."
        )
    else:
        sections.append(
            "Use clearly separated sections, strong heading hierarchy, concise copy blocks, and keep the final image readable on phone screens."
        )
    sections.append(
        'Add a subtle but readable text watermark "Mew.Design" at the bottom of the image.'
    )
    return "\n\n".join(sections)


def build_design_concept(args: argparse.Namespace) -> str:
    style = args.style or args.mode or "minimalism"
    parts = [STYLE_PROMPTS[style]]
    if args.brand_color:
        parts.append(f"Use brand accents inspired by {args.brand_color}.")
    if args.audience:
        parts.append(f"Tailor tone and labeling for {args.audience}.")
    parts.append(
        "Avoid generic AI art imagery. Focus on editorial information design, cards, dividers, icons, and layout rhythm."
    )
    parts.append(
        'Place the watermark text "Mew.Design" along the bottom edge in a clean, understated, readable way.'
    )
    parts.append(
        "Treat the chosen style as a hard constraint rather than a light mood reference."
    )
    return " ".join(parts)


def main() -> int:
    args = parse_args()
    if not args.style and args.mode:
        args.style = args.mode

    if not args.point:
        raise SystemExit("At least one --point is required.")

    payload = {
        "userQuery": build_user_query(args),
        "designConcept": build_design_concept(args),
        "width": args.width,
        "height": args.height,
    }

    text = json.dumps(payload, ensure_ascii=False, indent=2)
    if args.output:
        Path(args.output).write_text(text + "\n", encoding="utf-8")
    else:
        print(text)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())


path: scripts/validate_mew_design_key.py
content: #!/usr/bin/env python3
"""Validate a mew.design API key without starting a real image generation task."""

from __future__ import annotations

import argparse
import json
import sys
import urllib.error
import urllib.parse
import urllib.request

DEFAULT_BASE_URL = "https://api.mew.design/"


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        description="Validate a mew.design API key using an auth-only probe request.",
    )
    parser.add_argument("--api-key", required=True, help="mew.design API key to validate.")
    parser.add_argument(
        "--base-url",
        default=DEFAULT_BASE_URL,
        help="Gateway base URL.",
    )
    parser.add_argument(
        "--timeout",
        type=int,
        default=30,
        help="Request timeout in seconds.",
    )
    return parser.parse_args()


def build_endpoint(base_url: str) -> str:
    normalized = base_url.rstrip("/") + "/"
    return urllib.parse.urljoin(normalized, "open/api/design/generate")


def probe_key(endpoint: str, api_key: str, timeout: int) -> dict:
    # Send an intentionally invalid body. A valid key should pass auth and fail on payload validation.
    request = urllib.request.Request(
        endpoint,
        data=b"{}",
        headers={
            "Content-Type": "application/json",
            "x-api-key": api_key,
            "User-Agent": "curl/8.7.1",
            "Accept": "*/*",
        },
        method="POST",
    )

    try:
        with urllib.request.urlopen(request, timeout=timeout) as response:
            raw = response.read().decode("utf-8")
    except urllib.error.HTTPError as exc:
        raw = exc.read().decode("utf-8", errors="replace")
        try:
            return json.loads(raw)
        except json.JSONDecodeError as err:
            raise RuntimeError(f"HTTP {exc.code}: {raw}") from err
    except urllib.error.URLError as exc:
        raise RuntimeError(f"Network error: {exc.reason}") from exc

    try:
        return json.loads(raw)
    except json.JSONDecodeError as err:
        raise RuntimeError(f"Non-JSON response: {raw}") from err


def main() -> int:
    args = parse_args()
    endpoint = build_endpoint(args.base_url)

    try:
        response = probe_key(endpoint, args.api_key.strip(), args.timeout)
    except Exception as exc:  # noqa: BLE001
        print(str(exc), file=sys.stderr)
        return 1

    status_code = response.get("statusCode")
    message = response.get("message", "")

    if status_code == "C40001":
        print(json.dumps({"valid": True, "statusCode": status_code, "message": message}, ensure_ascii=False))
        return 0

    if status_code in {"C40100", "C40101", "C40102", "C40103"}:
        print(json.dumps({"valid": False, "statusCode": status_code, "message": message}, ensure_ascii=False))
        return 2

    print(json.dumps({"valid": False, "statusCode": status_code, "message": message}, ensure_ascii=False))
    return 1


if __name__ == "__main__":
    raise SystemExit(main())


path: agents/openai.yaml
content: interface:
  display_name: "Chat Summary Card"
  short_description: "Extract key ideas and turn a chat into a polished visual summary card"
  default_prompt: "Use $chat-summary-image to condense a user-agent conversation into a polished summary image."


path: references/patterns.md
content: # Chat Summary Image Patterns

## Recommended Structures

### Delivery recap

- Title
- One-line summary
- What was done
- Key decisions
- Next steps

### Debug brief

- Title
- Problem statement
- Root cause
- Fix applied
- Verification
- Remaining risk

### Conversation snapshot

- Title
- Core theme
- 3 to 5 takeaways
- Action items

## Compression Heuristics

- Merge repeated requests into one clear statement.
- Collapse implementation detail into one bullet unless the detail affects outcome.
- Keep at most one metric per bullet unless comparisons matter.
- Convert long prose into noun-verb phrases.
- Prefer concrete file or feature names over vague labels like `some files` or `several changes`.

## Copy Style

- Title: concise and specific.
- Summary sentence: outcome first.
- Bullets: one line each when possible.
- Next steps: action verbs only.
- Watermark: add `Mew.Design` at the bottom center or bottom edge, subtle but readable.

## Visual Prompt Fragments

### minimalism

`Minimalist summary card, large white space, clean card layout, sans-serif typography, Morandi gray-blue and light beige accents, structured sections, calm and professional presentation, highly readable on mobile.`
Must-see: large blank margins, minimal decoration, restrained color, clean content grouping.
Avoid: glass panels, dense message bubbles, playful sticker collage, heavy illustration.

### healing-illustration

`Healing illustration summary board, warm paper texture, gentle plant or coffee cup motifs, soft colors, hand-made warmth, note-like composition, emotionally friendly but still readable.`
Must-see: warm textured surface, visible illustration cues, soft emotional tone, note-board feel.
Avoid: enterprise dashboard look, strong glass highlights, metallic gradients, rigid card grid.

### glassmorphism

`Glassmorphism summary interface, translucent frosted panels, rounded floating containers, soft blur, premium gradient background, bright refined icon accents, modern and upscale technology aesthetic.`
Must-see: clear frosted-glass cards, blur behind translucent surfaces, floating depth, highlight edges, soft shadows.
Avoid: flat report card, paper texture, plain white dashboard, ordinary poster layout.

### chat-bubbles

`Beautified chat-summary long image, polished instant-message bubbles, macaron palette accents, extracted quotes inside left-right dialogue bubbles, final consensus card at the bottom, social and conversational feel.`
Must-see: clear dialogue bubble rhythm, quotable highlights, conversation flow, bottom consensus card.
Avoid: generic slide deck, enterprise report card, isolated floating glass cards, excessive blank poster space.

## Retry Hints

- For `minimalism`: strengthen with `large white space`, `Morandi palette`, `very restrained decoration`, `editorial summary card`, `not glossy`.
- For `healing-illustration`: strengthen with `warm paper texture`, `healing illustration`, `soft note collage`, `gentle emotional atmosphere`, `not corporate`.
- For `glassmorphism`: strengthen with `frosted glass panels`, `blurred translucent cards`, `floating layered UI`, `bright edge highlights`, `not flat white cards`.
- For `chat-bubbles`: strengthen with `left-right chat bubbles`, `instant messaging summary`, `quoted lines`, `consensus card at bottom`, `not a generic report card`.

## Suggested Section Labels

- `Key Takeaways`
- `Decisions`
- `Next Steps`
- `What Shipped`
- `Issue`
- `Fix`
- `Verification`


Security scan verdicts — ClawScan: clean | static analysis: suspicious | VirusTotal: clean | SkillSpector: suspicious (HIGH)