GitHub 0
Skip to content

Coding agents

Tell coding agents how your program syncs, and let them test a sync without touching the machine's agents.

A coding agent that works on a program built on skillrc needs three facts: where the state is, which files a sync may write, and how to test without the user's agents. Put them in AGENTS.md:

## Sync

- skillrc runs the sync (`sync` from skillrc/sync). Our `SyncHost` is in `src/host.ts`; it reads
  the plan from `~/.config/mytool/mytool.json`.
- State is in `~/.local/state/mytool`: `state.json`, `last-run.json` and the store. Never edit them
  by hand; `loadState` and `saveState` do.
- Config edits go through `editConfigFile` or `setTomlTable`, never a whole-file write: the user and
  the agents edit the same files.
- Tests never touch the machine's agents. Every folder, HOME and git's config included, is a temp one.
AGENTS.md

Build the Places in a temporary folder, and point every variable an agent or git reads there too. skillrc's own engine tests do this:

import { mkdtempSync, realpathSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { vi } from "vitest";

const root = realpathSync(mkdtempSync(join(tmpdir(), "mytool-")));
const home = join(root, "home");
vi.stubEnv("HOME", home);
vi.stubEnv("XDG_CONFIG_HOME", join(home, ".config"));
vi.stubEnv("CLAUDE_CONFIG_DIR", join(home, ".claude"));
vi.stubEnv("CODEX_HOME", join(home, ".codex"));
vi.stubEnv("GIT_CONFIG_NOSYSTEM", "1");

const places = Object.freeze({
  program: "mytool",
  state: join(root, "state"),
  config: join(root, "config"),
});
ts

A SyncHost whose targets returns one folder under home stands in for an agent. A local source or a bare git repository in root stands in for a remote.

Two variables shorten waits in tests: <PROGRAM>_LOCK_WAIT_MS sets how long withSyncLock waits for a running sync, and <PROGRAM>_SYNC_TIMEOUT_MS sets the limit on a whole sync.

Every page on this site has a raw Markdown copy at /raw/<page>.md, such as /raw/guide/sync.md, and a full index at /llms.txt.