Communitygithub.com

opensource-pipeline

開源管線:將私有專案進行分支、清理及打包,以安全地公開發行。串聯三個代理程式(forker、sanitizer、packager)。

opensource-pipeline 是什麼?

此技能提供一個自動化的三階段管線,用於將私有專案安全地轉換為開源版本。首先由「forker」代理程式複製專案,移除所有機密與內部參考;接著「sanitizer」代理程式進行六類掃描(機密、個資、內部參考、危險檔案、配置完整性、Git 歷史),確保無遺漏;最後由「packager」代理程式產生標準開源套件,包含 CLAUDE.md、setup.sh、README.md、LICENSE 等檔案。支援 Claude Code 等平台,並提供 `/opensource fork`、`/opensource verify`、`/opensource package` 等指令。此管線將安全性放在首位,在 sanitizer 失敗時要求使用者介入,並在推送至 GitHub 前取得明確確認。

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

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Open-Source Pipeline 技能

透過三階段管線安全地將任何專案開源:Fork(移除機密)→ Sanitize(驗證乾淨)→ Package(產生 CLAUDE.md + setup.sh + README)。

啟用時機

  • 使用者說「open source this project」或「make this public」
  • 使用者想要將私有儲存庫準備好進行公開發行
  • 使用者需要在推送至 GitHub 前移除機密
  • 使用者執行 /opensource fork、/opensource verify 或 /opensource package

指令

指令動作
/opensource fork PROJECT完整管線:fork + sanitize + package
/opensource verify PROJECT對現有儲存庫執行 sanitizer
/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:執行 Forker 代理程式

啟動 opensource-forker 代理程式:

Agent(
  description="Fork {PROJECT} for open-source",
  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:執行 Sanitizer 代理程式

啟動 opensource-sanitizer 代理程式:

Agent(
  description="Verify {PROJECT} sanitization",
  subagent_type="opensource-sanitizer",
  prompt="""
驗證開源分支的清理狀態。

專案:{STAGING_PATH}
來源(供參考):{SOURCE_PATH}

執行所有掃描類別:
1. 機密掃描(CRITICAL)
2. 個資掃描(CRITICAL)
3. 內部參考掃描(CRITICAL)
4. 危險檔案檢查(CRITICAL)
5. 配置完整性檢查(WARNING)
6. Git 歷史稽核

在 {STAGING_PATH} 中產生 SANITIZATION_REPORT.md,並附上 PASS/FAIL 判定。
"""
)

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

若 FAIL: 向使用者顯示發現結果。詢問:「修正這些問題並重新掃描,或中止?」

  • 若選擇修正:套用修正,重新執行 sanitizer(最多重試 3 次 — 若連續 FAIL 3 次,則呈現所有發現結果並要求使用者手動修正)
  • 若選擇中止:清除暫存目錄

若 PASS 或 PASS WITH WARNINGS: 繼續進行步驟 5。

步驟 5:執行 Packager 代理程式

啟動 opensource-packager 代理程式:

Agent(
  description="Package {PROJECT} for open-source",
  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

獨立執行 sanitizer。解析路徑:若 PROJECT 包含 /,則視為路徑。否則依序檢查 $HOME/opensource-staging/PROJECT、$HOME/PROJECT,然後是目前目錄。

Agent(
  subagent_type="opensource-sanitizer",
  prompt="Verify sanitization of: {resolved_path}. Run all 6 scan categories and generate SANITIZATION_REPORT.md."
)

/opensource package PROJECT

獨立執行 packager。詢問「License?」和「Description?」,然後:

Agent(
  subagent_type="opensource-packager",
  prompt="Package: {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           # 來自 forker 代理程式
    SANITIZATION_REPORT.md   # 來自 sanitizer 代理程式
    CLAUDE.md                # 來自 packager 代理程式
    setup.sh                 # 來自 packager 代理程式
    README.md                # 來自 packager 代理程式
    .env.example             # 來自 forker 代理程式
    ...                      # 已清理的專案檔案

反模式

  • 絕不在未經使用者核准的情況下推送到 GitHub
  • 絕不跳過 sanitizer — 它是安全閘門
  • 絕不在 sanitizer FAIL 且未修正所有重大發現結果時繼續進行
  • 絕不將 .env、*.pem 或 credentials.json 留在暫存目錄中

最佳實踐

  • 對於新版本,始終執行完整管線(fork → sanitize → package)
  • 暫存目錄會持續存在,直到明確清理 — 可用於審查
  • 在發布前若進行任何手動修正,請重新執行 sanitizer
  • 將機密參數化而非直接刪除 — 保留專案功能

相關技能

請參閱 security-review 以了解 sanitizer 所使用的機密偵測模式。

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.

相關技能