awesome-style-mimic
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStyle mimic — learn a site's voice, rewrite anything in it
Style mimic — 学习网站语气,用其重写任意内容
Two modes sharing one artifact: Learn deep-crawls a website and produces a self-contained
style guide; Apply rewrites documents in that guide's voice so a whole batch reads as one
author. The guide file is the only thing that crosses sessions — everything else is working
state.
Bundled files (load on demand):
- — the crawl engine: state, corpus writes, link filtering, serial classification, quotas, stop criterion. Learn mode runs it; never reimplement it by hand.
scripts/crawl-ingest.mjs - — the per-document rewriter instructions Apply mode gives each subagent verbatim.
references/rewriter-contract.md - — complete style guides produced by Learn mode (buffer.com, hubspot.com, zapier.com, ahrefs.com, semrush.com, hootsuite.com, clickup.com, linktr.ee). The format reference, and directly usable with Apply mode. Their samples are SYNTHETIC — composed to demonstrate each register, not quoted from the sites (the publishable policy below).
references/example-styles/
两种模式共享同一份产出物:学习模式 深度爬取网站并生成自包含的风格指南;应用模式 按照该指南的风格重写文档,使整批内容读起来像出自同一作者之手。风格指南文件是唯一会跨会话保留的内容——其余所有内容都是工作状态数据。
内置文件(按需加载):
- — 爬取引擎:负责状态管理、语料写入、链接过滤、序列化页面分类、配额管理、停止条件判断。由学习模式调用,切勿手动重新实现。
scripts/crawl-ingest.mjs - — 应用模式会逐字提供给每个子Agent的单文档重写指令。
references/rewriter-contract.md - — 由学习模式生成的完整风格指南示例(包括buffer.com、hubspot.com、zapier.com、ahrefs.com、semrush.com、hootsuite.com、clickup.com、linktr.ee)。可作为格式参考,也可直接用于应用模式。这些示例中的样本是合成的——为演示每种语域风格而创作,并非从网站引用(详见下文可发布策略)。
references/example-styles/
Mode dispatch
模式调度
- Argument is a URL → Learn mode.
- Arguments are a style-guide path + a file/folder target → Apply mode.
- Ambiguous → ask.
- 参数为URL → 学习模式。
- 参数为风格指南路径 + 文件/文件夹目标 → 应用模式。
- 含义不明确 → 询问用户。
Learn mode
学习模式
Output: (host without ). Working state:
(, , ) — resumable, deletable after the guide lands.
styles/<host>.mdwww.style-crawl/<host>/state.jsoncorpus/analysis/输出:(host 不含 )。工作状态目录:(包含 、、)——支持中断恢复,生成指南后可删除。
styles/<host>.mdwww.style-crawl/<host>/state.jsoncorpus/analysis/0. Browser preflight
0. 浏览器预检查
Learn mode drives a real browser through whatever automation the agent has — Playwright MCP
( bridge to the user's live Chrome, or a spawned browser), or an equivalent
browser tool; without one, say so and stop (a plain HTTP fetch tool cannot render JS-heavy
sites and silently misses content — do not degrade to it without telling the user).
--extensionWith the Playwright MCP bridge, run the target gate first (the procedure is in
, shipped with ): ask which bridge
when the session exposes more than one, probe which browser and profile answered, and confirm
with the user before the crawl starts. Wrong browser or no bridge → ask for that browser's
from the extension's status page, set it in the MCP entry,
restart, re-run the gate. Then list tabs (a lone
means the bridge is not attached — stop and have the user fix it; no extension installed at all
→ the install for Chrome or Edge is
https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm);
never touch the bridge's own tab;
open ONE working tab and reuse it. Warn the user the browser is busy while the crawl runs.
Dismiss cookie/consent banners once on the first page — they pollute extracted text.
references/browser-interaction.mdawesome-content-publisherPLAYWRIGHT_MCP_EXTENSION_TOKENabout:blankconnect.html学习模式通过Agent可用的任意自动化工具驱动真实浏览器——比如Playwright MCP(通过桥接用户正在使用的Chrome,或启动一个新的浏览器),或等效的浏览器工具;如果没有此类工具,明确告知用户并停止运行(普通的HTTP fetch工具无法渲染重度依赖JS的网站,会静默遗漏内容——切勿在未告知用户的情况下降级使用此类工具)。
--extension使用Playwright MCP桥接时,首先运行目标门禁检查(流程见附带的):如果会话暴露了多个桥接,询问使用哪一个;探测响应的浏览器和配置文件,并在爬取开始前与用户确认。浏览器错误或无桥接 → 让用户从扩展状态页面获取对应浏览器的,在MCP配置项中设置该令牌,重启后重新运行门禁检查。随后列出标签页(如果只有一个页面,说明桥接未连接——停止运行并让用户修复;如果完全没有安装扩展 → Chrome或Edge的安装地址为https://chromewebstore.google.com/detail/playwright-extension/mmlmfjhmonkocbjadbfplnigmagldckm);切勿操作桥接自带的标签页;打开一个工作标签页并复用。爬取运行期间,需提醒用户浏览器正处于占用状态。在第一个页面关闭一次cookie/同意横幅——它们会污染提取的文本。
awesome-content-publisherreferences/browser-interaction.mdPLAYWRIGHT_MCP_EXTENSION_TOKENabout:blankconnect.html1. Crawl loop (BFS by real links — no sitemap.xml)
1. 爬取循环(基于真实链接的BFS — 不使用sitemap.xml)
All bookkeeping lives in the bundled ingester:
node <skill-dir>/scripts/crawl-ingest.mjs --dump dump-<host>.json --dir style-crawl/<host> [--origin <url>]It ingests a dump of fetched pages and prints one JSON line: (up to 8 URLs),
counters, coverage %, . No → just re-read state; that is also how a crawl
RESUMES after interruption. First run needs .
nextBatchdone--dump--originThe loop is two tool calls per batch of 8 pages:
- Fetch batch — one browser-evaluate call that es the batch same-origin inside the page, parses each response with
fetch(), stripsDOMParserplusnav,header,footer,script,style,noscript,svg,iframe,form,aside, and returns[role="navigation"],[aria-hidden="true"]per page (~250 ms pause between fetches). Save the result to a file (Playwright MCP: the[{requested, url, title, text (≤30k chars), links[]}]parameter onfilename), namedbrowser_evaluate— page text must stay OUT of the conversation context, and the host-specific name keeps concurrent sessions from clobbering each other. Insertdump-<host>.jsonbefore closing block tags before parsing so\nkeeps paragraph breaks:textContent
js
html = html.replace(/<\/(p|div|h[1-6]|li|section|article|ul|ol|blockquote|tr)>/gi, '\n</$1>');- Ingest — run the script; feed its into the next fetch. Repeat until
nextBatch.done: true
Fast-path validity check: extract the FIRST page twice — live (navigated tab) and via
— and compare. Empty or much shorter fetch text → the site is JS-rendered: fall
back to per-page navigation + a settle wait + the same extraction in the live DOM, still
dumping to the file and ingesting with the same script (single-page dumps are fine).
fetch()Rules:
- Read-only: navigation and DOM reads only; never click actions or type into forms (consent
dismissal excepted). The script already skips login/cart/account paths, media files,
/
.mdpage mirrors, feeds, and localized mirrors (.txt,/es, …) — style is learned from the primary language./fr - One crawl at a time machine-wide; never crawl the same host from two sessions (shared
corrupts).
state.json - Mid-crawl steering by editing between batches is allowed: trim a low-value serial quota (author bios, changelog entries), or purge noise the skip-list missed (legal archive years, malformed URLs) — remove such URLs from
state.jsonANDfrontierso coverage math stays honest.discovered - Report the ingester's counter line to the user every ~3 batches.
所有状态记录都由内置的摄取器处理:
node <skill-dir>/scripts/crawl-ingest.mjs --dump dump-<host>.json --dir style-crawl/<host> [--origin <url>]它会摄取已抓取页面的转储文件,并输出一行JSON:(最多8个URL)、计数器、覆盖率%、。不带参数 → 仅重新读取状态;这也是爬取中断后恢复的方式。首次运行需要参数。
nextBatchdone--dump--origin爬取循环每处理8个页面为一批,包含两次工具调用:
- 抓取批次 — 一次browser-evaluate调用,在页面内同域该批次的所有页面,用
fetch()解析每个响应,移除DOMParser以及nav,header,footer,script,style,noscript,svg,iframe,form,aside元素,然后返回每个页面的[role="navigation"],[aria-hidden="true"](每次抓取之间暂停约250毫秒)。将结果保存到文件(Playwright MCP:使用[{requested, url, title, text (≤30k chars), links[]}]的browser_evaluate参数),文件名为filename——页面文本必须放在对话上下文之外,且按主机命名的文件可避免并发会话相互覆盖。解析前在块级元素的闭合标签前插入dump-<host>.json,使\n保留段落换行:textContent
js
html = html.replace(/<\/(p|div|h[1-6]|li|section|article|ul|ol|blockquote|tr)>/gi, '\n</$1>');- 摄取 — 运行脚本;将其输出的作为下一次抓取的输入。重复此过程直到
nextBatch。done: true
快速有效性检查:对第一个页面提取两次——一次是实时页面(已导航的标签页),一次通过——并对比结果。如果fetch得到的文本为空或短得多 → 说明该网站是JS渲染的:回退到逐页导航 + 等待加载稳定 + 在实时DOM中执行相同提取的方式,仍然转储到文件并使用相同的脚本摄取(单页转储也可以)。
fetch()规则:
- 只读模式:仅执行导航和DOM读取操作;切勿点击或在表单中输入(关闭同意横幅除外)。脚本已自动跳过登录/购物车/账户路径、媒体文件、/
.md页面镜像、订阅源以及本地化镜像(.txt、/es等)——风格仅从主语言版本学习。/fr - 同一台机器同一时间只能运行一个爬取任务;切勿从两个会话爬取同一主机(共享会导致数据损坏)。
state.json - 允许在批次间隙编辑进行中途调整:削减低价值序列化页面的配额(作者简介、更新日志条目),或清理跳过列表遗漏的噪声内容(法律归档年份、格式错误的URL)——需同时从
state.json和frontier中移除这些URL,以保证覆盖率计算的准确性。discovered - 每约3个批次向用户报告一次摄取器的计数器行。
2. Serial pages and the stop criterion (handled by the script)
2. 序列化页面与停止条件(由脚本处理)
Serial = templated pages whose count can run to thousands (blog posts, products, glossary
terms, tags). The script samples them (default quota 18 per pattern) instead of exhausting
them: auto-serial path patterns plus automatic promotion when ≥8 URLs share a
template. fires at ≥80% coverage of NON-serial
pages with all quotas met, or an empty frontier. Safety cap 300 pages: on ,
STOP and tell the user the real coverage — never present a capped crawl as full.
<prefix>/<varying-last-segment>donecapHit: true序列化页面 = 基于模板生成的页面,数量可能多达数千个(博客文章、产品、术语表条目、标签)。脚本会对其进行采样(每个模式默认配额18个)而非全部爬取:自动识别序列化路径模式,当≥8个URL共享模板时,会自动将其归类为序列化页面。当非序列化页面覆盖率≥80%且所有配额均已满足,或待爬队列为空时,触发。安全上限为300页:如果,立即停止并告知用户真实覆盖率——切勿将受限爬取呈现为完整爬取。
<前缀>/<可变的最后一段>donecapHit: true3. Analysis fan-out (parallel, from disk)
3. 分析扇出(并行,从磁盘读取)
Split into batches of ~15 files; spawn one subagent per batch, all
concurrently. Each reads its files and writes STYLE observations (not content summaries) to
with fixed sections: Lexicon / Voice & POV /
Rhythm / Structure / Formatting / Genre notes / Golden-sample candidates (3–5 verbatim
excerpts ≤120 words with source file and why), returning only a 5-line summary.
Resource preflight (before fan-out): cap concurrency at , ≈ 0.7 GB for these read-only agents; go serial if
CPU load > 85% or free RAM < 2×per_agent; recompute before each wave; where the runtime caps
sub-agent concurrency itself, defer to it.
corpus/*.mdstyle-crawl/<host>/analysis/batch-N.mdmin((cores−1)×0.75, free_gb×0.7/per_agent, 6)per_agent将拆分为每批约15个文件;每批生成一个子Agent,全部并行运行。每个子Agent读取其负责的文件,并将风格观察结果(而非内容摘要)写入,包含固定章节:词汇 / 语气与视角 / 节奏 / 结构 / 格式 / 体裁说明 / 黄金样本候选(3-5段不超过120词的原文摘录,注明源文件和入选理由),仅返回5行摘要。
资源预检查(扇出前):并发数上限为,这些只读Agent的约为0.7 GB;如果CPU负载>85%或可用内存<2×单Agent占用,则改为串行执行;每轮执行前重新计算;如果运行时本身限制了子Agent并发数,以运行时的限制为准。
corpus/*.mdstyle-crawl/<host>/analysis/batch-N.mdmin((核心数−1)×0.75, 可用GB×0.7/单Agent占用, 6)单Agent占用4. Synthesis
4. 合成
One agent (or the main context) reads all , reconciles (majority wins;
genre differences become sub-profiles, not contradictions), and writes
with exactly these sections: Voice profile · Tone rules (Do/Don't) · Lexicon · Rhythm &
syntax · Structure (with the site's invariant CTA strings quoted verbatim) · Formatting
habits · Genre notes · Samples · Rewrite instructions. writes the
same section set for an author's own voice, so either file can be handed to Apply mode or to
— keep the names exactly as listed rather than improving them. The guide must be self-contained —
Apply sessions see only this file. See for the
target shape and depth.
analysis/batch-*.mdstyles/<host>.mdawesome-content-voiceawesome-content-campaignreferences/example-styles/buffer.com.mdTwo sample policies — pick by the guide's destination, ask when unclear:
- Private/local guide (default): golden samples — 8–10 verbatim excerpts across genres, each verified letter-for-letter against its corpus file before inclusion (drop or fix any that don't match), labeled with genre and source URL. Verbatim anchors give Apply mode the highest fidelity.
- Publishable guide: synthetic samples — the excerpts are COMPOSED by you in the described style about invented, generic subject matter: no sentence taken from the site, no real claims or people, no source URLs. Section opens with "Composed to demonstrate the register — not text from the site." Short phrase-level microcopy patterns (CTA strings, verdict openers) may stay verbatim. Converting an existing golden-sample guide to publishable = rewrite only its samples section this way and strip sample attributions.
一个Agent(或主上下文)读取所有,进行整合(多数意见为准;体裁差异作为子配置,而非矛盾),并写入,必须严格包含以下章节:语气概况 · 语调规则(应该/不应该) · 词汇 · 节奏与句法 · 结构(逐字引用网站固定的CTA字符串) · 格式习惯 · 体裁说明 · 样本 · 重写指令。工具为作者自身风格生成的文件也使用相同的章节结构,因此两种文件都可以交给应用模式或使用——请严格保持列出的名称,不要自行优化。风格指南必须是自包含的——应用模式会话只能看到这个文件。目标格式和深度参考。
analysis/batch-*.mdstyles/<host>.mdawesome-content-voiceawesome-content-campaignreferences/example-styles/buffer.com.md两种样本策略——根据风格指南的用途选择,不明确时询问用户:
- 私有/本地指南(默认):黄金样本 — 跨体裁的8-10段原文摘录,每段在收录前都已逐字与语料文件核对(不匹配的则丢弃或修正),标注体裁和源URL。原文锚点能为应用模式提供最高的保真度。
- 可发布指南:合成样本 — 摘录由你按照描述的风格,针对虚构的通用主题创作:没有从网站引用的句子,没有真实的主张或人物,没有源URL。章节开头注明“为演示语域风格而创作——并非来自网站的文本”。短语级的微文案模式(CTA字符串、结论开头语)可以保留原文。将现有的黄金样本指南转换为可发布版本 = 仅用这种方式重写其样本章节,并移除样本出处。
Apply mode
应用模式
Inputs: a style-guide path + a target (file or folder). Read the guide FIRST, fully — its
Golden samples anchor the tone; its Rewrite instructions override defaults below.
输入:风格指南路径 + 目标(文件或文件夹)。首先完整阅读风格指南——其中的黄金样本是语调的锚点;重写指令优先级高于以下默认规则。
Target resolution
目标解析
Single file → one rewrite. Folder → glob prose-bearing sources ( — component files: copy strings only), skipping
, build output, lockfiles, pure code/config. List the set first when >20 files.
.md .mdx .txt .html .htm .astro .svelte .vue .jsx .tsxnode_modules单个文件 → 重写一次。文件夹 → 匹配所有包含散文内容的源文件(——组件文件:仅复制文本字符串),跳过、构建输出、锁文件、纯代码/配置文件。如果文件数>20,先列出所有待处理文件。
.md .mdx .txt .html .htm .astro .svelte .vue .jsx .tsxnode_modulesOutput rules
输出规则
Target inside a git repo ( exits 0) → ask which
mode, unless the user already named one:
git -C <target> rev-parse --show-toplevel- Separate worktree (recommended) — , rewrite in-place inside the worktree, user reviews with
git -C <repo-root> worktree add -b restyle/<style-name> <repo-root>-restyleand merges or removes it (their call, never yours). Worktrees cut from HEAD — warn ifgit diffshows uncommitted changes on target files.git status - Mirror folder — next to the target; originals untouched.
<target-name>-styled/ - In-place — only on explicit request; warn first on a dirty working tree.
Non-repo target → mirror folder by default; in-place only on explicit request.
目标位于git仓库内(退出码为0)→ 询问使用哪种模式,除非用户已经指定:
git -C <target> rev-parse --show-toplevel- 独立worktree(推荐) — 执行,在worktree内原地重写,用户通过
git -C <仓库根目录> worktree add -b restyle/<风格名称> <仓库根目录>-restyle审查后决定合并或删除(由用户决定,切勿自行操作)。Worktree从HEAD创建——如果git diff显示目标文件有未提交的更改,需发出警告。git status - 镜像文件夹 — 在目标旁创建文件夹;原文件保持不变。
<目标名称>-styled/ - 原地重写 — 仅在用户明确要求时使用;如果工作树未清理,需先发出警告。
非仓库目标 → 默认使用镜像文件夹;仅在用户明确要求时原地重写。
Fan-out and the one-author guarantee
扇出与单一作者保证
One subagent per file, spawned in parallel. Each subagent gets: the style-guide path, one
source path, one output path, the file mode (markdown/html/component), and the FULL text of
— identical guide + identical contract per file is what
keeps one authorial voice across the batch. Never relay a summary of the guide; each
subagent reads the guide file itself. A failed file gets one retry, then is reported — never
silently dropped. Resource preflight (before fan-out): cap concurrency at , ≈ 0.7 GB for these read/write agents; go serial if
CPU load > 85% or free RAM < 2×per_agent; recompute before each wave; where the runtime caps
sub-agent concurrency itself, defer to it.
references/rewriter-contract.mdmin((cores−1)×0.75, free_gb×0.7/per_agent, 6)per_agentAfter all rewrites land (2+ files), run ONE consistency-pass subagent over the whole output
set (for >15 files: first/last 3 paragraphs plus a middle excerpt each): find cross-document
drift — lexicon used in one file but violated in another, tone shifts, inconsistent
heading/CTA patterns — fix findings directly with edits, return the
list. Report that list to the user; it is the evidence the batch reads as one author.
path: what changed每个文件对应一个子Agent,并行生成。每个子Agent获得:风格指南路径、一个源文件路径、一个输出路径、文件模式(markdown/html/component)以及的完整文本——每个文件使用相同的指南+相同的契约,是整批内容保持同一作者语气的关键。切勿传递指南的摘要;每个子Agent都要自行读取指南文件。失败的文件可重试一次,之后仍失败则上报——切勿静默丢弃。
资源预检查(扇出前):并发数上限为,这些读写Agent的约为0.7 GB;如果CPU负载>85%或可用内存<2×单Agent占用,则改为串行执行;每轮执行前重新计算;如果运行时本身限制了子Agent并发数,以运行时的限制为准。
references/rewriter-contract.mdmin((核心数−1)×0.75, 可用GB×0.7/单Agent占用, 6)单Agent占用所有重写完成后(2个及以上文件),运行一个一致性检查子Agent处理全部输出文件(如果文件数>15:每个文件取首尾3段加中间一段摘录):找出跨文档的不一致之处——比如一个文件使用的词汇在另一个文件中被违反、语调偏移、标题/CTA模式不一致——直接编辑修复发现的问题,返回列表。将该列表报告给用户;这是整批内容读起来像出自同一作者的证明。
路径: 更改内容Verification (both modes)
验证(两种模式均适用)
- Learn: the final report cites the ingester's numbers (pages visited, non-serial coverage %,
serial patterns sampled, failures) — from , not memory — and states that every golden sample was grep-verified verbatim against the corpus.
state.json - Apply: the final report lists files rewritten/skipped/failed, the consistency-pass fix list, and where the originals are (untouched mirror / worktree branch / in-place).
- Both: anything unverifiable (a capped crawl, a file the rewriter refused) is stated explicitly, never implied as done.
- 学习模式:最终报告引用摄取器的统计数据(已访问页面数、非序列化页面覆盖率%、已采样序列化模式数、失败数)——数据来自,而非内存——并说明每个黄金样本都已通过grep逐字核对过语料库。
state.json - 应用模式:最终报告列出已重写/已跳过/失败的文件、一致性检查修复列表,以及原文件的位置(未修改的镜像 / worktree分支 / 原地重写)。
- 两种模式:任何无法验证的情况(受限爬取、重写器拒绝处理的文件)都要明确说明,切勿暗示已完成。
Anti-patterns
反模式
- Crawling instead of real navigation links — sitemaps list URLs the site's own linking never surfaces and miss the link-graph signal of what matters.
sitemap.xml - Letting page text into the conversation context during the crawl (dump to disk; context compaction must not be able to lose corpus data).
- Presenting a capped or partial crawl as full coverage.
- Style guides padded with abstractions ("friendly but professional") instead of quotable mechanics (exact CTA strings, verdict-first FAQ openers, em-dash pivots).
- Rewriters translating the source document (style transfers across languages; words do not), inventing facts, or "improving" content beyond voice/rhythm/lexicon/formatting.
- Publishing a golden-sample guide as-is — verbatim excerpts of someone else's site do not belong in a public repo; convert to synthetic samples first (the publishable policy above).
- 爬取而非真实导航链接——站点地图列出的URL可能是网站自身链接从未展示的,还会丢失链接图所反映的内容重要性信号。
sitemap.xml - 爬取期间将页面文本放入对话上下文(应转储到磁盘;上下文压缩绝不能导致语料数据丢失)。
- 将受限或部分爬取呈现为完整覆盖。
- 风格指南充斥着抽象描述(比如“友好但专业”),而非可引用的具体规则(确切的CTA字符串、结论先行的FAQ开头、破折号转折用法)。
- 重写器翻译源文档(风格可以跨语言迁移,但词汇不行)、编造事实,或在语气/节奏/词汇/格式之外“优化”内容。
- 直接发布黄金样本指南——他人网站的原文摘录不应出现在公共仓库中;需先转换为合成样本(见上文可发布策略)。