claude-code-infrastructure-showcase README

The project's README from github.com/diet103/claude-code-infrastructure-showcase. As one markdown file: README.md.

Claude Code Infrastructure Showcase

A curated reference library of production-tested Claude Code infrastructure.

Born from 6 months of real-world use managing a complex TypeScript microservices project, this showcase provides the patterns and systems that solved the "skills don't activate automatically" problem and scaled Claude Code for enterprise development.

This is NOT a working application - it's a reference library. Copy what you need into your own projects.

New to Claude Code infrastructure? Three terms cover 90% of this README:

Full explanations in Key Concepts.


What's Inside

Production-tested infrastructure for:

Time investment to build: 6 months of iteration Time to integrate into your project: 15-30 minutes


Quick Start

Requirements

Note: the first npx tsx run may ask to install tsx - say yes.

The wizard copies everything, installs dependencies, and configures your mode:

# 1. Clone this repo
git clone https://github.com/diet103/claude-code-infrastructure-showcase.git

# 2. Run the setup wizard, pointing to YOUR project
cd claude-code-infrastructure-showcase
npx tsx setup.ts ~/my-project

The wizard will:

Scripting it, or letting Claude Code run it? Add --yes: npx tsx setup.ts ~/my-project --yes (see --help for all flags)

Option B: Manual (3 Commands)

# 1. Clone this repo
git clone https://github.com/diet103/claude-code-infrastructure-showcase.git

# 2. Copy .claude/ into YOUR project
cp -r claude-code-infrastructure-showcase/.claude ~/my-project/.claude

# 3. Install hook dependencies
cd ~/my-project/.claude/hooks && npm install && chmod +x *.sh

Option C: Let Claude Code Do It (Easiest)

Don't want to touch the terminal? Open Claude Code in your project and paste this:

Clone https://github.com/diet103/claude-code-infrastructure-showcase to a temp
directory and read its CLAUDE_INTEGRATION_GUIDE.md. Then install the
infrastructure into this project by running the setup wizard non-interactively
(npx tsx setup.ts <this project's absolute path> --yes). When it finishes, show
me the verification results and fix anything that failed.

Claude clones the repo, runs the wizard (which verifies its own work), and reports back.

Verify It Works (30 Seconds)

Any time, from your project root:

bash .claude/scripts/verify-setup.sh

Eight checks - Node version, hook registration, executable bits, dependencies, config validity, even firing a test prompt through the real activation hook - each with an exact fix command if it fails. Or ask Claude to run /verify-setup and it fixes failures itself.

Enable AI-Powered Classification (Optional)

No API key needed by default. The standard mode uses regex/keyword matching - free, offline, zero API calls. AI classification is an optional upgrade that matches your intent instead of your keywords.

To enable it (Gemini's free tier easily covers this use case):

# 1. Get a free Gemini API key: https://aistudio.google.com/apikey

# 2. Put it in the hooks .env file:
cp .claude/hooks/.env.example .claude/hooks/.env
# then open .claude/hooks/.env and uncomment: GEMINI_API_KEY=your-key-here
# (add .env to your project's .gitignore so you never commit it)

# 3. Enable AI mode - edit .claude/skills/skill-rules.json and change:
#   "skill_activation_mode": "disabled"  →  "skill_activation_mode": "fallback"

Prefer environment variables? export GEMINI_API_KEY=your-key in ~/.bashrc works too - the hooks read both. (fallback mode always degrades gracefully: no key, dead network, slow provider - you get regex matching, never a broken prompt.)

Upgrading an Existing Install

Re-running the wizard on a project that already has .claude/ deliberately copies no files - it only re-chmods hooks, updates skill-rules.json settings, and reinstalls dependencies. It will never clobber your customized skill-rules.json or skills.

To pick up new files from a newer version of this repo:

Editor Setup (Optional)

The repo includes a NeoVim configuration optimized for Claude Code's prompt editing mode (Ctrl+G):

The setup wizard can install this automatically, or manually:

mkdir -p ~/.config/nvim
cp editor-config/init.lua ~/.config/nvim/init.lua
cp editor-config/vimrc ~/.vimrc
echo 'export EDITOR=nvim' >> ~/.bashrc && source ~/.bashrc

See editor-config/README.md for full keybinding reference.

What You'll See

After setup, when you type "create a React component" in Claude Code:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⛔ MANDATORY SKILL ACTIVATION REQUIRED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

You MUST activate these skills BEFORE any action:
  → frontend-dev-guidelines

⚠️ EDITS WILL BE BLOCKED until mandatory skills are activated.
Your FIRST action must be: Skill tool calls.
[via regex]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Skills auto-activate based on your prompts. No more forgetting to load them.


Pick Your Path

🤖 Using Claude Code to Integrate?

Claude: Read CLAUDE_INTEGRATION_GUIDE.md for step-by-step integration instructions tailored for AI-assisted setup.

📚 Browse the Skills Catalog

Available skills (full catalog):

🤖 Specialized Agents

8 production-tested agents for complex tasks (full list):


What Makes This Different?

The Auto-Activation Breakthrough

Problem: Claude Code skills just sit there. You have to remember to use them.

Solution: UserPromptSubmit hook that:

Result: Skills activate when you need them, not when you remember them.

AI-Powered Classification (NEW in v2.0)

Choose your activation mode:

Mode How It Works Cost Offline
disabled (default) Regex/keyword matching only Free Yes
fallback AI first, regex on failure Low Graceful
ai-only Pure AI classification Low No

Supported AI providers:

Provider Model API Key Free Tier
Gemini gemini-3-flash-preview GEMINI_API_KEY Yes (generous)
OpenAI gpt-4o-mini OPENAI_API_KEY No
Anthropic claude-haiku-4-5 ANTHROPIC_API_KEY No
Ollama llama3.2 (local) None needed Yes (local)

Auto-detection tries providers in order: Gemini > OpenAI > Anthropic > Ollama. Override with SKILL_AI_PROVIDER=gemini.

Conservativeness levels control suggestion aggressiveness:

Production-Tested Patterns

These aren't theoretical examples - they're extracted from:

The patterns work because they solved real problems.

Modular Skills (500-Line Rule)

Large skills hit context limits. The solution:

skill-name/
  SKILL.md                  # <500 lines, high-level guide
  resources/
    topic-1.md              # aim for <500 lines each
    topic-2.md
    topic-3.md

Progressive disclosure: Claude loads main skill first, loads resources only when needed.


Repository Structure

.claude/
├── skills/                 # 4 production skills
│   ├── backend-dev-guidelines/  (11 resource files)
│   ├── frontend-dev-guidelines/ (10 resource files)
│   ├── skill-developer/         (6 resource files)
│   ├── error-tracking/
│   └── skill-rules.json    # Skill activation configuration
├── hooks/                  # 9 hooks for automation
│   ├── skill-activation-prompt.*  (ESSENTIAL)
│   ├── skill-verification-guard.* (ESSENTIAL, v2.0)
│   ├── skill-activation-tracker.* (ESSENTIAL, v2.0)
│   ├── post-tool-use-tracker.sh   (ESSENTIAL)
│   ├── session-doc-updater.*      (optional, installed by default)
│   ├── error-handling-reminder.*  (optional)
│   ├── stop-build-check-enhanced.sh (optional)
│   ├── tsc-check.sh        (optional, needs customization)
│   └── trigger-build-resolver.sh  (optional)
├── agents/                 # 8 specialized agents
│   ├── code-architecture-reviewer.md
│   ├── refactor-planner.md
│   ├── frontend-error-fixer.md
│   └── ... 5 more
├── commands/               # 4 slash commands
│   ├── dev-docs.md
│   ├── verify-setup.md
│   └── ...
└── scripts/
    └── verify-setup.sh     # One-command health check

dev/
└── active/                 # Dev docs pattern examples
    └── showcase-ai-upgrade/

Component Catalog

🎨 Skills (4)

Skill Lines Purpose Best For
skill-developer 426 Creating and managing skills Meta-development
backend-dev-guidelines 304 Express/Prisma/Sentry patterns Backend APIs
frontend-dev-guidelines 398 React/MUI v7/TypeScript React frontends
error-tracking ~250 Sentry integration Error monitoring

All skills follow the modular pattern - main file + resource files for progressive disclosure.

👉 How to integrate skills →

🪝 Hooks (9)

Hook Type Essential? Customization
skill-activation-prompt UserPromptSubmit ✅ YES ✅ None needed
skill-verification-guard PreToolUse ✅ YES (v2.0) ✅ None needed
skill-activation-tracker PostToolUse (Skill) ✅ YES (v2.0) ✅ None needed
post-tool-use-tracker PostToolUse (Edit) ✅ YES ✅ None needed
tsc-check Stop ⚠️ Optional ⚠️ Heavy - monorepo only
trigger-build-resolver Stop ⚠️ Optional ⚠️ Heavy - monorepo only
error-handling-reminder Stop ⚠️ Optional ⚠️ Moderate
stop-build-check-enhanced Stop ⚠️ Optional ⚠️ Moderate
session-doc-updater Stop ⚠️ Optional (installed by default) ✅ None - no-ops until session indexing is configured (CONFIG.md)

Hook types: UserPromptSubmit fires on every prompt you send; PreToolUse fires before each Edit/Write; PostToolUse fires after; Stop fires when Claude finishes responding.

New in v2.0:

Start with the essential hooks - they enable skill auto-activation and work out of the box.

👉 Hook setup guide →

🤖 Agents (8)

Standalone - just copy and use!

Agent Purpose
code-architecture-reviewer Review code for architectural consistency
code-refactor-master Plan and execute refactoring
documentation-architect Generate comprehensive documentation
frontend-error-fixer Debug frontend errors
plan-reviewer Review development plans
refactor-planner Create refactoring strategies
web-research-specialist Research technical issues online
auto-error-resolver Auto-fix TypeScript errors

👉 How agents work →

💬 Slash Commands (4)

Command Purpose
/dev-docs Create structured dev documentation
/dev-docs-update Update docs before context reset
/verify-setup Run the infrastructure health check and fix failures
/route-research-for-testing Research route patterns for testing

Key Concepts

Hooks + skill-rules.json = Auto-Activation

The system:

  1. skill-activation-prompt hook runs on every user prompt
  2. Checks skill-rules.json for trigger patterns
  3. Suggests relevant skills automatically
  4. Skills load only when needed

This solves the #1 problem with Claude Code skills: they don't activate on their own.

Progressive Disclosure (500-Line Rule)

Problem: Large skills hit context limits

Solution: Modular structure

Example: backend-dev-guidelines has 11 resource files covering routing, controllers, services, repositories, testing, etc.

Dev Docs Pattern

Problem: Context resets lose project context

Solution: Three-file structure

Works with: /dev-docs slash command to generate these automatically


Works with Codex Too (Cross-Agent Support)

Codex CLI's hooks system uses the same events, stdin schema, and exit-code semantics as Claude Code, and skills follow the cross-agent Agent Skills standard. This repo ships both wired up — one canonical codebase, zero forked scripts:

Setup:

  1. Install Codex natively in your shell environment (npm i -g @openai/codex). If you're on WSL, don't use a Windows-side install through the interop layer — hooks would run as Windows processes with UNC paths.
  2. Launch codex from the repo root. On first run Codex asks you to trust this project's hooks — accept (trust is hash-persisted in ~/.codex/config.toml, and re-prompted if the hook config changes).
  3. That's it. Prompt-time skill suggestions, edit blocking for block-enforced skills (two-try model included), file tracking, session-state, and the activation telemetry (state/metrics.jsonl) all run identically under both agents — same state directory, same metrics, one skill-rules.json.

Known parity gap: Codex has no Skill tool event, so the PostToolUse tracker that clears mandatory_pending early never fires there; the two-try model bounds the cost at one advisory block per skill per session. .codex/agents/ is an experimental subagent port and not wired into any of this.


⚠️ Important: What Won't Work As-Is

settings.json

The included settings.json works out of the box for the essential hooks (UserPromptSubmit, PreToolUse, PostToolUse). If you add optional Stop hooks (tsc-check, build-check), those need customization for your project structure. Note that the shipped settings.json contains hook registrations only - permissions are yours to manage (e.g. via /permissions in Claude Code).

Blog Domain Examples

Skills use generic blog examples (Post/Comment/User):

Hook Directory Structures

Some hooks expect specific structures:


Integration Workflow

Recommended approach:

Option A: Setup Wizard (Fastest)

npx tsx setup.ts ~/my-project          # interactive
npx tsx setup.ts ~/my-project --yes    # non-interactive (what Claude Code uses)

The wizard handles everything: tech detection, mode selection, provider config, dependency install, and a self-verification pass at the end.

Option B: Manual Setup

Phase 1: Skill Activation (15 min)

  1. Copy all essential hooks (skill-activation-prompt, skill-verification-guard, skill-activation-tracker, post-tool-use-tracker)
  2. Update settings.json with hook registrations
  3. Install hook dependencies: cd .claude/hooks && npm install
  4. Make shell scripts executable: chmod +x .claude/hooks/*.sh

Phase 2: Add First Skill (10 min)

  1. Pick ONE relevant skill
  2. Copy skill directory
  3. Create/update skill-rules.json
  4. Customize path patterns

Phase 3: Enable AI (Optional, 5 min)

  1. Edit `.clau

claude-code-infrastructure-showcase (diet103/claude-code-infrastructure-showcase)

Searching Database…

这是什么东西?一个经过精选的参考资料库,收录了在生产环境中实际验证过的 Claude Code 基础设施——hooks、skills 和 agents,全部提炼自在一个真实的 TypeScript 微服务项目上连续 6 个月的日常使用。它解决了 skills 不会自动激活的问题,并展示了让 Claude Code 在企业级开发中扩展规模的实践模式。
所以它不是一个我能运行的应用——那我到底能得到什么?它明确不是一个可运行的应用。你得到的是一个 .claude/ 目录,里面有 hooks、skills、agents 和斜杠命令(还有一个对应的 .codex/ 目录),以及一个安装向导,可以把这些内容复制到你自己的项目里。
我怎么把它装到我的项目里?用 npx tsx setup.ts ~/my-project 运行安装向导——它会复制所有内容、安装依赖、识别你的技术栈(React、Express、Prisma 等),并通过 8 项健康检查完成自检;另外还有手动 3 条命令的方式和让 Claude Code 全权代劳的选项。README 估计集成需要 15-30 分钟,而且 /verify-setup 随时可以重新跑一遍检查,大约 30 秒完成。
开始之前我需要装好什么?Node.js 18+(推荐 20+)和 npm;只有启用可选的 Stop hooks 时才需要 jq。第一次运行 npx tsx 时可能会提示安装 tsx——同意即可。
有没有平台方面的坑?有——这些 hooks 是 bash 脚本,所以 Windows 的 cmd/PowerShell 直接跑不了;Windows 用户需要 WSL2。macOS 和 Linux 可以原生运行。
skill 自动激活会把我的提示词发送到 API 吗?默认不会:激活使用的是正则/关键词匹配——免费、离线、零 API 调用。AI 分类是可选的升级功能(可选 Gemini 免费额度、OpenAI、Anthropic 或本地 Ollama),一旦服务不可用会自动退回到正则匹配。
自动激活到底解决了什么问题?Claude Code 的 skills 通常就静静躺在那里,直到你自己想起来去加载它们。一个 UserPromptSubmit hook(skill-activation-prompt)会在每条提示词上运行,把 skill-rules.json 里的触发模式和你的提示词及文件上下文进行比对,自动推荐相关的 skills——v2.0 还加入了校验防护,在编辑代码前强制执行必需的 skill 激活,采用两次机会的拦截机制。
开箱即用的东西具体有哪些?4 个模块化 skills(后端和前端开发规范、Sentry 错误跟踪,以及一个面向 skill 开发者的元 skill)、9 个 hooks——4 个是核心的,其余是可选的 Stop 检查(比如 tsc-check)、8 个专业 agents(例如 auto-error-resolver、code-architecture-reviewer 和 web-research-specialist),还有 4 个斜杠命令,包括 /dev-docs 和 /verify-setup。
它能配合 Claude Code 以外的编程 agent 使用吗?可以——Codex CLI 开箱即支持。Skills 会镜像到 .agents/skills/,这是 Agent Skills 标准位置,Codex 和其他 30 多个工具都能原生读取;.codex/hooks.json 则通过一个轻量的适配层注册同样的 4 个生命周期 hooks——只有一份规范的代码库,不会产生分叉的脚本。
为什么 skills 要限制在 500 行以内?过大的 skills 会撑爆模型的上下文限制。因此每个 skill 都是模块化的:一个 500 行以内的主 SKILL.md,包含概览和导航,再加上 Claude 只在需要时才加载的资源文件——仅 backend-dev-guidelines 一个就有 11 个资源文件。dev-docs 系统同样基于这种渐进式披露的思路,即使上下文被重置也能保留文档。
Creator
diet103
Size
0.3 MB
Stars
10K
Updated
CommitJul 12
Age
11mo
Commits · 90 Days