Skip to content

Instantly share code, notes, and snippets.

@dskarzh
Last active February 11, 2026 10:57
Show Gist options
  • Select an option

  • Save dskarzh/b3481aa89449d3e4a50beeb58697d591 to your computer and use it in GitHub Desktop.

Select an option

Save dskarzh/b3481aa89449d3e4a50beeb58697d591 to your computer and use it in GitHub Desktop.
## Basics
1. **CLAUDE.md files** — Always run `/init` for every project you work in. This creates a good-enough starting CLAUDE.md file to build upon as you go.
2. **Managing context**
- Your **conversations** persist and can be resumed later (`/resume`) — useful for building up context with valuable information and continuing work across multiple days. You can also give meaningful names for your conversations with `/rename <name>`.
- Reset the conversation with `/clear` when switching tasks. Compress it with `/compact` to keep key information while reclaiming context window space.
3. **Plan mode** — Design "big" tasks before implementing them, or create things like specs and requirements documents. Helps align with Claude on the approach before any code is written.
4. **GitHub integration** — Claude can create commits, push them to remote, read PR comments, and fix issues raised in reviews — all without leaving the terminal.
5. **Permissions** — Configure your `settings.json` to auto-allow bash commands you are comfortable with (e.g., read-only ones like `git status`, `git log`, `mvn dependency:tree`). Reduces interruptions from permission prompts and speeds up your workflow.
### Tips
- Save important information to Claude's memory using **hashtags**.
- Ask Claude to **interview you** before starting a task so it can gather context and clarify requirements upfront.
- Import files directly into the conversation with the **`@` syntax**.
- Paste **screenshots or images** into the terminal to help Claude understand exactly which visual element you are talking about.
## Useful in ThingsBoard
- Create skills with repeatable workflows common to ThingsBoard (making PR considering TB branching structure)
- Configure additional working directories so Claude Code can access both CE and PE codebases simultaneously. For example, when working in PE, add the CE directory as an additional workspace (and vice versa). This allows Claude to search, read, and reference code across both projects without switching sessions.
## Usage Ideas
Claude Code is useful not only for developers but for other roles as well:
- **Support engineers** can use it to ask questions about ThingsBoard code and get accurate answers without ever needing to communicate with developers.
- **Documentation writers** can put doc writing styles and guidelines in their CLAUDE.md files and ask Claude to write docs with perfect English and consistent style.
- **UI development** — Use the Playwright MCP to give Claude access to a browser. This allows Claude to interact with your app, see the rendered UI, and make more informed changes when developing frontend features.
## Advanced
### Cloud-Based Autonomous Tasks with Claude Code for Web
You can use [Claude Code for Web](https://claude.ai) to spin off autonomous coding tasks that run in the cloud directly against your GitHub repo. Connect your GitHub account, select a repository and branch, and give Claude a task — it will work autonomously in a cloud sandbox, creating a PR when done. This is useful for offloading independent tasks (bug fixes, refactors, feature implementations) without occupying your local terminal, and multiple tasks can run in parallel.
### Parallel Workers with Git Worktrees
Use the `claude-worker` script to spin up an isolated Claude Code session in a git worktree. This lets you run multiple Claude agents in parallel on separate branches without them interfering with each other.
Save this as `claude-worker` in your repo root and make it executable (`chmod +x claude-worker`):
```bash
#!/usr/bin/env bash
set -euo pipefail
REPO_ROOT="$(git rev-parse --show-toplevel)"
WORKTREES_DIR="${REPO_ROOT}/.worktrees"
usage() {
cat <<'USAGE'
Usage: claude-worker <branch-name>
Creates a worktree branched from the current branch.
Examples:
./claude-worker feat/my-feature
USAGE
exit 1
}
if [[ $# -lt 1 || "$1" == "--help" || "$1" == "-h" ]]; then
usage
fi
BRANCH="$1"
BASE_REF="$(git rev-parse --abbrev-ref HEAD)"
WORKTREE_PATH="${WORKTREES_DIR}/${BRANCH//\//-}"
mkdir -p "$WORKTREES_DIR"
if [[ -d "$WORKTREE_PATH" ]]; then
echo "Worktree already exists at $WORKTREE_PATH, reusing it."
else
if git show-ref --verify --quiet "refs/heads/$BRANCH" 2>/dev/null; then
git worktree add "$WORKTREE_PATH" "$BRANCH"
else
git worktree add -b "$BRANCH" "$WORKTREE_PATH" "$BASE_REF"
fi
fi
cd "$WORKTREE_PATH"
# Disable GPG signing in worktree (sandbox makes ~/.gnupg read-only)
git config commit.gpgsign false
exec claude \
--dangerously-skip-permissions \
--settings '{"sandbox":{"enabled":true,"autoAllowBashIfSandboxed":true,"excludedCommands":["git"],"allowUnsandboxedCommands":false,"network":{"allowedDomains":["github.com","*.github.com"],"allowAllUnixSockets":true}}}'
```
## My user-level CLAUDE.md (`~/.claude/CLAUDE.md`)
```markdown
# User Context
## About Me
- **Role**: Software Engineer at ThingsBoard IoT platform
- **Focus**: Backend development
- **Primary language**: Java
## Git Preferences
- **Commit messages**: Always use Conventional Commits format (e.g., `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`)
```
## My user-level settings (`~/.claude/settings.json`)
```json
{
"attribution": {
"pr": ""
},
"permissions": {
"allow": [
"Bash(sdk list *)",
"Bash(cat *)",
"Bash(head *)",
"Bash(tail *)",
"Bash(less *)",
"Bash(wc *)",
"Bash(ls *)",
"Bash(find *)",
"Bash(tree *)",
"Bash(file *)",
"Bash(stat *)",
"Bash(du *)",
"Bash(df *)",
"Bash(diff *)",
"Bash(grep *)",
"Bash(rg *)",
"Bash(awk *)",
"Bash(sed -n *)",
"Bash(which *)",
"Bash(type *)",
"Bash(env)",
"Bash(printenv *)",
"Bash(echo *)",
"Bash(pwd)",
"Bash(mkdir *)",
"Bash(test *)",
"Bash(git log *)",
"Bash(git show *)"
]
},
"model": "opus",
"enabledPlugins": {
"ralph-loop@claude-plugins-official": true
},
"alwaysThinkingEnabled": true,
"defaultMode": "default"
}
```
## Example of `settings.local.json` file configured to attach additional directory with (e.g., PE)
```json
{
"permissions": {
"allow": [
"Bash(git -C /home/dskarzh/IdeaProjects/thingsboard log *)",
"Bash(git -C /home/dskarzh/IdeaProjects/thingsboard show *)",
"Bash(git -C /home/dskarzh/IdeaProjects/thingsboard remote -v)",
],
"additionalDirectories": [
"/home/dskarzh/IdeaProjects/thingsboard-pe"
]
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment