~ / rigs / adnanmokhtar / refract

adnanmokhtar/refract

Write your AI coding setup once, run it in every tool. One source of truth — 184 commands, 99 agents, 234 skills, 24 role-based packs — compiled into the native format of Claude Code, Cursor, Gemini CLI, OpenCode, Aider, Cline, Codex, Conti

↗ GitHub ★ 2 MIT updated 1d ago project Claude CodeCodex Claude plugin
share on X
ARCHETYPE
Fort Knox
Deny lists, pre-tool hooks, sandboxing. Nothing touches prod without a signature.
CONTEXT TAX · EVERY TURN
~11.0k tokens
Heavy · median rig: 2.3k · breakdown
GUARDRAILS
4/5
Blocks destructive commands · Pre-tool screening hook · No YOLO mode · Sandbox or ask-first rules · details
Quality 74/100 Guardrails v2

Copy this rig

# review before running: this installs third-party code
$ npx degit adnanmokhtar/refract/templates/repo-baseline/.claude ./rig-refract  # inspect, then merge into .claude/

MCP servers are added to Claude Code at local scope; env vars are shown as YOUR_… placeholders — we never store values. Files are fetched with degit into a separate folder so you can review before merging.

$ npx degit adnanmokhtar/refract/templates/packs/ai-engineering/skills/eval-run .claude/skills/eval-run
$ npx degit adnanmokhtar/refract/templates/packs/ai-engineering/skills/llm-gateway-audit .claude/skills/llm-gateway-audit
$ npx degit adnanmokhtar/refract/templates/packs/ai-engineering/skills/prompt-audit .claude/skills/prompt-audit
$ npx degit adnanmokhtar/refract/templates/packs/ai-engineering/skills/retrieval-eval .claude/skills/retrieval-eval
$ npx degit adnanmokhtar/refract/templates/packs/ai-engineering/skills/vector-index-audit .claude/skills/vector-index-audit
$ npx degit <redacted>-contract-scan .claude/skills/algorithm-contract-scan
$ npx degit <redacted>-derivation .claude/skills/complexity-derivation
$ npx degit <redacted>-scan .claude/skills/complexity-scan
$ npx degit <redacted>-stability-scan .claude/skills/numeric-stability-scan
$ npx degit <redacted>-detect .claude/skills/align-detect
$ npx degit <redacted>-oracle .claude/skills/convention-oracle
$ npx degit <redacted>-ratchet-scan .claude/skills/convention-ratchet-scan
$ npx degit <redacted>-and-align .claude/skills/find-and-align
$ npx degit <redacted>-layout-scan .claude/skills/naming-layout-scan
$ npx degit <redacted>-adoption-scan .claude/skills/wrapper-adoption-scan
$ npx degit <redacted>-consistency-audit .claude/skills/api-consistency-audit
$ npx degit <redacted>-snapshot .claude/skills/api-snapshot
$ npx degit <redacted>-tenant .claude/skills/debug-tenant
$ npx degit <redacted>-error-scan .claude/skills/edge-error-scan
$ npx degit <redacted>-test-method .claude/skills/endpoint-test-method
$ npx degit <redacted>-diff .claude/skills/env-diff
$ npx degit <redacted>-contract-scan .claude/skills/http-contract-scan
$ npx degit <redacted>-lifecycle-scan .claude/skills/job-lifecycle-scan
$ npx degit <redacted>-tail-method .claude/skills/log-tail-method
$ npx degit <redacted>-scaffold .claude/skills/module-scaffold
$ npx degit <redacted>-independent-ops .claude/skills/parallelize-independent-ops
$ npx degit <redacted>-transition-scan .claude/skills/state-transition-scan
$ npx degit <redacted>-boundary-scan .claude/skills/validation-boundary-scan
$ npx degit <redacted>-format-scan .claude/skills/wire-format-scan
$ npx degit <redacted>-business-coverage .claude/skills/check-business-coverage
$ npx degit <redacted>-scan .claude/skills/ledger-scan
$ npx degit <redacted>-scan .claude/skills/lifecycle-scan
$ npx degit <redacted>-rule-scan .claude/skills/pricing-rule-scan
$ npx degit <redacted>-scan .claude/skills/report-scan
$ npx degit <redacted>-invoice-scan .claude/skills/tax-invoice-scan
$ npx degit adnanmokhtar/refract/templates/packs/code-quality/skills/architectural-diagnosis .claude/skills/architectural-diagnosis
$ npx degit adnanmokhtar/refract/templates/packs/code-quality/skills/change-brief .claude/skills/change-brief
$ npx degit adnanmokhtar/refract/templates/packs/code-quality/skills/correctness-smell-scan .claude/skills/correctness-smell-scan
$ npx degit adnanmokhtar/refract/templates/packs/code-quality/skills/dead-code-scan .claude/skills/dead-code-scan
$ npx degit adnanmokhtar/refract/templates/packs/code-quality/skills/debt-ledger .claude/skills/debt-ledger
$ curl -fsSL --create-dirs -o .claude/agents/test-engineer.md https://raw.githubusercontent.<redacted>-stale-knowledge-slice/resources/.claude/agents/test-engineer.md
$ curl -fsSL --create-dirs -o .claude/agents/test-engineer.md https://raw.githubusercontent.<redacted>-stale-knowledge-slice/resources/.claude/agents/test-engineer.md
$ curl -fsSL --create-dirs -o .claude/agents/verifier.md https://raw.githubusercontent.com/adnanmokhtar/refract/main/templates/repo-baseline/.claude/agents/verifier.md
$ curl -fsSL --create-dirs -o .claude/agents/project-dispatcher.md https://raw.githubusercontent.<redacted>-baseline/.claude/agents/project-dispatcher.md

Merge into .claude/settings.json (project) or ~/.claude/settings.json (user). Hook commands reference scripts in the source repo — copy those too.

{
  "permissions": {
    "deny": [
      "Bash(rm -rf:*)",
      "Bash(rm -fr:*)",
      "Bash(git push --force:*)",
      "Bash(git push -f:*)",
      "Bash(git reset --hard:*)",
      "Bash(git clean -fd:*)",
      "Bash(git branch -D:*)",
      "Bash(git commit --amend:*)",
      "Bash(*uninstall*)",
      "Bash(*:--no-verify:*)",
      "Bash(rm -rf:*)",
      "Bash(rm -fr:*)",
      "Bash(git push --force:*)",
      "Bash(git push -f:*)",
      "Bash(git reset --hard:*)",
      "Bash(git clean -fd:*)",
      "Bash(git branch -D:*)"
    ]
  },
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write|MultiEdit",
        "hooks": [
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/test-lock.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/artifact-ownership.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/pre-edit-guard.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/secret-scan.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/module-boundaries.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/inject-path-rules.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/inject-blast-radius.sh"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/guard-destructive.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/guard-irreversible.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/test-lane.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/test-lock.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/judge-bash-guard.sh"
          }
        ]
      },
      {
        "matcher": "Read|Grep|Glob|Agent|Task",
        "hooks": [
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/judge-bash-guard.sh"
          },
          {
            "type": "command",
            "command": "cd \"${CLAUDE_PROJECT_DIR:-.}\" && .claude/hooks/artifact-ownership.sh"
          }
        ]
      }
    ]
  },
  "sandbox": {
    "enabled": true
  }
}

Skills (148)

eval-runllm-gateway-auditprompt-auditretrieval-evalvector-index-auditalgorithm-contract-scancomplexity-derivationcomplexity-scannumeric-stability-scanalign-detectconvention-oracleconvention-ratchet-scanfind-and-alignnaming-layout-scanwrapper-adoption-scanapi-consistency-auditapi-snapshotdebug-tenantedge-error-scanendpoint-test-methodenv-diffhttp-contract-scanjob-lifecycle-scanlog-tail-methodmodule-scaffoldparallelize-independent-opsstate-transition-scanvalidation-boundary-scanwire-format-scancheck-business-coverageledger-scanlifecycle-scanpricing-rule-scanreport-scantax-invoice-scanarchitectural-diagnosischange-briefcorrectness-smell-scandead-code-scandebt-ledgerduplication-scanerror-handling-scanrefactoring-sweepsmoke-verifysuppression-scantest-shieldtype-safety-scancontract-diffdata-test-scanderived-data-scanextract-scangrain-probeincremental-load-scanlineage-traceorchestration-scanpii-copy-scanwarehouse-scan-auditconnection-config-scanindex-coverage-scanmigration-rehearsalmigration-safetyn-plus-one-scanquery-shape-scanschema-consistency-auditschema-diffschema-integrity-scantransaction-scanlane-backendlane-frontendlane-mobilecompose-scancontainer-build-scandeploy-safety-scangitops-auditmonitor-deploypipeline-cache-scanpipeline-integrity-scanprogressive-deliveryrelease-integrity-scanrelease-securitychaos-testcoordination-scandlq-replaydual-write-scanevent-contract-scanmessaging-scanretry-deadline-scanworkflow-scanchangelog-generatediagram-syncdoc-drift-scandoc-sample-scandoc-structure-scandocstring-coveragequickstart-verifyallocation-scancandidate-pricingcommitment-coverageegress-traceguardrail-scanspend-anomaly-triagespend-path-scanstorage-growth-scanunit-cost-probea11y-code-scana11y-scanbundle-analyzeclient-data-scancomponent-playgroundcritical-path-scandev-server-startfont-optimizationi18n-scanimage-optimizationlcp-auditlighthouse-cinavigation-speedrender-correctness-scanrouting-scanseo-auditssr-auditstreaming-ssrverify-with-playwrightvisual-checkadmission-policydns-tls-lifecycle-scandr-auditedge-reliability-scaniac-cost-scaniac-lifecycle-scaniac-state-scank8s-api-version-scank8s-auditk8s-availability-scank8s-render-scank8s-wiring-scannetwork-exposure-auditserverless-reliability-scantf-plan-reviewapply-pack-adaptationcompute-anchor-densitycontext-load-scandecision-record-scanextract-architecture-deeplyextract-base-class-idiomextract-business-contextextract-codebase-overviewextract-conventions-emerging

Subagents (4)

test-engineerWrites the failing test first and proves the fix with it.
test-engineerWrites the failing test first and proves the fix with it.
verifier
model: opus
Independent fresh-context judge, dispatched by pipeline commands with a brief: grades a run's locked acceptance contract with tests it runs at HEAD (mode acceptance), or refutes candidate review findi
project-dispatcherReads PROJECTS.md and determines which sibling repos a task affects. Produces impact matrices for cross-repo work.

Hooks (27)

eventmatcherruns
PostToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/post-edit-check.sh
PostToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/format-on-save.sh
PostToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/auto-test.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/test-lock.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/artifact-ownership.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/pre-edit-guard.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/secret-scan.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/module-boundaries.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/inject-path-rules.sh
PreToolUseEdit|Write|MultiEditcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/inject-blast-radius.sh
PreToolUseBashcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/guard-destructive.sh
PreToolUseBashcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/guard-irreversible.sh
PreToolUseBashcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/test-lane.sh
PreToolUseBashcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/test-lock.sh
PreToolUseBashcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/judge-bash-guard.sh
PreToolUseRead|Grep|Glob|Agent|Taskcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/judge-bash-guard.sh
PreToolUseRead|Grep|Glob|Agent|Taskcd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/artifact-ownership.sh
UserPromptSubmit*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/recall-inject.sh
SessionStart*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/session-start.sh
PreCompact*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/precompact-handoff.sh
Stop*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/update-session-log.sh
Stop*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/verify-gate.sh
SubagentStop^(.+:)?verifier$cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/persist-verdict.sh
SubagentStop*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/persist-review.sh
Notification*cd "${CLAUDE_PROJECT_DIR:-.}" && .claude/hooks/notify.sh
PostToolUseEdit|Write|MultiEdit.claude/hooks/dispatch-hook.sh
SessionStart*.claude/hooks/session-start.sh

Slash commands (10)

/catchup/execute-plan/fix-bug/ship/verify-plan/cross-repo-task/migration-doctor/migration-workspace-status/project-map/sync-contract

Permissions

deny (17)
Bash(rm -rf:*)
Bash(rm -fr:*)
Bash(git push --force:*)
Bash(git push -f:*)
Bash(git reset --hard:*)
Bash(git clean -fd:*)
Bash(git branch -D:*)
Bash(git commit --amend:*)
Bash(*uninstall*)
Bash(*:--no-verify:*)
Bash(rm -rf:*)
Bash(rm -fr:*)
Bash(git push --force:*)
Bash(git push -f:*)
Bash(git reset --hard:*)
Bash(git clean -fd:*)
Bash(git branch -D:*)
ask (0)
—
allow (14)
Bash(git status:*)
Bash(git diff:*)
Bash(git log:*)
Bash(git show:*)
Bash(git branch:*)
Bash(git rev-parse:*)
Bash(ls:*)
Bash(find:*)
Bash(grep:*)
Bash(rg:*)
Bash(cat:*)
Bash(head:*)
Bash(tail:*)
Bash(wc:*)

Similar rigs

copied ✓