Skip to content
FrankX.AI

Claude Code Templates & Starter Kit (CLAUDE.md, Skills, Settings & Hooks)

6 min read•11/2/2026•Frank

For software engineers and technical founders setting up a new repository for coding agents: a clean Claude Code starter kit prevents context bloat, accidental destructive commands, and repeated onboarding prompts. Verified as of November 2026 across Next.js, Python, and TypeScript monorepos, the five copy-paste templates below give you a working CLAUDE.md, .claude/settings.json, SKILL.md, /ship slash command, and secret-guard hook in under fifteen minutes.

What is the recommended .claude/ directory structure?

A maintainable repository separates always-on invariants (CLAUDE.md) from on-demand workflows (skills/, commands/, agents/) and machine enforcement (settings.json hooks):

your-repo/
├── CLAUDE.md                                   # Always-on repo contract (80–150 lines)
├── AGENTS.md                                   # Cross-harness contract for Codex / OpenCode
├── .mcp.json                                   # Project-scoped MCP server definitions
└── .claude/
    ├── settings.json                           # Committed permissions + PreToolUse/PostToolUse hooks
    ├── settings.local.json                     # Gitignored personal overrides
    ├── skills/
    │   └── release-gate/
    │       ├── SKILL.md                        # Progressive-disclosure domain instructions
    │       └── scripts/verify-links.mjs        # Deterministic validator script
    ├── commands/
    │   └── ship.md                             # Explicit /ship operator workflow
    └── agents/
        └── code-reviewer.md                    # Isolated read-only verification subagent
FileLoaded into contextCommitted to GitPrimary responsibility
CLAUDE.mdEvery session turnYesBuild/test commands, architecture map, non-negotiable rules
.claude/settings.jsonHarness config parserYesSafe tool allowlists, denied destructive commands, hooks
.claude/skills/<name>/SKILL.mdYAML header at boot; body on matchYesSpecialized domain rules (UI, SQL, SEO, testing)
.claude/commands/<name>.mdOnly when /name runsYesRepeatable multi-step operator sequences
.claude/agents/<name>.mdIsolated subagent windowYesIndependent review or broad codebase exploration

Template 1: Lean CLAUDE.md repository contract

Keep CLAUDE.md concise and operational. Every command listed here should be verified in CI so the agent can self-check its work before summarizing.

# Project: Acme Web Platform

## Stack & commands
- Runtime: Node 22, Next.js 16 App Router, TypeScript strict, Tailwind CSS, Vitest
- Install: `pnpm install --frozen-lockfile`
- Type check: `pnpm run type-check`
- Unit tests: `pnpm test`
- Build gate: `pnpm run build`

## Architecture boundaries
- `app/` — Server Components by default; add `'use client'` at leaf interactive controls only
- `lib/db/` — Drizzle queries and schema migrations; all writes require Zod input validation
- `components/ui/` — Shared accessible primitives; preserve keyboard focus rings and ARIA labels

## Git & pull request protocol
- Create feature branches named `agent/<harness>/<scope>` from `origin/main`
- Run `pnpm run type-check && pnpm test` before every commit
- Never commit `.env*` files, API keys, or customer PII fixtures
- Keep edits surgical to the requested scope

Template 2: .claude/settings.json with safe permissions and hooks

Commit a balanced .claude/settings.json that pre-approves routine test and inspection commands, blocks destructive flags, and runs automatic formatting or secret checks on file edits:

{
  "permissions": {
    "allow": [
      "Bash(pnpm run type-check)",
      "Bash(pnpm test*)",
      "Bash(pnpm run lint*)",
      "Bash(git status*)",
      "Bash(git diff*)",
      "Bash(git log*)"
    ],
    "deny": [
      "Bash(rm -rf /)",
      "Bash(git push --force*)",
      "Bash(git reset --hard*)",
      "Read(.env)",
      "Read(.env.local)",
      "Read(.env.production)"
    ]
  },
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "node scripts/hooks/block-protected-files.mjs"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "npx prettier --write --ignore-unknown \"$CLAUDE_FILE_PATHS\""
          }
        ]
      }
    ]
  }
}

And here is the zero-dependency scripts/hooks/block-protected-files.mjs guard referenced above (exits code 2 so Claude Code halts the write and explains why):

#!/usr/bin/env node
import fs from 'node:fs'

const payload = JSON.parse(fs.readFileSync(0, 'utf8') || '{}')
const filePath = String(payload?.tool_input?.file_path ?? '')
const protectedPatterns = [/^\.env($|\.)/, /^pnpm-lock\.yaml$/, /^migrations\/locked\//]

if (protectedPatterns.some((rx) => rx.test(filePath))) {
  process.stderr.write(`Blocked edit to protected path: ${filePath}. Ask human operator first.\n`)
  process.exit(2)
}

Template 3: Progressive-disclosure SKILL.md

Write the description field in third person with explicit trigger terms (Use when...). That single field determines whether Claude loads the skill at the right moment.

---
name: api-route-hardening
description: Enforce Zod request validation, rate-limit headers, structured error envelopes, and integration tests on Next.js Route Handlers. Use when creating or modifying files under app/api/.
---

# API route hardening

## Required checklist
1. Parse request body, query params, and headers through a strict `zod` schema before business logic.
2. Return consistent JSON error shapes: `{ error: { code: string, message: string, requestId: string } }`.
3. Enforce authentication and tenant authorization prior to any database read or mutation.
4. Set explicit `Cache-Control` headers (`no-store` on authenticated or mutating endpoints).
5. Add or update a `node:test` or `vitest` case covering `200`, `400` validation failure, and `401` unauthorized responses.

You can generate tailored SKILL.md files interactively in the FrankX Skill Builder or browse 114 production examples in frankxai/claude-skills-library.

Template 4: /ship slash command (.claude/commands/ship.md)

Slash commands turn a multi-step pre-PR ritual into a deterministic four-letter invocation:

---
description: Run type-check, tests, diff audit, and open a draft pull request
---

Execute the pre-release verification sequence for the current branch:

1. Verify we are on a feature branch (`git branch --show-current` must differ from `main`).
2. Run `pnpm run type-check` and `pnpm test`. Stop immediately and fix any failure before continuing.
3. Inspect `git diff origin/main...HEAD` for unintended debug logs, secrets, or out-of-scope file edits.
4. Stage verified files, write a conventional commit message explaining the mechanism changed, push the branch, and open a draft pull request with test output attached.

Template 5: Independent reviewer subagent (.claude/agents/code-reviewer.md)

Subagents shine when given read-only tools so an independent context window critiques the work produced by your main session:

---
name: code-reviewer
description: Independent read-only reviewer for pull request diffs, security boundaries, and test coverage.
tools: Read, Grep, Glob, Bash(git diff*), Bash(git log*)
---

You are an independent technical reviewer auditing the current branch diff against `origin/main`.

1. Check every modified route, database query, and external call for unhandled failure states, injection risks, or missing auth checks.
2. Verify tests exercise real system behavior against concrete fixtures and verifiable failure states.
3. Report findings with exact `file:line` references grouped into `Blocker` and `Improvement`, ending with `VERDICT: PASS` or `VERDICT: FAIL`.

Next steps

Audience decisions

One call per audience. The source on the row is the page the call has to survive.

Adopt, wait, or skip by audience
AudienceCallWhySource
Engineers onboarding a single repository to Claude CodeAdoptCommitting a 100-line CLAUDE.md, .claude/settings.json, and one release-gate SKILL.md takes fifteen minutes and eliminates repeated test approvals and context drift.docs.anthropic.com/en/docs/claude-code/memory
Teams running Claude Code alongside Codex CLI or CursorAdoptStoring domain checklists in the standard SKILL.md folder layout and mirroring core build rules in AGENTS.md lets every developer harness share one source of truth.agentskills.io
Solo prototypes under 500 lines of throwaway codeSkipA two-hour spike needs zero custom hooks or subagent profiles; add the starter kit once the repository graduates to pull requests and CI.github.com/frankxai/claude-skills-library

Frequently asked questions

Where do Claude Code templates live inside a repository?

Root instruction contract at CLAUDE.md, shared permissions and hooks at .claude/settings.json, reusable skills at .claude/skills/<name>/SKILL.md, slash commands at .claude/commands/<name>.md, and isolated subagents at .claude/agents/<name>.md.

How big should a production CLAUDE.md file be?

Aim for 80 to 150 lines. Every line in CLAUDE.md is injected into every session turn, so moving specialized playbooks into progressive-disclosure SKILL.md files preserves context budget and improves instruction adherence.

Can I install ready-made Claude Code templates with one command?

Yes. Run /plugin marketplace add frankxai/claude-skills-library inside Claude Code or generate custom templates in the interactive FrankX Skill Builder at /skills/builder.

Keep learning

Continue in the Learn Hub

Curated videos, official docs, and expert channels for the platforms this guide touches.