Heidelberg AICurriculum
Track 14 · Advanced
14.1

Building complex codebases

Make an AI agent reliable on a large, real codebase

16 lessons 2026-08-08 AI-generated

1Overview

A discipline (not a tool) for making an AI coding agent reliable on a large, real codebase — tool-agnostic, anchored on Cole Medin's open-source workflow.

A discipline, not a tool: how to get an AI coding assistant to work reliably on a big, real codebase instead of "vibe coding" one-offs. The core idea — popularised by Cole Medin — is a second "AI layer" checked into source control next to your code (a lean CLAUDE.md of rules, reusable commands, and later skills, subagents and MCP), driven by a tight Plan → Implement → Validate loop. → Unlike the AI coding assistants chapter (which tool to use), this chapter is about the workflow that makes any of them dependable at scale. Tool-agnostic, but Claude Code is the running example. → Next rung: Self-host on a private cloud — ship it yourself, safely, once it works.

1.2After this chapter you can
Build a version-controlled "AI layer" (CLAUDE.md + reusable commands) for a real project
Run any task through the Plan → Implement → Validate loop
Scale up with skills, subagents and MCP — without overengineering
Turn each agent mistake into a permanent fix to your system
1.3When to reach for it

When "vibe coding" stops working — the project is too big for the agent to hold in its head and new changes start breaking old things.

1.4Key parts

A version-controlled "AI layer" (a lean CLAUDE.md + reusable commands), and the Plan → Implement → Validate loop.

Anatomy of the AI layer Your git repo contains your code plus the AI layer (CLAUDE.md, commands, skills). Every task runs a Plan → Implement → Validate loop; pass = shipped, fail = fix and retry, which feeds improvements back into the AI layer. Anatomy of the AI layer a second codebase, checked in next to your code, that teaches the agent your project your git repo Your code src/ · tests · the app itself — what you ship + The AI layer CLAUDE.md — lean project rules .claude/commands/ — shortcuts skills · subagents · MCP — on demand checked in together — agent context is reviewed and improved like code drive every task with one loop 1 · Plan fresh-context blueprint 2 · Implement follow the plan 3 · Validate checks must pass pass ✓ shipped fail → fix & retry every miss → new rule in the AI layer ↑ It's context, not a smarter model — give the agent the layer and it stops guessing.

2Lessons 16

2.1 Make an AI agent work on large codebases

A CLAUDE.md file stores project rules that the AI layer reads to guide its output.

Add a version‑controlled AI layer so the agent can reliably work on a large repository

TryIn the building‑complex‑codebases UI, open the existing repo large-app, type the request “Add a logging helper that follows the project’s conventions and update the related tests”, and submit it. Then create a file named CLAUDE.md at the repo root with the rule “All logs must use logger.info with tag [APP]”, commit the change, and repeat the exact same request.

Paste the whole text into the chat input box of the building‑complex‑codebases tool. Watch how the first response guesses the logging style, while after adding CLAUDE.md the second response follows the rule exactly.

  1. Create a CLAUDE.md file in the repository root and write project rules there
  2. Add the file to Git with git add CLAUDE.md
  3. Commit the change using git commit -m "Add AI layer"
  • You'll see Subsequent one‑line requests produce code that follows the defined project rules
  • Takeaway A checked‑in AI layer supplies consistent context for reliable agent output
  • Check How does committing a CLAUDE.md file change the way the AI agent generates code?
  • Cost The AI layer is upfront effort — an hour or two on a real repo — that pays back on every task afterwards. It's a habit, not a purchase.

2.2 Create and explore your first repository

A repository is a shared folder plus its full edit history, and Gitea provides a self‑hosted Git forge where that repo lives.

Create a repository, push an initial file, and explore the dashboard UI

TryClick + New Repository, name it lab-notebook, tick 'Initialize Repository', then edit README.md directly in the browser and commit the change.

No git command line needed for this first step — Gitea's web editor commits for you.

This is your project's home page — and the whole forge in one view: files and commit history in the middle, and tabs for Issues, Pull Requests and Actions across the top. Self-hosted, so it all lives on your server. Credit: gitea.com ↗
  1. Click + New Repository, fill in name and description, choose visibility and create it
  2. Navigate the dashboard to view the file list, rendered README and branch selector at the top
  3. Add or edit a file via the web UI (or clone, modify and push) and watch the new commit appear in history
  • You'll see A file list with the README displayed below and a fresh commit shown in the history panel
  • Takeaway Gitea hosts a Git repo on your own server while preserving the familiar files‑plus‑history model
  • Check What three pieces of information does the Gitea dashboard show after you create a repository?
  • Cost Gitea itself is free and open-source (MIT license) — no seat limits, no repo limits, run as many instances as you like.

2.3 Host a repository on GitHub

GitHub is a hosted platform built on Git that adds a web UI, pull requests, issues and AI integration on top of plain version control.

Create an account, push a repo to GitHub and observe the additional collaboration features it provides

TryCreate a free account at github.com, click New repository, name it (e.g. lab-notebook), and initialize it with a README. Then either clone it locally (git clone <url>) or, if you already have a local repo, add GitHub as a remote: git remote add origin <url> && git push -u origin main.

No git experience? GitHub Desktop or VS Code's Source Control panel do the same steps with buttons instead of commands.

A repo page is your project's front door — file tree, README, commit history, and every collaboration tab live here (this is scanpy, a real single-cell analysis project). Credit: github.com ↗
  1. Create a new repository using New repository or push an existing local one as the remote
  2. Open the repo page to see the rendered README, file browser, commit history and navigation tabs
  3. Add a collaborator via Settings → Collaborators
  • You'll see A live GitHub page showing the README, file tree, commit list and tabs for Code, Issues, Pull requests and Actions
  • Takeaway GitHub layers collaboration tools over Git, enabling AI agents to interact directly with hosted code
  • Check Which UI elements appear on a newly created GitHub repository that are not present in a bare local Git repo?
  • Cost Free tier: unlimited public and private repos, unlimited collaborators, no credit card needed. Verified students get GitHub Pro free via the Student Developer Pack (education.github.com/pack).

2.4 Create a lean CLAUDE.md for your project

A hierarchical set of CLAUDE.md files—global, repository‑specific and local—defines where the agent looks for rules.

Do this first Make an AI agent work on large codebases

Provide concise build, test and lint instructions plus repository rules for the agent at session start

TryIn the repository root, create a new file named CLAUDE.md and paste these lines: ``` # Build Commands ./gradlew build ./gradlew test ./gradlew lint # Directory Map src/ – source code tests/ – unit tests docs/ – documentation configs/ – configuration files # Hard Rules - Never modify files in `vendor/`. - All new modules must include a corresponding test file. - Lint must pass before any commit. ``` Save the file.

Open the File Explorer in the building-complex-codebases UI, click + New File, name it CLAUDE.md, paste the content and hit Save. Verify the file is under 150 lines to keep the prompt lean.

  1. Add a CLAUDE.md file to the repository root containing essential commands, a brief directory map and hard rules
  2. Edit the file so each line is high‑signal and keep the total under roughly 150 lines
  3. Organise rule locations using the hierarchy: personal defaults in ~/.claude/CLAUDE.md, repo‑specific rules in ./CLAUDE.md and optional notes in a git‑ignored local file
  • You'll see The agent automatically follows the defined conventions, applying correct folders, commands and guardrails without extra prompts
  • Takeaway One well‑crafted CLAUDE.md file gives every future session immediate awareness of your codebase
  • Check What three locations are used to store hierarchical CLAUDE.md rule files?
  • Cost CLAUDE.md loads every session, so every extra line is paid for on every message. Trimming to essentials keeps the agent both cheaper and more obedient.

2.5 Propose, review and merge changes

A branch is an isolated copy of the project, and a pull request (PR) proposes merging that branch back into main after review.

Do this first Create and explore your first repository

Create a pull request, examine its diff and merge it into the main branch

TryCreate a branch called add-protocol-notes, edit a file on it, then open a pull request against main and leave a review comment on one line.

PRs work the same whether the branch came from a person or an AI coding agent — review the diff either way.

Every change is reviewed before it lands — a merged pull request with its file tree and green/red diff, on a self-hosted Gitea (this is the very forge that hosts this course). Credit: 32dots Gitea
  1. Create a new branch from the repository to isolate your edits
  2. Open a pull request so Gitea displays a line‑by‑line diff between the branch and main
  3. Review the changes, add inline comments if needed and click the merge button once satisfied
  • You'll see A diff view with green additions, red deletions and an enabled merge button after checks pass
  • Takeaway Pull requests act as a safety net, ensuring no AI‑generated code reaches main without review
  • Check What three actions complete the PR workflow in Gitea from branch creation to merging?
  • Cost Included free with self-hosted Gitea — unlimited PRs and reviewers, no per-seat charge.

2.6 Open, review, and merge a pull request

A pull request (PR) on GitHub lets you propose changes from a branch, view a diff, comment and approve before merging into main.

Do this first Host a repository on GitHub

Open a pull request, review its file changes and merge it into the main branch

TryCreate a new branch (git checkout -b fix-typo), edit one line — e.g. fix a typo in the README — commit and push it (git push -u origin fix-typo), then click Compare & pull request on GitHub.

Or skip the terminal entirely: click the pencil icon on any file in the GitHub web UI, and it creates the branch and PR for you.

Files changed is where review happens — deleted lines in red, added lines in green, and every changed file listed on the left. Credit: github.com ↗
  1. Click Open pull request against main and write a concise description of the change
  2. Select the Files changed tab to view red deletions and green additions, adding inline comments as needed
  3. Press the green Merge pull request button after all feedback is addressed
  • You'll see A PR page showing the Files changed tab with coloured diffs and a green Merge pull request button once approved
  • Takeaway Pull requests provide a repeatable review loop that underpins reliable AI‑assisted modifications
  • Check Which three UI elements are involved when reviewing and merging a GitHub pull request?
  • Cost Free on every tier — pull requests, reviews, and diffs cost nothing regardless of plan.

2.7 Create reusable, version‑controlled commands

A /.claude/commands/ markdown file defines a slash command that can be invoked to load preset context.

Do this first Create a lean CLAUDE.md for your project

Create a shared, version‑controlled command that can be invoked from any session instead of retyping prompts

TryCreate a markdown file at .claude/commands/prime.md with a short description and the steps to load the current ticket, the repository file tree, and recent git history. Save the file, then invoke the new command by typing /prime in a chat session.

Paste this into the editor screen of the building‑complex‑codebases tool and click Save; ensure the file path is exactly .claude/commands/prime.md so it’s tracked by git. After saving, test the command by entering /prime in the chat.

  1. Save the markdown definition inside .claude/commands/ in your project
  2. Commit the new file to git so it is tracked and shared across the team
  3. Invoke the command with /prime to load context in a fresh session
  • You'll see A single‑word slash command loads the ticket, file tree and recent git history for every participant
  • Takeaway Any repeated prompt can become a version‑controlled command that streamlines the whole team's workflow
  • Check What three steps turn a frequent prompt into a reusable /prime command?
  • Cost Writing a command is a few minutes once; it then saves that setup on every future task. The .claude/ folder is the asset, not any single session.

2.8 File and link an issue

An issue tracks a unit of work—bug, task or question—and lives alongside the code with its own comment thread, labels and assignee.

Do this first Propose, review and merge changes

Create an issue, label it, and link it to a commit so it closes automatically when merged

TryOpen a new issue titled 'Sample IDs inconsistent in batch import', add a label, assign it to yourself, and reference it in a commit message as Fixes #<issue-number>.

Referencing the issue number in a commit or PR auto-closes it when merged.

A backlog that lives with your code — open issues plus a filter bar for labels, milestones and assignees, on a self-hosted Gitea. Credit: 32dots Gitea
  1. Click New Issue, write a description using Markdown and add any checklists or attachments
  2. Select appropriate labels and choose an assignee from the dropdown menu
  3. Reference the issue number (e.g. #12) in a commit message or PR description to close it on merge
  • You'll see The new issue appears with its label chip and assignee avatar, then shows a closed state after the linked commit merges
  • Takeaway Issues attach work items directly to the codebase and can be auto‑closed by linked commits
  • Check How does referencing an issue number in a commit message affect the issue’s status?
  • Cost Free, unlimited issues per repo — no separate project-management tool needed.

2.9 File a scoped issue and track it on a project board

Issues on GitHub capture bugs, tasks or questions, while Projects provide a kanban board to organise those issues into columns such as To do, In progress and Done.

Do this first Host a repository on GitHub

Create a scoped issue, label it for filtering and place its card on a project board

TryOpen your repo's Issues tab, click New issue, and write one concrete task, e.g. 'Add a unit test for normalize_counts()'. Add a label. Then open the Projects tab, create a board, and add the issue to it.

Keep the issue to one clear, scoped task, not a vague wishlist — vague issues get vague pull requests, from humans and AI alike.

Every issue is a scoped, assignable unit of work — titles, labels, and filters keep a busy backlog searchable (scanpy has 478 open). Credit: github.com ↗
  1. Enter a clear title and description in New issue to define the work and acceptance criteria
  2. Add relevant labels (bug, enhancement, etc.) using the Labels selector
  3. Open Projects, add the issue as a card and drag it between columns as work progresses
  • You'll see A numbered issue appears in the Issues list and a corresponding card shows up on the selected Project board
  • Takeaway Well‑scoped issues drive both tracking and visual workflow management for human and AI contributors
  • Check What three actions connect an issue to a project board and make it visible as a moving card?
  • Cost Free on every tier — unlimited Issues and Projects. GitHub's own AI features on Issues (like assigning one to Copilot) are billed separately, under Copilot.

2.10 Run a Plan‑Implement‑Validate loop on real code

The Plan‑Implement‑Validate loop structures work into three phases where the agent plans, writes code and validates checks before finishing.

Do this first Create reusable, version‑controlled commands

Execute the Plan‑Implement‑Validate loop so the agent only finishes when all checks pass

TryIn the **Plan** screen, type a Product Requirements Prompt that adds a function `calculate_stats(data: List[float]) -> Dict[str, float]` to *stats.py*, updates *requirements.txt* if needed, creates unit tests in *test_stats.py* (checking mean, median, stddev), and specifies lint and type‑check must pass. Then click **Implement**, paste the same PRP into the fresh implementation window and generate the code. Finally click **Validate** to run `/validate` and view the results.

Paste the full PRP in the Plan dialog, then use the Implement button to start a new clean session and finally hit Validate; watch for any failing test or lint error—those indicate the loop isn’t complete yet.

  1. Prompt the agent to produce a Product Requirements Prompt (PRP) that lists steps, files and required checks
  2. Start a fresh session and run the implement phase following the PRP without prior context
  3. Run lint, type‑check and tests then use /validate or /review to confirm all checks succeed
  • You'll see The agent creates a plan, writes code from a clean slate and reports completion only after passing lint, type‑check and tests
  • Takeaway Running PIV forces the agent to prove its work and prevents recurring bugs
  • Check Which three stages must be completed in order for the agent to report successful task completion?
  • Cost Planning and validating add minutes up front, but they're far cheaper than debugging a confident wrong implementation later — and the loop gets faster as your rules accumulate.

2.11 Run CI automatically on each push

Gitea Actions is a built‑in CI/CD system that runs YAML workflow files placed in .gitea/workflows/ on every push, compatible with GitHub Actions syntax.

Do this first File and link an issue

Wire up an automatic workflow that triggers on each push and observe its execution

TryAdd .gitea/workflows/test.yml with a job that checks out the repo and runs your test command, then push — watch it run under the repo's Actions tab.

An existing GitHub Actions workflow will usually run on Gitea Actions with no changes.

A Gitea Actions tab listing workflow runs with green success ticks, workflow names (ci.yml, deploy-prod.yml) and commit shas
  1. 1 Every workflow file a pushed .gitea/workflows/*.yml appears here
  2. 2 Passed or failed a red run is where the runner reports back

Best viewed on desktop — tap Enlarge to read the numbered controls.

CI that never leaves your server — real build-and-deploy workflow runs on a self-hosted Gitea runner, green ticks and all. Credit: 32dots Gitea
  1. Enable a runner by clicking Enable a runner to register a Gitea Runner with your instance
  2. Create a YAML workflow file in .gitea/workflows/ defining the on: push trigger and steps such as checkout, install and test
  3. Push the commit and open the Actions tab to watch the run’s live status and logs
  • You'll see A green check mark appears on the latest commit and a step‑by‑step log is shown under the Actions tab
  • Takeaway Gitea Actions turns every push into an automatic test run without relying on external CI services
  • Check What three actions are required to set up Gitea Actions that run on each push?
  • Cost Free — you supply the compute (your own runner), so there's no per-minute CI bill.

2.12 Run a CI workflow on every push

GitHub Actions runs YAML workflow files in .github/workflows/ on events like pushes, providing a fresh VM to execute steps such as tests, linting or AI‑driven checks.

Do this first Open, review, and merge a pull request

Run a CI workflow on every push and watch its result in the Actions tab

TryCreate .github/workflows/test.yml with: on: push jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: echo "Hello from Actions" Commit and push it, then open the Actions tab.

Indentation matters in YAML — copy it exactly, or edit the file directly in the GitHub web UI to avoid whitespace mistakes.

Every run is logged with a status — a green check for success, a red X for failure, full console output one click away. Credit: github.com ↗
  1. Add a workflow file to .github/workflows/; GitHub automatically picks it up
  2. Open the Actions tab after pushing to see a new run appear within seconds
  3. Click the run, expand steps and read the log output to verify execution
  • You'll see A workflow run appears in the Actions tab, turns green when finished and shows “Hello from Actions” in the expanded log
  • Takeaway GitHub Actions makes the repository an automation platform that can also execute AI steps within pipelines
  • Check Which three observations confirm a successful GitHub Actions run after pushing a workflow file?
  • Cost Free tier: 2,000 Actions minutes/month (public repos run unlimited). Team adds 3,000 shared minutes; heavier CI means paying per-minute overages or upgrading.

2.13 Add skills, subagents and MCP only when required

A SKILL.md file describes a skill that can be referenced by the agent, while subagents and an MCP server extend functionality on demand.

Do this first Run a Plan‑Implement‑Validate loop on real code

Add heavier AI layers—skills, subagents and MCP—only when a concrete need is demonstrated

TryCreate a file SKILL.md in the repository describing a ‘Data Cleaning’ procedure that removes rows with missing values from data.csv, then ask the agent to use this skill on data.csv.

Paste the prompt into the Agent Console and hit Run; verify that the agent loads the new skill only for this task and does not add extra context otherwise.

  1. Create a SKILL.md file describing the procedure and required steps
  2. Reference the skill in the agent configuration so it loads only when relevant
  3. Define a subagent with its own isolated context for parallel work
  4. Launch the subagent from the main thread when an independent task is identified
  5. Configure an MCP server to connect to external systems such as GitHub or Jira
  6. Invoke the MCP endpoint from the agent after confirming real‑world data is needed
  • You'll see The agent loads a skill, starts a subagent or contacts an MCP server exactly when the task demands it
  • Takeaway Skills, subagents and MCP expand capability but must earn their cost through proven necessity
  • Check What three conditions trigger the activation of a skill, subagent or MCP within the AI layer?
  • Cost Skills, subagents and MCP all consume context and tokens. Their value is real but conditional — the discipline is adding them late, not early.

2.14 Run your own Gitea server

Gitea ships as a single Go binary (or one Docker container) with no required external services — SQLite is enough for a small team. Self-hosting means your code, history, and CI logs never leave hardware you control.

Do this first Run CI automatically on each push

Stand up a self‑hosted Gitea instance with a single Docker command and the web installer.

Trydocker run -d --name=gitea -p 3000:3000 -p 222:22 -v /var/lib/gitea:/data -e USER_UID=1000 -e USER_GID=1000 gitea/gitea:latest

Then open http://:3000 and complete the install wizard — SQLite is fine to start, swap in Postgres later if you outgrow it.

One container, your infrastructure — Gitea's official Docker install guide: a compose file and the gitea:latest image are the whole setup. Credit: docs.gitea.com ↗
  1. Run the container — execute the provided docker run command to start Gitea with a persistent volume.
  2. Open your browser — navigate to http://localhost:3000.
  3. Complete the install wizard — select Database Type, fill in Admin Username and Password, then click Install Gitea.
  • You'll see The Gitea install wizard at http://localhost:3000, followed by a functional repository forge after you submit it.
  • Takeaway Self‑hosting is just one Docker command and a short wizard, keeping everything inside your own infrastructure
  • Check What three steps must you follow to stand up a self‑hosted Gitea instance using Docker and complete the install wizard?
  • Cost Self-hosted Gitea is free (MIT license) — you pay only for the server it runs on. Gitea Cloud (managed) starts around $9.50/month if you'd rather not run the box yourself.

2.15 Assign an Issue to Copilot and review its pull request

The Copilot coding agent is GitHub's autonomous AI contributor: assign it a GitHub Issue like you would a teammate, and it works in an isolated sandbox on its own copilot/* branch — plans the task into a checklist, writes code, runs tests, pushes commits — then opens a pull request for you to review. It runs on GitHub Actions infrastructure and cannot touch main or any protected branch directly. Beyond the coding agent, GitHub's official MCP server (github.com/github/github-mcp-server) lets any MCP-compatible AI tool — Claude included — read and write repos, Issues, and PRs directly, which is how agents outside GitHub's own UI can work the same loop.

Do this first File a scoped issue and track it on a project board·Run a CI workflow on every push

Create a scoped Issue, let Copilot generate a PR, and approve the changes

TryOpen (or reuse) an Issue with one concrete, scoped task — e.g. 'Add input validation to load_csv()'. In the Assignees panel, assign it to Copilot. It reacts with an eyes emoji, opens a draft pull request within a minute or two, and starts working — check back to watch its checklist fill in.

Coding agent needs a Copilot Pro, Business, or Enterprise seat — it isn't included on the free completions-only tier.

The agent works like a remote teammate — assigned an Issue, it opens a pull request and pushes commits on its own copilot/* branch for you to review. Credit: github.blog ↗
  1. Write a detailed work‑order in the Issue description specifying the function, file or behaviour and acceptance criteria
  2. Select Copilot in the Assignee field to assign the Issue to the coding agent
  3. Open the generated PR via the Pull requests tab, read the diff and add feedback using the Comment box, then approve when satisfied
  • You'll see A pull request linked to your Issue with a task checklist that fills in as commits are pushed
  • Takeaway An Issue can act as a work order that an AI agent turns into a reviewable pull request without touching the main branch
  • Check Which three actions are required to create an Issue, assign it to Copilot, and review the automatically generated pull request?
  • Cost Coding agent is included in Copilot Pro ($10/mo), Business, and Enterprise — not the free tier — and runs draw from your premium-request quota. Note: GitHub paused new sign-ups for the free student Copilot plan in April 2026; check education.github.com/pack for current availability.

2.16 Run an AI‑driven feature development loop

The prime → plan → implement → validate sequence orchestrates a full ticket lifecycle driven by AI commands.

Do this first Add skills, subagents and MCP only when required

Deliver a real ticket by executing prime → plan → implement → validate and improve the AI layer from any mistakes

Tryrun ticket 42 end‑to‑end: prime && plan && implement && validate

Paste the command into the Command Console of the building‑complex‑codebases tool and press Enter; watch for any error messages so you can add a rule to CLAUDE.md when something fails.

  1. Select a real ticket from your repository
  2. Run the prime command to initialise the AI agent for the ticket
  3. Execute the plan command to generate an implementation plan
  4. Apply the implement command to create the code changes
  5. Validate the result with the validate command
  6. If a mistake occurs, edit CLAUDE.md to add a rule or tighten a command
  • You'll see The feature appears in the codebase after passing all four stages, and CLAUDE.md contains new rules added during the run
  • Takeaway Every error becomes a permanent system fix that compounds the agent’s reliability
  • Check How does executing the prime → plan → implement → validate command sequence guarantee that a real ticket is fully developed and that any mistakes are turned into permanent CLAUDE.md rules?
  • Cost The loop has a setup cost, but it's front-loaded: the more you run it, the more your rules and commands carry the work, and the less each task costs you.

3You’ll know it worked 53 checkable outcomes in this chapter

  • The feature is merged and passes all lint, type, and test checks
  • All unit tests pass after adding the feature and no existing workflow fails
  • The feature is merged or deployed after successfully completing all four stages without manual intervention
  • The assignee's avatar appears on the issue card in the list view
  • The new Issue appears in the repository's Issues list with the entered title and body
  • Logging into http://<host_ip>:3000 with the admin credentials shows the dashboard; the database files appear in `./data/gitea.db` if SQLite is used
  • The main branch shows the new commit and the PR is listed as “Merged” in the repository’s Pull Requests tab
  • The repo appears under your profile with the chosen name

53 outcomes in all — one per recipe below.

4FAQ, Tips & How-to 88

one problem, one solution, one action

Internal tools & ops7

How-to Claude Code Founder +2

Adding code to an unfamiliar repo

A merged change that matches the codebase conventions — and a plan + checks you could hand to anyone.

~8 min · low code Lesson → AI-generated
How-to Claude Code Founder +2

Need a one‑word shortcut for the team’s review checklist

A `/review` command in `.claude/commands/` that anyone on the repo invokes in one word.

~8 min · low code Lesson → AI-generated
How-to Claude Code Small biz +2

Need a feature that follows a short spec

A working feature plus the spec and checks that produced it, reusable the next time you add one.

~8 min · low code Lesson → AI-generated
How-to Claude Code Small biz +2

My dependencies keep breaking when I upgrade

Up-to-date dependencies with a clear record of which bump broke what — not a mystery red build.

~8 min · low code Lesson → AI-generated
How-to Claude Code Small biz +1

Adding a new feature to an internal tool

A new capability in the internal tool that ships without quietly breaking an existing workflow.

~8 min · low code Lesson → AI-generated
How-to Claude Code Robotics

Need a one‑command firmware flash and test run

A `.claude/commands/test-target.md` that any engineer invokes in one word; the agent flashes, waits, reads the UART output, and reports which grip-state tests passed or failed.

~8 min · low code Lesson → AI-generated
How-to Claude Code Robotics

Need to verify a refactored grip FSM

A refactored grip-control module with a written plan, a clean static-analysis run, and a UART test log confirming all six grip transitions passed on real hardware — ready for the ISO 13485 change record.

~8 min · low code Lesson → AI-generated

Knowledge & docs3

How-to Claude Code Scientist +2

Tired of re‑explaining your codebase

A sub-100-line CLAUDE.md the agent loads every session — so you stop re-explaining the project.

~8 min · low code Lesson → AI-generated
How-to Claude Code Creator

Chaotic personal repo

A documented, lightly-tested project the agent can navigate, turning a fragile hobby repo into something extendable.

~8 min · low code Lesson → AI-generated
How-to Claude Code Robotics

Multiple firmware in one repo risk HAL/ISR/RTOS violations

A version-controlled CLAUDE.md under ~120 lines that prevents the most destructive class of agent mistakes before they reach the compiler.

~8 min · low code Lesson → AI-generated

Research & data tools1

How-to Claude Code Scientist

Analysis script keeps breaking on reruns

A pinned, tested, documented script someone else (or future-you) can actually re-run and trust.

~8 min · low code Lesson → AI-generated
How-to Everyone

Can’t get reviewers to run my code locally

A portfolio with live, deployable projects signals you can ship software from start to finish

Tech With Tim ↗ Summary → AI-generated
How-to Everyone

Only let my script access repos

Create a token that only allows the permissions Codex needs

Tech With Tim ↗ Summary → AI-generated
How-to Everyone

Sending final changes to repo

Push changes to a GitHub repo named portfolio-website-tutorial to start an automated build

Leon van Zyl ↗ Summary → AI-generated
How-to Everyone

AI forgets your codebase every time you start a new session

Checking the AI layer into git ensures every new session begins with the same context, eliminating repeated explanations

The AI layer is upfront effort — an hour or two on a real repo — that pays back on every task afterwards. It's a habit, not a purchase. Lesson → AI-generated
How-to Everyone

Typing the same prompt over and over

Turn any prompt you type more than twice into a reusable command to avoid retyping

Writing a command is a few minutes once; it then saves that setup on every future task. The `.claude/` folder is the asset, not any single session. Lesson → AI-generated
How-to Everyone

Need to fire a multi‑step setup with one word

Invoke any saved command with a leading slash, turning multi-step setup into one word

~5 min · no code Lesson → AI-generated
How-to Everyone

Starting a new task and need all the context

A single `/prime` command can orient a fresh session by loading the ticket, file tree, and recent git history

~5 min · no code Lesson → AI-generated
How-to Everyone

Changing a command in a shared repo

Updating a command in the shared `.claude/` repo instantly upgrades the workflow for all team members

Lesson → AI-generated
How-to Everyone

Want a full spec before any code is written

A PRP captures every step, file change, and test up front so the implementation can run unattended

Planning and validating add minutes up front, but they're far cheaper than debugging a confident wrong implementation later — and the loop gets faster as your rules accumulate. Lesson → AI-generated
How-to Everyone

Code drifts away from the plan

Implementing in a clean session keeps the agent focused solely on the plan's instructions

Lesson → AI-generated
How-to Everyone

Need to verify generated code passes lint, type‑checking and tests

Running `/validate` runs lint, type-checking, and tests automatically, surfacing any failures before the agent declares completion

~10 min · low code Lesson → AI-generated
How-to Everyone

Jobs list many skills together

Keeping each skill focused prevents unnecessary context growth

Skills, subagents and MCP all consume context and tokens. Their value is real but conditional — the discipline is adding them late, not early. Lesson → AI-generated
How-to Everyone

Turn a repo ticket into a merged feature automatically

Running the full prime → plan → implement → validate loop on a real ticket turns isolated tricks into a single, repeatable system

The loop has a setup cost, but it's front-loaded: the more you run it, the more your rules and commands carry the work, and the less each task costs you. Lesson → AI-generated
How-to Everyone

Need a fresh repo but don’t want the command line

You can spin up a new repo directly from the web UI without using the command line

~5 min · no code Lesson → AI-generated
How-to Everyone

After creating a repo you can instantly see its files, rendered README, and recent commit count

Lesson → AI-generated
How-to Everyone

Need to keep changes separate from main

Your edits stay separate from main until you explicitly merge them

Lesson → AI-generated
How-to Everyone

Need to review a pull request and give feedback

Inline comments let reviewers give precise feedback before merging

Lesson → AI-generated
How-to Everyone

Pull request stuck behind required checks

Merging only becomes possible after required checks pass, ensuring safety

Lesson → AI-generated
How-to Everyone

Need to record a problem or request

Creating an issue captures the problem or request with rich formatting for later reference

**A backlog that lives with your code** — open issues plus a filter bar for labels, milestones and assignees, on a self-hosted Gitea. Credit: 32dots Gitea
Free, unlimited issues per repo — no separate project-management tool needed. Lesson → AI-generated
How-to Everyone

Backlog is a jumble of issues

Labels turn a mixed backlog into searchable, filterable groups like bug or enhancement

Lesson → AI-generated
How-to Everyone

Assigning an issue makes the owner visible via an avatar, clarifying who will handle it

Lesson → AI-generated
How-to Everyone

When I want an issue closed by a commit

Referencing an issue number in a commit message automatically closes the issue when the commit merges

~5 min · no code Lesson → AI-generated
How-to Everyone

Can’t run CI pipelines on your own server

A registered Gitea Runner provides the compute needed to execute workflow jobs

Lesson → AI-generated
How-to Everyone

Need CI to trigger on every push

Placing a correctly formatted YAML file triggers automated builds on each push

~5 min · no code Lesson → AI-generated
Tip Everyone

Green check — verify successful CI execution

A green check mark on the latest commit confirms that all workflow steps passed

Lesson → AI-generated
How-to Everyone

Want to host your own Git server

You can stand up a full Gitea instance with a single docker run command

**One container, your infrastructure** — Gitea's official Docker install guide: a compose file and the gitea:latest image are the whole setup. Credit: docs.gitea.com ↗
~5 min · no code Self-hosted Gitea is free (MIT license) — you pay only for the server it runs on. Gitea Cloud (managed) starts around $9.50/month if you'd rather not run the box yourself. Lesson → AI-generated
How-to Everyone

Need a first admin user and storage configured

The web-based wizard lets you finish setup in minutes, choosing database and admin credentials

Lesson → AI-generated
How-to Everyone

Don’t want to set up a separate database

Choosing SQLite in the wizard lets you run Gitea with no separate DB server

Lesson → AI-generated
How-to Everyone

Need a free account and don’t want to enter a credit card

You can create a GitHub account without a credit card and start hosting repositories immediately

**A repo page is your project's front door** — file tree, README, commit history, and every collaboration tab live here (this is scanpy, a real single-cell analysis project). Credit: github.com ↗
Free tier: unlimited public **and** private repos, unlimited collaborators, no credit card needed. Verified students get GitHub Pro free via the Student Developer Pack (education.github.com/pack). Lesson → AI-generated
How-to Everyone

A GitHub repo shows a web UI with rendered files and navigation that a bare local repo lacks

Lesson → AI-generated
How-to Everyone

Need to let a teammate edit the repo

GitHub lets you grant repository permissions to other users, a capability Git alone does not provide

Lesson → AI-generated
How-to Everyone

Want others to review your changes

Opening a PR creates a reviewable diff and notifies reviewers

**Files changed is where review happens** — deleted lines in red, added lines in green, and every changed file listed on the left. Credit: github.com ↗
Free on every tier — pull requests, reviews, and diffs cost nothing regardless of plan. Lesson → AI-generated
How-to Everyone

I need to define a concrete task for my team

A well-scoped Issue tells anyone (or an AI) exactly what needs to change and how success is measured

~5 min · no code Lesson → AI-generated
How-to Everyone

Want to see an issue move across columns

Linking the Issue to a Project creates a card you can move across columns as work advances

~5 min · no code Lesson → AI-generated
How-to Everyone

Want to change an issue’s state just by dragging its card

Moving a card reflects the current state of work without editing the Issue itself

Lesson → AI-generated
How-to Everyone

New CI pipeline won’t appear after adding a file

Adding a YAML file to .github/workflows/ instantly registers a new CI/CD pipeline

**Every run is logged with a status** — a green check for success, a red X for failure, full console output one click away. Credit: github.com ↗
Free tier: 2,000 Actions minutes/month (public repos run unlimited). Team adds 3,000 shared minutes; heavier CI means paying per-minute overages or upgrading. Lesson → AI-generated
How-to Everyone

Pushing a commit but the workflow never runs

A workflow set to run on push starts automatically after you commit and push the file

Lesson → AI-generated
How-to Everyone

The echo command proves the workflow ran and lets you view custom log messages

Lesson → AI-generated
How-to Everyone

Run a tiny CI on each push that just prints a hello message

A ready-to-use YAML shows the exact syntax needed to trigger on push and echo a message

~5 min · no code Lesson → AI-generated
How-to Everyone

You can locate and view the exact code that the AI builder saved for your app

Lesson → AI-generated
FAQ Everyone

What does "building complex codebases with AI" actually mean — isn't it just prompting?

It's the discipline of making an AI coding agent reliable on a large, real project, rather than relying on one-off prompts ("vibe coding"). The central idea, popularised by Cole Medin, is that every codebase needs a second "AI layer" checked into source control next to the code: a lean CLAUDE.md of rules, reusable slash commands, and — when needed — skills, subagents and MCP connections. Because that layer is version-controlled, your AI workflow improves like code does, and every session starts already knowing your project instead of guessing.

GitHub ↗ AI-generated
FAQ Everyone

What is CLAUDE.md and how long should it be?

CLAUDE.md is a Markdown file the agent loads automatically at the start of every session — put your build/test/lint commands, a short directory map, and the hard rules specific to your codebase. Keep it lean: a model can only reliably follow so many instructions, and a bloated rules file hurts adherence. The practical test for each line is "would the agent be wrong without it?" — if not, delete it. There's also a hierarchy: a global file for your personal defaults, a project file for the repo, and a gitignored local file for personal notes.

Anthropic ↗ AI-generated
FAQ Everyone

What is the Plan → Implement → Validate (PIV) loop?

It's a three-step loop for any real task. Plan first with no edits: have the agent write a plan complete enough to run in a fresh context window — steps, files, and the checks that must pass (Cole calls the comprehensive version a "Product Requirements Prompt"). Implement in a clean session that just follows the plan, so it doesn't drift on stale context. Validate against checks that have to pass — lint, types, tests, then review. A model asked "are you done?" will say yes; a failing test it cannot. When something breaks, fix the system (a rule or check) so that class of bug can't recur.

GitHub ↗ AI-generated
FAQ Everyone

When should I use skills vs subagents vs MCP?

Skills package a procedure the agent loads only when relevant (a SKILL.md) so specialised know-how doesn't bloat every session — one skill should do one job. Subagents run in their own isolated context, useful for parallelising independent work without contaminating the main thread. MCP (Model Context Protocol) connects external systems like GitHub, a database or Jira so the agent reads real data. The key discipline is restraint: each costs context and tokens, so add them only on a demonstrated need — start with CLAUDE.md plus commands and grow from there.

Anthropic ↗ AI-generated
FAQ Everyone

Do I need Claude Code specifically, or does this work with Cursor and Codex?

The discipline is tool-agnostic — the AI layer and the Plan → Implement → Validate loop apply to any agentic coding tool. Claude Code is the running example here (and the one Cole's reference repo targets) because its CLAUDE.md, slash commands, skills, subagents and MCP map cleanly onto these ideas, but Cursor, Codex and similar tools have their own equivalents of project rules, reusable commands and external connections. Learn the habits once and you can carry them between tools.

GitHub ↗ AI-generated
FAQ Everyone

How do I create a new repository in Gitea?

From the Gitea dashboard click the "+ New Repository" button, enter a name and optional description, choose Public or Private, and optionally tick "Initialize Repository." Then confirm by clicking the Create button. The new repo appears immediately with its file list, README preview, and recent commit count.

AI-generated
FAQ Everyone

What is a pull request in Gitea?

A pull request (PR) asks to merge a branch back into the target branch and shows a diff view of the changes line‑by‑line. Reviewers can add inline comments or request changes before the PR is merged. The Merge button becomes active only after required checks pass, then clicking it completes the merge.

AI-generated
FAQ Everyone

How can I assign an issue to a teammate?

When creating or editing an issue, use the Assignee dropdown to select a user; their avatar appears on the issue card. This makes clear who is responsible for fixing the ticket. Labels can also be added to categorize the issue.

AI-generated
FAQ Everyone

How does Gitea support CI/CD pipelines?

Gitea includes built‑in Actions that run workflow files placed in a ".gitea/workflows/" directory. A YAML file defines triggers (e.g., "on: push") and job steps such as checkout, install, and test. A registered Gitea Runner—a small Go binary—executes the jobs on your own server, and a green check mark shows successful execution.

AI-generated
FAQ Everyone

What is needed to host my own Gitea instance?

You can start a full Gitea web/SSH service with a single Docker run command that launches the Gitea binary. After the container starts, open http://localhost:3000 and complete the five‑minute web wizard, which creates the first admin user and configures storage. Choosing SQLite in the wizard lets you run Gitea without setting up a separate database.

AI-generated
FAQ Everyone

How do I give my script limited access to a repo?

Create a personal access token (PAT) that only includes the scopes you need: Repository admin, Contents, and Pull requests. In GitHub settings, generate a new PAT with those permissions and use it in your script.

AI-generated
FAQ Everyone

How can reviewers see my project without installing anything locally?

Push the code to a public GitHub repository and add a deployment link (e.g., Render, Vercel, Heroku). Reviewers can then open the repo online and click the live demo link to run the application in their browser.

AI-generated
FAQ Everyone

What’s the basic git workflow to trigger an automated build on GitHub?

Stage all changed files, commit them with a message (for example, "final"), and push the commit to the target repository such as portfolio-website-tutorial. The push event starts the automated build defined in your workflow.

AI-generated
FAQ Everyone

Do I need a credit card to create a free GitHub account?

No. You can sign up at github.com with just an email, username, and password, and you’ll immediately get a free account that can host repositories.

AI-generated
FAQ Everyone

How do I add someone as a collaborator so they can edit my repository?

Go to Settings → Manage access in your repo, click Invite a collaborator, enter the person’s GitHub username, and assign them read/write or admin rights. They will then be able to push changes directly to the repository.

AI-generated
How-to Everyone

New self‑hosted Git service needs its first admin

The initial Gitea launch presents an admin creation form. Supplying a strong username, email and password creates the super‑user that can manage users, repositories, and server settings.

TroubleChute Linux ↗ Lesson → AI-generated
How-to Everyone

Need a copy of a GitHub project on my private server

Gitea’s “Migrate Repository” feature can clone a remote GitHub repository using a personal access token, preserving commits, branches, tags, and optionally issues/labels. This provides a quick backup or move of projects to your private server.

TroubleChute Linux ↗ Lesson → AI-generated
How-to Everyone

New self‑hosted Git server setup

When you first access Gitea’s web UI, you choose a lightweight SQLite DB (or PostgreSQL for larger setups), set the site title, domain, and SSH port, then create the first administrator account. This creates all internal tables and prepares the service for repositories.

KeepItTechie ↗ Lesson → AI-generated
How-to Everyone

Want a self‑hosted Git server on Windows without internet

Gitea is a lightweight, self‑hosted Git service that runs on Windows without internet access. By placing the executable and data folder together, running it once creates a web UI where you can configure a SQLite database, set the base URL to your machine's IP, and create users and repositories.

Anchorpoint ↗ Lesson → AI-generated
How-to Everyone

First run of a self‑hosted code server

The web installer creates the database schema, sets up an administrator, and lets you configure email, security, and registration options. Doing this once finalizes the installation.

Christian Lempa ↗ Lesson → AI-generated
How-to Everyone

Can’t push without typing a password

Adding your public key to your Gitea user profile enables password‑less authentication for pushes and pulls over SSH, improving security and convenience.

Christian Lempa ↗ Lesson → AI-generated
How-to Everyone

Need a fresh repo on my server

The Gitea UI mirrors GitHub/GitLab: a “New Repository” button opens a form where you set name, visibility, .gitignore, license and default branch. After creation the platform auto‑generates those files.

Elestio ↗ Lesson → AI-generated
How-to Everyone

Need a local copy of a remote repo in VS Code

Gitea provides an “Open with VS Code” button that launches the desktop client, letting you pick a local folder for cloning. This streamlines the usual `git clone` workflow.

Elestio ↗ Lesson → AI-generated
How-to Everyone

Team needs to review and merge code changes

Gitea supports branch creation, PR opening, labeling, assigning reviewers, and merging. This mirrors typical collaborative workflows on larger platforms.

Elestio ↗ Lesson → AI-generated
How-to Everyone

Need a way to log and follow bugs

Gitea’s Issues panel lets you create tickets with titles, descriptions, labels, assignees, due dates, and time tracking, providing a lightweight bug‑tracking system.

Elestio ↗ Lesson → AI-generated
How-to Everyone

Want a simple way to see task status at a glance

Gitea’s Projects feature offers a Kanban board where you can create columns (To‑Do, In Progress, Done) and drag issues or pull requests between them, enabling simple sprint planning.

Elestio ↗ Lesson → AI-generated
How-to Everyone

Want reviewers to check and combine your changes

A PR lets you request that a branch be merged into another; reviewers can comment, approve, or request changes before the final merge.

GitHub ↗ Lesson → AI-generated
How-to Everyone

Want to add files to a repo without the command line

The web interface lets you quickly add single or small groups of files by dragging them into the repo view and committing directly, useful for non‑technical uploads.

GitHub ↗ Lesson → AI-generated
How-to Everyone

Password alone isn’t safe

2FA adds a second verification step (e.g., an authenticator app) after entering your password, protecting against credential theft.

GitHub ↗ Lesson → AI-generated
How-to Everyone

Need a personal landing page on your profile

A repository named exactly after your username is treated as a special repo; its README.md is rendered on your profile, allowing you to showcase projects and personality.

GitHub ↗ Lesson → AI-generated
How-to Everyone

Need online code storage

A repository is where your project’s code lives in the cloud, allowing you to back up and share it. Creating one on GitHub gives you a public or private container for your files.

corbin ↗ Lesson → AI-generated
How-to Everyone

Want to experiment without breaking the main line

A branch copies the current state of the main line of development, letting you experiment safely. Changes stay isolated until you decide they’re ready.

corbin ↗ Lesson → AI-generated
How-to Everyone

Finished feature branch ready to go

A pull request (PR) shows the differences between a feature branch and main, lets you review changes, and then merges them when approved.

corbin ↗ Lesson → AI-generated
How-to Everyone

Need teammates to check my code before it goes live

A PR lets teammates examine, comment on, and approve your branch before it merges into the main line, ensuring quality control.

Mikey No Code ↗ Lesson → AI-generated
How-to Everyone

Need to merge a feature branch into main

A pull request (PR) shows differences between branches, allows code review, and safely merges changes after approval.

corbin ↗ Lesson → AI-generated
Tip Everyone

GitHub Account — create a free account

You sign up at github.com by providing email, password, username and selecting the free plan. This gives you an online identity for storing repositories.

How-to Everyone

Want to start a new openSUSE package

Using the plus icon on src.opensuse.org you can start a new package with the provided template, which pre‑configures Git LFS support and basic metadata. This gives you a ready‑to‑edit repository for your software.

openSUSE ↗ Lesson → AI-generated

The same set on /recipes, filtered by tool and role.

5Videos 3

6FAQ 5

What does "building complex codebases with AI" actually mean — isn't it just prompting?

It's the discipline of making an AI coding agent reliable on a large, real project, rather than relying on one-off prompts ("vibe coding"). The central idea, popularised by Cole Medin, is that every codebase needs a second "AI layer" checked into source control next to the code: a lean CLAUDE.md of rules, reusable slash commands, and — when needed — skills, subagents and MCP connections. Because that layer is version-controlled, your AI workflow improves like code does, and every session starts already knowing your project instead of guessing.

What is CLAUDE.md and how long should it be?

CLAUDE.md is a Markdown file the agent loads automatically at the start of every session — put your build/test/lint commands, a short directory map, and the hard rules specific to your codebase. Keep it lean: a model can only reliably follow so many instructions, and a bloated rules file hurts adherence. The practical test for each line is "would the agent be wrong without it?" — if not, delete it. There's also a hierarchy: a global file for your personal defaults, a project file for the repo, and a gitignored local file for personal notes.

What is the Plan → Implement → Validate (PIV) loop?

It's a three-step loop for any real task. Plan first with no edits: have the agent write a plan complete enough to run in a fresh context window — steps, files, and the checks that must pass (Cole calls the comprehensive version a "Product Requirements Prompt"). Implement in a clean session that just follows the plan, so it doesn't drift on stale context. Validate against checks that have to pass — lint, types, tests, then review. A model asked "are you done?" will say yes; a failing test it cannot. When something breaks, fix the system (a rule or check) so that class of bug can't recur.

When should I use skills vs subagents vs MCP?

Skills package a procedure the agent loads only when relevant (a SKILL.md) so specialised know-how doesn't bloat every session — one skill should do one job. Subagents run in their own isolated context, useful for parallelising independent work without contaminating the main thread. MCP (Model Context Protocol) connects external systems like GitHub, a database or Jira so the agent reads real data. The key discipline is restraint: each costs context and tokens, so add them only on a demonstrated need — start with CLAUDE.md plus commands and grow from there.

Do I need Claude Code specifically, or does this work with Cursor and Codex?

The discipline is tool-agnostic — the AI layer and the Plan → Implement → Validate loop apply to any agentic coding tool. Claude Code is the running example here (and the one Cole's reference repo targets) because its CLAUDE.md, slash commands, skills, subagents and MCP map cleanly onto these ideas, but Cursor, Codex and similar tools have their own equivalents of project rules, reusable commands and external connections. Learn the habits once and you can carry them between tools.

7Glossary 16 terms

Show the 16 terms
Building complex codebases
/prime
Loads context for a fresh session — the ticket, the file tree, and recent git history — so the agent gets oriented in one step.
/plan
Asks the agent to write an implementation plan (steps, files, and the checks that must pass) without editing any code yet.
/implement
Executes an approved plan — ideally in a fresh session so it follows the plan instead of drifting on old conversation.
/validate
Runs the checks that must pass — lint, type-check and tests — and reports what failed.
/review
A structured code-review pass over the changes, looking for bugs, missing tests and security issues.
CLAUDE.md
Project rules the agent loads at the start of every session; keep it lean — only rules it would be wrong without.
~/.claude/CLAUDE.md
Your personal, global rules that apply across all of your projects. The ~ means your home folder.
.claude/commands/
The folder where reusable slash commands live — checked into git alongside your code so the whole team shares them.
SKILL.md
A saved skill — a short file describing a procedure the agent loads only when it is relevant.
INITIAL.md
A plain feature request file; in Cole’s context-engineering workflow the agent turns it into a full plan (a PRP).
AI layer
The version-controlled context that teaches the agent your codebase — rules, commands and skills — kept next to the code.
PIV loop
Plan → Implement → Validate: plan in a fresh context, implement, then prove the work with checks that must pass.
PRP
Product Requirements Prompt — a comprehensive, validation-gated blueprint the agent generates from a request and then executes.
context window
The amount of text (code, chat, rules) a model can consider at once; it is finite, so what you load matters.
subagent
A helper agent with its own isolated context, used to parallelise or isolate work without contaminating the main session.
MCP
Model Context Protocol — a standard way to connect an agent to external systems like GitHub, a database, or Jira.

8See also

💬 Discuss this chapter

Ask, share, or report — over on the Heidelberg AI community forum.