home / skills / velcrafting / codex-skills / bootstrap-repo

bootstrap-repo skill

/skills/meta/bootstrap-repo

This skill bootstraps or refreshes a repo scaffold with governance files and Tree.txt to ensure fast, predictable structure.

npx playbooks add skill velcrafting/codex-skills --skill bootstrap-repo

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.2 KB
---
name: bootstrap-repo
description: Bootstrap or refresh a repo scaffold (governance docs, .codex folder, Tree.txt). Use only when explicitly invoked.
---
# Bootstrap Repo

## Goal
Create or refresh a standard repo scaffold quickly and predictably:
- AGENTS.md
- ARCHITECTURE.md
- CALIBRATION.md
- DECISIONS.md
- SUGGESTIONS.md
- REVIEW_QUEUE.md
- ROADMAP.md
- Tree.txt
- .codex/SKILLS.md

## Non-negotiables
- Do not create duplicate files (no foo_copy.md, foo 2.md).
- If a file exists, modify it in place.
- Keep this bootstrap fast: bounded questions, template-driven outputs.
- Prefer defaults when user is unsure.

## Workflow

### 1) Quick discovery (read-only)
Perform a fast scan of the target repo:

- Identify repo root
- Detect existing scaffold files
- Detect stack hints:
  - `package.json`, `pnpm-lock.yaml`, `yarn.lock`
  - `pyproject.toml`, `requirements.txt`, `poetry.lock`
  - `Makefile`, CI configs
- Detect test / lint / build commands if trivially discoverable
- Detect frontend/backend roots if obvious (`frontend/`, `backend/`, `src/`)

Do **not** recurse deeply. This is heuristic, not forensic.

### 2) Bounded setup questions (multiple-choice)
Ask 8–12 questions max. Multiple-choice + recommended defaults.
Allow a fast-path: user can reply `defaults` to accept all recommended options.

Use this exact question format:

```text
1) Repo identity?
a) New repo scaffold
b) Existing repo refresh (recommended if files exist)

2) Stack shape?
a) Python backend
b) Node/Next frontend
c) Monorepo (Python + Node) (recommended if both exist)
d) Other

3) Primary objective for the next 2–4 weeks?
a) Ship new feature/domain (recommended)
b) Stabilize reliability
c) Refactor/cleanup
d) Mixed

4) Risk posture?
a) Risk-off / safety-first (recommended)
b) Balanced
c) Move fast

5) Change discipline?
a) No drive-by refactors (recommended)
b) Refactor allowed when touching code

6) Test posture?
a) Run relevant tests by default (recommended)
b) Only run tests on request

7) Decision rigor?
a) Propose decisions for non-trivial tradeoffs (recommended)
b) Keep decisions informal

8) Roadmap format?
a) Milestones + checkpoints (recommended)
b) Simple task list

9) Repo boundaries?
a) Prefer domain modules; avoid god files (recommended)
b) Flexible

10) Skills usage?
a) Use skills when relevant, never block progress (recommended)
b) Strict: must use skills if applicable

11) README handling?
a) Create README if missing (recommended)
b) Always refresh README (only if you want it overwritten)
c) Do not create/modify README

If answers are incomplete, proceed with recommended defaults and list assumptions.

### Template source

- Use templates from: `~/.codex/templates/repo-scaffold/`
- If a specialized profile is later added (e.g., TradingBot-style), select the corresponding template folder.
- If the template folder is missing or incomplete, fall back to minimal inline templates embedded in this skill.
- Templates must be applied deterministically:
  - Do not invent structure outside the template.
  - Only fill documented placeholders (mission, risk posture, quality bar, boundaries).

---

### 3) Template application
- Select templates from `~/.codex/templates/`
- If a specialized template set exists (e.g. domain-specific), use it
- Otherwise fall back to the generic templates

Template rules:
- Apply deterministically
- Only fill documented placeholders (mission, posture, boundaries, quality bar)
- Do not invent new sections beyond the template

---

### 4) Generate or update scaffold (write changes)
- Create missing files from templates
- Update existing files in place to align with chosen options
- Ensure `.codex/telemetry/` exists (repo-local)
- Create or refresh `.codex/SKILLS.md` (repo-local skills note)
- Generate `Tree.txt` excluding:
  - `.git`, `.venv`, `node_modules`, `.next`, `dist`, `build`
  - `.pytest_cache`, `.mypy_cache`, `__pycache__`, `.DS_Store`
  - `.codex/log`, `.codex/sessions`

---

### 5) Optional: minimal repo profile inference
If stack inference is **high confidence**, create a **minimal** `REPO_PROFILE.json` in repo root:

- language(s)
- frontend/backend presence
- obvious command hooks if detected

If confidence is low, skip and defer to `$personalize-repo`.

Never overwrite an existing profile without explicit approval.

---

### 6) Completion report
Output a short report (8–14 lines) including:
- Files created or updated
- Assumptions used (if any)
- Whether a repo profile was created or deferred
- Next recommended step:
  - If intent is fuzzy: `$intake-interview`
  - If structure needs tailoring: `$personalize-repo`
  - If intent is clear: `$create-plan`

Do **not** print full file contents.

---

## Checks
- Repo contains the expected scaffold files
- No duplicate files created
- Tree.txt renders cleanly and excludes junk paths
- `.codex/telemetry/` exists in repo

---

## Failure modes
- Existing files diverge heavily from templates → modify minimally, do not rewrite wholesale
- Stack inference ambiguous → skip profile creation and defer
- User answers contradictory → apply recommended defaults and record assumptions

---

## Notes
This skill establishes **structure and discipline**, not product direction.
It should always make the repo easier for subsequent skills to reason about.

Overview

This skill bootstraps or refreshes a deterministic repo scaffold quickly and predictably. It creates or updates governance and structure artifacts (.codex folder, Tree.txt, governance docs) while avoiding duplicates and preferring in-place edits. Use only when explicitly invoked.

How this skill works

It performs a fast, shallow scan to detect existing scaffold files, stack hints, and obvious frontend/backend roots. You answer a short set of bounded multiple-choice questions (or reply 'defaults') to drive template selection. The skill applies deterministic templates from a local template store, creates missing files, updates existing ones in place, ensures .codex/telemetry exists, and writes a clean Tree.txt.

When to use it

  • Initializing a new codebase with standard governance and layout
  • Refreshing and enforcing a consistent scaffold for an existing project
  • Onboarding new contributors who need predictable structure
  • Before running higher-level planning or automation skills
  • When you want a fast, template-driven standardization pass

Best practices

  • Run the quick discovery step first; accept recommended defaults when unsure
  • Answer the bounded 8–12 multiple-choice questions or reply 'defaults' to proceed fast
  • Allow in-place minimal edits to existing files instead of full rewrites
  • Keep the template folder at ~/.codex/templates/ up to date for domain profiles
  • If stack inference is uncertain, defer creating a repo profile and run personalization later

Example use cases

  • Start a new project with standard governance docs and a deterministic Tree.txt
  • Refresh an older project to add .codex/telemetry and align governance notes
  • Apply a minimal scaffold to a mono-repo detected as Python + Node
  • Create a clear file tree excluding common build and cache directories
  • Quickly produce a short completion report summarizing changes and next steps

FAQ

How many questions will I be asked?

You will be asked 8–12 bounded multiple-choice questions with recommended defaults; reply 'defaults' to accept all.

Will existing files be overwritten?

No. Existing files are modified in place with minimal changes; duplicates are never created.