- Prettier config required for documentation/writing repos - Migrations must live in internal/db/migrations/ and be embedded - Avoid cluttering repo root; canonical subdirectory names listed
4.8 KiB
Development Policies
-
All references to Docker images, Go modules, and packages must use cryptographic hashes. Mutable references (tags,
@latest, etc.) are remote code execution vulnerabilities. -
Every repo with software must have a root
Makefilewith these targets:make test,make lint,make fmt(writes),make fmt-check(read-only),make check(prereqs:test,lint,fmt-check), andmake docker. -
Always use Makefile targets (
make fmt,make test,make lint, etc.) instead of invoking the underlying tools directly. The Makefile is the single source of truth for how these operations are run. -
Every repo should have a
Dockerfile. For non-server repos, the Dockerfile should bring up a development environment and runmake check(the build should fail if the branch is not green). -
Use platform-standard formatters:
blackfor Python,prettierfor JS/CSS/Markdown/HTML,go fmtfor Go. Always use default configuration with one exception: set four-space indents for everything except Go. Documentation and writing repos (Markdown, HTML, CSS) should also have.prettierrcand.prettierignore. -
Pre-commit hook:
make checkif local testing is possible, otherwisemake lint && make fmt-check. The Makefile should provide amake hookstarget to install the pre-commit hook. -
make testmust complete in under 20 seconds. Add a 30-second timeout in the Makefile. -
Docker builds must complete in under 5 minutes.
-
make checkmust not modify any files in the repo. Tests may use temporary directories. -
mainmust always passmake check, no exceptions. -
Never use
git add -Aorgit add .. Always stage files explicitly by name. -
Make all changes on a feature branch. You can do whatever you want on a feature branch.
-
.golangci.ymlis standardized and must NEVER be modified by an agent, only manually by the user. Copy from~/dev/upaas/.golangci.ymlif available. -
When pinning images or packages by hash, add a comment above the reference with the version and date (YYYY-MM-DD).
-
Use
yarn, notnpm. -
Write all dates as YYYY-MM-DD (ISO 8601).
-
Simple projects should be configured with environment variables.
-
Dockerized web services listen on port 8080 by default, overridable with
PORT. -
README.mdis the primary documentation. Required sections:- Description: First line must include the project name, purpose, category (web server, SPA, CLI tool, etc.), license, and author. Example: "µPaaS is an MIT-licensed Go web application by @sneak that receives git-frontend webhooks and deploys applications via Docker in realtime."
- Getting Started: Copy-pasteable install/usage code block.
- Rationale: Why does this exist?
- Design: How is the program structured?
- TODO: Update meticulously, even between commits. When planning, put the todo list in the README so a new agent can pick up where the last one left off.
- License: MIT, GPL, or WTFPL. Ask the user for new projects.
Include a
LICENSEfile in the repo root and a License section in the README. - Author: @sneak.
-
First commit of a new repo should contain only
README.md. -
Go module root:
sneak.berlin/go/<name>. -
Use SemVer.
-
Database migrations live in
internal/db/migrations/and must be embedded in the binary. Pre-1.0.0: modify existing migrations (no installed base assumed). Post-1.0.0: add new migration files. -
All repos should have an
.editorconfigenforcing the project's indentation settings. -
Avoid putting files in the repo root unless necessary. Root should contain only project-level config files (
README.md,Makefile,Dockerfile,LICENSE,.gitignore,.editorconfig,REPO_POLICIES.md, and language-specific config). Everything else goes in a subdirectory. Canonical subdirectory names:bin/— executable scripts and toolscmd/— Go command entrypointsconfigs/— configuration templates and examplesdeploy/— deployment manifests (k8s, compose, terraform)docs/— documentation and markdown (README.md stays in root)internal/— Go internal packagesinternal/db/migrations/— database migrationspkg/— Go library packagesshare/— systemd units, data filesstatic/— static assets (images, fonts, etc.)web/— web frontend source
-
New repos must contain at minimum:
README.md,.git,.gitignore,.editorconfigREPO_POLICIES.md(copy from thepromptsrepo)Dockerfile,.dockerignore- Go:
go.mod,go.sum,.golangci.yml - JS:
package.json,yarn.lock,.prettierrc,.prettierignore - Python:
pyproject.toml