Communitygithub.com

开源发布管线

开源发布管线:分支、清理并打包私有项目以安全公开发布。串联3个代理(分支代理、清理代理、打包代理)。触发方式:

开源发布管线 是什么?

这是一个用于安全地将私有项目开源化的三阶段管线技能。它通过 Forker(分支代理)复制项目源码并清除所有机密信息、Sanitizer(清理代理)验证项目是否完全干净、Packager(打包代理)生成开箱即用的开源打包文件(如 CLAUDE.md、setup.sh、README.md、LICENSE 等),最终为用户生成可直接推送到 GitHub 的完整开源项目副本。该技能支持 Claude Code、Cursor 等 AI Agent 平台。用户可以通过 `/opensource fork`、`/opensource verify`、`/opensource package` 等命令分别执行完整管线或独立步骤,避免将机密信息泄露到公共仓库中。它的工作流程包括收集用户输入(项目路径、许可证、GitHub 组织/用户名、描述),自动执行秘密扫描、PII 扫描、内部引用扫描、危险文件检查、配置完整性检查和 Git 历史审计,并在清理失败时最多重试 3 次,确保发布过程安全可靠。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/opensource-pipeline

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

开源发布管线技能

通过三阶段管线安全地将任何项目开源化:分支(剥离机密)→ 清理(验证清洁)→ 打包(生成 CLAUDE.md + setup.sh + README)。

何时激活

  • 用户说“将这个项目开源”或“使其公开”
  • 用户希望为公开发布准备一个私有仓库
  • 用户需要在推送到 GitHub 前剥离机密
  • 用户调用 /opensource fork、/opensource verify 或 /opensource package

命令

命令操作
/opensource fork PROJECT完整管线:分支 + 清理 + 打包
/opensource verify PROJECT对现有仓库运行清理器
/opensource package PROJECT生成 CLAUDE.md + setup.sh + README
/opensource list显示所有暂存的项目
/opensource status PROJECT显示某个暂存项目的报告

协议

/opensource fork PROJECT

完整管线 — 主要工作流程。

步骤 1:收集参数

解析项目路径。如果 PROJECT 包含 /,则视为路径(绝对或相对)。否则依次检查:当前工作目录、$HOME/PROJECT,然后询问用户。

SOURCE_PATH="<解析后的绝对路径>"
STAGING_PATH="$HOME/opensource-staging/${PROJECT_NAME}"

询问用户:

  1. “哪个项目?”(如果未找到)
  2. “许可证?(MIT / Apache-2.0 / GPL-3.0 / BSD-3-Clause)”
  3. “GitHub 组织或用户名?”(默认:通过 gh api user -q .login 检测)
  4. “GitHub 仓库名称?”(默认:项目名称)
  5. “README 的描述?”(分析项目以提供建议)

步骤 2:创建暂存目录

mkdir -p $HOME/opensource-staging/

步骤 3:运行分支代理

生成 opensource-forker 代理:

Agent(
  description="对 {PROJECT} 进行分支操作以准备开源",
  subagent_type="opensource-forker",
  prompt="""
对项目执行分支操作以准备开源发布。

源路径:{SOURCE_PATH}
目标路径:{STAGING_PATH}
许可证:{chosen_license}

遵循完整分支协议:
1. 复制文件(排除 .git、node_modules、__pycache__、.venv)
2. 剥离所有机密和凭据
3. 将内部引用替换为占位符
4. 生成 .env.example
5. 清理 Git 历史
6. 在 {STAGING_PATH}/FORK_REPORT.md 中生成 FORK_REPORT.md
"""
)

等待完成。读取 {STAGING_PATH}/FORK_REPORT.md。

步骤 4:运行清理代理

生成 opensource-sanitizer 代理:

Agent(
  description="验证 {PROJECT} 的清理结果",
  subagent_type="opensource-sanitizer",
  prompt="""
验证开源分支的清理结果。

项目:{STAGING_PATH}
源路径(以供参考):{SOURCE_PATH}

运行所有扫描类别:
1. 秘密扫描(严重)
2. PII 扫描(严重)
3. 内部引用扫描(严重)
4. 危险文件检查(严重)
5. 配置完整性检查(警告)
6. Git 历史审计

在 {STAGING_PATH} 内生成 SANITIZATION_REPORT.md,并包含 PASS/FAIL 判定。
"""
)

等待完成。读取 {STAGING_PATH}/SANITIZATION_REPORT.md。

如果结果为 FAIL: 向用户展示发现的问题。询问:“修复这些问题并重新扫描,还是中止?”

  • 如果选择修复:应用修复,重新运行清理器(最多重试 3 次 — 经过 3 次 FAIL 后,展示所有发现的问题并请用户手动修复)
  • 如果选择中止:清理暂存目录

如果结果为 PASS 或 PASS WITH WARNINGS: 继续执行步骤 5。

步骤 5:运行打包代理

生成 opensource-packager 代理:

Agent(
  description="对 {PROJECT} 进行打包以准备开源",
  subagent_type="opensource-packager",
  prompt="""
为项目生成开源打包文件。

项目:{STAGING_PATH}
许可证:{chosen_license}
项目名称:{PROJECT_NAME}
描述:{description}
GitHub 仓库:{github_repo}

生成:
1. CLAUDE.md(命令、架构、关键文件)
2. setup.sh(一键引导,设为可执行)
3. README.md(或增强现有)
4. LICENSE
5. CONTRIBUTING.md
6. .github/ISSUE_TEMPLATE/(bug_report.md、feature_request.md)
"""
)

步骤 6:最终审查

向用户展示:

开源分支已就绪:{PROJECT_NAME}

位置:{STAGING_PATH}
许可证:{license}
生成的文件:
  - CLAUDE.md
  - setup.sh(可执行)
  - README.md
  - LICENSE
  - CONTRIBUTING.md
  - .env.example({N} 个变量)

清理状态:{sanitization_verdict}

后续步骤:
  1. 审查:cd {STAGING_PATH}
  2. 创建仓库:gh repo create {github_org}/{github_repo} --public
  3. 推送:git remote add origin ... && git push -u origin main

是否继续创建 GitHub 仓库?(yes/no/review first)

步骤 7:GitHub 发布(经用户批准后)

cd "{STAGING_PATH}"
gh repo create "{github_org}/{github_repo}" --public --source=. --push --description "{description}"

/opensource verify PROJECT

独立运行清理器。解析路径:如果 PROJECT 包含 /,则视为路径。否则依次检查 $HOME/opensource-staging/PROJECT,然后 $HOME/PROJECT,然后当前目录。

Agent(
  subagent_type="opensource-sanitizer",
  prompt="验证清理结果:{resolved_path}。运行全部 6 个扫描类别并生成 SANITIZATION_REPORT.md。"
)

/opensource package PROJECT

独立运行打包器。询问“许可证?”和“描述?”,然后:

Agent(
  subagent_type="opensource-packager",
  prompt="打包:{resolved_path} ..."
)

/opensource list

ls -d $HOME/opensource-staging/*/

显示每个项目及其管线进度(FORK_REPORT.md、SANITIZATION_REPORT.md、CLAUDE.md 是否存在)。


/opensource status PROJECT

cat $HOME/opensource-staging/${PROJECT}/SANITIZATION_REPORT.md
cat $HOME/opensource-staging/${PROJECT}/FORK_REPORT.md

暂存目录布局

$HOME/opensource-staging/
  my-project/
    FORK_REPORT.md           # 来自分支代理
    SANITIZATION_REPORT.md   # 来自清理代理
    CLAUDE.md                # 来自打包代理
    setup.sh                 # 来自打包代理
    README.md                # 来自打包代理
    .env.example             # 来自分支代理
    ...                      # 清理后的项目文件

反模式

  • 绝不能在未经用户批准的情况下推送到 GitHub
  • 绝不能跳过清理器——它是安全门
  • 绝不能在清理器 FAIL 后不修复所有严重问题就继续
  • 绝不能将 .env、*.pem 或 credentials.json 留在暂存目录中

最佳实践

  • 对新版本始终运行完整管线(分支 → 清理 → 打包)
  • 暂存目录会一直保留直到被显式清理——用它来审查
  • 手动修复后、发布前重新运行清理器
  • 将秘密参数化而不是删除它们——确保项目功能完整

相关技能

参见 security-review(清理器使用的秘密检测模式)。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

相关技能