TL;DR (summary)

How I use Claude Code on my hobby projects. The agents develop inside deterministic rules. A second model reviews the work. I test and approve it. Shell scripts and a hook handle what has to happen the same way every time.

On a recent project I tweaked how I use Claude Code for agentic coding. Putting the emphasis on testing by me and on the agents following deterministic instructions improved the quality of the results.

Note this setup is tailored to my "hobby" projects which mostly run on free accounts. For example, I'm not subscribed to enterprise GitHub.

Vibe Coding vs Agentic Coding

#
  • Vibe coding: ask an AI for code and accept whatever comes back with little or no reviewing.
  • Agentic coding: the agent works through detailed requirements on its own inside a written rulebook. It runs checks it can't skip. A different model reviews the work and I approve every PR.

Some Key Points on the Setup

#

Developer/QA Role Playing

#

Separation of roles is clear. The agent does the development and I write the tests.

Any new additions or edits via MCP made in tools like Jira or Figma are treated as drafts until I've approved them.

Deterministic Scripts

#

Written prompts can give different results each time they run and I found the full context of a prompt wasn't always remembered by long-running agents. Writing shell scripts for tasks like testing a database migration or running the right tests after a change leaves the agents much less room for error.

Dual Models

#

Using one session and one model to check the quality of its own changes doesn't work well. Opus does the development. Once the work is finished a new session using Fable starts with fresh context so a different model tests and reviews the changes.

Virtual Machine

#

To keep Claude away from production and from the rest of my network it runs in isolation on a Linux virtual machine on my home server with no access to my home network. It runs under its own user, with its own restricted GitHub account. A hook stops it pushing to main or merging a PR. I merge every PR myself following my review.

I connect to the VM over SSH and it opens Claude Code in a tmux session. That keeps the session running when I disconnect so I can pick it up again from any machine.

CLAUDE.md and Skills

#

CLAUDE.md is read at the start of every session. It holds the safety rules, code standards and architecture. For everything else it points to skills which act as workflows.

Example CLAUDE.md

#
markdown
# CLAUDE.md
 
Jot is a notes app: Next.js and Postgres, deployed on Vercel. This file loads
every session, so it only holds what applies to every task. Workflows are skills.
 
## Roles
 
You're the developer. I'm the tester and product owner. You build and open
PRs; I test, sign off and merge. Don't mark your own homework: tell me what
you checked and how, and I'll decide whether it's done.
 
## What you can do
 
| Just do it                       | Ask me first               | Never (a hook blocks these) |
| -------------------------------- | -------------------------- | --------------------------- |
| Read code, run tests and checks  | Add a dependency           | Merge a PR                  |
| Branch, commit, push your branch | Change the database schema | Push to `main`              |
| Open a PR                        | Change how anything looks  | Touch production            |
|                                  | (draw it first)            | Edit an old migration       |
 
## Done means proved
 
- Every new test is shown failing without the fix (`scripts/prove-test.sh`).
- A new migration is proved on realistic data (`scripts/prove-migration.sh`).
- `scripts/check.sh` is green.
- "It should work" isn't done. Show me it working.
 
## Talking to me
 
Answer first, then what I need to decide. One question at a time. Long detail
goes in the PR, not the chat.
 
## Workflows
 
| When                                | Use the skill |
| ----------------------------------- | ------------- |
| Working a Jira ticket               | `jira-ticket` |
| A bug I report                      | `bug`         |
| After a merge, or something slipped | `retro`       |

Example Skill

#

The retro skill helps with continuous improvement of the agentic workflows.

markdown
---
name: retro
description: Runs a short retro after a piece of work and turns each lesson into a rule, a script or a hook, so the same mistake can't happen twice.
when_to_use: After a PR merges, after a bug reaches production, or when I say "retro".
---
 
# Retro
 
1. List what went wrong or nearly did: bugs I found that you didn't, checks you
   skipped, steps you forgot, anything you had to redo.
2. For each one, ask why it got through, not just what happened.
3. Decide where the fix belongs, from strongest to weakest:
   - **A hook**, if it must never happen (it blocks the command)
   - **A script**, if it must happen the same way every time
   - **A test**, if it's about the code's behaviour
   - **A line in a skill**, if it needs judgement
   - **A line in CLAUDE.md**, only if it applies to every task
4. Make the change, and show the mistake it prevents would now be caught.
5. Report it as a table: what happened, why, and the fix.

The development workflows do things like build a checklist, pull in details from tools like Jira, Figma and databases when needed and document the changes to help guide me with testing.

Any steps or checks which must be done in specific ways are written as shell scripts.

Example Script

#

This proves a new database migration works on realistic data before it is requested for review.

bash
#!/usr/bin/env bash
# Proves a new migration works on data shaped like production's before it
# ships: production already has rows when the deploy runs it.
#
#   scripts/prove-migration.sh
set -euo pipefail
 
migrations="prisma/migrations"
 
# Existing migrations never change: production's history has to match them
if git diff --name-only --diff-filter=MD origin/main -- "$migrations" | grep -q .; then
  echo "FAIL: an existing migration was edited or deleted. Add a new one instead."
  exit 1
fi
 
new="$(git diff --name-only --diff-filter=A origin/main -- "$migrations" | grep 'migration.sql$' | tail -n 1)"
if [[ -z "$new" ]]; then
  echo "No new migration on this branch."
  exit 1
fi
 
# A throwaway database on the local server, dropped whatever happens
if [[ -n "${PGHOST:-}" && "$PGHOST" != "localhost" && "$PGHOST" != /* ]]; then
  echo "Refusing: PGHOST points at $PGHOST, not a local server."
  exit 1
fi
scratch="prove_$(date +%s)"
createdb "$scratch"
trap 'dropdb "$scratch"' EXIT
apply() { psql --quiet -v ON_ERROR_STOP=1 -d "$scratch" -f "$1" >/dev/null; }
 
# The first migration, then realistic rows written against it (so the sample
# data never goes stale), then every later migration up to the new one
mapfile -t files < <(ls "$migrations"/*/migration.sql | sort)
apply "${files[0]}"
apply scripts/sample-data.sql
for file in "${files[@]:1}"; do
  apply "$file"
  [[ "$file" == "$new" ]] && break
done
 
# The new migration's own checks, if it has some
checks="scripts/migration-checks/$(basename "$(dirname "$new")").sql"
if [[ -f "$checks" ]]; then
  apply "$checks"
fi
 
echo "Proved $(dirname "$new") on realistic data."

Guardrails

#

A rule in CLAUDE.md is advice. A hook is enforcement. Before every shell command the agent tries a hook reads it and blocks things like merging, pushing to main, deploying, and anything that touches the production database:

text
Blocked by .claude/hooks/guard-bash.mjs: Merging is Aaron's: he reviews and merges every PR (CLAUDE.md safety rules).

The agent wrote the first version of that hook and it passed all of its own tests. Code reviews then found 17 ways past it: 7 on Opus and 10 more on Fable. That's exactly why every change gets reviewed by a fresh session on a different model.

Always Improving

#

After each piece of work the retro skill turns anything that slipped into a hook, a script, a test or a rule so the same mistake shouldn't happen again.