Programmer's Guide for AI-Assisted Development
The setup-claude-project.sh script creates an optimized, language-agnostic project structure
for development with Claude Code. Version 4.0 takes advantage of mature Claude Code features: hooks,
modular rules, path-specific loading, auto-memory, and agent teams.
# Download the script
curl -O https://raw.githubusercontent.com/s220284/claude-code-setup/main/setup-claude-project.sh
# Make it executable
chmod +x setup-claude-project.sh
# Run it
./setup-claude-project.sh MyProject "A web application for task management"
# Or run interactively
./setup-claude-project.sh
# Navigate to your project
cd MyProject
# Customize rules for your language
edit .claude/rules/code-style.md
edit .claude/rules/testing.md
# Let Claude analyze your codebase
claude
> /init
# Claude automatically loads CLAUDE.md and rules at session start
/init after setup to let Claude analyze your codebase and
generate additional project-specific instructions that complement the scaffolded rules.
Scaffolded PostToolUse hook auto-fixes shell script line endings and permissions. Notification hook sends macOS alerts when Claude needs attention.
.claude/rules/ directory with path-specific YAML frontmatter. Rules load
automatically when working in matching directories.
Claude Code's built-in memory handles session continuity. SESSION_LOG.md and CONTINUATION_GUIDE.md are no longer needed.
Agent teams (experimental) are the new direction for multi-agent workflows, replacing loop-based plugins like ralph-loop.
All Python-specific references removed. Generic placeholders work with any tech stack — customize for your language.
Skills now use YAML frontmatter (name, description,
user-invocable) for proper registration with Claude Code.
| Change | Details |
|---|---|
| Removed SESSION_LOG.md | Auto-memory handles session continuity |
| Removed CONTINUATION_GUIDE.md | Generic content Claude already knows |
| Removed ralph-loop plugin | Agent teams are the new direction |
| Added .claude/rules/ | Modular, path-specific rule files |
| Added .claude/settings.local.json | Personal overrides, gitignored |
| Added Hooks in settings.json | PostToolUse shell fixer, Notification alerts |
v4.0 creates a focused set of files, each with a clear purpose:
Purpose: Main session reference — auto-loaded by Claude Code
Contains (~80 lines):
@import syntax)Purpose: Current system status snapshot
Tracks component health, production state, critical files, recent changes, and known issues. Update after completing features.
Purpose: Shared project configuration — permissions, hooks, and MCP servers
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": ["Bash(git status)", "Bash(git diff *)", "Bash(git log *)"],
"deny": ["Read(.env)", "Read(.env.*)"]
},
"hooks": {
"PostToolUse": [{ "matcher": "Write", "hooks": [{ "type": "command", "command": "..." }] }],
"Notification": [{ "matcher": "", "hooks": [{ "type": "command", "command": "..." }] }]
}
}
Purpose: Personal overrides (gitignored)
Add your own permissions, MCP servers, or hook overrides without affecting the shared configuration.
Purpose: Code conventions scoped to src/**
Uses paths: YAML frontmatter so rules only load when working on source files.
Purpose: Testing standards scoped to tests/**
Uses paths: YAML frontmatter so rules only load when working on test files.
Purpose: Commit workflow skill with YAML frontmatter
Now includes name, description, and user-invocable: true
frontmatter for proper skill registration.
Purpose: Language-agnostic CI pipeline template
Contains TODO placeholders for your language-specific setup, install, and test commands.
Claude Code's hook system lets you run commands automatically in response to events. Hooks are configured
in .claude/settings.json and execute shell commands when triggered.
Hooks fire on specific events during a Claude Code session:
| Event | When It Fires | Use Cases |
|---|---|---|
PreToolUse |
Before a tool executes | Validation, blocking dangerous operations |
PostToolUse |
After a tool executes | Auto-formatting, file fixing, notifications |
Notification |
When Claude sends a notification | System alerts, sound cues, integrations |
Each hook entry has a matcher (which tool or pattern to match) and an array of hook
commands to run.
Matcher: Write
Automatically fixes CRLF line endings and sets executable permissions on .sh files
whenever Claude writes one. This replaces the manual "Critical: Shell Script Line Endings" warning
from v3.0.
{
"matcher": "Write",
"hooks": [{
"type": "command",
"command": "jq -r '.tool_input.file_path // empty' | xargs -I{} sh -c 'case \"{}\" in *.sh) sed -i \"\" \"s/\\r$//\" \"{}\" && chmod +x \"{}\" ;; esac'"
}]
}
Matcher: "" (matches all notifications)
Sends a macOS notification when Claude Code needs your attention, so you can work in other apps while waiting.
{
"matcher": "",
"hooks": [{
"type": "command",
"command": "osascript -e 'display notification \"Claude Code needs your attention\" with title \"Claude Code\"' 2>/dev/null || true"
}]
}
To add your own hooks, edit .claude/settings.json and add entries to the appropriate event
array. Examples of useful custom hooks:
prettier or black after Write.claude/settings.local.json for personal hooks that shouldn't
be shared with the team (e.g., sound alerts or personal notification preferences).
The .claude/rules/ directory contains modular rule files that Claude loads automatically.
Rules can be scoped to specific file paths using YAML frontmatter.
.md files in .claude/rules/paths: frontmatter only activate when working on matching filesUse YAML frontmatter with paths: to scope rules to specific directories:
---
paths:
- "src/**"
---
# Code Style
- Use consistent naming conventions
- Keep functions focused
- Use environment variables for configuration
This rule only loads when Claude is working on files matching src/**.
Scope: src/**
Language-agnostic code conventions: naming, function design, configuration, security. Customize for your specific language and framework.
Scope: tests/**
Testing standards: coverage targets, test patterns, mocking strategy. Customize for your test framework.
Create new .md files in .claude/rules/ for different concerns:
# Example: .claude/rules/api-design.md
---
paths:
- "src/api/**"
- "src/routes/**"
---
# API Design Rules
- Use RESTful conventions
- Always validate request bodies
- Return consistent error formats
- Include pagination for list endpoints
@import .claude/rules/code-style.md
syntax to make the relationship explicit.
v4.0 documents available global plugins directly in CLAUDE.md. These are pre-installed capabilities you can use across all projects.
| Plugin | Skills/Agents | Purpose |
|---|---|---|
| commit-commands | /commit, /commit-push-pr, /clean_gone | Git workflow automation |
| feature-dev | /feature-dev | Guided feature development |
| pr-review-toolkit | /review-pr, code-reviewer, silent-failure-hunter, type-design-analyzer | Comprehensive PR review |
| frontend-design | /frontend-design | Production-grade UI development |
Agent teams are Claude Code's new direction for multi-agent workflows. They replace loop-based plugins like ralph-loop with a more structured approach to background processing and parallel agent coordination.
Agent teams allow you to define specialized agents that work together on complex tasks, each with their own tools and context. This is an experimental feature — check the Claude Code documentation for the latest status.
Common workflow commands available in any project:
| Task | Skill |
|---|---|
| Commit changes | /commit |
| Commit, push, and create PR | /commit-push-pr |
| Review a PR | /review-pr |
| Build a UI component | /frontend-design |
| Clean deleted remote branches | /clean_gone |
Every production code change MUST include ALL THREE:
v4.0 relies on Claude Code's auto-memory for session continuity. Claude automatically remembers context from previous sessions without manual logging.
For projects that need explicit status tracking, PROJECT_STATE.md provides a system
status snapshot. Update it after completing features or deployments.
Use relative paths or environment variables. All code must work in containers.
# WRONG
path = "/Users/username/projects/myapp"
# CORRECT
path = env_var("APP_ROOT", "/app") # Use your language's equivalent
MyProject/
├── CLAUDE.md # Main session reference (~80 lines)
├── CLAUDE.local.md # Personal overrides (gitignored)
├── PROJECT_STATE.md # System status
├── src/ # Source code
├── tests/ # Test files
├── docs/ # Documentation
├── scripts/ # Utility scripts
├── .claude/
│ ├── settings.json # Permissions, hooks, MCP config
│ ├── settings.local.json # Personal overrides (gitignored)
│ ├── rules/ # Modular rule files
│ │ ├── code-style.md # Code conventions (src/**)
│ │ └── testing.md # Testing standards (tests/**)
│ ├── hooks/ # Custom hook scripts
│ └── skills/
│ └── commit/
│ └── SKILL.md # Commit skill (with frontmatter)
└── .github/
└── workflows/
└── ci.yml # CI pipeline template
| File | Purpose | Committed |
|---|---|---|
CLAUDE.md |
Main instructions (auto-loaded) | Yes |
CLAUDE.local.md |
Personal overrides | No |
.claude/settings.json |
Shared config, hooks, permissions | Yes |
.claude/settings.local.json |
Personal config overrides | No |
.claude/rules/*.md |
Modular, path-specific rules | Yes |