Skip to content

NocodeMrLi/mr-li-writer-skill

mr-li-writer

Verified

面向中文内容创作的编辑判断、研究、策划、写作与平台原生交付工作流。根据标题、素材、参考资料、核心想法或模糊灵感,先识别读者任务、材料条件和创新必要性,再按需完成语境扫描、可写性判断与方向校准,并区分发布平台与内容目标,进行事实检索、观点设计、平台原生正文写作、标题策划和对应交付。适用于公众号文章、知乎回答、小红书原生笔记、官网/网页、个人博客、行业解读、实用指南和基于素材的扩展研究写作。

FileKindSize
SKILL.mdexecutableskill md62.0 KB
agents/openai.yamlexecutablescript12.9 KB
assets/gzh-design/LICENSEexecutablescript34.2 KB
assets/gzh-design/NOTICE.mdmarkdown568 B
assets/gzh-design/assets/preview-template.htmlexecutablescript3.8 KB
assets/gzh-design/references/common-components.mdexecutablescript14.3 KB
assets/gzh-design/references/eval-cases.mdexecutablescript5.7 KB
assets/gzh-design/references/format-normalize.mdexecutablescript4.4 KB
assets/gzh-design/references/theme-generator.mdexecutablescript25.3 KB
assets/gzh-design/references/theme-graphite-minimal.mdexecutablescript34.1 KB
assets/gzh-design/references/theme-index.mdexecutablescript3.1 KB
assets/gzh-design/references/theme-moyu-green.mdexecutablescript46.1 KB
assets/gzh-design/references/theme-moyu-ticket.mdexecutablescript24.7 KB
assets/gzh-design/references/theme-olive-journal.mdexecutablescript56.2 KB
assets/gzh-design/references/theme-red-white.mdexecutablescript29.9 KB
assets/gzh-design/references/theme-zen-whitespace.mdexecutablescript23.5 KB
assets/mr-li-writer-promo-poster.pngbinary179.4 KB
assets/mr-li-writer-promo-silent.mp4binary1.2 MB
assets/readme-banner.svgother5.3 KB
assets/readme-showcase/moyu-green-content.jpgbinary281.1 KB
assets/readme-showcase/moyu-green-cover.jpgbinary183.8 KB
assets/readme-showcase/moyu-green-list.jpgbinary203.4 KB
assets/readme-showcase/moyu-green-long.jpgbinary431.9 KB
assets/readme-showcase/olive-journal-content.jpgbinary177.7 KB
assets/readme-showcase/olive-journal-cover.jpgbinary214.2 KB
assets/readme-showcase/olive-journal-ending.jpgbinary154.1 KB
assets/readme-showcase/olive-journal-long.jpgbinary352.3 KB
assets/readme-showcase/red-white-cover.jpgbinary183.1 KB
assets/readme-showcase/red-white-long.jpgbinary405.3 KB
assets/readme-showcase/red-white-section.jpgbinary227.4 KB
assets/readme-showcase/red-white-table.jpgbinary219.4 KB
references/commercial-source-terms.txtmarkdown389 B
references/delivery-protocol.mdmarkdown11.7 KB
references/editorial-evaluation-protocol.mdmarkdown3.1 KB
references/editorial-routing-protocol.mdmarkdown6.2 KB
references/genre-structure-protocol.mdmarkdown7.5 KB
references/high-impact-writing-protocol.mdmarkdown6.2 KB
references/humanize-rules.mdexecutablescript11.5 KB
references/ideation-protocol.mdmarkdown6.7 KB
references/lint-checks.mdmarkdown3.9 KB
references/opening-design-protocol.mdmarkdown9.2 KB
references/platform-native-protocol.mdmarkdown19.3 KB
references/research-protocol.mdexecutablescript13.9 KB
references/title-rules.mdexecutablescript9.2 KB
references/writing-rules.mdexecutablescript18.4 KB
scripts/build_gzh_html.pyexecutablescript70.3 KB
scripts/build_html.pyexecutablescript31.8 KB
scripts/component_lint.pyexecutablescript8.1 KB
scripts/extract_seed.pyexecutablescript5.8 KB
scripts/gzh_component_inventory.pyexecutablescript1.8 KB
scripts/lint_article.pyexecutablescript19.5 KB
scripts/scan_sensitive.pyscript2.0 KB
scripts/source_governance.pyscript4.9 KB
scripts/validate_delivery_bundle.pyexecutablescript18.3 KB
scripts/validate_gzh_html.pyexecutablescript14.4 KB
scripts/validate_research_scope.pyexecutablescript10.0 KB
scripts/validate_task_intake.pyscript27.3 KB
scripts/wrap_gzh_preview.pyexecutablescript3.7 KB

scripts/extract_seed.py

View on GitHub
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Extract DOCX, text-based PDF, and image seed materials.

The script keeps names and entities by default. Use --redact-term repeatedly
when a user explicitly wants exact terms removed from the extracted output.
Scanned PDFs still require an OCR-capable PDF workflow.
"""

import argparse
import os
import re
import sys
import tempfile

IMAGE_EXTS = {".png", ".jpg", ".jpeg", ".bmp", ".webp"}


def check_dep(module_name, pip_name, feature):
    try:
        return __import__(module_name)
    except ImportError:
        sys.stderr.write(
            "[缺少依赖] 功能 '%s' 需要 %s。\n"
            "请安装到受管环境后再运行,例如:\n"
            "  python3 -m pip install %s\n" % (feature, pip_name, pip_name)
        )
        sys.exit(2)


_ocr_engine = None


def get_ocr():
    global _ocr_engine
    if _ocr_engine is None:
        mod = check_dep("rapidocr_onnxruntime", "rapidocr_onnxruntime", "图片 OCR")
        _ocr_engine = mod.RapidOCR()
    return _ocr_engine


def ocr_image(image_path):
    engine = get_ocr()
    result, _ = engine(image_path)
    if not result:
        return ""
    return "\n".join(
        str(line[1]).strip()
        for line in result
        if line and len(line) > 1 and str(line[1]).strip()
    )


def escape_table_cell(value):
    return value.strip().replace("\n", " ").replace("|", "\\|")


def heading_level(style_name):
    match = re.search(r"(?:Heading|标题)\s*([1-6])", style_name or "", re.I)
    return int(match.group(1)) if match else None


def extract_docx(path):
    docx = check_dep("docx", "python-docx", "DOCX 文字提取")
    doc = docx.Document(path)
    out = []

    from docx.table import Table
    from docx.text.paragraph import Paragraph

    # Preserve paragraph/table order from the document body.
    for child in doc.element.body.iterchildren():
        if child.tag.endswith("}p"):
            paragraph = Paragraph(child, doc)
            text = paragraph.text.strip()
            if not text:
                continue
            level = heading_level(paragraph.style.name if paragraph.style else "")
            out.append("#" * (level or 0) + (" " if level else "") + text)
        elif child.tag.endswith("}tbl"):
            table = Table(child, doc)
            rows = []
            for row in table.rows:
                cells = [escape_table_cell(cell.text) for cell in row.cells]
                rows.append("| " + " | ".join(cells) + " |")
            if rows and table.rows[0].cells:
                separator = "|" + " --- |" * len(table.rows[0].cells)
                out.extend([rows[0], separator, *rows[1:]])

    image_parts = [
        part
        for part in doc.part.related_parts.values()
        if "image" in str(part.content_type)
    ]
    if image_parts:
        out.append("\n[以下为文档内嵌图片的 OCR 结果,请人工核验]")
        with tempfile.TemporaryDirectory(prefix="mr_li_seed_") as tmpdir:
            for index, part in enumerate(image_parts, 1):
                ext = os.path.splitext(str(part.partname))[1] or ".png"
                image_path = os.path.join(tmpdir, "img_%d%s" % (index, ext))
                with open(image_path, "wb") as handle:
                    handle.write(part.blob)
                try:
                    text = ocr_image(image_path)
                except SystemExit as exc:
                    if int(exc.code or 0) == 2:
                        out.append("\n[图片 OCR 已跳过:缺少 OCR 依赖;上方 DOCX 文字已保留。]")
                        break
                    raise
                out.append("\n--- 图片 %d ---" % index)
                out.append(text if text else "(未识别到文字)")

    return "\n\n".join(out)


def extract_pdf(path):
    pypdf = check_dep("pypdf", "pypdf", "PDF 文字提取")
    reader = pypdf.PdfReader(path)
    pages = []
    for index, page in enumerate(reader.pages, 1):
        text = (page.extract_text() or "").strip()
        pages.append("### PDF 第 %d 页\n%s" % (index, text or "(未提取到文字,可能是扫描版)"))
    return "\n\n".join(pages)


def extract_image(path):
    text = ocr_image(path)
    return text if text else "(未识别到文字)"


def apply_redactions(text, terms):
    for term in terms:
        if term:
            text = text.replace(term, "[已按要求脱敏]")
    return text


def parse_args():
    parser = argparse.ArgumentParser(description="提取 DOCX、PDF 和图片种子素材")
    parser.add_argument("paths", nargs="+", help="待提取的文件路径")
    parser.add_argument(
        "--redact-term",
        action="append",
        default=[],
        help="精确脱敏一个词,可重复使用;默认不自动删除人名或实体",
    )
    return parser.parse_args()


def extract_path(path):
    ext = os.path.splitext(path)[1].lower()
    if ext == ".docx":
        return extract_docx(path)
    if ext == ".pdf":
        return extract_pdf(path)
    if ext in IMAGE_EXTS:
        return extract_image(path)
    raise ValueError("不支持的格式 %s" % ext)


def main():
    args = parse_args()
    exit_code = 0
    for raw_path in args.paths:
        path = os.path.abspath(raw_path)
        if not os.path.isfile(path):
            sys.stderr.write("[警告] 文件不存在,已跳过: %s\n" % path)
            exit_code = 1
            continue
        print("=" * 20)
        print("[文件] %s" % path)
        print("=" * 20)
        try:
            text = apply_redactions(extract_path(path), args.redact_term)
            print(text)
        except SystemExit:
            raise
        except Exception as exc:
            sys.stderr.write("[错误] 处理失败 %s: %s\n" % (path, exc))
            exit_code = 1
        print()
    sys.exit(exit_code)


if __name__ == "__main__":
    main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall