I open-sourced my Claude Code setup
by Piotrek ยท Feb 1, 2025 ยท dotclaude
I open-sourced my entire Claude Code setup โ inlcuding hooks, agents, and skills.
With this setup, you get:
- Auto-formatting after every edit
- Secret detection that blocks API keys
- Type checking when Claude finishes work
- Specialized agents for frontend/backend/debugging
Here's how it works ๐
The Problem
Claude Code uses four different scopes in its scope system:
- Enterprise managed policy (highest priority) โ set by admins, users can't override
- ~/.claude/settings.json โ user global
- .claude/settings.json โ project (can be committed)
- .claude/settings.local.json โ project local (gitignored)
If your're on Pro/Max plan, you only have access to levels 2-4. The enterprise managed policies are for organizations that need to enforce policies across all their developers.
In this article, we'll focus on level 2, user global.
The problem with config files that live in ~/.claude is that:
- they're not version-controlled
- they can't be shared across machines
- they can't be collaborated on or forked from others' configs
What this means is that you'll typically have to copy and paste your config files to each new machine you work on. Not ideal.
The Solution: Symlinks
To solve this, we can make a git repo the single source of truth by creating symlinks to the repo files.
Instead of copying files to ~/.claude, we can point ~/.claude at the repo:
~/.claude/hooks โ ~/[your-home-directory]/dotclaude/hooks
Now when Claude reads ~/.claude/hooks/[some-hook-file], it's actually reading from your git repo.
This is an elegant solution that allows you constantly tweak your setup and don't have to worry where your latest version is stored.
Of course, this would also work if we git init directly in ~/.claude. It's one less directory to think about. But I prefer to keep my git repos in a separate directory. It's easier, but also safer, since you can't accidentally commit secrets, credentials, or other sensitive information to your main repo. So a very carefully crafted .gitignore is a must.
Also, on a new machine, you can't just git clone - CC creates ~/.claude with its own files first.
What's Included
- ๐ก๏ธ Security hooks โ block hardcoded secrets, dangerous commands
- โจ Auto-format โ Prettier/Black runs after every edit
- ๐ Validators โ SvelteKit routes, import paths, migrations
- ๐ค Agents โ frontend, backend, debug, code review, deployment
- ๐ Skills โ reusable task definitions
Setup
The setup takes 30 seconds:
git clone https://github.com/dopiotrek/dotclaude.git ~/repos/dotclaude
cd ~/repos/dotclaude
./install.sh
That's it. Start a new Claude session so that it picks up the new config and everything works.
The script included in the repo handles also backing up your old config. In case you want to revert to the old config.
The Workflow
Once you have the repo setup, the workflow is simple:
- Edit files in
~/repos/dotclaude/ - Changes apply instantly (it's the same file via symlink!)
git commitwhen you're happy- Push to sync across machines
No reinstall needed. No copying. Just git.
Repo: github.com/dopiotrek/dotclaude
Fork it, customize it, share your improvements.
The install script handles everything โ backup, symlinks, permissions.
I'll be updating this repo regularly with new hooks, agents, and skills.