module-strip
按预设裁掉示例模块(文章 / 作品 / 使用指南 / 迁移型文档 docs / 首页 FAQ / 示例数据),guides 与 docs 共用的侧栏树与搜索两者都裁才删,同步改掉首页、导航、集合定义、llms.txt 里的引用;--audit…
by bkywksj★ 55 GitHub stars
Install module-strip in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
模块裁剪(module-strip)
何时使用
- 新站点不需要文章模块 / 作品模块 / 首页 FAQ
- 孵化后清空框架自带的示例数据、示例文章、示例封面
- 给某个客户的交付副本裁掉部分功能
- 框架同步之后,检查已裁掉的模块有没有被带回来(
--audit) - 查看有哪些可裁剪的模块、裁剪会改哪些文件;为新的业务模块编写裁剪预设
概述
框架是一个完整的示例站。新项目往往只需要其中一部分,比如纯视频目录站不要文章、纯博客不要作品目录。
删目录不够:首页的「最新文章」区块、导航的「文章」入口、content.config.ts 的集合定义、llms.txt 的文章段都还引用着它们,直接删会构建失败。
本技能按预设把「删文件 + 改引用」作为一个整体完成。
module-strip.mjs <模块...>
├─ 参数检查:未知参数一律报错退出(拼错的 --preveiw 不会被当成「没传」而真的去删文件)
├─ 安全检查:是 Astro 项目?是框架模板本身?(模板只允许 --preview / --audit)git 工作区干净?
├─ 已裁剪的模块(.framework-sync.json 的 strippedModules)→ 输出「已裁剪,跳过」
├─ 已改造的模块(transformedModules,如 works → videos)→ 输出「已改造,跳过」
├─ 每个模块:在内存里执行全部文本改动 → 任一必需锚点找不到 → 整个模块跳过(绝不半截裁剪)
├─ 写盘:删目录 / 删文件 → 写回改动过的文件(多余空行收拢)
├─ 记录:.framework-sync.json 的 strippedModules(framework-sync 据此跳过这些路径)
└─ --verify:pnpm verify(build + check:seo + test)
可用预设
| 模块 | 删除 | 同步修改 |
|---|---|---|
posts 文章 |
src/content/posts/、src/pages/posts/、src/lib/posts.ts |
content.config.ts 去掉 posts 集合;首页去掉「最新文章」区块、文章统计、「阅读文章」按钮;llms.txt.ts 去掉文章段;导航去掉「文章」 |
works 作品目录 |
src/pages/works/、src/components/works/、WorksExplorer.tsx、src/lib/works.ts、works.json、categories.json、public/examples/、tests/e2e/works.spec.ts、tests/unit/works-schema.test.ts(通用的 smoke.spec.ts / content-schema.test.ts 保留) |
content.config.ts 去掉 works / categories 集合;首页去掉精选与分类区块、作品/分类统计、「浏览全部作品」按钮;llms.txt.ts 去掉分类与作品段;导航去掉「作品」;404 页去掉「浏览作品」 |
guides 使用指南 |
src/content/guides/、src/pages/guide/、src/components/docs/ 里指南专用的组件(GuideMeta / GuideSidebar / GuideToc / PrevNext / PhonePreview / Steps / Callout 等 13 个)、src/layouts/GuideLayout.astro、src/lib/guides.ts、src/lib/guide-sections.ts、guide-sidebar.json、tests/unit/guides.test.ts、tests/e2e/guides.spec.ts |
content.config.ts 去掉 guides 集合(文件里再没有 glob( 时一并去掉 glob 导入);astro.config.ts 去掉 MDX 集成与只为它设的 onwarn;llms.txt.ts 去掉指南段;导航去掉「指南」。侧栏树与站内搜索归共享部分(见下)。依赖 @astrojs/mdx 不自动卸载,报告末尾提示 |
docs 迁移型文档 |
src/content/docs/、[...slug].astro、sitemap.xml.ts、DocsLayout / LandingLayout、docs 组件(ContactDialog / DocsPhonePreview / DocsToc / ImageViewer)、lib/docs*.ts、lastmod / sitemap-rank / preview、四个 Markdown 插件、docs-theme / docs-content / landing / brand.css、docs.json 等 7 份数据、build-llms / indexnow / check-anchors / build-icons / scripts/lib/site-meta.mjs / scripts/migrate/、对应测试 |
content.config.ts 去掉 docs 集合;astro.config.ts 去掉三处「// docs 模块」接线(插件两处、withDocsSitemap 换回核心站点地图配置);package.json 去掉 icons / llms / indexnow / check:anchors。@iconify 三个依赖不自动卸载;frameWidth: 'wide' 要手动改回,报告末尾提示 |
faq 首页常见问题 |
src/data/faq.json |
首页去掉 FAQ 区块与 FAQPage 结构化数据(lib/seo.ts 的 faqJsonLd 保留) |
examples 示例数据与封面 |
public/examples/、两篇示例文章 |
works.json、categories.json 清空为 [](内容已不是框架示例时不覆盖);模块本身保留。src/data/faq.json 与 scripts/sync/sources/example.mjs 不处理,报告末尾会提示人工替换 |
- 预设可以组合、任意顺序:
posts faq works与works faq posts结果一致
共享部分(几个模块共用的文件)
guides 与 docs 都要用侧栏树(SidebarTree.astro + lib/sidebar.ts + 其测试)和站内搜索(SearchButton / SearchDialog、页头搜索入口、build 里的 pagefind)。
这组写在 presets/_shared-doc-infra.json(modules: ["guides", "docs"]),成员全部不在了才删:
| 情况 | 共享部分 |
|---|---|
| 只裁 guides(docs 还在) | 保留,报告里出「🔗 共享部分保留:docs 还在用」 |
| 只裁 docs(guides 还在) | 保留 |
| guides docs 一起裁,或其中一个早已裁过 / 项目里本来就没有 | 一起删,报告里单独一节「✂️ 共享:文档基础设施」 |
「不在」= 记在 strippedModules、本次一起裁、或项目里本来就没有(预设的 marker 文件不存在);transformedModules 里的模块算「在」。
共享部分不写进 strippedModules(它不是模块);--audit 在成员都已裁时也检查它的文件有没有被带回。
新增几个模块共用的东西时,照 _shared-doc-infra.json 写一份 _shared-<名字>.json,并给成员预设都加上 marker。
- 全部裁掉时,首页只剩 Hero;报告末尾的「需人工确认」会列出要按新站点重写的地方
.claude/skills/module-strip/
├── SKILL.md
├── scripts/module-strip.mjs
└── presets/
├── posts.json works.json guides.json docs.json faq.json examples.json
├── _shared-doc-infra.json # guides 与 docs 共用的侧栏树、站内搜索(成员都裁掉才删)
└── _template.json # 新预设模板(_ 开头的不会出现在可用列表里)
命令
S=.claude/skills/module-strip/scripts/module-strip.mjs
node $S --list # 列出可用预设
node $S posts faq --preview # 预览:删哪些、改哪些,不写盘
node $S posts faq --verify # 执行并跑 pnpm verify
node $S works --target ../my-site-delivery # 裁交付副本(见场景 3)
node $S --audit # 只读:已裁模块的文件有没有被框架同步带回来
| 参数 | 说明 |
|---|---|
--preview(或 --dry-run) |
只预检、只报告;任何目录都可以预览,包括框架模板 |
--verify |
裁剪后在目标目录跑 pnpm verify(目标目录必须已装依赖) |
--target <目录> |
目标项目根目录,默认当前目录。🔴 交付目录也用它:--target <.delivery-sync.json 里的 deliveryDir>;脚本没有 --delivery 参数(传了会报错退出) |
--audit [模块...] |
只读检查:读目标的 .framework-sync.json 的 strippedModules(或命令行给的模块),看预设 delete_dirs / delete_files 列的路径是否又出现、清空过的示例数据是否又带回示例标记;不改任何文件,框架模板里也能跑。transformedModules 里的模块即使点名也不检查 |
--force |
跳过「工作区不干净」「既不是 git 仓库也不是交付目录」的拦截 |
--allow-template |
允许在框架模板本身执行(几乎不需要:模板要保留全部示例) |
退出码:0 成功(含「全部模块已裁剪 / 已改造,跳过」、--audit 没发现问题)/ 1 --audit 发现被带回的文件 / 2
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- presets/_shared-doc-infra.json
- presets/_template.json
- presets/docs.json
- presets/examples.json
- presets/faq.json
- presets/guides.json
- presets/posts.json
- presets/works.json
- scripts/module-strip.mjs
FAQ
What does the module-strip skill do?
按预设裁掉示例模块(文章 / 作品 / 使用指南 / 迁移型文档 docs / 首页 FAQ / 示例数据),guides 与 docs 共用的侧栏树与搜索两者都裁才删,同步改掉首页、导航、集合定义、llms.txt 里的引用;--audit 检查已裁模块是否被同步带回。触发词:裁剪、模块裁剪、删除示例、去掉示例页、清空示例、精简框架、strip、不要文章模块、不要作品模块
How do I install the module-strip skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the module-strip skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…