Skip to content

Latest commit

History

37 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

KahnClaude

A personal Claude Code framework — commands, skills, agents, hooks, and CLAUDE.md templates for effective AI-assisted development across any language or stack.


What Is This?

KahnClaude is a Claude Code configuration layer, not a project scaffold or runnable application. It provides the infrastructure that makes Claude dramatically more effective: slash commands, triggered skills, specialist agents, enforcement hooks, and CLAUDE.md templates.

You use it to configure projects, not to run them. Drop it into any existing codebase — C++, Python, Rust, C#, web — and Claude immediately gains structured workflows, quality enforcement, and expert templates.

Two Ways to Use It

A. Install into an existing project:

# Inside a Claude Code session in your project
/kc:install

Non-destructive — only adds what's missing. Creates .claude/ with all components.

B. Install global config once:

# Inside a Claude Code session (one-time, merges with any existing ~/.claude/)
/kc:install-global

What NOT to do: Don't expect a runnable app from this repo. This is the configuration layer that enhances Claude in your projects — it's not a project itself.


What's Included

ComponentCountPurpose
Slash Commands24On-demand workflows invoked with /command
Skills0Trigger-activated expertise templates
Agents19Specialist subagents with restricted tool access
Hooks8Deterministic enforcement scripts (Python)
Project Template1Master CLAUDE.md with guide comments (used by /kc:generate-claude-md)
Tech-Stack Guides1+Unreal Engine + placeholders for future stacks
Global Template1@~/.claude/CLAUDE.md for cross-project rules

Quick Start

# 1. Clone KahnClaude somewhere permanent
git clone <repo-url>~/tools/kahnclaude
# 2. Install global config (one-time)# Open Claude Code from anywhere and run:
/kc:install-global
# 3. In any project, install the Claude layer:cd~/your-project
claude
/kc:install
# 4. Customize CLAUDE.md for your project# 5. Configure MCPs for your tools and stack (see MCP section below)# 6. Build Claude's knowledge base of your project:
/document

Step 6:/document creates an ARCHITECTURE.md and subsystem docs so Claude understands your codebase from the first session. Run it once after setup. You may document more subsystems using the /document skill. Use /learn to update documentation from the current context as you go.


MCP Servers

MCP (Model Context Protocol) servers extend Claude with real-time access to external tools, docs, and services. Add them globally with claude mcp add -s user ... or per-project with claude mcp add ....

Always Recommended

These MCPs are useful in virtually every project. MCPs are project-scoped by default. We recommend installing those globally using claude mcp add --scope user.

MCPWhat It AddsInstall
Context7Up-to-date library docs and code examples pulled at query time — eliminates hallucinated APIsclaude mcp add context7 -- npx -y @upstash/context7-mcp@latest
GitHubRead issues, PRs, and code from any repo without leaving Claudeclaude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp","headers":{"Authorization":"Bearer YOUR_GITHUB_PAT"}}'
FilesystemLets Claude read/write files outside the project root (cross-repo work, config management)claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/allow

Project-Type Recommendations

Project TypeRecommended MCPs
Web / SaaSPlaywright (browser automation, E2E testing), Figma (design specs), Notion (product docs), Linear or Jira
Game Dev (Unreal Engine)Unreal Engine MCP (Blueprint/C++ introspection), Perforce MCP (if using P4)
Data / MLPostgreSQL or SQLite MCP (query live data)
MobileFigma MCP (design handoff), Firebase or Supabase MCP
DevOpsDocker MCP, AWS/GCP/Azure MCPs

Finding More MCPs

Look for MCPs matching your specific tools and workflow — project management (Jira, Linear, Notion), design (Figma), communication (Gmail, Slack), version control (GitHub, Perforce), and tech-stack specific (Supabase, Unreal Engine...). A well-chosen MCP can eliminate entire categories of copy-paste between Claude and your tools.


Plugins

Plugins extend Claude Code itself — adding slash commands, skills, and automation at the editor level rather than at the MCP/tool level.

Always Recommended

PluginWhat It AddsInstall
claude-wardenPermission manager — pre-approves safe bash commands to eliminate repetitive allow/deny prompts/plugin marketplace add banyudu/claude-warden then /plugin install warden@claude-warden

Why warden? Claude frequently asks permission for routine commands like git status, ls, grep, etc. Warden lets you approve patterns once so they never prompt again, without weakening security for genuinely risky operations.

Finding More Plugins

Browse the Claude Code plugin marketplace from inside any session:

/plugin marketplace list

Supported Stacks

KahnClaude is language-agnostic. Components are designed to work across:

CategorySupported
LanguagesPython, Rust, C++, C#, TypeScript/JavaScript, Go
EnvironmentsWindows, WSL2, macOS, Linux
EditorsVS Code (primary), any editor with terminal access
Version ControlGit

Project Structure

kahnclaude/
├── README.md
├── CONTRIBUTING.md
├── CLAUDE.md # This repo's own Claude rules
├── LICENSE
├── .gitignore
│
├── .claude/ # All Claude components (framework + distributable)
│ ├── settings.json # Hooks wiring for this framework repo
│ ├── commands/ # Slash commands
│ │ ├── <name>.md # scope: project → distributed to projects
│ │ └── kc/ # scope: framework → KahnClaude management only
│ │ └── <name>.md # invoked as /kc:<name>
│ ├── skills/ # Triggered expertise templates
│ │ └── <name>/
│ │ └── SKILL.md
│ ├── agents/ # Specialist subagents
│ │ ├── <name>.md # Universal agents
│ │ ├── core/ # Cross-cutting specialists
│ │ ├── python/ # Python specialists
│ │ ├── web/ # Web/React specialists
│ │ └── mobile/ # React Native/Expo specialists
│ └── hooks/ # Enforcement scripts (Python only)
│ └── <name>.py
│
├── project/ # CLAUDE.md templates for new projects
│ ├── CLAUDE.md # Master template with guide comments (used by /kc:generate-claude-md)
│ ├── CLAUDE.local.md
│ └── tech-stacks/ # Tech-specific Q&A guides for auto-generation
│ ├── unreal.md # Unreal Engine detection + 8 guided questions
│ ├── react-nextjs.md # (Placeholder for future implementation)
│ └── [more stacks...].md
│
├── global/ # Global ~/.claude/ config templates
│ ├── CLAUDE.md
│ ├── settings.json
│ └── statusline.py # Status line script (installed to ~/.claude/statusline.py)
│
└── inspiration/ # Third-party reference — NEVER MODIFY

Commands — On-Demand Workflows

Invoke with /command-name inside any Claude Code session. Commands are Markdown files with YAML frontmatter. Two scopes:

  • scope: project — distributed to target projects via /kc:install; live in .claude/commands/
  • scope: framework — KahnClaude management only, never distributed; live in .claude/commands/kc/, invoked as /kc:<name>

Framework Commands

CommandWhat It Does
/kc:installInstall KahnClaude components into the current project
/kc:install-globalMerge global config into ~/.claude/ (smart merge, never overwrites)
/kc:updateUpdate installed components from the latest framework source
/kc:importAnalyze a repo's Claude Code components and selectively integrate into KahnClaude
/kc:harvestPull improvements back from a target project into KahnClaude (reverse of update)
/kc:create-agent-skillCreate a new agent, skill, or slash command following framework conventions
/kc:fix-agent-skillDebug a misbehaving agent or skill — session analysis + convention audit

Project Commands

CommandWhat It Does
/kc:generate-claude-mdAuto-detect tech stack and generate a complete CLAUDE.md; use --additive to enhance existing
/reviewReview current diff for bugs, security issues, and best practices
/commitGenerate a conventional commit message and commit staged changes
/worktreeCreate a git worktree + branch for isolated task work
/refactorRefactor a file against CLAUDE.md rules — split, extract, clean up
/progressShow file counts, test status, recent git activity, and next actions
/documentBuild or update project docs: no args = ARCHITECTURE.md index, with args = subsystem deep-dive
/learnUpdate docs from a git SHA, SHA range, a plain-text fact, or auto-detected changes
/linearImplement a Linear issue — set In Progress, branch, plan, code, test, PR
/jiraImplement a Jira issue — transition In Progress, branch, plan, code, test, PR
/prGenerate a PR title and description from the current branch diff; optionally create via gh
/linear-planBrainstorm and create or update Linear issues (planning only, no implementation)
/jira-planBrainstorm and create or update Jira issues (planning only, no implementation)
/explainExplain code in detail — overview, components, control flow, dependencies, gotchas, usage
/answerResearch a question using general knowledge, codebase search, Context7 docs, or web search
/testGenerate tests by delegating to the test-writer agent (single source of truth)
/security-checkScan for exposed secrets, missing .gitignore entries, and unsafe patterns

Skills — Triggered Expertise

Skills activate automatically when Claude detects trigger keywords in conversation. No explicit invocation needed.

No skills are included yet. Use /kc:create-agent-skill to add one.


Agents — Specialist Subagents

Agents are specialists Claude delegates to automatically. Each has restricted tool access appropriate to its role.

Universal

AgentToolsSpecialization
code-reviewerRead, Grep, GlobFinds real bugs: security → correctness → performance → maintainability
test-writerRead, Write, Grep, Glob, BashWrites behavior tests with explicit assertions and edge cases
documenterRead, Write, Edit, Grep, GlobArchitecture docs, subsystem docs, Mermaid diagrams, Decisions logs, READMEs, API specs, user manuals
api-devRead, Grep, Glob, Write, WebFetch, WebSearchDesigns REST/GraphQL contracts; produces OpenAPI/GraphQL specs
backend-devRead, Grep, Glob, Bash, Write, Edit, WebSearch, WebFetchPolyglot backend implementer; detects stack and ships production-ready features

Core (cross-cutting)

AgentToolsSpecialization
core/code-archaeologistRead, Grep, Glob, BashDeep codebase explorer; produces 11-section assessment report
core/performance-optimizerRead, Grep, Glob, BashProfiles bottlenecks and applies high-impact fixes with before/after metrics
core/tech-lead-orchestratorRead, Grep, Glob, BashOrchestrates multi-step tasks by assigning sub-agents; uses Opus 4.6

Python

AgentToolsSpecialization
python/fastapi-devRead, Write, Grep, Glob, BashFull-stack FastAPI specialist — endpoints, schemas, auth, and tests; version-aware
python/python-devRead, Write, Edit, Bash, Grep, Glob, WebFetchModern Python 3.12+ — architecture, packaging, async, type system
python/security-devRead, Grep, Glob, Bash, WebFetchCryptography, OWASP audits, auth flows, compliance
python/devops-cicd-devRead, Write, Edit, Bash, Grep, Glob, WebFetchCI/CD pipelines, Docker/K8s, IaC, cloud deployments

Web

AgentToolsSpecialization
web/frontend-devRead, Grep, Glob, Bash, Write, Edit, WebFetchUniversal UI builder; React, Svelte, or vanilla JS/TS
web/tailwind-css-devRead, Grep, Glob, Bash, Write, Edit, WebFetchTailwind CSS v4+; container queries, OKLCH themes, accessibility
web/react-component-dev(all)React 19 + Next.js App Router; RSC, shadcn/ui, accessible components
web/react-nextjs-dev(all)Next.js SSR/SSG/ISR, Server Actions, App Router, performance optimization
web/supabase-devRead, Write, Edit, Grep, Glob, Bash, WebFetchSupabase + PostgreSQL — auth, RLS, schema design, Storage, Realtime, Edge Functions

Mobile

AgentToolsSpecialization
mobile/react-native-expo-devRead, Write, Grep, Glob, BashSenior Expo/React Native specialist; TypeScript-first; checks SDK version before writing any code
mobile/react-native-component-devRead, Write, Grep, Glob, BashReusable RN UI components; component API design, design systems, Reanimated 3, accessibility

Hooks — Enforcement Over Suggestion

CLAUDE.md rules are suggestions. Hooks are deterministic — they always run as Python scripts at specific lifecycle points.

CLAUDE.md rule: "don't read .env"
→ Parsed by LLM → Weighed against context → Maybe followed
PreToolUse hook blocking .env access
→ Always executes → Exit code 2 → Operation blocked. Period.
HookEventBehavior
block-secretsPreToolUseBlocks Read/Edit on .env, SSH keys, credentials, and secret path patterns
block-dangerous-commandsPreToolUseBlocks rm -rf /, force-push to main, chmod 777, curl | sh, mkfs, and secret exfiltration
verify-no-secretsStopWarns if staged files contain secrets (AWS keys, GitHub tokens, Stripe keys, PEM)
check-branchPreToolUseBlocks git commit on main/master when KC_BRANCH_PROTECT=true or marker file present
check-env-syncStopWarns if .env has keys missing from .env.example
after-editPostToolUseAuto-formats files after edit/write: prettier (JS/TS/JSON/MD/CSS), black+ruff (Python), gofmt (Go), rustfmt (Rust)
notifyNotificationSends desktop notifications when Claude needs attention (Windows toast, macOS, Linux, terminal bell fallback)
lint-on-stopStopRuns linters at end of turn: ruff+mypy (Python), cargo check+clippy (Rust), go vet+staticcheck (Go), npm lint+tsc (Node/TS)

Hook Lifecycle

EventWhen It Fires
PreToolUseBefore Claude reads, writes, or runs a command
PostToolUseAfter Claude writes or edits a file
StopWhen Claude finishes a turn
NotificationWhen Claude sends a notification to the user

Exit Codes

CodeMeaning
0Allow — no action
1Warning — shown, operation continues
2Block — stderr fed back to Claude, operation stopped

Templates

@project/CLAUDE.md

Master template for auto-generating project-specific CLAUDE.md files. Used by /kc:generate-claude-md command to:

  • Auto-detect tech stack (Unreal, Node.js, Python, Rust, etc.)
  • Load tech-specific Q&A guides (e.g., Unreal Engine)
  • Ask guided questions about project configuration
  • Instantiate template with user answers and auto-detected versions
  • Populate all sections: Project Overview, Critical Rules, Tech Stack Details, Service Ports, etc.

Every section includes <!-- GUIDE: ... --> comments explaining purpose, format, and examples so users understand what to put where.

Tech-Stack Guides: @project/tech-stacks/

Specialized Q&A guides loaded by /kc:generate-claude-md when a tech stack is detected.

  • unreal.md — Unreal Engine (8 guided questions: version, project type, platforms, C++ vs Blueprint, plugins, content structure, build targets, do's/don'ts)
  • react-nextjs.md — React / Next.js (placeholder for future; guides in progress)
  • [more stacks].md — Additional stacks (Django, Rust, C#/.NET) can be added following the same pattern

When /kc:generate-claude-md detects a manifest file (.uproject, package.json, pyproject.toml, etc.), it loads the matching guide and asks all questions to build a complete, annotated CLAUDE.md.

@project/CLAUDE.local.md

Personal overrides — gitignored, never committed. For individual workflow preferences, local environment details, and project-specific personal notes.

@global/CLAUDE.md

Installed once at @~/.claude/CLAUDE.md. Applies security rules and coding standards across every project. Merged with any existing global config — never overwrites.

@global/settings.json

Installed once at @~/.claude/settings.json. Wires up global hooks and configures the status line. Merged with existing settings — top-level keys like statusLine are added only if absent.

@global/statusline.py

Installed to ~/.claude/statusline.py. Renders the Claude Code status line showing: cwd | branch | model | ctx% | $cost | rate-limit %. Reads JSON from stdin (Claude Code's StatusLine event). No dependencies beyond stdlib.


Key Concepts

Hooks Are Stronger Than Rules

Three layers of enforcement, strongest to weakest:

  1. .gitignore — last line of defense, filesystem-level (strongest)
  2. Hooks — guaranteed to run, blocks operations before they happen
  3. CLAUDE.md rules — behavioral suggestions (weakest — Claude can override under context pressure)

One Task, One Chat

Research shows 39% performance degradation when mixing unrelated topics in a single Claude session. Use /clear between unrelated tasks. A 2% misalignment early in a conversation can cause 40% failure by the end.

Plan First, Code Second

For non-trivial tasks, start in plan mode. Don't let Claude write code until you've agreed on the plan. Every plan step must have a unique name so you can reference and replace steps cleanly.

CLAUDE.md Is Team Memory

Every time Claude makes a mistake, add a rule to prevent it recurring. The file is in git — the whole team benefits from every lesson learned.

Hooks Are Python

All KahnClaude hooks are Python. No bash. Reasons: cross-platform (Windows, WSL, macOS, Linux), no shell quoting edge cases, stdlib-only, easy to test.


Adding Components

See CONTRIBUTING.md for the full guide.

ComponentLocationNaming
Command (project).claude/commands/<name>.mdkebab-case action verb
Command (framework).claude/commands/kc/<name>.mdkebab-case action verb; invoked as /kc:<name>
Skill.claude/skills/<name>/SKILL.mdkebab-case category
Agent.claude/agents/<name>.mdkebab-case role
Hook.claude/hooks/<name>.pyblock-, check-, lint-, verify- prefix

Contributing

See CONTRIBUTING.md. Contributions of commands, skills, agents, and hooks are welcome. Bash scripts are not — Python only.

About

Claude code generalist framework for software engineering

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages