npx skills add ...
npx skills add darkmatter/skills --skill darkmatter-repo-setup
Use when setting up a new repo, onboarding an existing repo to darkmatter standards, running a compliance check, or when the user says "set up this repo", "bring repo up to standards", "apply template", or "audit repo". Checks and installs the org TypeScript toolchain (Bun catalog, Effect 4, effect-agent, effect-orpc, Postgres-first data, tsgo, oxlint/oxfmt, Vitest, vite-plus, React 19, shadcn), Nix flake-parts devshell, ops/ surface, CI pipeline, and AGENTS.md conventions.
npx skills add darkmatter/skills --skill darkmatter-repo-setup
You are a setup agent. Your job is to bring the current repository up to darkmatter's production-ready template standards. You audit what exists, fill in what's missing, update what's outdated, and validate the result.
Apply codebase-design for the shared readability rules and examples, and domain-organization for names and role directories. Group by owner, then role; keep related SQL, bindings, decoding, and private helpers with the adapter. Expose complete operations through explicit package entries. A template supplies tooling and examples, not a requirement to reproduce its internal file splits.
Preserve configured line limits. Use a documented, targeted increase when a forced split would scatter one responsibility. Do not create a file, service, or test for every helper. Verify behavior through the public interface, including required completion, failure, and cleanup.
Clone the canonical template repo to a temp directory and read from it:
Read files from /tmp/darkmatter-template to understand the target state.
Adapt content to the target repo — do not blindly copy project names,
package names, or app logic. The structure and conventions are the
standard; the specific app is the example.
The template root package.json catalog is the preferred-libs home. Align new
dependency choices with that catalog, then add only the app-specific libraries
the target repo needs. When the current template demonstrates a narrower
resource such as D1, keep the current Darkmatter preference in mind: new
application data starts on Postgres unless the repo records a specific
edge-local or demo reason.
Clean up when done:
All Effect-related setup and code must follow the Effect Solutions quick-start — the canonical field manual for idiomatic Effect.
Install the effect-solutions CLI for agent-accessible best-practice
lookup:
Before writing or auditing any Effect-related file, consult the relevant topic:
See references/effect-solutions.md for the full topic reference. Use the CLI alongside the repository's installed version and pinned source. Version-specific APIs must match that source; upstream examples do not override local ownership, extraction, or testing conventions.
Clone the template repo first (you will need it throughout):
Determine the repo's current state:
git rev-parse --show-toplevel to find the repo root.package.json if it exists.AGENTS.md if it exists.flake.nix if it exists..zed/, ops/, .github/, docs/, justfile.Classify the repo:
package.json or no flake.nix. Start from the
template and adapt.Read the supporting checklist at references/checklist.md. Work through every section. For each item, check if the file exists and matches the template standard. Record findings as:
Present a summary table to the user before making changes. Include the count of ✅ / ⚠️ / ❌ items.
For each ❌ or ⚠️ item, create or update the file. Read the corresponding
file from the cloned template at /tmp/darkmatter-template, adapt it to
the target repo, and write it. Work section by section in this order —
later sections may depend on earlier ones:
package.json — root manifest, scripts, catalog, engines
packages/tooling — shared tsconfig and oxc config
TypeScript configs — root + per-package (consult
effect-solutions show tsconfig)
Linting & formatting — oxlint.config.ts, .oxfmtrc.json
Testing — vitest.config.ts (consult effect-solutions show testing)
Zed config — .zed/settings.json (consult
effect-solutions show project-setup)
Nix flake — flake.nix, flake/, nix/, bun.nix
justfile
ops/ directory — full structure with READMEs
CI — .github/workflows/ci.yaml
.gitignore
Docs — architecture.md, getting-started.md, README.md
Effect source code — services, data models, errors, config,
effect-orpc routes when the repo needs typed RPC, and Postgres adapters
for application data unless the repo documents a different database choice
(consult effect-solutions show for each area)
AGENTS.md — last, because it documents everything else. Keep
repo-specific instructions in docs/AGENTS.repo.md; never edit the
generated AGENTS.md directly. Add darkmatter-skills
(github:darkmatter/skills) as a flake input and concatenate the
shared topics the repo adopts with its own text:
Refresh the committed file with:
If CLAUDE.md is missing, create it containing @AGENTS.md (an existing
one is never touched). Add a CI step so a stale AGENTS.md fails the
build:
Adaptation rules:
ops-monorepo-demo / @ops-demo/web with the target repo's
actual name and package names.Ops monorepo demo in user-facing strings with the repo's
actual display name.apps/web with an
Effect/Bun HTTP server and packages/web-core with domain helpers,
mirroring the template.bun.nix after any package.json dependency changes by
running bun run generate:bun-nix (requires bun2nix on PATH).After all changes, run the full validation suite from the repo root:
If any step fails, attempt to fix it. If a step is not applicable (e.g., no Docker), note it and skip. Report the final status of each step.
Clean up the cloned template:
Produce a final summary:
effect-solutions list # list all topics
effect-solutions show project-setup # language service, reference repos
effect-solutions show tsconfig # TS compiler settings for Effect
effect-solutions show basics # Effect.fn and Effect.gen conventions
effect-solutions show services-and-layers # Context.Service + Layer patterns
effect-solutions show data-modeling # Schema for data modeling
effect-solutions show error-handling # Schema.TaggedError
effect-solutions show config # Effect.Config
effect-solutions show testing # @effect/vitest