← Back to Blog

Claude Code Power User: Git Automation, Context Management, and Keeping Prompts Handy

5 min read

Part 3 of 3 in the “Building with Claude Code” series


In Part 1, we set up Claude Code and made our first commit. In Part 2, we built a complete web app using Plan Mode and feature branches. Now let’s talk about the tricks that make you fast.

This post covers the techniques that turned Claude Code from “a cool AI tool” into a permanent part of my workflow.

Git Automation: Let Claude Handle the Tedious Parts

Auto-Generated Commit Messages

Writing good commit messages is important but tedious. Claude Code reads the actual diff and writes accurate messages for you:

Stage all changes and write a commit message following conventional
commits format. Summarize what changed and why.

Claude looks at every changed file, understands the semantic meaning, and writes something like:

feat: add tag filtering sidebar with real-time bookmark count

- Added TagService with methods to aggregate unique tags and counts
- Created /api/tags endpoint returning tag statistics
- Built sidebar component with clickable tag pills
- Integrated frontend filtering via fetch API
- Tags with zero bookmarks are automatically cleaned up

Piping Diffs into Claude for Code Review

This is my favorite trick. From a regular terminal:

git diff | claude -p "Review these changes for bugs, security
issues, and code quality. Be specific about file and line."

I’ve caught real issues this way — an XSS vulnerability in a Thymeleaf template, a missing null check, and an N+1 query problem.

You can do the same for pull requests:

gh pr diff 3 | claude -p "Review this PR. Focus on: security,
error handling, and API contract consistency."

The GitHub App for Automated PR Reviews

/install-github-app

This installs the Claude Code GitHub App on your repo. When you open a PR, Claude automatically reviews it and posts comments.

Tagging Releases

Create a git tag v1.0.0 with the message "Initial release:
bookmarks manager with CRUD, import/export, tag management,
and web UI". Push the tag to origin.

Then create a GitHub release:

gh release create v1.0.0 --generate-notes

Context Management: The Skill Nobody Talks About

Claude Code has a ~200K token context window. When it fills up, quality drops.

The /compact Command

/compact

Summarizes the conversation, freeing context while preserving important decisions. Run it before starting each new feature, after long debugging sessions, or whenever Claude seems to forget earlier decisions.

The /clear Command

/clear

Wipes the conversation entirely but CLAUDE.md still loads automatically. Use when switching between unrelated tasks.

When to Use Which

Situation Command
Starting a new feature /compact
Switching to an unrelated task /clear
Claude forgot something /compact, then repeat it
Long debugging session ended /compact
Starting a fresh work session Just open Claude — CLAUDE.md loads automatically

CLAUDE.md as Living Documentation

CLAUDE.md isn’t just documentation. It’s configuration for your AI teammate. Every convention you put here, Claude follows automatically. Include your tech stack, coding conventions, Git workflow, API endpoints, and architecture decisions.

Update it regularly:

Update CLAUDE.md to reflect the current state of the project.
Add any new features, endpoints, and decisions we made.

The Prompt Library System

After a weekend with Claude Code, I formalized my reusable prompts into a system with three layers:

Layer 1: PROMPTS.md in the Repo

A file at the project root containing every reusable prompt, organized by task — feature development, Git workflow, debugging, code quality. Since it’s in your repo, it travels with the project.

Layer 2: Cheat Sheet Pinned in IntelliJ

A compact markdown file with just the commands and shortcuts. Open it in IntelliJ, right-click the tab, select Pin Tab. It stays visible no matter what else you open.

Layer 3: Printed Reference Card

A one-page PDF with every command, shortcut, prompt template, and the conventional commit format. After a week, most of it becomes muscle memory.

Terminal One-Liners

Power moves that don’t require an interactive session:

# Quick question, no session needed
claude -p "What Kotlin version is this project using?"

# Review uncommitted changes
git diff | claude -p "Review these changes for issues"

# Review a PR
gh pr diff 3 | claude -p "Review this PR for bugs and security"

# Analyze logs
cat app.log | claude -p "Summarize errors and suggest fixes"

# Security scan on changed files
git diff main --name-only | claude -p "Review these files for security issues"

What I’d Do Differently Next Time

  1. Start with CLAUDE.md on day one — don’t add it as an afterthought
  2. Run /compact proactively — don’t wait until Claude starts forgetting
  3. Use Plan Mode for everything over 2 files
  4. Let Claude write every commit message
  5. Keep PROMPTS.md in the repo from the start
  6. Feature branches aren’t overhead — they’re a safety net

The Bigger Picture

This tool doesn’t replace coding skill. It amplifies it. When I gave vague prompts, I got mediocre results. When I was specific — when I used Plan Mode, structured my requests — the output was remarkable.

The developers who’ll get the most from Claude Code are the ones who already know what good code looks like and can articulate what they want. The AI handles the typing; you handle the thinking.


Full Series

  • Part 1: Getting Started with Claude Code — Setup, IntelliJ, CLAUDE.md, first commit
  • Part 2: Building a Web App with Claude Code — Plan Mode, feature branches, debugging
  • Part 3: Claude Code Power User — Git automation, context management, prompt libraries (you are here)

All code is on GitHub.