Claude Code

Team setup guide for the Kun engine configuration

Complete setup guide for the databayt team Kun engine configuration via Claude Code.

One-Liner Setup

macOS / Linux

curl -fsSL https://kun.databayt.org/install | bash

Windows (PowerShell)

powershell -ExecutionPolicy Bypass -Command "iwr https://kun.databayt.org/install.ps1 | iex"

The wizard installs the Claude Code CLI, clones ~/kun, installs the team configuration, and prompts for your personal secrets Gist ID — each teammate is handed their own (see Secrets). Full walkthrough: Onboarding.


What Gets Installed

ComponentDescription
AgentsArchitecture, React, Prisma, product repos (hogwarts, souq, mkan, shifa), leadership fleet
Skills/check, /ship, /handover, /qa, /release, /health, /sync, … — commands are retired, skills carry the verbs
RulesCross-cutting + path-scoped domain rules (React 19, Next 16, Prisma 6, Tailwind 4, …)
Memoryteam, capacity, repositories, component snapshots
MCP ServersGitHub, Neon, shadcn, browser, Vercel, Stripe, Slack, … — full fleet, universal
Scriptssetup, secrets, sync-repos, health (macOS + Windows)

Live counts are declared in kun/.claude/engine.json/health flags drift.


Step-by-Step Installation

Step 1: Install Claude Code CLI

macOS / Linux

curl -fsSL https://claude.ai/install.sh | sh

Windows (PowerShell)

irm https://claude.ai/install.ps1 | iex

Verify

claude --version

Step 2: Install Team Config

macOS / Linux

git clone https://github.com/databayt/kun.git ~/kun 2>/dev/null || git -C ~/kun pull
bash ~/kun/.claude/scripts/setup.sh engineer

Windows

git clone https://github.com/databayt/kun.git "$env:USERPROFILE\kun"
& "$env:USERPROFILE\kun\.claude\scripts\setup.ps1" -Role engineer

Step 3: Setup Secrets

Each teammate is handed a personal Gist ID — never share yours.

macOS / Linux

~/.claude/scripts/secrets.sh <YOUR_GIST_ID>

Windows

& "$env:USERPROFILE\.claude\scripts\secrets.ps1" -GistId <YOUR_GIST_ID>

Step 4: Restart Terminal & Run

claude
# or with alias
c

Directory Structure

~/.claude/                      # Windows: %USERPROFILE%\.claude\
├── CLAUDE.md                   # Personal global config — seeded from template once, never overwritten
├── settings.json               # Environment & hooks (from settings-windows.json on Windows)
├── mcp.json                    # Full MCP server fleet (universal)
├── .env                        # Secrets (auto-generated, DO NOT COMMIT)
├── agents/                     # Specialist + leadership agents
│   ├── architecture.md
│   ├── hogwarts.md             # Education SaaS patterns
│   ├── souq.md                 # E-commerce patterns
│   ├── mkan.md                 # Rental/booking patterns
│   ├── shifa.md                # Healthcare patterns
│   ├── react.md
│   ├── prisma.md
│   └── ...
├── skills/                     # Skills carry the verbs (commands are retired)
│   ├── check/SKILL.md
│   ├── ship/SKILL.md
│   ├── health/SKILL.md
│   └── ...
├── rules/                      # Cross-cutting + path-scoped domain rules
├── memory/                     # Persistent memory files
│   ├── team.json
│   ├── capacity.json
│   └── repositories.json       # All org repos with monitoring
└── scripts/
    ├── setup.sh / setup.ps1    # Canonical installer (kun/.claude → ~/.claude)
    ├── secrets.sh / .ps1       # Secrets from your personal Gist
    ├── sync-repos.sh / .ps1    # Sync all org repos locally
    └── health.sh / .ps1        # Config health check

Shell Configuration

macOS / Linux

Add to ~/.zshrc or ~/.bashrc:

export PATH="$HOME/.local/bin:$HOME/.claude/bin:$PATH"
alias c='claude --dangerously-skip-permissions'   # primary agent
alias a='agy --dangerously-skip-permissions'       # secondary agent — Antigravity
 
# Auto-load secrets
[ -f "$HOME/.claude/.env" ] && export $(grep -v "^#" "$HOME/.claude/.env" | xargs)

The installer writes these as shell functions, not aliases — same effect. a is the secondary agent: the fallback when claude is unavailable, and the cheap lane for easy tasks.

Reload: source ~/.zshrc

Windows (PowerShell Profile)

Add to $PROFILE:

# Agent launchers
function c { claude --dangerously-skip-permissions $args }   # primary
function a { agy --dangerously-skip-permissions $args }       # secondary — Antigravity
 
# Auto-load secrets
if (Test-Path "$env:USERPROFILE\.claude\.env") {
    Get-Content "$env:USERPROFILE\.claude\.env" | ForEach-Object {
        if ($_ -and -not $_.StartsWith("#")) {
            $parts = $_ -split "=", 2
            if ($parts.Length -eq 2) {
                [Environment]::SetEnvironmentVariable($parts[0], $parts[1], "Process")
            }
        }
    }
}

Reload: . $PROFILE


Quick Keywords

After setup, just say these words to trigger actions:

Workflow

KeywordAction
devKill port 3000 → Start server → Open browser
buildRun build with error scanning
pushFull git commit + push
quickFast commit (skip build)
deployDeploy to Vercel staging
shipDeploy to production

Creation

KeywordAction
atomCreate atom (2+ primitives)
templateCreate template (full-page layout)
blockCreate block (UI + logic)
componentCreate React component
pageCreate Next.js page

Repository References

KeywordAction
like hogwartsReference education SaaS patterns
like souqReference e-commerce patterns
like mkanReference rental/booking patterns
like shifaReference healthcare patterns
from codebaseClone pattern from codebase
/reposExplore all org repositories

Quality

KeywordAction
testGenerate tests (Vitest)
securitySecurity audit (OWASP)
performanceCore Web Vitals check
reviewCode review

See full keyword list (90+) in ~/.claude/CLAUDE.md.


Secrets Management

Secrets are stored in a private GitHub gist and auto-loaded via scripts.

What's Included

Required

  • GITHUB_PERSONAL_ACCESS_TOKEN - GitHub API access

Per-Project Databases

  • DATABASE_URL_CODEBASE - Codebase project DB
  • DATABASE_URL_HOGWARTS - Hogwarts (education SaaS) DB
  • DATABASE_URL_MKAN - Mkan (rental marketplace) DB
  • DATABASE_URL_SOUQ - Souq (e-commerce) DB (when created)
  • DATABASE_URL_SHIFA - Shifa (healthcare) DB (when created)

AI Keys

  • ANTHROPIC_API_KEY - Claude API
  • GROQ_API_KEY - Groq API

Auth

  • OAuth credentials (Google, Facebook)
  • AUTH_SECRET - NextAuth secret

Services

  • Stripe, Resend, Cloudinary, ImageKit, Telegram

Per-Project Database Usage

When working on a specific project, copy the appropriate DATABASE_URL to your project's .env:

# Working on hogwarts?
DATABASE_URL=$DATABASE_URL_HOGWARTS
 
# Working on mkan?
DATABASE_URL=$DATABASE_URL_MKAN
 
# Working on codebase?
DATABASE_URL=$DATABASE_URL_CODEBASE

Or use an alias in your shell profile:

alias use-hogwarts='export DATABASE_URL=$DATABASE_URL_HOGWARTS'
alias use-mkan='export DATABASE_URL=$DATABASE_URL_MKAN'
alias use-codebase='export DATABASE_URL=$DATABASE_URL_CODEBASE'

Update Secrets

  1. Open your personal secrets Gist (each teammate is handed their own Gist ID)
  2. Click Edit
  3. Update values
  4. Re-run ~/.claude/scripts/secrets.sh <YOUR_GIST_ID> to pull the updates

Manual Override

Create/edit ~/.claude/.env directly:

GITHUB_PERSONAL_ACCESS_TOKEN=ghp_xxx
DATABASE_URL_HOGWARTS=postgresql://...
# ... other variables

Repository Sync

Sync all organization repositories locally for deep reference:

macOS / Linux

# Sync all repos
~/.claude/scripts/sync-repos.sh
 
# Check status
~/.claude/scripts/sync-repos.sh status
 
# Watch upstream dependencies
~/.claude/scripts/sync-repos.sh watch
 
# Sync specific repo
~/.claude/scripts/sync-repos.sh hogwarts

Windows

& "$env:USERPROFILE\.claude\scripts\sync-repos.ps1"
& "$env:USERPROFILE\.claude\scripts\sync-repos.ps1" -RepoName status

Monitored Repositories

Core Libraries (Priority 1):

  • codebase - Patterns, agents, templates, blocks
  • shadcn - UI component library (shadcn/ui fork)
  • radix - Radix primitives
  • kun - Code Machine config

Product Repositories (Priority 2):

  • hogwarts - Education SaaS (multi-tenant, LMS, billing)
  • souq - E-commerce (multi-vendor, cart)
  • mkan - Rental marketplace (booking, listings)
  • shifa - Medical platform (appointments, patients)

Specialized (Priority 3):

  • ios-app - iOS mobile
  • android-app - Android mobile
  • distributed-computer - Rust infrastructure
  • marketing - Landing pages

Configuration Sync

To get latest team configuration updates:

macOS / Linux

git -C ~/kun pull && bash ~/kun/.claude/scripts/setup.sh engineer

Windows

git -C "$env:USERPROFILE\kun" pull; & "$env:USERPROFILE\kun\.claude\scripts\setup.ps1" -Role engineer

This refreshes agents, skills, rules, memory, scripts, settings, and the MCP fleet from the kun repo — the single source of truth.

Your ~/.claude/CLAUDE.md is personal and never overwritten.


MCP Servers

28 MCP servers are pre-configured:

MCPPurposeTrigger
githubGit operationspush, pr, issue
neonDatabaseprisma, migration
shadcnUI componentsui, component
browserPlaywrighttest, e2e
vercelDeploymentsdeploy, ship
stripePaymentspayment, billing
posthogAnalyticsanalytics
sentryErrorserror, debug
airtableDataairtable
notionDocsnotion

See full list in ~/.claude/mcp.json.


Product Agent Reference

Each product repo has a dedicated agent with patterns:

hogwarts (Education SaaS)

"auth like hogwarts"      # Multi-tenant auth
"billing like hogwarts"   # Stripe subscription
"lms like hogwarts"       # Course management

Patterns: Multi-tenant architecture, subdomain routing, role-based access, Stripe billing

souq (E-commerce)

"cart from souq"          # Shopping cart
"vendor like souq"        # Vendor dashboard
"catalog like souq"       # Product catalog

Patterns: Redux cart, multi-vendor, product variants, order management

mkan (Rental Marketplace)

"booking like mkan"       # Booking system
"listings like mkan"      # Property listings
"calendar like mkan"      # Availability calendar

Patterns: Property listings, date range booking, availability management, search filters

shifa (Healthcare)

"appointments like shifa" # Appointment scheduling
"patient like shifa"      # Patient records
"schedule like shifa"     # Doctor scheduling

Patterns: Appointment system, patient records, doctor schedules, prescription management


Local Customizations

Your personal config lives in files the engine never touches:

  • ~/.claude/CLAUDE.md — your global instructions (seeded from a template on first install, then yours: preferences, machine quirks, personal keywords)
  • .claude/settings.local.json — per-project personal settings overrides
  • ~/.claude/.env — your secrets

Everything else (agents, skills, rules, settings.json, mcp.json) is engine-managed and refreshed from the kun repo on every setup run.


Troubleshooting

Windows: "claude not found"

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

macOS: Permission denied

chmod +x ~/.claude/scripts/*.sh

MCP servers not loading

  1. Check ~/.claude/mcp.json exists
  2. Verify environment variables are set
  3. Restart Claude

Secrets not loading

# Check .env file
cat ~/.claude/.env
 
# Manually source
source ~/.zshrc

Config Sources

Canonical (kun)

https://github.com/databayt/kun/tree/main/.claude

The kun repo is the single source of truth. setup.sh installs it to ~/.claude/, and every machine refreshes from it — nothing installs from other repos.


Permission Flags

FlagPurpose
--dangerously-skip-permissionsSkip all prompts
--allowedTools "Bash,Read,Write"Whitelist tools
-p "prompt"Direct prompt mode
-rResume last session

Usage Examples

# Start session
c
 
# Direct prompt
c "fix the login bug"
 
# Resume last session
c -r
 
# With specific tools allowed
claude --allowedTools "Read,Grep,Glob" "find all TODO comments"