Agent skill

Fork Discipline

by jezweb in jezweb/claude-skills

Audit and enforce the core/client boundary in multi-client projects.

MITAuto-check: notesDevelopment

Install Fork Discipline

skills CLI
$ npx skills add jezweb/claude-skills --skill fork-discipline -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jezweb/claude-skills fork-discipline --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jezweb/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/dev-tools/skills/fork-discipline .claude/skills/fork-discipline && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fork-discipline
GitHub stars
1.1k
Token cost
~3.1k tokens
SKILL.md length
754 words
Files
1
Skills in repo
52
Repo updated
First seen
Licence
MIT

At a glance

Audit and enforce the core/client boundary in multi-client projects.

  • Works in 9 steps: Detect Project Type → Map the Boundary → Find Violations → …
  • Tasks that involve Refactoring
  • SKILL.md covers The Principle, When to Use, Modes and Audit Mode, plus 4 more sections
  • Calls git

What it does

Fork Discipline is an agent skill from jezweb/claude-skills. Audit and enforce the core/client boundary in multi-client projects. Detects where shared platform code is tangled with client-specific code, finds hardcoded client checks, config files that replace instead of merge, scattered client code, migration conflicts, and missing extension points. Produces a boundary map, violation report, and refactoring plan. Optionally generates FORK.md documentation and restructuring scripts. Triggers: 'fork discipline', 'check the boundary', 'is this core or client', 'platform…

Its SKILL.md is about 3.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: claude-code-only

It sits in Development, covering Refactoring and Code migrations. The repository describes itself as: Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Tasks that involve Refactoring
  • Tasks that involve Code migrations

Example prompts

  • “fork discipline”
  • “check the boundary”
  • “is this core or client”
  • “/fork-discipline”

Requirements

  • Compatibility (from SKILL.md): claude-code-only
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Glob, Grep, Bash

Workflow steps

9 steps, taken from the step headings in SKILL.md.

  1. Detect Project Type
  2. Map the Boundary
  3. Find Violations
  4. Produce the Report
  5. Move Client Code Out of Core
  6. Replace Client Checks with Feature Flags
  7. Implement Config Merge
  8. Add Extension Point for Custom Routes
  9. Generate the Refactoring Script

What it can do on your machine

Read from SKILL.md and the folder at commit 64965d9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Glob
    • Grep
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    claude-code-only

    From compatibility in the SKILL.md frontmatter.

Context cost

Fork Discipline loads about 3.1k tokens when it runs. Until then it costs about 155 tokens; SKILL.md has 754 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~155
When it runs · the whole SKILL.md, loaded when a task matches
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Glob, Grep, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jezweb/claude-skills at commit 64965d9, republished under its MIT licence (© jezweb). 754 words, ~3,087 tokens.

Download SKILL.mdSave it as .claude/skills/fork-discipline/SKILL.md (or your agent's skills folder).
name
fork-discipline
description
Audit and enforce the core/client boundary in multi-client projects. Detects where shared platform code is tangled with client-specific code, finds hardcoded client checks, config files that replace instead of merge, scattered client code, migration conflicts, and missing extension points. Produces a boundary map, violation report, and refactoring plan. Optionally generates FORK.md documentation and restructuring scripts. Triggers: 'fork discipline', 'check the boundary', 'is this core or client', 'platform audit', 'client separation', 'fork test', 'refactor for multi-client', 'clean up the fork'.
allowed-tools
Read, Write, Edit, Glob, Grep, Bash
compatibility
claude-code-only

Fork Discipline

Audit the core/client boundary in multi-client codebases. Every multi-client project should have a clean separation between shared platform code (core) and per-deployment code (client). This skill finds where that boundary is blurred and shows you how to fix it.

The Principle

project/
  src/            ← CORE: shared platform code. Never modified per client.
  config/         ← DEFAULTS: base config, feature flags, sensible defaults.
  clients/
    client-name/  ← CLIENT: everything that varies per deployment.
      config      ← overrides merged over defaults
      content     ← seed data, KB articles, templates
      schema      ← domain tables, migrations (numbered 0100+)
      custom/     ← bespoke features (routes, pages, tools)

The fork test: Before modifying any file, ask "is this core or client?" If you can't tell, the boundary isn't clean enough.

When to Use

  • Before adding a second or third client to an existing project
  • After a project has grown organically and the boundaries are fuzzy
  • When you notice if (client === 'acme') checks creeping into shared code
  • Before a major refactor to understand what's actually shared vs specific
  • When onboarding a new developer who needs to understand the architecture
  • Periodic health check on multi-client projects

Modes

ModeTriggerWhat it produces
audit"fork discipline", "check the boundary"Boundary map + violation report
document"write FORK.md", "document the boundary"FORK.md file for the project
refactor"clean up the fork", "enforce the boundary"Refactoring plan + migration scripts

Default: audit


Audit Mode

Step 1: Detect Project Type

Determine if this is a multi-client project and what pattern it uses:

SignalPattern
clients/ or tenants/ directoryExplicit multi-client
Multiple config files with client namesConfig-driven multi-client
packages/ with shared + per-client packagesMonorepo multi-client
Environment variables like CLIENT_NAME or TENANT_IDRuntime multi-client
Only one deployment, no client dirsSingle-client (may be heading multi-client)

If single-client: check if the project CLAUDE.md or codebase suggests it will become multi-client. If so, audit for readiness. If genuinely single-client forever, this skill isn't needed.

Step 2: Map the Boundary

Build a boundary map by scanning the codebase:

CORE (shared by all clients):
  src/server/          → API routes, middleware, auth
  src/client/          → React components, hooks, pages
  src/db/schema.ts     → Shared database schema
  migrations/0001-0050 → Core migrations

CLIENT (per-deployment):
  clients/acme/config.ts    → Client overrides
  clients/acme/kb/          → Knowledge base articles
  clients/acme/seed.sql     → Seed data
  migrations/0100+          → Client schema extensions

BLURRED (needs attention):
  src/server/routes/acme-custom.ts  → Client code in core!
  src/config/defaults.ts line 47    → Hardcoded client domain
Step 3: Find Violations

Scan for these specific anti-patterns:

Client Names in Core Code
bash
# Search for hardcoded client identifiers in shared code
grep -rn "acme\|smith\|client_name_here" src/ --include="*.ts" --include="*.tsx"

# Search for client-specific conditionals
grep -rn "if.*client.*===\|switch.*client\|case.*['\"]acme" src/ --include="*.ts" --include="*.tsx"

# Search for environment-based client checks in shared code
grep -rn "CLIENT_NAME\|TENANT_ID\|process.env.*CLIENT" src/ --include="*.ts" --include="*.tsx"

Severity: High. Every hardcoded client check in core code means the next client requires modifying shared code.

Config Replacement Instead of Merge

Check if client configs replace entire files or merge over defaults:

typescript
// BAD — client config is a complete replacement
// clients/acme/config.ts
export default {
  theme: { primary: '#1E40AF' },
  features: { emailOutbox: true },
  // Missing all other defaults — they're lost
}

// GOOD — client config is a delta merged over defaults
// clients/acme/config.ts
export default {
  theme: { primary: '#1E40AF' },  // Only overrides what's different
}
// config/defaults.ts has everything else

Look for: client config files that are suspiciously large (close to the size of the defaults file), or client configs that define fields the defaults already handle.

Severity: Medium. Stale client configs miss new defaults and features.

Scattered Client Code

Check if client-specific code lives outside the client directory:

bash
# Files with client names in their path but inside src/
find src/ -name "*acme*" -o -name "*smith*" -o -name "*client-name*"

# Routes or pages that serve a single client
grep -rn "// only for\|// acme only\|// client-specific" src/ --include="*.ts" --include="*.tsx"

Severity: High. Client code in src/ means core is not truly shared.

Missing Extension Points

Check if core has mechanisms for client customisation without modification:

Extension pointHow to checkWhat it enables
Config mergeDoes config/ have a merge function?Client overrides without replacing
Dynamic importsDoes core look for clients/{name}/custom/?Client-specific routes/pages
Feature flagsAre features toggled by config, not code?Enable/disable per client
Theme tokensAre colours/styles in variables, not hardcoded?Visual customisation
Content injectionCan clients provide seed data, templates?Per-client content
Hook/event systemCan clients extend behaviour without patching?Custom business logic

Severity: Medium. Missing extension points force client code into core.

Show full SKILL.md (280 more words)Show less
Migration Number Conflicts
bash
# List all migration files with their numbers
ls migrations/ | sort | head -20

# Check if client migrations are in the reserved ranges
# Core: 0001-0099, Client domain: 0100-0199, Client custom: 0200+

Severity: Low until it causes a conflict, then Critical.

Feature Flags vs Client Checks
typescript
// BAD — client name check
if (clientName === 'acme') {
  showEmailOutbox = true;
}

// GOOD — feature flag in config
if (config.features.emailOutbox) {
  showEmailOutbox = true;
}

Search for patterns where behaviour branches on client identity instead of configuration.

Step 4: Produce the Report

Write to .jez/artifacts/fork-discipline-audit.md:

markdown
# Fork Discipline Audit: [Project Name]
**Date**: YYYY-MM-DD
**Pattern**: [explicit multi-client / config-driven / monorepo / single-heading-multi]
**Clients**: [list of client deployments]

## Boundary Map

### Core (shared)
| Path | Purpose | Clean? |
|------|---------|--------|
| src/server/ | API routes | Yes / No — [issue] |

### Client (per-deployment)
| Client | Config | Content | Schema | Custom |
|--------|--------|---------|--------|--------|
| acme | config.ts | kb/ | 0100-0120 | custom/routes/ |

### Blurred (needs attention)
| Path | Problem | Suggested fix |
|------|---------|--------------|
| src/routes/acme-custom.ts | Client code in core | Move to clients/acme/custom/ |

## Violations

### High Severity
[List with file:line, description, fix]

### Medium Severity
[List with file:line, description, fix]

### Low Severity
[List]

## Extension Points
| Point | Present? | Notes |
|-------|----------|-------|
| Config merge | Yes/No | |
| Dynamic imports | Yes/No | |
| Feature flags | Yes/No | |

## Health Score
[1-10] — [explanation]

## Top 3 Recommendations
1. [Highest impact fix]
2. [Second priority]
3. [Third priority]

Document Mode

Generate a FORK.md for the project root that documents the boundary:

markdown
# Fork Discipline

## Architecture

This project serves multiple clients from a shared codebase.

### What's Core (don't modify per client)
[List of directories and their purpose]

### What's Client (varies per deployment)
[Client directory structure with explanation]

### How to Add a New Client
1. Copy `clients/_template/` to `clients/new-client/`
2. Edit `config.ts` with client overrides
3. Add seed data to `content/`
4. Create migrations numbered 0100+
5. Deploy with `CLIENT=new-client wrangler deploy`

### The Fork Test
Before modifying any file: is this core or client?
- Core → change in `src/`, all clients benefit
- Client → change in `clients/name/`, no other client affected
- Can't tell → the boundary needs fixing first

### Migration Numbering
| Range | Owner |
|-------|-------|
| 0001-0099 | Core platform |
| 0100-0199 | Client domain schema |
| 0200+ | Client custom features |

### Config Merge Pattern
Client configs are shallow-merged over defaults:
[Show the actual merge code from the project]

Refactor Mode

After an audit, generate the concrete steps to enforce the boundary:

1. Move Client Code Out of Core

For each violation where client code lives in src/:

bash
# Create client directory if it doesn't exist
mkdir -p clients/acme/custom/routes

# Move the file
git mv src/routes/acme-custom.ts clients/acme/custom/routes/

# Update imports in core to use dynamic discovery
2. Replace Client Checks with Feature Flags

For each if (client === ...) in core:

typescript
// Before (in src/)
if (clientName === 'acme') {
  app.route('/email-outbox', emailRoutes);
}

// After (in src/) — feature flag
if (config.features.emailOutbox) {
  app.route('/email-outbox', emailRoutes);
}

// After (in clients/acme/config.ts) — client enables it
export default {
  features: { emailOutbox: true }
}
3. Implement Config Merge

If the project replaces configs instead of merging:

typescript
// config/resolve.ts
import defaults from './defaults';

export function resolveConfig(clientConfig: Partial<Config>): Config {
  return {
    ...defaults,
    ...clientConfig,
    features: { ...defaults.features, ...clientConfig.features },
    theme: { ...defaults.theme, ...clientConfig.theme },
  };
}
4. Add Extension Point for Custom Routes

If clients need custom routes but currently modify core:

typescript
// src/server/index.ts — auto-discover client routes
const clientRoutes = await import(`../../clients/${clientName}/custom/routes`)
  .catch(() => null);
if (clientRoutes?.default) {
  app.route('/custom', clientRoutes.default);
}
5. Generate the Refactoring Script

Write a script to .jez/scripts/fork-refactor.sh that:

  • Creates the client directory structure
  • Moves identified files
  • Updates import paths
  • Generates the FORK.md

The Right Time to Run This

Client countWhat to do
1Don't refactor. Just document the boundary (FORK.md) so you know where it is.
2Run the audit. Fix high-severity violations. Start the config merge pattern.
3+Full refactor mode. The boundary must be clean — you now have proof of what varies.

Rule 5 from the discipline: Don't abstract until client #3. With 1 client you're guessing. With 2 you're pattern-matching. With 3+ you know what actually varies.

Tips

  • Run this before adding a new client, not after
  • Config merge is the single highest-ROI refactor — do it first
  • Feature flags beat if (client) even with one client. "This is mostly the same except..." = feature flag, not fork.
  • FORK.md is for the team, not just for Claude — write it like a human will read it

© jezweb, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/dev-tools/skills/fork-discipline of jezweb/claude-skills.

Open the folder on GitHubat commit 64965d9

Compare with similar skills

Fork Discipline next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Fork Discipline compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fork Discipline this skilljezweb/claude-skills1.1k—~3.1kAutomated safety check: NotesMIT
Migrate Core Code to Submodulestinyhumansai/openhuman42k—~2.6kAutomated safety check: PassGPL-3.0
ast-grep Structural Searchcode-yeongyu/oh-my-openagent70k—~3.3kAutomated safety check: PassMIT
ast-grep Codemod Referencewarp-drive-data/warp-drive3.2k—~2.6kAutomated safety check: PassMIT
Hai Ast Grephylarucoder/hai-stack383—~1.5kAutomated safety check: PassCustom licence
Java 21 Developer Guide for Grailsapache/grails-core2.9k—~1.9kAutomated safety check: PassApache-2.0

Similar skills

  • Migrate Core Code to Submodules

    tinyhumansai/openhuman

    Plans and carries out moving non-host-specific code and its tests from the OpenHuman core into vendored tiny submodule libraries, then releases the submodule and re-pins the host.

    42k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • ast-grep Structural Search

    code-yeongyu/oh-my-openagent

    Searches and rewrites code by syntax-tree shape across 25 languages with ast-grep, for codemods, structural queries and YAML lint rules, using a Python wrapper script.

    70k GitHub stars~3.3k tokensUpdated today
    DevelopmentAuto-check passed
  • ast-grep Codemod Reference

    warp-drive-data/warp-drive

    Reference for writing and debugging TypeScript and JavaScript codemods with @ast-grep/napi: parsing, node queries, meta-variables, rule objects and editing.

    3.2k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Hai Ast Grep

    hylarucoder/hai-stack

    Produces a ready-to-run ast-grep command or reusable YAML lint/codemod rule, validated against positive and negative fixtures.

    383 GitHub stars~1.5k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Guide for writing modern Java 21 in a Grails and Groovy codebase: records, sealed classes, pattern matching, text blocks and how Java works alongside Groovy.

    2.9k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed
  • trace-mcp Codemods

    nikolai-vysotskyi/trace-mcp

    Replaces repeated hand edits with the trace-mcp apply_codemod tool, previewing matches in a dry run before bulk mechanical changes across one file or many.

    188 GitHub stars~729 tokensUpdated today
    DevelopmentAuto-check passed

More from jezweb/claude-skills

All 52 skills in this repo
  • Favicon Gen

    jezweb/claude-skills

    Generate custom favicons from logos, text, or brand colours.

    1.1k GitHub starsUsed in 1 repo~1k tokens
    Auto-check passed
  • Tailwind Theme Builder

    jezweb/claude-skills

    Set up Tailwind v4 + shadcn/ui themed UI with dark mode. An agent skill from jezweb/claude-skills.

    1.1k GitHub starsUsed in 1 repo~3.2k tokens
    Auto-check passed
  • Elevenlabs Agents

    jezweb/claude-skills

    Build conversational AI voice agents on the ElevenLabs platform.

    1.1k GitHub stars~3.3k tokensUpdated 3 days ago
    Auto-check passed
  • Responsiveness Check

    jezweb/claude-skills

    Test website responsiveness across viewport widths using browser automation.

    1.1k GitHub starsUsed in 1 repo~1.7k tokens
    Auto-check passed
  • MCP Builder

    jezweb/claude-skills

    Build MCP servers in Python with FastMCP. An agent skill from jezweb/claude-skills.

    1.1k GitHub stars~3.1k tokensUpdated 3 days ago
    Auto-check: notes
  • GitHub Release

    jezweb/claude-skills

    Prepare and publish GitHub releases. An agent skill from jezweb/claude-skills.

    1.1k GitHub stars~944 tokensUpdated 3 days ago
    Auto-check: notes

Categories

Questions about Fork Discipline

What does Fork Discipline do?

Audit and enforce the core/client boundary in multi-client projects. Fork Discipline is an agent skill from jezweb/claude-skills. Audit and enforce the core/client boundary in multi-client projects.

When should I use Fork Discipline?

Fork Discipline fits situations like: tasks that involve Refactoring; tasks that involve Code migrations.

How do I install Fork Discipline in Claude Code?

Run `npx skills add jezweb/claude-skills --skill fork-discipline -a claude-code`. Or copy the skill folder (plugins/dev-tools/skills/fork-discipline in jezweb/claude-skills) into .claude/skills/fork-discipline in your project. Claude Code loads it when a task matches its description.

How do I install Fork Discipline in Codex?

Run `npx skills add jezweb/claude-skills --skill fork-discipline -a codex`. Or copy the skill folder (plugins/dev-tools/skills/fork-discipline in jezweb/claude-skills) into .agents/skills/fork-discipline in your project. Codex loads it when a task matches its description.

Can I use Fork Discipline in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jezweb/claude-skills --skill fork-discipline -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fork-discipline, .gemini/skills/fork-discipline, .github/skills/fork-discipline and .opencode/skills/fork-discipline in your project.

What does Fork Discipline need to run?

Going by SKILL.md and its folder, Fork Discipline needs the command-line tools its instructions call (git). Its frontmatter pre-approves these tools: Read, Write, Edit, Glob, Grep, Bash. Compatibility (from SKILL.md): claude-code-only.

Does Fork Discipline access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Fork Discipline safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Fork Discipline use?

Fork Discipline is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Fork Discipline use?

About 3.1k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Fork Discipline?

Skills that share tags, products or a category with Fork Discipline: Migrate Core Code to Submodules (tinyhumansai/openhuman, 42k stars), ast-grep Structural Search (code-yeongyu/oh-my-openagent, 70k stars), ast-grep Codemod Reference (warp-drive-data/warp-drive, 3.2k stars) and Hai Ast Grep (hylarucoder/hai-stack, 383 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fork Discipline?

jezweb (a GitHub user) maintains it in jezweb/claude-skills, which has 1,052 GitHub stars. The repository holds 52 skills in this directory. The repository was last updated on October 5, 2026.

Source: jezweb/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.