帮用户把私有项目整理成可开源的仓库。核心能力:(1) 扫描源码和 git 历史中的密钥/token 泄漏;(2) 根据项目场景推荐开源协议(MIT / Apache 2.0 / GPL 等)并生成 LICENSE;(3) 补齐 README 免责声明、CONTRIBUTING.md、SECURITY.md、.gitignore 等开源必备文档;(4) 检查 bundle identifier、package.json 等所有权/商标隐患。触发词:「开源」「open source」「选择协议」「LICENSE」「准备开源」「检测密钥」「secret scan」「上传 github」。
npx skills add https://github.com/iamzhihuix/happy-claude-skills --skill open-source-prep
把私有项目整理成可安全开源的仓库。分 5 个阶段串行执行,密钥扫描必须最先通过才能进入后续步骤。
用户说:
LICENSE(大写无后缀),GitHub 才识别...REDACTED... 占位符 — 即使是用户主动粘贴进来的必须先做,发现问题要停下。扫描三个地方:
git log --all -p)扫描模式见 references/secrets-patterns.md。关键模式包括:
| 类型 | 模式 |
|------|------|
| JWT | eyJhbGc[0-9A-Za-z_-]{20,} |
| GitHub token | gh[posur]_[0-9A-Za-z]{36,} |
| OpenAI / Anthropic | sk-[a-zA-Z0-9]{20,}, sk-ant-[a-zA-Z0-9-]{40,} |
| AWS access key | AKIA[0-9A-Z]{16} |
| Google API key | AIza[0-9A-Za-z_-]{35} |
| Slack token | xox[baprs]-[0-9A-Za-z-]{10,} |
| Stripe | sk_live_[0-9A-Za-z]{20,} |
| 私钥 PEM | -----BEGIN.*PRIVATE KEY----- |
| 通用密码 | password\s*[:=]\s*["'][^"']{8,} |
敏感文件名(staged 时警报):
.env, .env.local, .env.productioncredentials.json, secrets.json*.pem, *.key, *.p12, *.pfxid_rsa, id_ed25519执行命令(按项目大小自适应):
# 工作区扫描(含未追踪)
git ls-files --others --exclude-standard -z | xargs -0 grep -lE "<pattern>" 2>/dev/null
# 已追踪文件
git grep -nE "<pattern>" 2>/dev/null
# Git 历史
git log --all -p 2>/dev/null | grep -cE "<pattern>"
# 敏感文件名
git ls-files | grep -E "(^|/)(\.env|credentials\.json|.*\.(pem|key|p12|pfx))$"
区分真密钥 vs 占位符:
... / REDACTED / example / test / xxx / dummy发现真密钥时:
eyJhbGc...[12 chars]...abcd 前后各 4 位,中间省略).env 并加入 .gitignoregit filter-repo 或 git reset --soft HEAD~1git filter-repo --invert-paths + force push根据决策树推荐,不要一上来就问所有问题:
第一问:项目性质?
第二问(针对个人项目):涉及可申请专利的新颖技术?
第三问(针对 copyleft 偏好):SaaS 形态(用户通过网络用不下载)?
默认推荐 MIT — 95% 个人项目合适。生成的 LICENSE 使用 templates/LICENSE-MIT.txt 模板,版权人从 git config user.name 读取,年份是当前年份。
协议对比速查:
| 协议 | 长度 | 专利 | 商标 | copyleft | 场景 |
|------|------|------|------|----------|------|
| MIT | 20 行 | 无 | 无 | 无 | 个人工具首选 |
| Apache 2.0 | 200 行 | 显式 | 保护 | 无 | 企业/专利场景 |
| GPL v3 | 长 | 有 | - | 强 | 病毒式开源 |
| AGPL v3 | 长 | 有 | - | 极强 | SaaS 场景 |
生成以下文件(如已存在则显示 diff,用户确认后再改):
LICENSE — 协议文本,填入版权人 + 年份CONTRIBUTING.md — 开发环境、PR 流程、测试命令(用 templates/CONTRIBUTING.md)SECURITY.md — 漏洞上报流程(用 templates/SECURITY.md)README.md 补充(用 Edit tool 插入):LICENSE 文件检查并提示修改:
.gitignore — 确保包含: src-tauri/target/ # Tauri
target/ # Rust 通用
node_modules/ # Node
dist/ build/ out/ # 构建产物
.env* # 环境变量
.DS_Store Thumbs.db # OS
coverage/ *.lcov # 覆盖率报告
src-tauri/tauri.conf.json 的 identifier 字段package.json 的 name 字段Cargo.toml 的 [package] namecom.google.*、com.factory.*)→ 警告商标风险com.<github-username>.<project-name>询问用户是否要做:
.github/workflows/release.yml).github/ISSUE_TEMPLATE/)gh repo edit --visibility public)注意:切换为 public 是不可逆的信息公开,必须用户明确确认后才执行,且要再跑一次 Phase 1 密钥扫描。
每个阶段结束后向用户报告:
## Phase N: xxx
✅ 通过:[...]
⚠️ 警告:[...]
❌ 需处理:[...]
下一步:[...]
最后给一个完整 checklist。
templates/LICENSE-MIT.txt — MIT 协议模板(用 {{YEAR}} {{AUTHOR}} 占位)templates/LICENSE-Apache-2.0.txt — Apache 2.0 模板templates/LICENSE-GPL-3.0.txt — GPL v3 模板(较长,可用 gh api 拉官方文本)templates/LICENSE-AGPL-3.0.txt — AGPL v3 模板templates/CONTRIBUTING.md — 贡献指南模板templates/SECURITY.md — 安全策略模板references/secrets-patterns.md — 完整的密钥正则表达式清单references/disclaimer-templates.md — 不同场景的免责声明范文Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more. Also supports plugin and theme development with commands to reload plugins, run JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, search vault content, perform vault operations from the command line, or develop and debug Obsidian plugins and themes.
Comprehensive project architecture blueprint generator that analyzes codebases to create detailed architectural documentation. Automatically detects technology stacks and architectural patterns, generates visual diagrams, documents implementation patterns, and provides extensible blueprints for maintaining architectural consistency and guiding new development.
Securely inspect and automate microscopy data workflows against OMERO.server with omero-py, BlitzGateway, OMERO CLI, tables, annotations, ROIs, rendering, and documented OMERO.web APIs. Use for scoped OMERO inventory, metadata export, import/export planning, or reviewed write workflows.
Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/PRD asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".
Master API documentation with OpenAPI 3.1, AI-powered tools, and modern developer experience practices. Create interactive docs, generate SDKs, and build comprehensive developer portals.
Creates comprehensive API changelogs documenting breaking changes, deprecations, and migration strategies for API consumers. Use when managing API versions, communicating breaking changes, or creating upgrade guides.
Master API documentation with OpenAPI 3.1, AI-powered tools, and modern developer experience practices. Create interactive docs, generate SDKs, and build comprehensive developer portals. Use PROACTIVELY for API documentation or developer portal creation.
Analyze fundamental data primitives, type systems, and state management patterns in a codebase. Use when (1) evaluating typing strategies (Pydantic vs TypedDict vs loose dicts), (2) assessing immutability and mutation patterns, (3) understanding serialization approaches, (4) documenting state shape and lifecycle, or (5) comparing data modeling approaches across frameworks.
Take iamzhihuix/open-source-prep from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.