Skip to content

qtsone/learning / skills/tutor

tutor

Flagged

Turn this agent into a personal programming tutor with a versioned 0-to-expert curriculum (Go available; more languages coming). Use when the user wants to learn a programming language, start or resume lessons, get their exercise code graded, check learning progress, or contribute curriculum fixes — e.g. "/tutor go", "/tutor resume", "teach me Go", "continue my lessons", "grade my exercise".

FileKindSize
SKILL.mdskill md9.2 KB
curriculum/content/focus/cli-tooling/capstone/LESSON.mdmarkdown17.1 KB
curriculum/content/focus/cli-tooling/capstone/TUTOR.mdmarkdown5.4 KB
curriculum/content/focus/cli-tooling/capstone/exercise/app.goscript5.8 KB
curriculum/content/focus/cli-tooling/capstone/exercise/authors.goscript1.6 KB
curriculum/content/focus/cli-tooling/capstone/exercise/authors_test.goscript7.3 KB
curriculum/content/focus/cli-tooling/capstone/exercise/cli_test.goscript11.5 KB
curriculum/content/focus/cli-tooling/capstone/exercise/config_test.goscript11.5 KB
curriculum/content/focus/cli-tooling/capstone/exercise/go.modmanifest187 B
curriculum/content/focus/cli-tooling/capstone/exercise/go.summanifest900 B
curriculum/content/focus/cli-tooling/capstone/exercise/main.goscript2.0 KB
curriculum/content/focus/cli-tooling/capstone/exercise/render.goscript1.9 KB
curriculum/content/focus/cli-tooling/capstone/exercise/root.goscript2.4 KB
curriculum/content/focus/cli-tooling/capstone/exercise/scan.goscript2.5 KB
curriculum/content/focus/cli-tooling/capstone/exercise/scan_test.goscript4.0 KB
curriculum/content/focus/cli-tooling/capstone/exercise/signal_unix_test.goscript1.4 KB
curriculum/content/focus/cli-tooling/capstone/exercise/version.goscript942 B
curriculum/content/focus/cli-tooling/capstone/quiz.jsonconfig5.0 KB
curriculum/content/focus/cli-tooling/capstone/solution/app.goscript9.9 KB
curriculum/content/focus/cli-tooling/capstone/solution/authors.goscript2.9 KB
curriculum/content/focus/cli-tooling/capstone/solution/render.goscript2.6 KB
curriculum/content/focus/cli-tooling/capstone/solution/root.goscript4.7 KB
curriculum/content/focus/cli-tooling/capstone/solution/scan.goscript3.7 KB
curriculum/content/focus/cli-tooling/cobra/LESSON.mdmarkdown12.8 KB
curriculum/content/focus/cli-tooling/cobra/TUTOR.mdmarkdown5.9 KB
curriculum/content/focus/cli-tooling/cobra/exercise/app.goscript1.7 KB
curriculum/content/focus/cli-tooling/cobra/exercise/go.modmanifest193 B
curriculum/content/focus/cli-tooling/cobra/exercise/go.summanifest900 B
curriculum/content/focus/cli-tooling/cobra/exercise/main.goscript422 B
curriculum/content/focus/cli-tooling/cobra/exercise/notes_test.goscript9.8 KB
curriculum/content/focus/cli-tooling/cobra/exercise/root.goscript919 B
curriculum/content/focus/cli-tooling/cobra/exercise/store.goscript1.7 KB
curriculum/content/focus/cli-tooling/cobra/quiz.jsonconfig5.1 KB
curriculum/content/focus/cli-tooling/cobra/solution/app.goscript2.4 KB
curriculum/content/focus/cli-tooling/cobra/solution/root.goscript4.2 KB
curriculum/content/focus/cli-tooling/distribution/LESSON.mdmarkdown17.2 KB
curriculum/content/focus/cli-tooling/distribution/TUTOR.mdmarkdown7.0 KB
curriculum/content/focus/cli-tooling/distribution/exercise/check.shexecutablescript12.0 KB
curriculum/content/focus/cli-tooling/distribution/exercise/go.modmanifest35 B
curriculum/content/focus/cli-tooling/distribution/exercise/internal/buildinfo/buildinfo.goscript1.4 KB
curriculum/content/focus/cli-tooling/distribution/exercise/main.goscript1.2 KB
curriculum/content/focus/cli-tooling/distribution/quiz.jsonconfig5.0 KB
curriculum/content/focus/cli-tooling/distribution/solution/.goreleaser.yamlconfig2.1 KB
curriculum/content/focus/cli-tooling/distribution/solution/internal/buildinfo/buildinfo.goscript1.3 KB
curriculum/content/focus/cli-tooling/files-processes/LESSON.mdmarkdown18.8 KB
curriculum/content/focus/cli-tooling/files-processes/TUTOR.mdmarkdown7.8 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/atomicfile.goscript772 B
curriculum/content/focus/cli-tooling/files-processes/exercise/atomicfile_test.goscript2.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/exec.goscript3.8 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/exec_test.goscript10.7 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/go.modmanifest44 B
curriculum/content/focus/cli-tooling/files-processes/exercise/main.goscript1.9 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/paths.goscript1.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/paths_test.goscript3.1 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/signal.goscript1.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/signal_test.goscript1.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/signal_unix_test.goscript2.4 KB
curriculum/content/focus/cli-tooling/files-processes/quiz.jsonconfig7.9 KB
curriculum/content/focus/cli-tooling/files-processes/solution/atomicfile.goscript2.1 KB
curriculum/content/focus/cli-tooling/files-processes/solution/exec.goscript5.4 KB
curriculum/content/focus/cli-tooling/files-processes/solution/paths.goscript2.2 KB
curriculum/content/focus/cli-tooling/files-processes/solution/signal.goscript2.1 KB
curriculum/content/focus/cli-tooling/flags-config/LESSON.mdmarkdown12.3 KB
curriculum/content/focus/cli-tooling/flags-config/TUTOR.mdmarkdown6.7 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/config.goscript2.4 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/config_test.goscript3.1 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/flagvalue.goscript769 B
curriculum/content/focus/cli-tooling/flags-config/exercise/flagvalue_test.goscript1.9 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/go.modmanifest41 B
curriculum/content/focus/cli-tooling/flags-config/exercise/loader.goscript5.5 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/loader_test.goscript12.4 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/main.goscript1.2 KB
curriculum/content/focus/cli-tooling/flags-config/quiz.jsonconfig5.3 KB
curriculum/content/focus/cli-tooling/flags-config/solution/config.goscript3.2 KB
curriculum/content/focus/cli-tooling/flags-config/solution/flagvalue.goscript957 B
curriculum/content/focus/cli-tooling/flags-config/solution/loader.goscript9.0 KB
curriculum/content/focus/cli-tooling/terminal-ux/LESSON.mdmarkdown14.8 KB
curriculum/content/focus/cli-tooling/terminal-ux/TUTOR.mdmarkdown6.2 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/color.goscript1.6 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/color_test.goscript2.3 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/go.modmanifest40 B
curriculum/content/focus/cli-tooling/terminal-ux/exercise/main.goscript3.6 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/progress.goscript1.9 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/progress_test.goscript1.9 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/prompt.goscript2.3 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/prompt_test.goscript4.7 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/render.goscript3.8 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/render_test.goscript6.1 KB
curriculum/content/focus/cli-tooling/terminal-ux/quiz.jsonconfig5.9 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/color.goscript1.8 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/progress.goscript2.0 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/prompt.goscript2.2 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/render.goscript4.3 KB
curriculum/content/focus/containers/capstone/LESSON.mdmarkdown20.0 KB
curriculum/content/focus/containers/capstone/TUTOR.mdmarkdown6.7 KB
curriculum/content/focus/containers/capstone/exercise/.dockerignoreother190 B
curriculum/content/focus/containers/capstone/exercise/.github/workflows/release.ymlconfig2.4 KB
curriculum/content/focus/containers/capstone/exercise/Dockerfileother903 B
curriculum/content/focus/containers/capstone/exercise/RUNBOOK.mdmarkdown1.6 KB
curriculum/content/focus/containers/capstone/exercise/check.shscript62.6 KB
curriculum/content/focus/containers/capstone/exercise/deploy/base/deployment.yamlconfig2.8 KB
curriculum/content/focus/containers/capstone/exercise/deploy/base/kustomization.yamlconfig845 B
curriculum/content/focus/containers/capstone/exercise/deploy/base/service.yamlconfig316 B
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/dev/kustomization.yamlconfig1.3 KB
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/dev/resources-patch.yamlconfig906 B
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/prod/kustomization.yamlconfig899 B
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/prod/resources-patch.yamlconfig341 B
curriculum/content/focus/containers/capstone/exercise/go.modmanifest48 B
curriculum/content/focus/containers/capstone/exercise/main.goscript6.4 KB
curriculum/content/focus/containers/capstone/quiz.jsonconfig6.5 KB
curriculum/content/focus/containers/capstone/solution/.github/workflows/release.ymlconfig6.4 KB
curriculum/content/focus/containers/capstone/solution/Dockerfileother1.2 KB
curriculum/content/focus/containers/capstone/solution/RUNBOOK.mdmarkdown7.7 KB
curriculum/content/focus/containers/capstone/solution/deploy/overlays/prod/kustomization.yamlconfig1.4 KB
curriculum/content/focus/containers/capstone/solution/deploy/overlays/prod/resources-patch.yamlconfig1.1 KB
curriculum/content/focus/containers/compose/LESSON.mdmarkdown13.5 KB
curriculum/content/focus/containers/compose/TUTOR.mdmarkdown5.2 KB
curriculum/content/focus/containers/compose/exercise/.env.exampleother348 B
curriculum/content/focus/containers/compose/exercise/app/Dockerfileother962 B
curriculum/content/focus/containers/compose/exercise/app/go.modmanifest40 B
curriculum/content/focus/containers/compose/exercise/app/main.goscript2.2 KB
curriculum/content/focus/containers/compose/exercise/check.shscript24.5 KB
curriculum/content/focus/containers/compose/exercise/compose.yamlconfig877 B
curriculum/content/focus/containers/compose/quiz.jsonconfig4.5 KB
curriculum/content/focus/containers/compose/solution/.envconfig203 B
curriculum/content/focus/containers/compose/solution/compose.yamlconfig1.6 KB
curriculum/content/focus/containers/deploying-go/LESSON.mdmarkdown21.1 KB
curriculum/content/focus/containers/deploying-go/TUTOR.mdmarkdown6.5 KB
curriculum/content/focus/containers/deploying-go/exercise/.dockerignoreother150 B
curriculum/content/focus/containers/deploying-go/exercise/Dockerfileother851 B
curriculum/content/focus/containers/deploying-go/exercise/SHUTDOWN.mdmarkdown1.4 KB
curriculum/content/focus/containers/deploying-go/exercise/check.shscript43.5 KB
curriculum/content/focus/containers/deploying-go/exercise/configmap.yamlconfig526 B
curriculum/content/focus/containers/deploying-go/exercise/deployment.yamlconfig2.5 KB
curriculum/content/focus/containers/deploying-go/exercise/go.modmanifest41 B
curriculum/content/focus/containers/deploying-go/exercise/main.goscript6.1 KB
curriculum/content/focus/containers/deploying-go/exercise/service.yamlconfig347 B
curriculum/content/focus/containers/deploying-go/exercise/shutdown_test.goscript3.3 KB
curriculum/content/focus/containers/deploying-go/quiz.jsonconfig6.5 KB
curriculum/content/focus/containers/deploying-go/solution/SHUTDOWN.mdmarkdown5.4 KB
curriculum/content/focus/containers/deploying-go/solution/configmap.yamlconfig541 B
curriculum/content/focus/containers/deploying-go/solution/deployment.yamlconfig4.0 KB
curriculum/content/focus/containers/deploying-go/solution/main.goscript6.1 KB
curriculum/content/focus/containers/docker-fundamentals/LESSON.mdmarkdown14.4 KB
curriculum/content/focus/containers/docker-fundamentals/TUTOR.mdmarkdown5.4 KB
curriculum/content/focus/containers/docker-fundamentals/exercise/Dockerfileother261 B
curriculum/content/focus/containers/docker-fundamentals/exercise/NOTES.mdmarkdown1.4 KB
curriculum/content/focus/containers/docker-fundamentals/exercise/check.shscript10.7 KB
curriculum/content/focus/containers/docker-fundamentals/exercise/go.modmanifest38 B
curriculum/content/focus/containers/docker-fundamentals/exercise/local.envconfig218 B
curriculum/content/focus/containers/docker-fundamentals/exercise/main.goscript780 B
curriculum/content/focus/containers/docker-fundamentals/exercise/scratch/notes.mdmarkdown153 B
curriculum/content/focus/containers/docker-fundamentals/quiz.jsonconfig5.5 KB
curriculum/content/focus/containers/docker-fundamentals/solution/.dockerignoreother230 B
curriculum/content/focus/containers/docker-fundamentals/solution/Dockerfileother504 B
curriculum/content/focus/containers/docker-fundamentals/solution/NOTES.mdmarkdown3.8 KB
curriculum/content/focus/containers/dockerizing-go/LESSON.mdmarkdown14.0 KB
curriculum/content/focus/containers/dockerizing-go/TUTOR.mdmarkdown5.4 KB
curriculum/content/focus/containers/dockerizing-go/exercise/.dockerignoreother143 B
curriculum/content/focus/containers/dockerizing-go/exercise/Dockerfile.naiveother512 B
curriculum/content/focus/containers/dockerizing-go/exercise/NOTES.mdmarkdown1.1 KB
curriculum/content/focus/containers/dockerizing-go/exercise/check.shscript14.2 KB
curriculum/content/focus/containers/dockerizing-go/exercise/go.modmanifest43 B
curriculum/content/focus/containers/dockerizing-go/exercise/go.summanifest0 B
curriculum/content/focus/containers/dockerizing-go/exercise/main.goscript1.7 KB
curriculum/content/focus/containers/dockerizing-go/quiz.jsonconfig4.5 KB
curriculum/content/focus/containers/dockerizing-go/solution/Dockerfileother755 B
curriculum/content/focus/containers/dockerizing-go/solution/NOTES.mdmarkdown2.7 KB
curriculum/content/focus/containers/helm-kustomize/LESSON.mdmarkdown19.1 KB
curriculum/content/focus/containers/helm-kustomize/TUTOR.mdmarkdown9.5 KB
curriculum/content/focus/containers/helm-kustomize/exercise/NOTES.mdmarkdown1.5 KB
curriculum/content/focus/containers/helm-kustomize/exercise/chart/Chart.yamlconfig518 B
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/_helpers.tplother1.8 KB
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/configmap.yamlconfig392 B
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/deployment.yamlconfig3.2 KB
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/service.yamlconfig512 B
curriculum/content/focus/containers/helm-kustomize/exercise/chart/values.yamlconfig1.4 KB
curriculum/content/focus/containers/helm-kustomize/exercise/check.shscript55.4 KB
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/base/deployment.yamlconfig2.1 KB
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/base/kustomization.yamlconfig798 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/base/service.yamlconfig347 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/dev/kustomization.yamlconfig616 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/dev/resources-patch.yamlconfig506 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/prod/kustomization.yamlconfig477 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/prod/resources-patch.yamlconfig614 B
curriculum/content/focus/containers/helm-kustomize/quiz.jsonconfig7.4 KB
curriculum/content/focus/containers/helm-kustomize/solution/NOTES.mdmarkdown3.3 KB
curriculum/content/focus/containers/helm-kustomize/solution/chart/Chart.yamlconfig366 B
curriculum/content/focus/containers/helm-kustomize/solution/chart/templates/configmap.yamlconfig547 B
curriculum/content/focus/containers/helm-kustomize/solution/chart/templates/deployment.yamlconfig2.5 KB
curriculum/content/focus/containers/helm-kustomize/solution/chart/values.yamlconfig1.2 KB
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/base/kustomization.yamlconfig915 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/dev/kustomization.yamlconfig820 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/dev/resources-patch.yamlconfig515 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/prod/kustomization.yamlconfig267 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/prod/resources-patch.yamlconfig649 B
curriculum/content/focus/containers/kubernetes-config/LESSON.mdmarkdown19.4 KB
curriculum/content/focus/containers/kubernetes-config/TUTOR.mdmarkdown6.3 KB
curriculum/content/focus/containers/kubernetes-config/exercise/NOTES.mdmarkdown1.3 KB
curriculum/content/focus/containers/kubernetes-config/exercise/app/Dockerfileother1.0 KB

curriculum/content/focus/containers/docker-fundamentals/exercise/check.sh

View on GitHub
#!/usr/bin/env bash
# Referee for the Docker Fundamentals exercise. It reads the files you wrote —
# Dockerfile, .dockerignore, NOTES.md — and grades them. That grading needs no
# Docker daemon, no network and no root. If Docker *is* installed and running,
# a few bonus checks actually build the image; when it isn't, those are
# reported SKIPPED, never failed.
# Run from this folder:  bash check.sh
set -u
cd "$(dirname "$0")" || exit 1

pass=0
fail=0
skip=0

ok() {
	pass=$((pass + 1))
	printf 'ok      %s\n' "$1"
}

bad() {
	fail=$((fail + 1))
	printf 'FAIL    %s\n        fix: %s\n' "$1" "$2"
}

skipped() {
	skip=$((skip + 1))
	printf 'SKIP    %s\n        why: %s\n' "$1" "$2"
}

finish() {
	echo
	if [ "$fail" -eq 0 ]; then
		echo "$pass checks passed, $skip skipped for missing tooling."
		if [ "$skip" -gt 0 ]; then
			echo "The skipped checks are a bonus: install Docker and re-run to have your image really built."
		fi
		exit 0
	fi
	echo "$pass passed, $fail failed, $skip skipped for missing tooling."
	echo "Fix the FAIL lines above and re-run: bash check.sh"
	exit 1
}

# Normalized Dockerfile: comments dropped, line continuations joined, so that
# "instruction N comes before instruction M" is a question about real order.
df_lines() {
	awk '
		{ sub(/\r$/, "") }
		/^[[:space:]]*#/ { next }
		{ line = line $0 }
		/\\[[:space:]]*$/ { sub(/\\[[:space:]]*$/, "", line); next }
		{
			gsub(/^[[:space:]]+|[[:space:]]+$/, "", line)
			if (line != "") print line
			line = ""
		}
	' Dockerfile
}

# True when .dockerignore has a pattern covering $1. Handles the shapes people
# actually write: a bare name, a trailing slash, a leading ./ or **/, a glob.
di_matches() {
	local target=$1 line pat
	while IFS= read -r line || [ -n "$line" ]; do
		line=${line%$'\r'}
		line="${line#"${line%%[![:space:]]*}"}"
		line="${line%"${line##*[![:space:]]}"}"
		case "$line" in '' | '#'* | '!'*) continue ;; esac
		pat=${line%/}
		pat=${pat#./}
		pat=${pat#/}
		[ -z "$pat" ] && continue
		# shellcheck disable=SC2053
		[[ $target == $pat ]] && return 0
		# shellcheck disable=SC2053
		[[ $target == ${pat#\*\*/} ]] && return 0
	done <.dockerignore
	return 1
}

# Prose the learner wrote under NOTES.md heading "## <n>. …", with the quoted
# prompt and blank lines removed.
section_answer() {
	awk -v want="$1" '
		/^##[[:space:]]/ {
			cur = 0
			n = $2
			sub(/\./, "", n)
			if (n == want) cur = 1
			next
		}
		cur { print }
	' NOTES.md | grep -v '^[[:space:]]*>' | grep -v '^[[:space:]]*$'
}

# ---------------------------------------------------------------- provided files

for f in main.go go.mod; do
	if [ -f "$f" ]; then
		ok "provided file $f is still here"
	else
		bad "provided file $f is still here" \
			"restore $f — the exercise is to containerize this program, not to change it"
	fi
done

if [ -f Dockerfile ]; then
	ok "Dockerfile exists"
else
	bad "Dockerfile exists" \
		"create a Dockerfile in this folder — LESSON.md lists what it must contain"
	finish
fi

norm=$(df_lines)

# ---------------------------------------------------------------- base image

base=$(printf '%s\n' "$norm" | grep -iE '^FROM[[:space:]]' | head -n 1 |
	awk '{ for (i = 2; i <= NF; i++) if ($i !~ /^--/) { print $i; exit } }')

if [ -n "$base" ]; then
	ok "Dockerfile starts from a base image ($base)"
else
	bad "Dockerfile starts from a base image" \
		"every Dockerfile needs a FROM line, e.g. FROM golang:1.22-bookworm"
	finish
fi

ref=${base##*/}
case "$ref" in
*@sha256:*)
	ok "base image is pinned by digest"
	;;
*:latest)
	bad "base image is pinned to a real version" \
		"latest is not a version, it is the default tag name — use a concrete tag such as golang:1.22-bookworm (Go 1.22 or newer, since go.mod says go 1.22)"
	;;
*:*)
	ok "base image is pinned to a concrete tag"
	;;
*)
	bad "base image is pinned to a real version" \
		"FROM $base has no tag, so Docker silently uses :latest — name a concrete tag such as golang:1.22-bookworm"
	;;
esac

# ---------------------------------------------------------------- workdir

workdir=$(printf '%s\n' "$norm" | grep -iE '^WORKDIR[[:space:]]' | head -n 1 | awk '{ print $2 }')
if [ -z "$workdir" ]; then
	bad "Dockerfile sets a WORKDIR" \
		"add e.g. WORKDIR /src before your COPY steps, so later instructions do not depend on whatever directory the base image happened to leave you in"
elif [ "${workdir#/}" = "$workdir" ]; then
	bad "WORKDIR is an absolute path" \
		"WORKDIR $workdir is relative to an unknown starting directory — use an absolute path like /src"
else
	ok "Dockerfile sets an absolute WORKDIR ($workdir)"
fi

# ---------------------------------------------------------------- layer ordering

copy_manifest=$(printf '%s\n' "$norm" | grep -niE '^COPY[[:space:]].*go\.mod' | head -n 1 | cut -d: -f1)
copy_source=$(printf '%s\n' "$norm" | grep -niE '^COPY[[:space:]]' |
	grep -viE 'go\.(mod|sum)' | head -n 1 | cut -d: -f1)
mod_download=$(printf '%s\n' "$norm" |
	grep -niE '^RUN[[:space:]].*go[[:space:]]+mod[[:space:]]+download' | head -n 1 | cut -d: -f1)

if [ -z "$copy_source" ]; then
	bad "Dockerfile copies the source into the image" \
		"add a COPY step that brings the .go files in, e.g. COPY . ."
elif [ -z "$copy_manifest" ]; then
	bad "Dockerfile copies go.mod before the source" \
		"add COPY go.mod ./ above the source COPY (this module has no third-party dependencies, so there is no go.sum yet)"
elif [ "$copy_manifest" -lt "$copy_source" ]; then
	ok "dependency manifest is copied before the source"
else
	bad "Dockerfile copies go.mod before the source" \
		"move the COPY go.mod ./ step above the source COPY — otherwise every source edit invalidates the dependency layer too"
fi

if [ -z "$mod_download" ]; then
	bad "Dockerfile downloads dependencies in their own layer" \
		"add RUN go mod download between the manifest COPY and the source COPY — that layer is what the cache is meant to keep"
elif [ -n "$copy_manifest" ] && [ -n "$copy_source" ] &&
	[ "$copy_manifest" -lt "$mod_download" ] && [ "$mod_download" -lt "$copy_source" ]; then
	ok "go mod download sits between the manifest COPY and the source COPY"
else
	bad "go mod download sits between the manifest COPY and the source COPY" \
		"order is COPY go.mod ./ then RUN go mod download then COPY . . — anywhere else and the layer is rebuilt on every edit"
fi

# ---------------------------------------------------------------- start command

if printf '%s\n' "$norm" | grep -qiE '^(CMD|ENTRYPOINT)[[:space:]]'; then
	ok "Dockerfile declares a start command (CMD or ENTRYPOINT)"
else
	bad "Dockerfile declares a start command (CMD or ENTRYPOINT)" \
		"an image with no default command cannot be started with a bare docker run — add CMD [\"/bin/clockwork\"] (or whatever path you built to)"
fi

if printf '%s\n' "$norm" | grep -qiE '^(CMD|ENTRYPOINT)[[:space:]]+[^[]'; then
	bad "start command uses exec form, not shell form" \
		"write it as a JSON array: CMD [\"/bin/clockwork\"]. Shell form wraps your binary in /bin/sh -c, so the shell becomes PID 1 and your program never sees the SIGTERM from docker stop"
else
	ok "start command uses exec form"
fi

# ---------------------------------------------------------------- .dockerignore

if [ ! -f .dockerignore ]; then
	bad ".dockerignore exists" \
		"create .dockerignore in this folder — without it the whole build context, junk included, is sent to the daemon and can land in a layer"
else
	effective=$(grep -vE '^[[:space:]]*(#|$)' .dockerignore | wc -l | tr -d ' ')
	if [ "$effective" -ge 1 ]; then
		ok ".dockerignore exists and has patterns"
	else
		bad ".dockerignore exists and has patterns" \
			"the file is empty or all comments — add the patterns listed in the acceptance criteria"
	fi

	if di_matches .git; then
		ok ".dockerignore excludes .git"
	else
		bad ".dockerignore excludes .git" \
			"add a .git line — repository history is often the largest thing in the context and none of it belongs in the image"
	fi

	if di_matches local.env; then
		ok ".dockerignore excludes local.env"
	else
		bad ".dockerignore excludes local.env" \
			"add local.env (or *.env) — it holds local settings and a token; anything in the context can be baked into a layer and shipped"
	fi

	if di_matches scratch; then
		ok ".dockerignore excludes scratch/"
	else
		bad ".dockerignore excludes scratch/" \
			"add scratch/ — personal notes are pure weight in the context and invalidate the cache when they change"
	fi
fi

# ---------------------------------------------------------------- NOTES.md

if [ ! -f NOTES.md ]; then
	bad "NOTES.md exists" \
		"restore NOTES.md and answer its four questions — the written half of this exercise is what your tutor grills you on"
else
	titles=(
		"1: container vs virtual machine"
		"2: the build cache and your edit"
		"3: tags, digests and latest"
		"4: where a container's writes go"
	)
	for i in 1 2 3 4; do
		title=${titles[$((i - 1))]}
		answer=$(section_answer "$i")
		words=$(printf '%s\n' "$answer" | wc -w | tr -d ' ')
		if printf '%s\n' "$answer" | grep -q '^[[:space:]]*TODO: your answer here\.'; then
			bad "NOTES.md answers question $title" \
				"the TODO placeholder is still there — replace it with your own answer"
		elif [ "$words" -lt 30 ]; then
			bad "NOTES.md answers question $title" \
				"only $words words of answer — explain it properly, in prose, as if to a colleague (about three sentences)"
		else
			ok "NOTES.md answers question $title"
		fi
	done
fi

# ---------------------------------------------------------------- optional live checks

if command -v docker >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
	if docker image inspect "$base" >/dev/null 2>&1 || docker pull "$base" >/dev/null 2>&1; then
		ok "live: base image $base is available locally"
		if build_log=$(docker build -t tutor-clockwork:check . 2>&1); then
			ok "live: docker build succeeds (tagged tutor-clockwork:check)"
			config=$(docker image inspect \
				--format '{{json .Config.Cmd}} {{json .Config.Entrypoint}}' \
				tutor-clockwork:check 2>/dev/null)
			case "$config" in
			"null null" | "")
				bad "live: built image has a default command" \
					"docker image inspect shows neither Cmd nor Entrypoint — your CMD line did not take effect"
				;;
			*)
				ok "live: built image carries a default command"
				;;
			esac
			# Leave the learner's machine as we found it.
			docker image rm -f tutor-clockwork:check >/dev/null 2>&1 || true
		else
			bad "live: docker build succeeds" \
				"read the build output below, find the first error, fix the Dockerfile"
			printf '%s\n' "$build_log" | tail -n 15 | sed 's/^/        | /'
		fi
	else
		skipped "live: build the image" \
			"cannot obtain base image $base (no registry access) — static grading above is unaffected"
	fi
else
	skipped "live: build the image" \
		"no running Docker daemon here. Install Docker and start it to get this bonus check; your grade comes from the static checks above"
fi

finish
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall