Skip to main content
  1. All Posts/

Claude Code Advanced Notes

·2033 words·10 mins·
Aaron
Author
Aaron
I only know that I know nothing.
Table of Contents

Introduction
#

I previously wrote a getting-started guide for Claude Code covering installation, configuration, and basic features. After diving deeper into daily usage, I discovered quite a few advanced techniques I hadn’t covered before — NoFlicker mode, input tricks, session management, caching strategies, and more. Each of these is a small detail on its own, but combined they make a huge difference in daily usage. This article is a structured supplement to the previous guide1.

NoFlicker Mode
#

In the traditional mode, Claude Code refreshes the entire conversation history on every turn, which can exceed the terminal’s refresh rate and cause flickering. NoFlicker mode solves this at its root.

How to enable: Add "noFlicker": true in settings.json, or run /tui fullscreen. Revert with /tui default.

Three major improvements:

  1. Built-in virtual scrolling: Instead of relying on terminal scrolling, it uses vim-like screen scrolling with Page Up/Page Down and mouse wheel support, smooth as butter
  2. Focus concise display: Each turn only shows the question plus a final result summary (e.g. “edited 5 files, added 54 lines, deleted 25 lines”). Intermediate steps can be expanded or left collapsed
  3. Quick context navigation: Directly see the correspondence between questions and answers without scrolling long distances

Ctrl+O three-level toggle (traditional mode only has one level):

  • Level 0: Focus mode, showing only summaries
  • First Ctrl+O: Show operation overview for each step (bash still condensed)
  • Second Ctrl+O: Fully expanded, equivalent to traditional mode

Other interactions:

  • “Jump to bottom” button at the bottom
  • Mouse click-through support
  • After Ctrl+O, press V to open full conversation log in nvim (vim users rejoice)
  • After Ctrl+O, press [ to switch to terminal native scrolling

Input Tips
#

Ctrl+S: Input Stash
#

While typing a long prompt, if you suddenly need to do something else first (switch models, run a command, invoke a skill), press Ctrl+S to push the current input onto a stack. It auto-restores after you finish the other operation.

Ctrl+G: External Editor for Prompts
#

For long prompts, press Ctrl+G to open an external editor (set EDITOR=nvim or EDITOR=code). Multi-line editing is much easier. Save and exit, and the content auto-fills the input box.

Ctrl+V: Paste Images
#

Press Ctrl+V to paste screenshots directly into the conversation. You can ask questions about the image, request UI design replication, etc. Claude understands the image content.

!: Run Bash Commands In-Place
#

Type ! ls and similar commands to execute them directly within Claude Code. Output automatically enters the context. Benefits:

  • Ask questions right after running a command, Claude can see the output
  • Say “fix” after an error, Claude sees the error and fixes it in place
  • No need to manually paste error messages

btw: Sidebar Questions (No Context Entry)
#

While Claude is working, type btw <question> for a temporary question:

  • Does not enter the main context, no token waste
  • Doesn’t interrupt the current task
  • One-time Q&A, auto-disappears after use
  • Perfect for questions you’re not sure are relevant

Session Management
#

clear: Clear Context
#

/clear wipes the current context and starts a fresh conversation. Benefits:

  • Saves tokens
  • Model focuses better on the current task
  • Avoids conflicts between old and new instructions that cause quality degradation

resume: Resume Session
#

Accidentally cleared? Use /resume to restore the previous conversation.

rename: Rename Session
#

  • /rename <name>: Manual naming
  • /rename (no arguments): Let Claude auto-generate a name based on context
  • Makes it easy to identify what each session is doing when running multiple

color: Session Coloring
#

/color <color> sets a theme color for the session, providing visual distinction for quick recognition.

recap: Auto Review
#

  • Auto-generates a gray recap summary after idle period
  • See at a glance what was being worked on when you switch back
  • Manually trigger with /recap
  • Can be disabled in config if you feel it wastes tokens

copy: Copy Replies
#

  • /copy: Copy the most recent reply
  • /copy <number>: Copy a specific numbered reply
  • NoFlicker mode also supports mouse text selection for direct copy (using OSC52 terminal feature)

Rewind
#

Rewind Conversation + Code
#

Rolls back both the conversation and reverts Claude’s code changes.

Rewind Conversation Only
#

Only reverts the conversation without modifying code (deleted files cannot be restored though).

Trigger Methods
#

  • Type /undo or rewind in the command line
  • Press Esc twice

Non-Interactive Mode (Direct CLI)
#

claude "prompt"
#

Execute directly in the terminal, auto-runs after entering TUI.

claude -p "prompt" (Pure Pipe Mode)
#

Does not launch the TUI, outputs results directly to the terminal. Use cases:

  • claude -p --model haiku "make a commit" — use the cheap model to quickly generate commit messages
  • Combine with scripts for automated workflows
  • Perfect when you only care about the final result

Natural Language to Command
#

Describe what you want in plain language (e.g. “delete the wiki-related mcp”), and Claude automatically converts it to the correct command.

Worktree (Working Tree Isolation)
#

Concept
#

Creates a complete code copy in an independent directory. Modifications don’t affect the main workspace. Multiple Claude sessions can work in parallel across different worktrees without interference.

Usage
#

  • claude -w <name> or say “switch to worktree” in conversation
  • Develop features in a worktree, then say “merge back to main”
  • Each worktree auto-creates an independent branch

Typical Workflow
#

  1. Say “switch to worktree, develop XXX feature”
  2. Claude auto-creates worktree and named branch
  3. Switch to Plan mode → interview me (let Claude ask questions first)
  4. Accept plan → Execute
  5. When done, say “merge back to main”

Plan Mode’s interview me
#

In Plan mode, type interview me to have Claude ask key questions about your requirements first, avoiding:

  • Plans that don’t match expectations, leading to rework
  • Wasting time correcting via repeated conversations
  • Better to confirm everything upfront before implementation begins

Scheduled Tasks and Loops
#

Loop: Recurring Tasks
#

/loop 1m report cpu usage
  • Repeat a prompt at specified intervals
  • Uses CronCreate internally
  • Stops when session exits
  • Recommend using with tmux to keep sessions alive

Schedule: One-Time Scheduled Tasks
#

Just describe it in natural language:

  • “Run XXX at 4pm”
  • Claude auto-sets up the scheduled execution
  • Fires at the specified time (terminal must stay open)
  • Use CronDelete to cancel manually

Skills System
#

On-Demand Loading
#

  • Skills only load when needed, not permanently in context (~10 tokens per Skill)
  • Compare to MCP: one MCP server can consume thousands of tokens of context
  • Skills trigger via keyword/pattern matching in descriptions

Create Skills from Conversations
#

Convert common tasks from the current conversation into reusable Skills:

  • Detect meaningful operations from the conversation
  • Guide you through setting skill name, goal, trigger conditions, parameters
  • Save and invoke on demand

Skill Description Writing
#

Descriptions go in the Skill tool’s description field, using Anthropic’s recommended format:

Describe what the skill does.
Use this skill when: [trigger condition/keyword pattern]
  • Trigger strength depends on pattern matching quality in the description
  • More specific patterns are more likely to be proactively invoked

On-Demand Content Loading
#

  • Main Skill file only contains basic information
  • Detailed docs go in reference files in a subdirectory
  • Claude only reads the relevant reference when needed
  • Supports referencing web URLs for up-to-date documentation

Hooks
#

Concept
#

Scripts that auto-trigger before/after Claude performs specific operations (like calling bash, editing files), configured in settings.json.

Typical Use Cases
#

a) Command Interception and Replacement

  • Detect pip → prompt to use uv
  • Detect npm → prompt to use pnpm
  • Can set fallback for special cases

b) Post-Edit Auto-Review

  • Auto re-read and check files after every edit/write
  • Check 30 lines above and below for correctness (e.g. missing commas in JSON)
  • Silent if fine, auto-fix if issues found
  • More reliable than rules, no cognitive load during editing

c) Auxiliary Skill Triggering

  • Detect background task start → inject prompt to have Claude associate cache-keepalive skill
  • Compensates for the “weak middle” attention problem in large models

Why Hooks Over Rules
#

  • Lower-end models (like GLM) easily forget text rules
  • Hooks are programmatic, 100% trigger rate
  • Too many rules degrade reasoning quality
  • Hooks don’t interfere with editing attention, only trigger after operations complete

Review Skill (Code Review)
#

Code Review Points
#

  • Check if modified files match context style (e.g. line break conventions)
  • Check for common AI “smell patterns”

Common AI Code Smells
#

  • Over-defensive programming: except: pass swallowing all exceptions silently
  • Unnecessary safety nets: Adding default values and type conversions when nothing went wrong
  • Not fixing root causes: Adding filters in the middle instead of fixing the upstream source
  • Dead code remnants: Changed functionality but didn’t remove old code
  • Hardcoded step numbers: 1. 2. 3. becoming 1. 2a. 2b. — ugly
  • Copy-paste with minor tweaks: Should be abstracted into a function

Best with SubAgent
#

Review requires reading many files but produces few conclusions → use a SubAgent to isolate the context, only returning key findings to the main agent.

Model and Configuration Tips
#

Recommended: Opus #

  • Opus 1M context and 200K are priced the same (after pricing change)
  • Extremely strong memory recall, even very early conversations are remembered
  • Sonnet 200K tends to forget earlier settings

Effort Setting
#

  • Must be set to high or max
  • auto mode skips thinking for simple questions, massively reducing quality
  • Even simple operations might involve dangerous commands (like deletes), skipping thinking is unacceptable

Disable Dynamic Thinking
#

  • Claude 4.0+ added dynamic thinking: simple questions might be answered without thinking
  • Recommend disabling to force full thinking on every request
  • A bit slower and more expensive, but with Max you’ll never run out anyway

Bypass Permission
#

  • Full-time bypass reduces manual confirmations
  • Recommend glancing at each command before executing
  • Modifying own config still triggers confirmation

Context Management Best Practices
#

Core Principle
#

Don’t keep a single context as a pet — Claude’s context is a finite memory window.

Key Recommendations
#

  • clear and start a new context when switching topics
  • Irrelevant context (like what to eat for breakfast) doesn’t help the current task (like discussing Skills)
  • Long context → scattered attention → lower intelligence
  • Degradation typically starts around 200K; 1M only delays compaction

Persist Important Conclusions to Files
#

  • Rules and conventions discussed with Claude should be written to CLAUDE.md or docs folders
  • Once context is lost, conversation records are gone
  • Files can be loaded on demand; context contents cannot

Compact (Compress Context)
#

  • /compact summarizes previous context into the first message
  • Continue working on top of the compressed context
  • Too many rules to remember? Compact once to reset

Attention Distribution Pattern
#

  • Most recent context: Most familiar (highest attention)
  • Earliest context: Moderately familiar
  • Middle context: Most easily forgotten (weakest attention)

Cache Cost Strategy (Cache Keepalive)
#

Anthropic’s Caching Mechanism
#

State Price Multiplier
First request (write) 1.25x
Cache hit (read) 0.1x
Cache expired (past TTL) 1.25x again
1-hour cache option 2.0x

The Five-Minute Strategy
#

  • Default cache TTL = 5 minutes
  • Refresh every 5 minutes to keep cache alive
  • 10 refreshes (50 minutes) = 1.0x total, far cheaper than letting cache expire after 50 minutes and paying 1.25x again
  • Use Hook + Skill combo to auto-trigger cache keepalive

Other Useful Features
#

claude install <package>
#

Install software using natural language. Claude handles dependencies and configuration automatically.

Natural Language Configuration System
#

  • No need to memorize complex commands, just describe what you want
  • Claude auto-converts to the correct command (e.g. systemd config, clash daemon)

Keyboard Shortcuts Reference
#

Shortcut Function
Ctrl+O Toggle display detail level (3 levels in NoFlicker)
Ctrl+S Stash current input, restore after other operations
Ctrl+G Open external editor for prompt
Ctrl+V Paste image into conversation
Esc Esc Rewind
Ctrl+OV Open full conversation log in vim
Ctrl+O[ Switch to terminal native scrolling
! <command> Run bash command in-place
btw <q> Sidebar question (no context entry)

Commands Reference
#

Command Function
/clear Clear context
/resume Resume previous session
/compact Compress context
/undo or rewind Rewind
/rename <name> Rename session
/rename Auto-generate session name
/color <color> Set session theme color
/copy [N] Copy recent/specified reply
/recap Manually trigger review
/loop <time> <prompt> Loop task execution
/focus / /focus off Toggle Focus mode
/tui fullscreen Enable NoFlicker mode
/tui default Revert to traditional mode
claude -p "..." Non-interactive mode

  1. The previous getting-started guide covered installation, three interaction modes, Plan Mode, Figma MCP, CLAUDE.md, Hooks, Agent Skills, SubAgents, Plugins, and other basics. I recommend reading that one first. ↩︎