Skip to content

LeoYeAI/agent-master-skills / skills/anygen-doc-generator

anygen-doc

Verified

Use this skill any time the user wants to create, draft, or generate a written document or report. This includes: competitive analysis, market research reports, technical design docs, PRDs, project proposals, meeting summaries, white papers, business plans, literature reviews, due diligence reports, industry analysis, executive summaries, SOPs, memos, and any request where the output is a structured document. Also trigger when: user says 写个文档, 做个竞品调研, 写份报告, 产品需求文档, 技术方案, 项目提案, 行业分析, 会议纪要整理成文档. If a document or report needs to be created, use this skill.

FileKindSize
SKILL.mdskill md16.9 KB
_meta.jsonconfig822 B
scripts/anygen.pyscript35.8 KB
scripts/auth.pyscript1000 B
scripts/fileutil.pyscript2.1 KB
skill.mdmarkdown12.1 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)
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: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall