LeoYeAI/agent-master-skills / skills/anygen-diagram-generator
anygen-diagram
VerifiedUse this skill any time the user wants to create diagrams, flowcharts, or visual structures. This includes: architecture diagrams, mind maps, org charts, user journey maps, system design diagrams, ER diagrams, sequence diagrams, process flows, decision trees, network topologies, class diagrams, Gantt charts, SWOT analysis diagrams, wireframes, and sitemaps. Also trigger when: user says 画个流程图, 做个架构图, 思维导图, 组织架构图, 用户旅程图, 系统设计图, 甘特图. If a diagram or visual structure needs to be drawn, use this skill.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 18.5 KB |
| _meta.json | config | 1006 B |
| scripts/anygen.py | script | 35.8 KB |
| scripts/auth.py | script | 1000 B |
| scripts/diagram-to-image.ts | script | 13.8 KB |
| scripts/fileutil.py | script | 2.1 KB |
| scripts/package-lock.json | manifest | 18.0 KB |
| scripts/package.json | manifest | 335 B |
| scripts/render-diagram.sh | script | 4.1 KB |
| skill.md | markdown | 13.2 KB |
scripts/fileutil.py
View on GitHub"""File I/O utilities for AnyGen — validation, encoding, read/write helpers."""
import base64
import json
from pathlib import Path
def validate_file(file_path):
"""Validate file path before upload. Returns (Path, error_msg)."""
path = Path(file_path).expanduser().resolve()
if not path.exists():
return None, f"File not found: {file_path}"
if not path.is_file():
return None, f"Not a regular file: {file_path}"
return path, None
def read_file_bytes(file_path):
"""Validate and read file contents. Returns (filename, bytes, size) or raises ValueError."""
path, err = validate_file(file_path)
if err:
raise ValueError(err)
with open(path, "rb") as f:
content = f.read()
return path.name, content, len(content)
def encode_file(file_path):
"""Encode file to base64 for legacy upload."""
path, err = validate_file(file_path)
if err:
raise ValueError(err)
with open(path, "rb") as f:
content = f.read()
suffix = path.suffix.lower()
mime_types = {
".pdf": "application/pdf",
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".gif": "image/gif",
".txt": "text/plain",
".doc": "application/msword",
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
".ppt": "application/vnd.ms-powerpoint",
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
}
mime_type = mime_types.get(suffix, "application/octet-stream")
return {
"file_name": path.name,
"file_type": mime_type,
"file_data": base64.b64encode(content).decode("utf-8"),
}
def read_json(file_path):
"""Read and parse a JSON file."""
with open(file_path, "r") as f:
return json.load(f)
def write_json(file_path, data):
"""Write data to a JSON file."""
with open(file_path, "w") as f:
json.dump(data, f, indent=2, ensure_ascii=False)
def write_bytes(file_path, content):
"""Write binary content to a file."""
with open(file_path, "wb") as f:
f.write(content)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |