Skip to content
AI Growth Lab
Navigation menu
AI Growth Lab

Loading lesson…

CoursesContactPrivacy

Curriculum based on Datawhale / Easy Vibe · CC BY-NC-SA 4.0

← Back to course

AI-Native Engineer

Claude Code Fundamentals
  1. Getting Started with Claude Code
  2. Essential Claude Code Techniques
  3. Configuring Claude Code for Your Project
  4. Everyday Development Workflows
  5. Troubleshooting Claude Code
MCP: Connecting Claude Code to Tools
  1. Getting Started with MCP in Claude Code
  2. Using and Troubleshooting MCP
  3. Configuring Common MCP Servers
Claude Code Skills
  1. Finding and Using Your First Skills
  2. Understanding Skills and SKILL.md
  3. Creating and Improving Your Own Skills
  4. How Claude Skills Work Internally
Claude Agent Teams
  1. Understanding and Setting Up Agent Teams
  2. Build an RPG with Agent Teams
  3. Agent Teams Best Practices
  4. Choosing When to Use Agent Teams
AI-Assisted Development Workflows
  1. Choosing an AI Development Strategy
  2. Developing Features and Fixing Bugs with AI
  3. Refactoring and Reviewing Code with AI
  4. Building a Project Knowledge Base
  5. Improving AI Collaboration Efficiency
Building Agents with Claude Agent SDK
  1. Getting Started with Claude Agent SDK
  2. Advanced Features and Practical Agent Examples
  3. Building a Code-Quality Guardrail Pipeline
Engineering Workflows with Superpowers
  1. Getting Started with Superpowers and Its Core Skills
  2. Build an Authentication System with Superpowers
  3. Configuring and Using Superpowers Effectively
Spec Coding
  1. Spec Coding Foundations
  2. Practicing Spec Coding in Claude Code
  3. Moving from Vibe Coding to Spec Coding
  4. Spec Coding FAQ and Summary
GitHub Spec-Driven Development
  1. Workflow Foundations and Setup
  2. From Product Idea to Specification
  3. From Specification to Working Software
  4. Reusable Prompts and Responsible Autonomy
Cross-Platform Development
  1. From a Web Page to Real Software and an AI-Native Product
  2. How to Choose the Right Platform for Your App
  3. How to Build an Android App with Jetpack Compose
  4. How to Build an iOS App with SwiftUI
  5. Build a Store Inspection App with React Native and Expo

Lesson Contents

  1. Core Techniques
AI Development FAQ and Summary
How to Build a Cross-Platform App with Flutter
  • How to Build a PWA Local App
  • How to Build a Browser AI Assistant Extension
  • How to Build a Cross-Platform Electron Desktop App
  • How to Build Platform, Pixel-Art, and 3D Games with Godot
  • How to Build a VS Code Extension
  • How to Build an Industrial Qt Desktop App
  • How to Build Your Personal Website and Academic Blog
  • How to Publish the Application You Built
  • On this page
    • Core Techniques

    Core Techniques

    Master these techniques and your Claude Code efficiency can improve by multiple times. They come from real development practice and cover high-frequency scenarios.

    Technique 1: Double-press Esc to Roll Back Conversation - Undo Misoperations

    This is the most common and important shortcut in Claude Code. During collaboration, you may mistype, give wrong instruction, or dislike an answer. Double-pressing Esc gives you quick "time rewind."

    Shortcut details:

    Press Esc once     -> clear current input (similar to Ctrl+C)
    Press Esc twice    -> roll back to previous conversation state (undo previous turn)
    Press Esc three times -> clear all conversation history (start over)
    

    Use cases:

    • Case A: you accidentally sent wrong instruction and Claude started executing. Quickly press Esc twice to return before execution.
    • Case B: Claude response is not what you wanted, and you want to rephrase. Double Esc to undo and ask again.
    • Case C: conversation has many rounds and context is messy. Triple Esc to clear and restart.

    Important note: double Esc rolls back conversation state, not code changes. If Claude already edited files, those edits are not auto-reverted. You must manually restore via Git.

    Recommendation: before potentially large code edits, save current state (git commit or git stash) so recovery is easy.

    Technique 2: Use @ to Reference Files - Precise Context Control

    Although Claude Code can read project files automatically, explicitly referencing files makes intent clearer and avoids wasting tokens on unrelated files.

    Basic usage:

    Instead of vague:

    Explain src/utils.ts
    

    Use explicit reference:

    @src/utils.ts Explain this file
    

    Advanced usage:

    Compare multiple files:

    @src/app.tsx @src/components/Header.tsx What is the relationship between these two files?
    

    Reference directory:

    @src/components/ Summarize all components under this directory
    

    Reference specific lines (with editor):

    @src/utils.ts:45-60 Explain what this code does
    

    Usage tips:

    1. Tab completion: type @ then press Tab, Claude shows file list under current directory and you can choose with arrows
    2. Relative paths: support references like @./config.json or @../shared/types.ts
    3. Fuzzy matching: partial file names are allowed, e.g. @utils can match src/utils.ts or src/utils/index.ts

    Technique 3: Use ! to Execute Commands - Terminal Integration

    Claude Code has built-in command execution. You can run commands without switching to another terminal.

    Basic usage:

    !npm test           # run tests
    !git status         # check Git status
    !ls -la             # list files
    

    Practical scenarios:

    Scenario: run tests and analyze failure

    !npm test
    # after failure
    Analyze test failure reasons and fix code
    

    Scenario: inspect Git diff

    !git diff
    # ask Claude to explain changes
    Summarize key changes in this diff
    

    Scenario: build project

    !npm run build
    # if build fails
    Build failed, help me fix it
    

    Safety note:

    For sensitive commands (for example rm -rf, sudo), Claude Code asks for confirmation. This is a protection mechanism. Confirm carefully.

    Technique 4: /plan Before Coding - Correct Way to Handle Complex Tasks

    For complex tasks, directly coding is often inefficient. /plan enters planning mode: define implementation plan first, then execute step by step.

    Usage:

    /plan
    I want to add user authentication. Please create an implementation plan.
    

    What Claude does:

    1. Analyze requirement
    2. Evaluate current project and stack
    3. Create step-by-step plan
    4. Discuss and adjust with your feedback

    Sample output:

    📋 User Authentication Implementation Plan
    
    Phase 1: Database design
    - [ ] Create users table (id, email, password_hash, created_at)
    - [ ] Create sessions table (id, user_id, expires_at)
    
    Phase 2: Backend API
    - [ ] POST /api/auth/register - register
    - [ ] POST /api/auth/login - login
    - [ ] POST /api/auth/logout - logout
    - [ ] GET /api/auth/me - get current user
    
    Phase 3: Frontend integration
    - [ ] Create login page
    - [ ] Create register page
    - [ ] Add route guards
    
    Phase 4: Testing
    - [ ] Write unit tests
    - [ ] Write integration tests
    
    Which phase do you want to start with? Or should we adjust the plan?
    

    Best practice:

    • For tasks over 30 minutes, use /plan first
    • Execute phase by phase and verify each phase
    • If requirement changes, rerun /plan to adjust

    Technique 5: /init Auto-generates Configuration - Fast Project Initialization

    /init is one of Claude Code's most powerful commands. It scans your project automatically, identifies stack and structure, and generates a complete CLAUDE.md.

    Usage:

    /init
    

    Claude performs:

    1. Scan project structure: identify framework/language/build tools
    2. Analyze config files: read package.json, tsconfig.json, etc.
    3. Infer style: naming conventions and file organization
    4. Generate CLAUDE.md

    Generated CLAUDE.md example:

    # My Project
    
    ## Tech Stack
    - Framework: Next.js 14 (App Router)
    - Language: TypeScript
    - Styling: Tailwind CSS
    - State: Zustand
    - Database: Prisma + PostgreSQL
    
    ## Common Commands
    
    \`\`\`bash
    npm run dev      # start dev server
    npm run build    # production build
    npm run test     # run tests
    npx prisma migrate dev  # DB migration
    \`\`\`
    
    ## Code Conventions
    - Use function components + Hooks
    - File naming: PascalCase (components), camelCase (utility funcs)
    - Commit style: Conventional Commits
    

    Why this matters:

    CLAUDE.md is Claude Code's "project memory." On every launch, Claude reads this file and understands project background. That means:

    • you do not need to repeatedly explain framework and stack
    • Claude follows your conventions and best practices
    • new team members can onboard faster

    Recommendation: after project initialization, run /init immediately, then refine generated config to match reality.

    Technique 6: /compact Compresses Context - Save Tokens

    Claude Code context window is limited (often around 200K tokens). Long conversations consume many tokens, increase cost, and may push important early info out of context.

    Usage:

    /compact
    

    How it works:

    /compact analyzes chat history, extracts key information (decisions made, code generated, confirmed requirements), and creates a concise summary. Later dialogue is based on this summary rather than full history.

    When to use:

    • after 5-6 rounds
    • when Claude seems to "forget" previous context
    • when switching to a new subtask but keeping key background

    Recommendation:

    # compress after long conversation
    /compact
    
    # keep working
    Now that user module is done, let's build order module.
    

    Technique 7: Use Claude Code to Assist Git Commits

    In Claude Code, recommended commit workflow is: let Claude inspect diff and draft commit message, then you run standard Git commands. This is clear and gives you one more review checkpoint before commit.

    Official references:

    • Built-in commands
    • Discover plugins

    Recommended workflow:

    # 1. Check current changes
    /diff
    !git status
    
    # 2. Ask Claude to summarize and generate commit message
    Based on current git diff, generate a Conventional Commits message,
    and explain in Chinese why this category is appropriate.
    
    # 3. After you confirm, run standard Git commit
    !git add -A
    !git commit -m "feat(docs): update Claude Code workflow guidance"
    

    Benefits of this approach:

    1. Aligned with current official capability: no dependency on removed built-ins
    2. Transparent: review diff and commit message before submit
    3. Portable: same workflow works in other AI IDEs or pure Git

    If you want "one-command commit" experience:

    Claude Code now recommends plugin-based extension. For example, commit-commands provides commands like /commit-commands:commit.

    # 1. Add plugin marketplace example
    /plugin marketplace add anthropics/claude-code
    
    # 2. Install commit workflow plugin
    /plugin install commit-commands@anthropics-claude-code
    
    # 3. Reload plugins
    /reload-plugins
    
    # 4. Use plugin command to commit
    /commit-commands:commit
    

    Additional notes:

    • /commit-commands:commit is provided by plugin, not current default built-in command
    • if you only need to inspect changes before commit, prefer /diff or ask Claude to explain git diff
    • official /review has also been marked deprecated; for similar capability, use plugin or natural-language review flow

    Technique 8: Shift+Tab Auto-Accept - Improve Fluency

    By default, Claude asks confirmation before editing code. This is useful when learning, but may feel slow later. Shift+Tab enables auto-accept mode for faster iteration.

    Usage:

    • press Shift+Tab -> enter auto-accept mode
    • press Shift+Tab again -> exit auto-accept mode

    Mode comparison:

    ModeBehaviorUse scenario
    Default modeAsk confirmation for every editLearning stage, important code
    Auto-acceptApply edits directlyAfter familiarization, rapid iteration

    Notes:

    • In auto-accept mode, Claude edits files directly with no second confirmation
    • Recommended to pair with Git so rollback is easy
    • For sensitive operations (delete files, modify key configs), Claude still asks

    Technique 9: Ctrl+C Cancel Operation - Emergency Brake

    When Claude is running a long task, or you realize you gave a wrong instruction, Ctrl+C is the emergency brake.

    Usage:

    • press Ctrl+C once -> cancel currently running operation
    • press Ctrl+C twice -> fully exit Claude Code

    Use cases:

    • long-running command needs interruption
    • Claude is generating large irrelevant code
    • wrong instruction detected and you want immediate stop

    Difference from double Esc:

    • Ctrl+C: stop ongoing operation (running command / generating code)
    • double Esc: roll back conversation state (undo previous turn)

    Technique 10: /context Check Context Usage - Optimize Token Cost

    /context displays current session context usage, helping you understand token consumption and optimize cost.

    Usage:

    /context
    

    Sample output:

    📊 Context Usage
    
    Token usage: 45,230 / 200,000 (22.6%)
    File references: 12 files
    Conversation rounds: 8
    
    Top token-consuming files:
    1. src/api/users.ts (3,420 tokens)
    2. node_modules/@types/react/index.d.ts (2,890 tokens)
    3. src/components/Dashboard.tsx (1,560 tokens)
    
    Suggestions:
    - Current usage is healthy, no compression needed
    - To reduce usage, add node_modules into .claudeignore
    

    How to use this information:

    1. Identify large files: if one file consumes a lot of tokens, check if it is really needed
    2. Optimize .claudeignore: ignore unrelated files (node_modules, build output, etc.)
    3. Decide when to compact: when usage exceeds 70%, consider /compact

    Technique 11: /resume Restore Session - Switch Multi-task Conversations

    When handling multiple tasks, you may run multiple conversation threads. /resume lets you switch back to previous session context in the current chat, without restarting.

    Usage:

    /resume
    

    How it works:

    Claude Code records previous sessions automatically. When you run /resume, it switches to previous session context and keeps all prior discussion content and state.

    Use cases:

    Case A: parallel multi-tasking

    # Task 1: fix bug
    claude> Fix login-page validation issue
    # ... one conversation ...
    
    # Task 2: add feature (new thread)
    claude> Add user registration feature
    # ... another conversation ...
    
    # Switch back to task 1
    claude> /resume
    # Continue previous bug-fix work
    

    Case B: temporary lookup then return

    claude> Explain this algorithm
    # ... discuss algorithm ...
    
    claude> /resume
    # Return to previous coding work
    

    Case C: resume after interruption

    claude> Continue previous work
    # If you interrupted before, /resume brings you back
    

    Comparison with related commands:

    CommandFunctionScenario
    /resumeSwitch back to previous session in current chatMulti-task switching
    claude -cContinue most recent sessionReconnect after exit
    claude -rRestore previous sessionRecover prior state after exit
    double EscRoll back one turnUndo most recent conversation turn

    Suggestions:

    1. Multi-task management: /resume is more efficient than re-explaining context
    2. Session memory: each session has independent context; /resume preserves it
    3. Use with /compact: in long sessions, compact first, then resume switch to keep context clean

    Previous
    Sign in to track progress
    Next