Phase 2: Development Workflows, Code Reviews, and Automated Quality Gates

Writing maintainable code requires standardized local development environments, small focused Pull Requests (PRs), constructive code review etiquette, and automated pre-commit static analysis.


⚡ Quick Dive

The PR Review Checklist & Etiquette

Guideline Target Metric / Rule Rationale
PR Size < 300 - 400 Lines of Code (LoC) Large PRs get rubber-stamped; small PRs get deep scrutiny
Review Turnaround < 4 to 24 Hours Eliminates branch merge conflicts and developer blockage
Comment Prefixes nit:, question:, blocking:, praise: Clarifies whether a review comment blocks merge or is optional
Automated Style 🔒 Never debate formatting in PR comments Handled automatically by pre-commit linters

📖 Extended Guide

1. Standardized DevContainers (.devcontainer/devcontainer.json)

Eliminate the "It works on my machine" problem by containerizing the development workspace:

{
  "name": "Production Backend DevContainer",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
  "features": {
    "ghcr.io/devcontainers/features/docker-in-docker:2": {},
    "ghcr.io/devcontainers/features/go:1": {},
    "ghcr.io/devcontainers/features/node:18": {}
  },
  "customizations": {
    "vscode": {
      "extensions": [
        "golang.Go",
        "esbenp.prettier-vscode",
        "dbaeumer.vscode-eslint"
      ]
    }
  },
  "postCreateCommand": "pre-commit install"
}

2. Pre-Commit Quality Gates (.pre-commit-config.yaml)

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: trailing-whitespace
      - id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files
  - repo: https://github.com/golangci/golangci-lint
    rev: v1.54.2
    hooks:
      - id: golangci-lint