Software Factory Part 1: Onboarding a Repo

Table of contents

Part 1 of 4 in the software factory series. The overview covers what the factory is and what happened on its first real ticket. To run it on your own repo, start at the Software Factory product page.

My software factory takes a Jira ticket and turns it into a tested, reviewed and verified pull request. It can do that on any repo, because the factory itself knows nothing about the repo it’s building in. Everything repo-specific lives in the repo, in a few contract files.

This post covers those files, the Claude Code skill that writes them, what it found when I pointed it at this site, and how to run the factory on your own project.


The Four Contract Files

Before it can build anything, the factory needs four things from a repo:

File What it’s for
CLAUDE.md The project rules every agent follows: stack, conventions, styling, accessibility and SEO patterns, commit style, files the factory must never touch
factory.yml Commands (install, test, start), the app’s port, protected paths, ticket modes
docs/app-navigation.md A map of the running app, for the agents that only see the browser
A test harness Something the test command in factory.yml can run, red or green

Adding a second repo is one config entry plus an onboarding run, with no changes to the factory’s code.


The onboard-repo Skill

Writing these by hand is tedious, and getting CLAUDE.md right takes a careful read of the codebase. So there’s a skill for it, onboard-repo, which runs in Claude Code on your laptop or inside the factory container. It:

  1. Surveys the repo: the stack and layout, code conventions with real snippets, styling tokens and accessibility patterns, existing tests, commit prefixes from git log, and cross-file sync points such as config that must match in three places.
  2. Writes or merges CLAUDE.md from that survey.
  3. Adds a test harness if there isn’t one, picked by stack, with one seed test per layer.
  4. Writes factory.yml and the navigation doc.
  5. Self-checks. It runs install, check, test and start, and confirms the app answers with HTTP 200.
  6. Opens an onboarding PR. It never pushes to the main branch.

What It Found on This Site

My first target was this site, an Astro 5 portfolio, and the survey turned up two things I hadn’t thought about.

First, it had no tests at all. Red-green can’t work without a test runner, so onboarding added Vitest (with Astro’s container API for components), Playwright for end-to-end tests, and an astro check script.

Second, astro check reported 52 type errors in existing code, 37 of them from one stray '/div' in a project page. The factory’s test command includes the type check, so no ticket could ever go green on top of that. Onboarding fixed the errors first, without changing the built output.


factory.yml and Ticket Modes

Here’s the factory.yml it wrote, with the comments removed and the recipes cut down to their first lines:

install: "npm ci && npx playwright install chromium"
check: "npm run check"
test: "npm run check && npm test && npm run test:e2e"
start: "npm run build && npm run serve -- --port 4321"
port: 4321
ready_path: "/"
navigation_doc: docs/app-navigation.md
protected_paths:
  - ".env*"
  - "vercel.json"
  - ".vercel/**"
  - "public/*.txt"
  - "scripts/indexnow.mjs"
commit_style:
  prefixes: [feat, fix, blog, seo, docs, refactor, perf, test, chore]
  trailer: "Jira: {KEY}"
ticket_modes:
  default:
    match: {}
    recipe: |
      Code or UI change (`feat:` / `fix:` / `seo:` / `refactor:` / `perf:`).
      - Map every acceptance criterion to at least one test that fails before the change.
      ...
  content:
    match:
      labels: [content, blog, notes]
      issue_types: [Content, Blog Post]
    recipe: |
      Content ticket (a new or updated blog post or note; commit prefix `blog:`).
      Red is a failing test that asserts the acceptance criteria for the post. Then
      writing the post turns it green.
      ...

test is the one command that decides red or green. start must serve the app on port, and the factory polls ready_path until it answers with HTTP 200. Whatever you list in protected_paths, .env files and factory.yml itself are always protected, so the factory can never rewrite its own contract.

Ticket modes handle tickets that aren’t code. A blog-post ticket can’t have a failing unit test in the usual sense, but it can have one asserting that the post’s page returns 200, has exactly one H1 equal to the title, has a seoTitle of 50 characters or fewer, and is listed on /blog/. The first non-default mode whose labels or issue types match the ticket wins; otherwise it’s default.


The Navigation Doc

The verifier agent never reads the code, so it needs another way to find its way around the app. The navigation doc is a plain Markdown file. Here’s an excerpt of the one onboarding wrote for this site:

# App navigation

For the factory's verifier agent, which checks acceptance criteria in a real
browser and reads no source code. Keep it current when routes or persistent UI
change.

- **URL rules:** every page URL ends in `/`. `/about` redirects (308) to `/about/`. Unknown
  paths return 404 with the site's 404 page. No auth, no locales.
- **Viewports:** desktop above 720px wide shows the top header with section links. At
  720px and below, the sections and search move to a **bottom tab bar**, and the header
  hides on scroll down and reappears on scroll up.
- **Theme:** light/dark, stored in `localStorage.theme`. The active theme is the
  `data-theme` attribute on `<html>` (`"light"` or `"dark"`). Toggle it with the header
  button `#theme-toggle` (aria-label "Toggle Theme") or the command palette action
  "Toggle light / dark theme".

## Routes
| Path | What it shows | How to reach it |
|---|---|---|
| `/blog/` | Blog index: featured posts, tag filter chips ("Filter posts by tag", `All` plus one chip per tag), post list | "Writing" section, tab "Blog" |
| `/blog/<slug>/` | Blog post. Example: `/blog/visual-regression-testing-across-releases/` | Links on `/blog/`, home, command palette |

My 2025 post listed “a navigation map so the agent stops guessing” as a future enhancement. It turned out to be one Markdown file.

Review the onboarding PR carefully. Its factory.yml commands run on every ticket, and its CLAUDE.md is the rulebook for every agent. It’s the one place where you set how the factory behaves for that repo.


Running It Yourself

You need Docker, a Jira Cloud site, a GitHub repo, and a Claude subscription or API key.

1. Clone and configure

git clone https://github.com/SreekeshOkky/software-factory.git
cd software-factory
cp .env.example .env

Fill in .env:

Variable Where it comes from
CLAUDE_CODE_OAUTH_TOKEN Run claude setup-token, which uses your subscription. Or set ANTHROPIC_API_KEY instead.
JIRA_BASE_URL https://your-site.atlassian.net (the JIRA_* variables are needed only if a repo uses the Jira tracker)
JIRA_EMAIL, JIRA_API_TOKEN A plain API token, not a scoped one, from id.atlassian.com. Ideally for a bot account that’s a member of the one project.
GH_TOKEN A fine-grained token limited to the target repos, with Contents and Pull requests set to read/write. Needed only if a repo is on GitHub.
GH_REVIEWER_TOKEN Optional. A second bot account for reviews, because GitHub won’t let a PR’s author review their own PR. Without it, the factory falls back to GH_TOKEN, which can still post comments.
JIRA_ROVO_MCP Optional, false by default. Also gives agents the Atlassian Rovo MCP server for linked issues and comments. The ticket text is always in the prompt either way.

Point factory.config.yml at your project and repo. The status names must match your Jira workflow exactly:

statuses: { todo: "To Do", in_progress: "In Progress", review: "In Review", done: "Done" }
repos:
  - name: my-app
    git: git@github.com:you/my-app.git
    base_branch: main
    tracker: { type: jira, project: APP }

tracker picks where tickets come from (Jira is the one vendor so far; add component: web to route one project to several repos). The code host is inferred from the github.com URL, or set it with host: { type: github }. The older jira: { project: APP } form still works.

2. Onboard the repo

Load the factory plugin (plugins/factory/) in Claude Code, or copy plugins/factory/skills/onboard-repo/ into ~/.claude/skills/. Run /onboard-repo in your app’s repo, then review and merge the PR it opens on the factory/onboard branch. Until factory.yml is on the main branch, the factory blocks every ticket for that repo as “not onboarded”.

3. Dry run, then the real thing

DRY_RUN=true docker compose run --rm factory node /app/orchestrator/dist/index.js --once
docker compose up -d --build && docker compose logs -f

A dry run reads the tracker and the code host (Jira and GitHub) but doesn’t write to them. The agents still run, and they still cost tokens.


Write a Ticket the Factory Can Build

The factory is only as good as the ticket, so write acceptance criteria that can be checked:

Summary: Add a "Back to top" link to the end of blog posts

Acceptance criteria
- A "Back to top" link appears after the last paragraph of every blog post
- Activating it moves focus and scroll position to the top of the page
- It's visible and meets contrast in both light and dark themes
- It isn't shown on pages that aren't blog posts

Add the factory-enabled label and move the ticket to To Do. Then follow it:

docker compose exec factory status KAN-5

“Updated name should persist after page refresh” is checkable. “Profile page should be intuitive” isn’t. Vague criteria produce vague tests and UNTESTABLE verdicts, so over time the UNTESTABLE rows become a review of how your team writes tickets.


Key Takeaways

  • Keep repo knowledge in the repo. CLAUDE.md, factory.yml and a navigation doc make the factory generic.
  • Let an agent do the survey, and a human approve it. The onboarding PR is where you set the rules every later agent follows.
  • Onboarding finds the debt that blocks automation. No tests and 52 type errors would have blocked every ticket.
  • Agents that only see the browser need a map. One Markdown file is enough.
  • Write tickets a machine can check. The factory’s output is only as good as the acceptance criteria.

Next: Part 2: Red-Green TDD an Agent Can’t Fake, on how the builder works and how the factory checks its claims.

esc