Skip to content

anipotts/claude-code-tips

claude-code-tips

CI GitHub stars last commit tested with license

my claude code setup, open source. hooks, agents, tips, and a plugin that mines your usage data.

if this saves you time, star it. it helps others find it.

quick start

claude plugin add anipotts/mine   # install the mine plugin

then: copy safety-guard.sh to block dangerous commands. read a tip. done.


the numbers

hundreds of sessions across dozens of projects. $200/mo max plan.

same usage would cost ~$12K on the API with caching, ~$95K without. no autonomous loops. no cron jobs. every session starts with me typing a prompt. how the cost math works →

mine stats showing sessions, tokens, costs, and projects


install the mine plugin

claude plugin add anipotts/mine

you get mine · session mining to sqlite. costs, search, error memory, pattern detection. all data stays local at ~/.claude/mine.db.

/mine                     today's sessions, cost, top tools
/mine search "websocket"  full-text search across all conversations
/mine mistakes            error patterns claude keeps repeating
/mine hotspots            most-edited files across sessions
/mine loops               repeated patterns across sessions

start with mine + the safety-guard hook. add more as you go. mine docs →


the 3 things that changed how i code

hooks

hooks are the difference between "claude does what i want" and "claude does whatever it feels like." CLAUDE.md gives guidance. hooks give enforcement. one is a suggestion, the other is a wall.

i run 11 hooks on every session. safety-guard blocks force pushes, rm -rf /, and curl | bash. no-squash blocks squash merges. context-save preserves state before compaction. my full hook philosophy →

agent teams

multiple claude instances working simultaneously on the same codebase, each in its own git worktree. the coordinator assigns tasks, collects results, merges the best approach.

i use this for parallel research, trying risky changes safely, and comparing approaches side-by-side without touching my working tree. how i use agent teams →

prompt caching

this is why the $200/mo plan is the best deal in AI coding. claude code caches your system prompt, tools, and CLAUDE.md as a prefix. 91% of my input tokens hit the cache, meaning i pay 10% of the input cost on 91% of my reads.

the key: keep your CLAUDE.md short and stable. every edit breaks the prefix cache. mine is 30 lines and changes maybe once a week. the full cost breakdown →


tips

short, standalone techniques. each one is something you can use in your next session.

tip what you learn
prompt caching get 97%+ cache hit rates, slash your bill
safety hooks block force pushes and rm -rf in 5 minutes
settings hierarchy project vs global vs local settings
session length why shorter sessions are more efficient (with data)
ultrathink force extended thinking for complex problems
context management compaction strategies, active tool rate, keeping sessions tight
plan mode when planning saves time vs when it wastes it
fast mode same model, faster output, the tradeoff
plugins build a plugin from scratch, what makes one worth installing
subagents agent teams, worktree isolation, when parallel pays off
mcp integration wire up MCP servers, use them inside sessions
hooks v2 command vs http vs prompt hooks, the async pattern

hooks

copy one, wire it up, done. each is a standalone bash script. full guide →

hook event what it does
safety-guard PreToolUse blocks force push, rm -rf /, DROP TABLE, curl-pipe-sh
no-squash PreToolUse blocks squash merges
panopticon PostToolUse logs every tool call to sqlite
context-save PreCompact saves context before compression
notify Notification routes to macOS, Slack, ntfy
6 more hooks
hook event what it does
commit-nudge PostToolUse reminds you to commit after N edits
replay-capture PostToolUse captures file changes for VHS replays
version-stamp SessionEnd auto-updates "tested with" stamps
stale-branch SessionStart warns about gone tracking branches
md-lint-fix PostToolUse auto-fixes markdown lint on save
knowledge-builder PostToolUse builds a codebase knowledge graph

safety-guard blocking a dangerous command

example agents

copy to .claude/agents/ and invoke with /agent <name>. each teaches a different pattern. guide →

agent pattern what it does
watch-tests daemon watches files, runs tests, proposes fixes
try-worktree worktree tries risky changes in isolated worktrees
arch-review quick review fast architecture smell-test
write-pr git integration PR descriptions from your diff

commands i use

command what it does
/mine usage data · costs, sessions, search, patterns
/ship stage, commit, push, open PR in one command
/improve propose CLAUDE.md updates from git history

plus 3 example commands you can copy: /sweep, /quicktest, /replay.


my personal takes

what
cost reality what claude code actually costs, the prompt caching math
mistakes i made what burned me so you can skip it
my stack the automation setup i actually run
session workflow how i work day-to-day with claude code
worktrees parallel exploration with the desktop app

vs the alternatives

diplomatic, data-driven, no FUD. every claim cites a source.

vs cursor · vs codex · vs gemini · vs antigravity · pricing


examples


how this repo works

this repo runs on its own patterns.

  • 12 CI workflows · docs audit, competitive intel, community digest, freshness check, stale cleanup, dependabot, releases, plugin smoke test, PR quality gate, validation, claude responder, upstream watcher
  • 11 hooks running on every session
  • <$1/month CI cost · AI-powered workflows use haiku
  • 0 manual maintenance · everything that doesn't require taste is automated

automation details →


tools i built from these patterns

these all came out of living in claude code every day. each solves a specific problem i kept hitting.

  • mine · session mining to sqlite. costs, search, error memory, pattern detection
  • claudemon · real-time session monitoring across projects and machines
  • cc · multi-session awareness. see what other sessions are doing, send messages between them
  • imessage-mcp · MCP server for read-only iMessage history. 26 tools, zero network requests

more from me


MIT · built by anipotts

Packages

 
 
 

Contributors

Languages