Terminal AI Coding Assistant: A Practical Guide to Working Efficiently
This guide explains how to use terminal-based AI coding assistants effectively in real development workflows. It covers three working modes (default, plan, and high-permission), upfront planning, reverse clarification for vague requirements, skills, explicit context with @ references, deep-thinking triggers, project convention files, undo strategies, context compaction and clearing, session resume, and subagents for code review. The focus is on turning interaction habits into engineering practices that produce reliable, reviewable code.
Introduction: Why Knowing How to Use It Matters More Than Knowing About It
AI coding capabilities have evolved rapidly over the past year, with new intelligent coding tools and agent frameworks appearing constantly. In developer hiring, beyond testing understanding of underlying principles, interviewers increasingly care about whether candidates have actually integrated these tools into their daily workflows. The reason is straightforward: a tool’s value lies not in concepts but in whether it can reliably produce deliverable code.
This article does not discuss low-level implementation. Instead, it focuses on a general methodology for using terminal-based AI coding assistants. “Terminal-based” refers to assistant programs that run directly in a developer’s local command-line environment and can read and write project files, execute commands, search code, and run tests. The techniques below apply to common tools in the industry, with the emphasis on turning “interaction style” into “engineering standards.”
1. Basic Operations and Three Working Modes
You typically start the assistant by invoking its command in the project root directory, then enter a continuous conversational interaction. Most tools offer three modes:
- Default mode: reads files, modifies code, and executes commands. Suitable for well-defined small changes.
- Plan mode: only analyzes and produces a plan without applying changes. Suitable for refactoring and technology selection.
- High-permission mode: skips per-step confirmation. Suitable for batch, low-risk, and rollback-safe scenarios.
The criterion for choosing a mode is “scope of change and reversibility.” For small scope and high reversibility, use default mode; for architectural changes, use plan mode first to align on the approach; only consider high-permission mode for batch mechanical changes with version control as a safety net.
2. Use Plan Mode for Upfront Planning
The most common cause of failure for complex requirements is “coding while guessing.” In plan mode, the assistant first outputs implementation steps, a list of affected files, and risk points; the developer confirms before execution. It is recommended to specify three things clearly in the prompt: the target behavior, the boundaries that must not be changed (such as public interfaces and data structures), and the acceptance criteria (such as a specific test passing). Only then is the resulting plan executable.
3. When Requirements Are Unclear, Let the AI “Interview” You First
If the requirement description is vague, you can explicitly ask the assistant to ask questions before acting, for example:
Don't write code yet. For this requirement, list the questions you need me to confirm,grouped by "functional scope / data sources / exception handling / compatibility," with at most three questions at a time.
This reverse clarification surfaces implicit assumptions and avoids generating large amounts of rework code.
4. Interface and Experience Optimization: Extend Capabilities with Skills
A skill is a reusable package of instructions that codifies the standards for a certain type of task, such as a unified output format, chart style, or document template. The usage is to install or define a skill first, then invoke it in the conversation. Its value lies in “define once, reuse long-term,” avoiding repeated description of preferences each time.
5. Use @ to Specify Context Precisely
Do not rely on the assistant to guess files. Using the @ prefix to explicitly reference files or directories can significantly improve hit rate:
How do I fix the null pointer risk in @src/order/service.ts?@tests/order/ Add tests following the case style here.
Principle: provide only context directly relevant to the task; irrelevant files dilute attention.
6. Use Deep-Thinking Triggers for Complex Features
For problems such as concurrency, cache consistency, and complex state machines, you can add “deep thinking” type trigger words to the prompt to make the model extend its reasoning chain and derive step by step. Applicable scenarios are design reviews and difficult defect localization; for tasks like renaming a variable, it is entirely unnecessary and instead adds time.
7. Codify Project Context with CLAUDE.md
CLAUDE.md in the project root directory carries long-term project conventions, and the assistant reads it in every session. Recommended contents include:
- Tech stack and directory structure description
- Standard commands for build, test, and lint
- Coding conventions and commit conventions
- Directories and files that must not be touched
Notes: keep it concise (usually within a hundred lines) and put volatile information elsewhere; avoid writing sensitive content such as secrets; teams should include it in version control to ensure consistent context.
8. What If You Change the Wrong Thing: Three Undo Methods
- In-conversation rewind: return to the file state before a certain conversation turn, suitable when you just realize the direction is wrong.
- Version control rollback: use Git’s checkout / revert to handle committed content; auditable and collaborative.
- Editor local history: suitable for scattered changes not included in version control.
Recommended order: version control first, then conversation rewind, then local history. Any AI-generated result should be treated as “a change pending review,” not a final product.
9. Context Management: Compact First, Then Clear
Long sessions continuously consume the context window, causing the assistant to “get confused” and forget earlier conventions. Steps:
- Check current context usage (most tools provide a /context type command).
- Prefer /compact to compress: keep conclusions and key decisions, discard redundant process.
- If the topic has switched or it is still messy after compaction, use /clear to fully clear, and rely on CLAUDE.md to rebuild the baseline.
The criterion is simple: when the assistant starts repeating mistakes or ignoring existing conventions, it is time to compact or clear.
10. Session Recovery: Resume Makes Work Continuable
Most tools support resuming historical sessions (such as /resume); after closing the terminal, you can enter again to continue. Practical advice: use a separate session for each independent task, and write the goal clearly at the start of the session so you can quickly pick up context after resuming.
11. Use Subagents for Code Review
A subagent is a dedicated assistant in an independent context, suitable for tasks with clear boundaries, such as code review, test generation, and documentation completion.
Act as a code reviewer and check @src/payment/,focusing on: exception branches, transaction boundaries, missing logs, and compatibility risks.Output by level "blocking / suggestion / optional," and do not modify code directly.
Difference between subagents and skills: a skill is “standards and process,” passively injected into the current session; a subagent is an “independent executor” with its own context, suitable for parallelism and isolation. The two are often used together—skills define review standards, and subagents perform the review.
Summary
The key to using terminal AI coding assistants smoothly is not memorizing commands but building a process: plan before acting, replace guessing with explicit context, carry long-term knowledge with project convention files, cover risks with version control and rollback mechanisms, and maintain stability for long tasks with context compaction and subagents. In engineering practice on platforms such as Baidu AI Cloud, this kind of standardized collaboration is likewise a foundational capability for improving R&D efficiency.
