Scaffolding GitHub Repositories
Given an unconfigured project (e.g., a folder with only package.json and src/), produce these files in one pass:
.gitignore
.pre-commit-config.yaml
.github/workflows/quality-gate.yml
.github/ISSUE_TEMPLATE/bug_report.yml
.github/ISSUE_TEMPLATE/feature_request.yml
assets/.gitkeep
README.md
Detect stack from the manifest first (package.json, pyproject.toml, Cargo.toml, go.mod), then generate every file tailored to that stack — don't emit generic boilerplate.
Progress:
- Step 1: Audit environment — read manifest file(s), identify language, framework, test runner, package manager
- Step 2: Build empty directory matrix (
mkdir -p .github/workflows .github/ISSUE_TEMPLATE assets) - Step 3: Add
.gitkeepto any folder left empty (e.g.assets/) so Git tracks it - Step 4: Write stack-specific
.gitignore - Step 5: Write
.pre-commit-config.yamlwith linting hooks matched to the stack - Step 6: Write YAML issue templates (bug report, feature request) with dropdowns/validations
- Step 7: Stage/reference visual assets (banners, gifs) in
assets/if provided, else leave placeholders - Step 8: Assemble interactive
README.md(HTML + Markdown + Mermaid) - Step 9: Write
.github/workflows/quality-gate.ymlCI pipeline (lint, test, doc-check) - Step 10: Verify — list all created paths, confirm nothing overwrites existing user content without warning
Step 1: Environment Audit
- Parse
package.json→ notescripts,dependencies,devDependencies,engines.node - Parse
pyproject.toml→ note[tool.poetry.dependencies]or PEP 621[project] - Parse
Cargo.toml/go.modsimilarly - Determine: language, package manager (npm/yarn/pnpm/poetry/pip/cargo/go), test framework (jest/pytest/cargo test/go test), linter/formatter already present
Step 4: .gitignore (example for Node/TS)
GITIGNORE# Dependencies node_modules/ .pnp/ # Build output dist/ build/ *.tsbuildinfo # Environment .env .env.local .env.*.local # Logs logs/ *.log npm-debug.log* # OS/IDE .DS_Store .vscode/* !.vscode/extensions.json .idea/ # Testing coverage/
Step 5: .pre-commit-config.yaml (Node/TS example)
YAMLrepos: - repo: https://github.com/pre-commit/mirrors-prettier rev: v3.3.3 hooks: - id: prettier types_or: [javascript, ts, markdown, yaml] - repo: https://github.com/igorshubovych/markdownlint-cli rev: v0.41.0 hooks: - id: markdownlint args: ["--fix"]
Step 6: Issue Templates
.github/ISSUE_TEMPLATE/bug_report.yml:
YAMLname: Bug Report description: File a bug report title: "[Bug]: " labels: ["bug", "triage"] body: - type: textarea id: description attributes: label: What happened? validations: required: true - type: dropdown id: severity attributes: label: Severity options: [Low, Medium, High, Critical] validations: required: true
Step 8: README skeleton
Include, in order:
- Centered title + badges (
<div align="center">) <picture>with dark/light banner viaprefers-color-scheme> [!TIP]/> [!IMPORTANT]callouts for quickstart caveats<details><summary>Table of Contents</summary>...</details>- Mermaid
graph TDarchitecture diagram <table>feature/status matrix- Collapsible
<details>sections per feature/module - Install/usage code blocks matched to detected package manager
<p align="right">back-to-top links after major sections
Step 9: quality-gate.yml (Node/TS example)
YAMLname: Quality Gate on: pull_request: branches: [main] jobs: lint-and-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 20 cache: npm - run: npm ci - run: npm run lint - run: npm test -- --ci - run: npx markdownlint README.md
Example 1:
Input: Node/TypeScript repo, package.json shows fastify, jest, Node v20, no existing CI/git config.
Output: Creates .gitignore (node_modules, dist, .env), .pre-commit-config.yaml (prettier + markdownlint), .github/ISSUE_TEMPLATE/*.yml, assets/.gitkeep, README.md with Mermaid diagram of Fastify routes, and .github/workflows/quality-gate.yml running npm ci, npm run lint, npm test.
Example 2:
Input: Python repo with pyproject.toml using Poetry and pytest.
Output: .gitignore excludes __pycache__/, .venv/, *.egg-info/; pre-commit hooks use black, ruff, markdownlint; CI workflow uses actions/setup-python@v5, poetry install, poetry run pytest; README quickstart uses poetry install && poetry run <entrypoint>.
- Always read the manifest before writing any config — never assume the stack.
- Never overwrite an existing
.gitignore,README.md, etc. — merge/append or warn instead. - Keep
.gitkeeponly in directories with no other tracked files. - Match CI runner steps to the actual
scriptsdefined in the manifest (don't inventnpm run lintif no lint script exists — add one or use the linter directly). - Prefer official GitHub Actions (
actions/checkout@v4,actions/setup-node@v4) pinned to major versions. - Keep README interactive elements (
<details>, Mermaid,<picture>) valid GFM — test render mentally before finalizing.
- Generating a generic
.gitignore/CI config that ignores the detected stack (e.g., Node ignores in a Python repo). - Forgetting the
.gitkeepand havingassets/silently vanish from git. - Writing issue templates as old-style
ISSUE_TEMPLATE.mdinstead of the modern YAML form schema. - Embedding raw HTML that breaks on GitHub's sanitized Markdown renderer (e.g., unsupported tags/attributes).
- Hardcoding badge URLs or repo names instead of deriving them from the manifest/repo metadata.