Open-Sourcing a Repository
Prepare a repository for public release so that an outsider with no prior
context can build, use, and contribute to it — and so that nothing sensitive
ships with it. Work through the steps in order; the secrets audit comes first
because its outcome (keeping vs. recreating the repository) affects
everything after it.
When to Use
- Making a private repository public
- Auditing an existing public repository for release quality ("make it
official")
- Choosing a license for a project
- Setting up packaging, versioning, or release automation ahead of a public
launch
When NOT to Use
- Routine development on an already-released project (no release event)
- Auditing third-party code for vulnerabilities (use a security-review skill)
- Publishing a package from a repository that will stay private — only the
release-management steps apply; skip the rest
Workflow
Step 1: Detect the organization profile
bash {baseDir}/scripts/detect_org.sh
The script inspects git remotes and recent committer emails, and prints a
profile name. If it prints trailofbits, read
references/trailofbits.md now and apply its
license policy, publishing accounts, and process notes throughout the
remaining steps. If it prints generic, proceed with the generic guidance
alone. If the user says the detection is wrong, trust the user.
Step 2: Audit for secrets — before anything else
A repository that has ever contained secrets (API keys, credentials,
client data) should not be flipped public. History rewriting is error-prone
and does not reach forks, caches, or CI artifacts. The reliable fix is a
fresh repository: copy the current tree over, commit, and archive the old
repository privately.
- Ask whether the project ever handled secrets or client-confidential
material. For a security consultancy's tooling, also ask whether test
fixtures or example data came from client engagements.
- Scan the full history with a dedicated tool if available —
gitleaks git . or trufflehog git file://. — rather than eyeballing.
- Check beyond the git tree: GitHub Actions logs and artifacts, old
releases, issue and PR history, and the repository wiki all become public
with the repository.
- After going public, enable GitHub secret scanning and push protection in
the repository settings.
Reject these rationalizations — this is the one step that cannot be fixed
after publication:
- "The key was revoked, so the history is fine." Revoked credentials still
leak infrastructure names, internal URLs, and patterns attackers use for
targeting.
- "We'll rewrite history with git-filter-repo." Rewrites miss forks,
clones, caches, and CI artifacts; the fresh-repository approach does not.
- "It's only test data." Fixtures derived from client engagements or
production systems are confidential regardless of how they are labeled.
Step 3: Run the readiness check
bash {baseDir}/scripts/check_readiness.sh
The script prints a checklist of presence indicators (README, LICENSE,
CONTRIBUTING, SECURITY.md, CI, tests, semver tags, ...) and warns about
tracked files that commonly contain secrets. Treat unchecked items as
discussion prompts, not hard failures — a research prototype does not need
everything a flagship library needs. Walk through the gaps with the user and
fix the ones that matter for this project.
Step 4: Documentation
The README is the project's front door. Confirm it explains:
- What the project is and what problem it solves (first paragraph)
- How to install it — package manager, container image, or build from
source; a fresh-clone build must work using only what is in the repository
- How to use it — at least one concrete, copy-pasteable example
- How to contribute — inline or via
CONTRIBUTING.md
- The license — a short section naming it
Also add:
SECURITY.md with vulnerability-reporting instructions (a contact
address or GitHub private vulnerability reporting). For security tooling
this is table stakes.
- API documentation, built and hosted (GitHub Pages via CI is the usual
route), linked from the README and the repository website field. See the
language references below for per-ecosystem doc tooling.
- A code of conduct if the project expects outside contributors.
Step 5: Licensing
No license means not open source, regardless of visibility. Read
references/licensing.md for selection criteria and
mechanics. The short version:
- Apply the organization's policy if one was detected in Step 1.
- Otherwise: Apache 2.0 as the permissive default, AGPLv3 when private
modification by competitors is a real concern, Creative Commons for
non-code artifacts.
- Add the
LICENSE file, set SPDX identifiers in package metadata, state
the license in the README, and verify all three agree.
Step 6: Tests and CI
- Confirm the test suite exists and passes; a public repository with a
failing default branch signals abandonment.
- Ensure CI runs the tests on every PR, across the supported
language-version and platform matrix.
- Enforce formatting and linting in CI (per-language tooling in the
references below), so style debates never reach review.
- Respect existing tooling. Do not replace a working formatter, linter,
or type checker as part of open-sourcing. If it lags the current
generation (the language references name the current tools), warn the
maintainer and let them decide; only when a category is missing entirely —
no type checker, no formatter — add the current default.
- Consider a coverage gate that fails CI when coverage drops.
- Harden the workflows themselves before they become public attack surface:
- Pin third-party actions to full commit SHAs; enable Dependabot for
github-actions so pins stay current.
- Set least-privilege
permissions: blocks (start from permissions: {}).
- Audit with
zizmor .github/workflows/ and lint with actionlint.
Step 7: Repository settings
- Branch protection on the default branch: no force pushes, PRs
required. Prefer rulesets for new repositories; classic branch protection
remains supported.
- Merge protection: required status checks so PRs cannot merge with
failing tests.
- Dependabot or Renovate for dependency and Actions updates. Group
updates to cut PR noise, and set a cooldown window (e.g., 7 days) so
freshly published — and occasionally hijacked — versions age before
adoption.
.editorconfig so contributors' editors agree on whitespace basics.
- Labels: create them as soon as more than one issue or PR needs one;
prefixes for facets scale well (
C: component, P: platform). See
blight's labels for a
worked example.
Step 8: Releases and versioning
- Tag every release
vX.Y.Z, following semver; use
-rc.N / -pre.N suffixes for release candidates and prereleases.
- Make releases CI-driven: pushing a tag (or publishing a GitHub Release)
triggers build, packaging, and upload with no manual steps. A release
should be
git tag vX.Y.Z && git push origin vX.Y.Z.
- Publish packages under an organization-owned account, not a personal one,
and use trusted publishing (OIDC) instead of long-lived tokens wherever
the index supports it.
Step 9: Language-specific practices
Identify the project's languages from its marker files and read the matching
reference for packaging, publishing, and quality tooling:
| Marker file |
Reference |
pyproject.toml, setup.py |
references/python.md — defers to the modern-python skill for tooling |
CMakeLists.txt, Makefile (C/C++) |
references/c-cpp.md |
Cargo.toml |
references/rust.md |
go.mod |
references/go.md |
package.json |
references/javascript.md |
Gemfile, *.gemspec |
references/ruby.md |
For other ecosystems, apply the cross-cutting principles: reproducible
builds from a fresh clone, CI-driven releases, trusted publishing or
organization-owned accounts, and license metadata in the package manifest.
Final Review
Before the visibility switch is flipped, verify from an outsider's
perspective:
- Clone into a clean directory and follow the README's build instructions
verbatim — do they work with no tribal knowledge?
- Re-run
{baseDir}/scripts/check_readiness.sh and confirm the remaining
gaps are deliberate choices, stated to the user.
- Confirm the secrets audit (Step 2) actually happened; it is the one step
that cannot be fixed after publication.
Making the repository public is then a repository-settings change. Pair the
release with an announcement where the organization has a process for one.
Additional Resources
Reference Files
- references/licensing.md — license selection
criteria, SPDX metadata, forks and relicensing
- references/trailofbits.md — Trail of Bits
policy overlay (loaded only when detected in Step 1)
- references/python.md,
references/c-cpp.md,
references/rust.md,
references/go.md,
references/javascript.md,
references/ruby.md — per-language packaging,
publishing, and quality tooling
Scripts
scripts/detect_org.sh — prints the organization profile
(trailofbits or generic) from git remotes and committer emails
scripts/check_readiness.sh — prints presence indicators for
release-readiness files and flags tracked files that commonly hold secrets
1---2name: open-sourcing3description: This skill should be used when the user asks to "open source this project", "prepare this repository for public release", "make this repo public", "check open-source readiness", "choose a license for this project", or "set up release automation" ahead of a public launch. Provides a release-readiness workflow covering secrets hygiene, licensing, documentation, CI, and language-specific packaging.4---5
6# Open-Sourcing a Repository
7
8Prepare a repository for public release so that an outsider with no prior
9context can build, use, and contribute to it — and so that nothing sensitive
10ships with it. Work through the steps in order; the secrets audit comes first
11because its outcome (keeping vs. recreating the repository) affects
12everything after it.
13
14## When to Use
15
16- Making a private repository public
17- Auditing an existing public repository for release quality ("make it
18 official")
19- Choosing a license for a project
20- Setting up packaging, versioning, or release automation ahead of a public
21 launch
22
23## When NOT to Use
24
25- Routine development on an already-released project (no release event)
26- Auditing third-party code for vulnerabilities (use a security-review skill)
27- Publishing a package from a repository that will stay private — only the
28 release-management steps apply; skip the rest
29
30## Workflow
31
32### Step 1: Detect the organization profile
33
34```sh
35bash {baseDir}/scripts/detect_org.sh
36```
37
38The script inspects git remotes and recent committer emails, and prints a
39profile name. If it prints `trailofbits`, read
40[references/trailofbits.md](references/trailofbits.md) now and apply its
41license policy, publishing accounts, and process notes throughout the
42remaining steps. If it prints `generic`, proceed with the generic guidance
43alone. If the user says the detection is wrong, trust the user.
44
45### Step 2: Audit for secrets — before anything else
46
47A repository that has **ever** contained secrets (API keys, credentials,
48client data) should not be flipped public. History rewriting is error-prone
49and does not reach forks, caches, or CI artifacts. The reliable fix is a
50fresh repository: copy the current tree over, commit, and archive the old
51repository privately.
52
531. Ask whether the project ever handled secrets or client-confidential
54 material. For a security consultancy's tooling, also ask whether test
55 fixtures or example data came from client engagements.
562. Scan the full history with a dedicated tool if available —
57 `gitleaks git .` or `trufflehog git file://.` — rather than eyeballing.
583. Check beyond the git tree: GitHub Actions logs and artifacts, old
59 releases, issue and PR history, and the repository wiki all become public
60 with the repository.
614. After going public, enable GitHub secret scanning and push protection in
62 the repository settings.
63
64Reject these rationalizations — this is the one step that cannot be fixed
65after publication:
66
67- *"The key was revoked, so the history is fine."* Revoked credentials still
68 leak infrastructure names, internal URLs, and patterns attackers use for
69 targeting.
70- *"We'll rewrite history with git-filter-repo."* Rewrites miss forks,
71 clones, caches, and CI artifacts; the fresh-repository approach does not.
72- *"It's only test data."* Fixtures derived from client engagements or
73 production systems are confidential regardless of how they are labeled.
74
75### Step 3: Run the readiness check
76
77```sh
78bash {baseDir}/scripts/check_readiness.sh
79```
80
81The script prints a checklist of presence indicators (README, LICENSE,
82CONTRIBUTING, SECURITY.md, CI, tests, semver tags, ...) and warns about
83tracked files that commonly contain secrets. Treat unchecked items as
84discussion prompts, not hard failures — a research prototype does not need
85everything a flagship library needs. Walk through the gaps with the user and
86fix the ones that matter for this project.
87
88### Step 4: Documentation
89
90The README is the project's front door. Confirm it explains:
91
92- **What the project is** and what problem it solves (first paragraph)
93- **How to install it** — package manager, container image, or build from
94 source; a fresh-clone build must work using only what is in the repository
95- **How to use it** — at least one concrete, copy-pasteable example
96- **How to contribute** — inline or via `CONTRIBUTING.md`
97- **The license** — a short section naming it
98
99Also add:
100
101- **`SECURITY.md`** with vulnerability-reporting instructions (a contact
102 address or GitHub private vulnerability reporting). For security tooling
103 this is table stakes.
104- **API documentation**, built and hosted (GitHub Pages via CI is the usual
105 route), linked from the README and the repository website field. See the
106 language references below for per-ecosystem doc tooling.
107- A **code of conduct** if the project expects outside contributors.
108
109### Step 5: Licensing
110
111No license means not open source, regardless of visibility. Read
112[references/licensing.md](references/licensing.md) for selection criteria and
113mechanics. The short version:
114
1151. Apply the organization's policy if one was detected in Step 1.
1162. Otherwise: Apache 2.0 as the permissive default, AGPLv3 when private
117 modification by competitors is a real concern, Creative Commons for
118 non-code artifacts.
1193. Add the `LICENSE` file, set SPDX identifiers in package metadata, state
120 the license in the README, and verify all three agree.
121
122### Step 6: Tests and CI
123
124- Confirm the test suite exists and passes; a public repository with a
125 failing default branch signals abandonment.
126- Ensure CI runs the tests on every PR, across the supported
127 language-version and platform matrix.
128- Enforce formatting and linting in CI (per-language tooling in the
129 references below), so style debates never reach review.
130- **Respect existing tooling.** Do not replace a working formatter, linter,
131 or type checker as part of open-sourcing. If it lags the current
132 generation (the language references name the current tools), warn the
133 maintainer and let them decide; only when a category is missing entirely —
134 no type checker, no formatter — add the current default.
135- Consider a coverage gate that fails CI when coverage drops.
136- Harden the workflows themselves before they become public attack surface:
137 - Pin third-party actions to full commit SHAs; enable Dependabot for
138 `github-actions` so pins stay current.
139 - Set least-privilege `permissions:` blocks (start from `permissions: {}`).
140 - Audit with `zizmor .github/workflows/` and lint with `actionlint`.
141
142### Step 7: Repository settings
143
144- **Branch protection** on the default branch: no force pushes, PRs
145 required. Prefer rulesets for new repositories; classic branch protection
146 remains supported.
147- **Merge protection**: required status checks so PRs cannot merge with
148 failing tests.
149- **Dependabot or Renovate** for dependency and Actions updates. Group
150 updates to cut PR noise, and set a cooldown window (e.g., 7 days) so
151 freshly published — and occasionally hijacked — versions age before
152 adoption.
153- **`.editorconfig`** so contributors' editors agree on whitespace basics.
154- **Labels**: create them as soon as more than one issue or PR needs one;
155 prefixes for facets scale well (`C:` component, `P:` platform). See
156 [blight's labels](https://github.com/trailofbits/blight/labels) for a
157 worked example.
158
159### Step 8: Releases and versioning
160
161- Tag every release `vX.Y.Z`, following [semver](https://semver.org/); use
162 `-rc.N` / `-pre.N` suffixes for release candidates and prereleases.
163- Make releases CI-driven: pushing a tag (or publishing a GitHub Release)
164 triggers build, packaging, and upload with no manual steps. A release
165 should be `git tag vX.Y.Z && git push origin vX.Y.Z`.
166- Publish packages under an organization-owned account, not a personal one,
167 and use **trusted publishing** (OIDC) instead of long-lived tokens wherever
168 the index supports it.
169
170### Step 9: Language-specific practices
171
172Identify the project's languages from its marker files and read the matching
173reference for packaging, publishing, and quality tooling:
174
175| Marker file | Reference |
176|-------------|-----------|
177| `pyproject.toml`, `setup.py` | [references/python.md](references/python.md) — defers to the modern-python skill for tooling |
178| `CMakeLists.txt`, `Makefile` (C/C++) | [references/c-cpp.md](references/c-cpp.md) |
179| `Cargo.toml` | [references/rust.md](references/rust.md) |
180| `go.mod` | [references/go.md](references/go.md) |
181| `package.json` | [references/javascript.md](references/javascript.md) |
182| `Gemfile`, `*.gemspec` | [references/ruby.md](references/ruby.md) |
183
184For other ecosystems, apply the cross-cutting principles: reproducible
185builds from a fresh clone, CI-driven releases, trusted publishing or
186organization-owned accounts, and license metadata in the package manifest.
187
188## Final Review
189
190Before the visibility switch is flipped, verify from an outsider's
191perspective:
192
1931. Clone into a clean directory and follow the README's build instructions
194 verbatim — do they work with no tribal knowledge?
1952. Re-run `{baseDir}/scripts/check_readiness.sh` and confirm the remaining
196 gaps are deliberate choices, stated to the user.
1973. Confirm the secrets audit (Step 2) actually happened; it is the one step
198 that cannot be fixed after publication.
199
200Making the repository public is then a repository-settings change. Pair the
201release with an announcement where the organization has a process for one.
202
203## Additional Resources
204
205### Reference Files
206
207- **[references/licensing.md](references/licensing.md)** — license selection
208 criteria, SPDX metadata, forks and relicensing
209- **[references/trailofbits.md](references/trailofbits.md)** — Trail of Bits
210 policy overlay (loaded only when detected in Step 1)
211- **[references/python.md](references/python.md)**,
212 **[references/c-cpp.md](references/c-cpp.md)**,
213 **[references/rust.md](references/rust.md)**,
214 **[references/go.md](references/go.md)**,
215 **[references/javascript.md](references/javascript.md)**,
216 **[references/ruby.md](references/ruby.md)** — per-language packaging,
217 publishing, and quality tooling
218
219### Scripts
220
221- **`scripts/detect_org.sh`** — prints the organization profile
222 (`trailofbits` or `generic`) from git remotes and committer emails
223- **`scripts/check_readiness.sh`** — prints presence indicators for
224 release-readiness files and flags tracked files that commonly hold secrets