Files
misc-productivity-tools-OPEN/skill-repo-publication-workflow.md
T

468 lines
14 KiB
Markdown
Raw Normal View History

2026-06-04 13:16:26 -06:00
---
name: skill-repo-publication-workflow
description: Use this skill when creating or updating a sanitized public repository from a private operational skill/workflow repository while preserving utility and preventing sensitive information from being published.
---
# Skill Repo Publication Workflow
## Contract
This skill guarantees:
- a public repository is populated only from explicitly approved private source files,
- copied files are sanitized before publication,
- sensitive infrastructure, credentials, operational topology, personal data, and private paths are detected and either removed, anonymized, or documented for human decision,
- the public repository receives a publication receipt describing inputs, changes, validation, unresolved risks, and next steps,
- recurring leak patterns become durable ratchet artifacts such as `.gitignore` rules, sanitization maps, checklists, validators, or anti-patterns.
## Human-Delivered Variables
The human must provide these variables before execution:
- `PRIVATE_REPO_PATH`: absolute path to the private source repo.
- `PUBLIC_REPO_PATH`: absolute path to the public/sanitized repo.
- `PUBLIC_REPO_STATUS`: one of `new-empty`, `existing-private`, `existing-public`.
- `FILES_TO_COPY`: explicit list of files or folders to copy from private to public.
- `PUBLICATION_INTENT`: one of `template`, `case-study`, `tooling-only`, `docs-only`, or `mixed`.
- `ALLOWED_BRAND_EXPOSURE`: whether real brand names/domains may remain.
- `ALLOWED_AUTHOR_EXPOSURE`: whether real author names/emails may remain.
- `ANONYMIZATION_MAP`: replacements for domains, emails, IPs, hostnames, users, paths, repo URLs, API names, and organization names.
- `PUBLIC_OUTPUT_BRANCH`: branch name to prepare in the public repo.
- `REVIEW_REPORT_PATH`: where to write the publication receipt.
Optional but strongly recommended:
- `PUBLIC_REPO_REMOTE_URL`: remote URL for the public repo.
- `PRIVATE_ONLY_PATTERNS`: terms that must never appear in public output.
- `ALLOW_HISTORY_REWRITE`: whether the agent may rewrite public repo history. Default: no.
- `ALLOW_DELETIONS_IN_PUBLIC_REPO`: whether the agent may delete files from public repo. Default: ask first.
- `VALIDATION_DEPTH`: one of `quick`, `standard`, or `deep`.
- `SYNC_MODE`: one of `initial-copy`, `incremental-update`, or `audit-only`.
- `HUMAN_REVIEW_REQUIRED_BEFORE_COMMIT`: default yes.
## Outputs
The skill produces:
- sanitized files in `PUBLIC_REPO_PATH`,
- a publication receipt at `REVIEW_REPORT_PATH`,
- a list of changed files,
- a list of sensitive findings and how each was handled,
- a list of unresolved review items,
- optional `.gitignore`, `.env.example`, `README.md`, or `PUBLICATION_WORKFLOW.md` updates,
- optional ratchet artifacts such as `sanitization-map.md`, leak-scan script, or publication checklist.
## Skill Shape
`service`: one bounded workflow with clear inputs and outputs.
It may become a `system` if future versions coordinate subagents for independent security review, docs review, and code review.
## Requires
This skill requires:
- read access to `PRIVATE_REPO_PATH`,
- write access to `PUBLIC_REPO_PATH`,
- shell access for `git`, `rg`, and basic file inspection,
- human-provided `FILES_TO_COPY`,
- human-provided anonymization policy,
- permission before destructive operations or history rewrites.
## Ensures
Before finishing, this skill ensures:
- public repo changes are traceable to the provided private source files,
- all copied files are scanned for sensitive material,
- no known private-only patterns remain unless explicitly allowed,
- generated/cache/export artifacts are excluded,
- public docs do not include live operational endpoints unless explicitly allowed,
- a run receipt documents what was copied, sanitized, validated, and left unresolved.
## Capabilities
Required host capabilities:
- CLI tools: `git`, `rg`, shell, file listing, diff.
- MCP/connectors: none required.
- browser access: not required unless validating public docs rendering.
- filesystem access: read private repo, write public repo.
- network access: not required unless syncing remotes.
- subagent support: optional for independent review.
- image/document/spreadsheet support: optional; required only if those assets are copied.
If a required capability is unavailable, stop and explain the missing primitive. Do not fake a leak scan or claim validation that was not run.
## State Scope
State scope: `project`.
Persistent writes:
- sanitized files in `PUBLIC_REPO_PATH`,
- publication receipt,
- optional `.gitignore`,
- optional `.env.example`,
- optional `PUBLICATION_WORKFLOW.md`,
- optional sanitization map/checklist/validator.
No cross-project user memory should be updated unless the human explicitly asks.
## Host Primitive Adapter
- spawn subagent: optional independent security/docs/code review.
- ask user: request missing human-delivered variables or decisions on ambiguous exposure.
- read/write files: copy selected files, edit sanitized public outputs, write receipt.
- run shell command: inventory files, scan with `rg`, inspect git status/diff.
- use browser: optional docs rendering check.
- use connector: not required.
- create durable report: required publication receipt.
If the host cannot provide safe file copy, shell scan, or write access to the public repo, stop.
## Workflow
### Phase 1: Intake And Gates
Collect the human-delivered variables.
STOP if:
- `PRIVATE_REPO_PATH` is missing,
- `PUBLIC_REPO_PATH` is missing,
- `FILES_TO_COPY` is vague or absent,
- `PUBLICATION_INTENT` is unclear,
- the public repo already has unrelated uncommitted changes and the human has not approved working around them.
Confirm whether the task is:
- initial sanitized publication,
- incremental sync,
- audit-only review.
### Phase 2: Baseline Inventory
Inspect both repos:
- `git status --short`
- tracked files,
- untracked files,
- existing `.gitignore`,
- existing public docs,
- public repo history status.
Identify generated artifacts that should not be published:
- `__pycache__/`
- `*.pyc`
- `.env`
- `*.csv`
- `*.jsonl`
- `*.sql`
- database dumps,
- telemetry exports,
- subscriber exports,
- local screenshots unless intentionally public.
### Phase 3: Copy Selected Files
Copy only `FILES_TO_COPY` from private to public.
Rules:
- preserve relative structure when it helps usability,
- do not copy `.git/`,
- do not copy generated caches,
- do not copy local output folders,
- do not copy raw data exports unless explicitly approved and anonymized.
For incremental updates, compare private source and public destination before overwriting. If a public file has unrelated public-only edits, merge carefully.
### Phase 4: Sanitize
Apply `ANONYMIZATION_MAP` consistently.
Sanitize these categories:
- live credentials and tokens,
- internal IPs,
- public IPs tied to private infrastructure,
- hostnames,
- SSH usernames,
- SSH key names,
- local workstation paths,
- private repo URLs,
- public webhook URLs,
- Caddy/reverse-proxy details,
- telemetry lake paths if too specific,
- database/container names if operationally revealing,
- sender emails,
- subscriber examples,
- real campaign exports,
- personal names if not allowed,
- brand names/domains if not allowed.
Prefer placeholders that preserve the teaching value:
```text
mail.example.com
telemetry.example.com
10.0.0.10
<email-vm-user>
<ops-monitor-user>
<ssh-key>
/path/to/project
[email protected]
brand-a.example
```
For scripts, prefer environment-variable defaults over hardcoded private values:
```bash
SSH_HOST="${SSH_HOST:-user@example.internal}"
SSH_KEY="${SSH_KEY:-$HOME/.ssh/example_key}"
```
### Phase 5: Add Public-Safe Support Files
Add or update as appropriate:
- `.gitignore`
- `.env.example`
- `README.md`
- `PUBLICATION_WORKFLOW.md`
- `sanitization-map.md`
Public docs should explain:
- this is a sanitized template/example,
- real credentials must come from environment variables or private config,
- raw subscriber/telemetry data must never be committed,
- operational endpoints in examples are placeholders.
### Phase 6: Leak Scan
Run scans on the public repo working tree.
Minimum scans:
```bash
rg -n --hidden -i "(password|passwd|secret|token|api[_-]?key|apikey|bearer|authorization|credential|private key|smtp_pass|postmark)" .
rg -n --hidden "([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,})" .
rg -n --hidden "((?:[0-9]{1,3}\.){3}[0-9]{1,3}|/mnt/c/Users|C:\\\\Users|/home/|/srv/data|/opt/|\.jsonl|\.csv|\.sql)" .
git ls-files | rg "(__pycache__|\.pyc$|\.env$|\.csv$|\.jsonl$|\.sql$|\.tar\.gz$|\.pem$|id_rsa|id_ed25519)"
```
If `PRIVATE_ONLY_PATTERNS` is provided, scan for each pattern.
For `VALIDATION_DEPTH=deep`, scan git history too:
```bash
git log --oneline --all
git grep -n -I -i "secret\|token\|password\|api_key" $(git rev-list --all)
```
If this is a fresh public repo, history should be clean by construction.
### Phase 7: Review Diff
Inspect:
- `git status --short`
- `git diff`
- newly added files,
- deleted files,
- unresolved placeholders,
- remaining real identifiers.
Classify findings:
- `blocker`: must fix before publication,
- `review`: human decision required,
- `accepted`: allowed public content,
- `false-positive`: safe placeholder or generic term.
### Phase 8: Ratchet
For every leak or near-leak discovered, add at least one durable guardrail:
- update `.gitignore`,
- update `sanitization-map.md`,
- add a private-only pattern,
- add a validation command,
- add an anti-pattern to this skill,
- add a checklist item to the public workflow,
- create a small leak-scan script.
Do not only fix the current leak. Make the same leak harder next time.
### Phase 9: Run Receipt
Write `REVIEW_REPORT_PATH` with:
- date/time,
- private repo path,
- public repo path,
- files copied,
- files changed,
- variables used,
- anonymization map applied,
- scans run,
- findings,
- fixes applied,
- ratchet artifacts added,
- unresolved risks,
- recommended human review points,
- whether the repo is safe to publish.
### Phase 10: Human Review Gate
If `HUMAN_REVIEW_REQUIRED_BEFORE_COMMIT=yes`, stop after writing the receipt and ask the human to review.
Do not push or make public automatically.
If commit is requested after review, commit only the public repo changes.
## Validation
Before finishing, verify:
- all requested files were copied or explicitly skipped with rationale,
- no unapproved source files were copied,
- leak scans were run and results reviewed,
- generated artifacts are ignored or absent,
- placeholders are consistent,
- scripts do not default to live private infrastructure unless explicitly allowed,
- the publication receipt exists and names unresolved risks,
- `git status --short` in the public repo is reported.
## Test Surface
This skill can be tested through:
- Static checks: required sections exist in this skill; command examples are syntactically plausible.
- Schema checks: optional receipt fields are present.
- Invariant checks: no private-only patterns remain in public output.
- Fixture tests: a fake private repo with known secrets is sanitized into a fake public repo.
- Behavioral/E2E tests: agent stops when required human variables are missing.
- LLM-as-judge evals: public docs remain useful after anonymization.
- Routing tests: "sanitize this private repo for public publication" routes here.
- Freshness checks: public workflow and sanitization map reflect new leak classes.
## Coverage And Edge-Case Audit
Before finishing, map:
- files copied,
- docs changed,
- scripts changed,
- data files skipped,
- secrets checked,
- operational identifiers checked,
- local paths checked,
- public-only edits preserved,
- git history risk reviewed.
Mark uncovered gaps as:
- `[SCAN]` needs a better scanner,
- `[MANUAL]` needs human judgment,
- `[HISTORY]` requires fresh repo or history rewrite,
- `[CONTENT]` brand/editorial decision,
- `[SECURITY]` infrastructure action outside repo.
## Edge Cases
Actively test or consider:
- public repo already has public-only edits,
- private file was renamed since last sync,
- a doc contains real domains that are intentionally public,
- a script needs usable defaults without real infrastructure,
- a file contains example credentials that look like secrets,
- git history contains removed sensitive content,
- binary files cannot be scanned,
- templates include customer/subscriber data,
- path examples reveal local usernames,
- docs mention endpoints that are live and unauthenticated.
## Ratchet Rules
When the skill discovers a recurring mistake, ambiguous case, failed validation, or agent shortcut, convert the lesson into at least one durable artifact:
- `.gitignore` rule,
- leak-scan command,
- sanitization map entry,
- STOP gate,
- anti-pattern,
- fixture,
- validation checklist item,
- public workflow update.
Then re-run the relevant scan.
## Regression Rule
If something that was previously sanitized reappears in public output, create a regression artifact immediately.
Acceptable artifacts:
- `PRIVATE_ONLY_PATTERNS` update,
- scan script rule,
- fixture containing the leak pattern,
- checklist update,
- anti-pattern update.
Do not merely remove the current instance.
## Validation Tiers
Tier 1: Fast deterministic checks run every time.
- file inventory,
- `rg` leak scans,
- generated artifact checks,
- `.gitignore` review,
- `git status` and `git diff`.
Tier 2: Realistic workflow checks run before important publication.
- copy a realistic changed file,
- sanitize it,
- run leak scan,
- inspect public docs for usefulness.
Tier 3: LLM-as-judge or human review when quality is subjective.
- whether anonymized docs remain understandable,
- whether brand references are acceptable,
- whether operational detail is too specific.
## Anti-Patterns
Do not:
- make the original operational repo public with full history unless it has been deliberately sanitized and history-reviewed,
- copy entire repos blindly,
- publish raw subscriber exports, telemetry JSONL, database dumps, or backups,
- leave live webhook URLs in public docs unless explicitly approved,
- hardcode real SSH users, IPs, or key names in public scripts,
- treat placeholder passwords as proof that the repo is safe,
- rely on a single grep as the whole security review,
- remove context so aggressively that public docs become useless,
- commit generated `__pycache__`, `.pyc`, `.env`, `.csv`, `.jsonl`, `.sql`, or backup archives,
- skip the run receipt.
## Final Report
Report:
- what was copied,
- what was sanitized,
- what scans were run,
- what risks were found,
- what was fixed,
- what ratchet artifact was added,
- what still needs human decision,
- whether the public repo is ready to push or publish.