# Claude Code Starter Setup

A minimal, opinionated Claude Code configuration you can adapt for your own projects.
Strip it back, swap the values, make it yours.

---

## CLAUDE.md template

Drop this in your project root. Claude reads it at session start.

```markdown
# project-name

REQ: One sentence -- what does this project do and for whom?

PRE:
- Stack: [e.g. Astro + TypeScript / Next.js + Postgres / FastAPI + React]
- Style: Functional, typed, no any, compiles clean
- Tests: [unit / integration / e2e / none]

## Intent Declaration

Before acting, classify:
- "file / save / log"    -> CREATE
- "find / search / show" -> QUERY
- "update / fix / edit"  -> MODIFY
- "build / create / make"-> BUILD

If ambiguous, ask one clarifying question before acting.

## Code Rules
- Greenfield: prefer clean rewrites over backwards-compatible workarounds
- Commits: type(scope): description -- no AI attribution
- No comments explaining WHAT the code does -- only WHY if non-obvious
```

---

## Global CLAUDE.md (~/.claude/CLAUDE.md)

Settings that apply across every project.

```markdown
# Global Claude Context

## Cross-Project Rules

**Paths:** Never hardcode absolute paths. Use:
- Python: Path(__file__).resolve().parent
- JS/TS:  new URL('.', import.meta.url)

**Commit Rules:**
- Never add "Co-Authored-By: Claude" or AI attribution
- Never skip hooks (--no-verify) unless explicitly asked
- Conventional commits: type(scope): description

## Code Philosophy
- Greenfield = clean implementation, no backward-compat workarounds
- Before preserving legacy code: confirm deployed + real users depend on it
- Don't add error handling for scenarios that can't happen
- Default to writing no comments
```

---

## Custom skill example

Skills live in `~/.claude/skills/`. Invoke with `/skill-name`.

```markdown
---
name: dev-session
description: Start a dev session -- load project context, orient, check tasks
---

1. Read CLAUDE.md for project context
2. Check git status and recent commits
3. Load any task list or README from the project
4. Report: current branch, what's in progress, any blockers
5. Ask: "What are we working on today?"
```

---

## Stop hook (auto session summary)

`~/.claude/hooks/stop.sh`

```bash
#!/bin/bash
# Fires at end of every Claude Code session

SUMMARY_FILE="$HOME/second-brain/vault/00_Dashboard/Dev Sessions.md"

if [ -f "$SUMMARY_FILE" ]; then
  echo "Session ended. Context saved to vault."
fi
```

---

## Tips

- Keep `CLAUDE.md` short. Claude reads it every session -- bloat slows the orient phase.
- Use `PRE:` to declare your actual conventions, not aspirational ones.
- The `Intent Declaration` block prevents Claude from acting on ambiguous requests without checking first. Worth keeping.
- Add project-specific env vars to `CLAUDE.md` so Claude knows what to expect.

---

*From digitalmakertechnology.studio*
