Communitygithub.com

開源發布管線

安全地將私人專案開源:分支(清除機密)→ 清理(驗證乾淨)→ 打包(生成 CLAUDE.md、setup.sh、README)。觸發三個代理程式協作。

開源發布管線 是什麼?

此技能提供了一個完整的三階段管線,用於將私人程式碼庫安全地轉換為公開開源專案。它協調三個專門的代理程式:forker 負責複製檔案並剝離機密與內部引用;sanitizer 執行六類掃描(機密、PII、內部引用、危險檔案、配置完整性、Git 歷史審計)以驗證清理是否徹底;packager 則生成開源所需的文件,包括 CLAUDE.md、setup.sh、README.md、LICENSE、CONTRIBUTING.md 以及 GitHub Issue 模板。支援 Claude Code、Cursor 和 Codex 等平台,透過 `/opensource` 命令觸發。主要工作流程是 `/opensource fork`,它依序執行所有階段,若 sanitizer 失敗則中斷並提示使用者修復(最多重試 3 次)。此外,`verify` 和 `package` 命令可獨立執行。所有暫存檔案都保存在 `$HOME/opensource-staging/` 目錄下,並在獲得使用者明確批准後才推送至 GitHub。

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

在你喜歡的 AI 中提問

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

說明文件

開源發布管線技能

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

觸發時機

  • 使用者說「將此專案開源」或「將其公開」
  • 使用者想要準備私人儲存庫以供公開發布
  • 使用者需要在推送到 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="將 {PROJECT} fork 為開源版本",
  subagent_type="opensource-forker",
  prompt="""
為開源發布 fork 專案。

來源:{SOURCE_PATH}
目標:{STAGING_PATH}
授權條款:{chosen_license}

遵循完整的 fork 協定:
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="驗證 {PROJECT} 的清理結果",
  subagent_type="opensource-sanitizer",
  prompt="""
驗證開源 fork 的清理狀態。

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

執行所有掃描類別:
1. 機密掃描(CRITICAL)
2. PII 掃描(CRITICAL)
3. 內部引用掃描(CRITICAL)
4. 危險檔案檢查(CRITICAL)
5. 配置完整性檢查(WARNING)
6. Git 歷史審計

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

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

如果 FAIL: 向使用者顯示發現的問題。詢問:「修復這些問題後重新掃描,還是中止?」

  • 如果修復:套用修正,重新執行 sanitizer(最多重試 3 次 — 若 3 次 FAIL 後,呈現所有發現的問題,請使用者手動修復)
  • 如果中止:清理暫存目錄

如果 PASS 或 PASS WITH WARNINGS: 繼續到步驟 5。

步驟 5:執行 Packager 代理程式

產生 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:最終審查

向使用者顯示:

開源 Fork 就緒:{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 儲存庫?(是 / 否 / 先審查)

步驟 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="驗證清理狀態:{resolved_path}。執行全部 6 類掃描並生成 SANITIZATION_REPORT.md。"
)

/opensource package PROJECT

獨立執行 packager。詢問「授權條款?」和「說明文字?」,然後:

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           # 來自 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/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

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.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相關技能