Terminal AI Coding Assistants: 11 Practical Tips to Use Them More Effectively
This article focuses on how to get the most out of terminal-based AI coding assistants — tools that can read and write project files, run commands, search code, run tests, and organize commits. Moving beyond basic "what they can do" theory, it covers 11 high-frequency scenarios: choosing the right work mode, planning before coding, letting the assistant interview you when requirements are unclear, locking in standards with custom skills, feeding precise context, using deeper reasoning for complex tasks, capturing project background, rolling back mistakes, managing context, resuming sessions, and reviewing code with sub-agents. It also includes a complete workflow from requirement to delivery, team adoption and security guidance, interview preparation, and a quick-reference table of recommended practices.
Introduction: From “Code Completion” to “Actionable Agents”
Over the past few years, AI coding tools have gained momentum fast, with new ones shipping almost every day. Many developers have tried them at least once, but finding the one that genuinely changes your coding habits and delivers a noticeable boost in productivity is not easy.
What I use most is an AI coding assistant that runs inside the terminal. It can read and write project files directly, execute commands, search code, and run tests or organize commits — effectively putting a professional programming partner right inside your terminal.
Recently, several developers have asked: with all the buzz around AI agent tools, will backend and agent-development interviews cover them? The answer is: very likely. The questioning usually happens on two levels. At the surface level, they ask about your hands-on experience and the pitfalls you’ve hit. At a deeper level, they probe how the tools actually work — for example, how the agent loop runs, how context is managed, and how tool calls are constrained. Beyond the principles, interviewers often care most about whether you have actually used these tools, because they have become a baseline capability for improving everyday productivity; knowing only the theory is far from enough.
This article doesn’t dive into complex internals. Instead, it focuses on how to use these tools well, organized around 11 high-frequency scenarios, with directly actionable methods, templates, and collaboration conventions. A quick-reference table is included at the end.
01 Understand Your Terminal AI Coding Assistant: Capability Model and Collaboration Boundaries
To use a tool effectively, first get clear on what it can do, what it can’t, and what you should ask it to do.
From Completion to Agents
- Inline code completion: Suggests candidate code from a little context before and after the cursor; you accept or reject with Tab. Its essence is “write faster.”
- Conversational code generation: Explain code, generate snippets, and troubleshoot through dialogue, but you still paste the output into your project manually. Its essence is “think more.”
- Terminal AI coding assistant: Can read and write files, execute commands, and search the codebase, forming a “sense–decide–act–feedback” loop. Sensing means reading code, command output, and errors; deciding means judging what to inspect or change next; acting means invoking tools to make it real; feedback means self-correcting based on results. Its essence is “deliver more completely.”
Understanding this difference explains why these tools can boost productivity dramatically yet must be used with care: they hold real operational permissions.
Three Iron Rules
- It executes; you decide. You make the calls on approach, and you sign off on results.
- Least privilege, always. Grant only the read/write scope needed to finish the task, and strictly isolate test databases from production credentials.
- Reversibility and verifiability are the prerequisites of trust. You need protection before changes and validation after them.
02 Basic Operations and Three Work Modes
Starting Up and Daily Interaction
Launch the assistant from your project’s root directory so it can read the code in the current folder. Day-to-day interaction follows the same rhythm: describe the task, watch which tools it calls and which files it modifies, and course-correct in time. The toolbar usually offers controls like interrupt and mode switching — when things drift off track, interrupt immediately rather than letting it continue.
Choosing Among the Three Work Modes
Measured by “human–machine collaboration density,” the work modes fall into three tiers:
| Work Mode | Interaction | Best For | Before You Use It |
|---|---|---|---|
| Default | Asks for step-by-step confirmation before reading/writing files or running commands | Everyday development, exploratory tasks, unfamiliar projects | Ready to use; check the commands before confirming |
| Plan | Read-only analysis, produces a plan first, acts only after confirmation | Multi-file changes, architecture adjustments, unclear requirements | Read the plan thoroughly before executing |
| Auto-Execute | Skips step-by-step confirmation and completes a whole task in one go | Repetitive batch tasks (uniform formatting, bulk logging, etc.) | Use a separate branch, a sandbox or container, credential isolation; review diffs afterward |
Emphasize this: Auto-Execute skips the confirmation step, not the responsibility. It’s only suitable for situations where “a broken change is easy to recover.”
03 Plan First, Then Code
Why “Plan First” Is Often Faster Than “Just Write”
Telling the AI to write code directly looks like one fewer step, but it tends to lead to three kinds of rework:
- Direction drift: The approach isn’t what you expected, and you discover the wrong thinking only after dozens of lines have changed.
- Scope creep: It touches files outside the plan, raising review and rollback costs.
- Overlooked implicit decisions: Key trade-offs like default technology choices or default exception handling are made without prior consensus.
Plan mode decouples “design” from “implementation.” Having a human review at the low-cost stage costs far less than reworking code that’s already written.
What the Planning Stage Should Produce
A solid implementation plan should at least include: a restatement of requirements, a list of files involved, a step-by-step implementation order, the verification method for each step, and risks with a rollback plan. For complex tasks, you can also ask for two or three candidate approaches with trade-off comparisons. A sample prompt:
Enter plan mode. Goal: <one-sentence description of the requirement>First do a read-only analysis of the relevant code, then output a plan:1) Restatement of requirements and boundary assumptions2) Files/modules involved and why they change3) Step-by-step implementation plan with a verification method for each step4) At least two candidate approaches with trade-off comparisons5) Risks and a rollback planDo not modify any files before confirmation.
Four Checkpoints When Reviewing a Plan
- Are requirement boundaries covered (empty data, oversized inputs, concurrency)?
- Are unnecessary dependencies or abstractions introduced?
- Is it consistent with the project’s existing layering and coding conventions?
- Does every step have an executable verification method?
Once the plan passes, switch to execution mode. If you find a flaw in the plan mid-execution, switch back to plan mode to revise rather than pressing on with a mistake.
04 When Requirements Are Unclear, Let the AI “Interview” You
Ambiguous requirements are the norm in everyday development. Much rework isn’t caused by coding ability but by mismatched understanding of what’s needed. Here, instead of rushing to have the AI “write it by guessing,” have it play “product manager” first and ask you questions in reverse.
The approach is simple: first have the AI restate its understanding of the requirement, then list the questions that need clarifying in a concentrated way — ideally split into “must confirm” and “can confirm later,” to avoid asking too much or too scattered in one round. A sample prompt:
Don't write code yet. Please:1. Restate your understanding of the requirement;2. List the points that remain ambiguous for implementation, ordered by impact on the result;3. For each ambiguous point, give 2~3 candidate interpretations and their impact;4. Point out external constraints I need to confirm (data scale, compatibility, performance, security, etc.).
Take a concrete example: the requirement is “add an Excel export feature to the list page.” At minimum, clarify these points:
- Data volume: A few thousand rows or hundreds of thousands? This directly decides whether to generate all at once or stream.
- Columns and filters: Export all fields or only the visible ones? Keep the current filter conditions?
- Sensitive fields: Do phone numbers and ID numbers need masking?
- Frequency and permissions: High-frequency exports need async tasks and rate limiting, and there must be clear control over who can export.
Once the answers are clear, organize them into a “confirmed requirements description” and paste it at the top of the conversation. Whether you later compact the context or start a new session, it serves as a consistent baseline that avoids drift in understanding.
05 When Output Isn’t Satisfactory, Lock in Your Standards with Custom Skills
If you find yourself repeatedly explaining “add comments to the code,” “use conventional commit message format,” or “present answers as tables,” those requirements should be locked in, not repeated verbally each time. Many terminal AI coding assistants support a “skill” or “custom instruction” mechanism: write a way of doing things as a reusable instruction package, then load it explicitly when needed. It’s essentially a structured prompt template whose core value is reusability, version management, and team sharing.
What Belongs in a Skill
- Code review checklists: Fixed checks for security, performance, maintainability, and so on.
- Generation conventions: Format requirements for API docs, unit tests, commit messages.
- Migration and upgrade processes: Standard steps for dependency upgrades, config migrations.
- Troubleshooting manuals: Diagnostic paths and cautions for a class of failures.
A Reusable Skill Example
---name: API doc generationdescription: Generate API documentation from route definitions and business code---## When to useWhen the user asks to generate or update API docs.## Steps1. Locate route and handler code; map inputs, outputs, and status codes.2. Cross-check error code definitions to fill in exception scenarios.3. Output using the template below, with ready-to-paste request/response examples.## Template- API name/path/method- Permission requirements- Request parameter table (name/type/required/description)- Response structure (success/all failure cases)- Notes## ConstraintsWrite only from code facts; mark unconfirmed items as "to be confirmed"; never fabricate fields.
Compared with repeating yourself verbally every time, skills offer three advantages: consistent standards, less ambiguity, and quick reuse by newcomers.
06 Point to the Right Context with File References
The model can only answer based on the information it can “see.” Feed it the wrong context, and answer quality drops sharply.
Precise References Beat Mass Dumping
Rather than vaguely saying “take a look at this project,” specify it: entry files, routing config, the data access layer, relevant tests. Two principles in practice:
- Fewer and precise beats more and messy: Large files unrelated to the task crowd out limited context space and dilute attention.
- Map first, details later: For large files, have the assistant search for key symbols or output a structure overview first, then read the relevant parts closely.
Four Objects to Specify as Context
- Specific files: Files to modify, and reference files that implement similar functionality.
- Configs and conventions: Coding standards, dependency config, environment variable templates.
- Historical clues: Related commits, defect records, design docs.
- Verification basis: Existing test cases, API docs, expected output samples.
A useful habit: each time you make a request, spend one sentence saying “where the relevant info lives.” For example: “Following the pagination implementation in file A, add a similar list query endpoint in file B, with tests referencing file C.” The assistant’s accuracy in locating things and the targeting of its changes both improve noticeably.
07 For Complex Features, Use Deeper Reasoning to Cut Trial-and-Error Cost
For complex problems like cross-module refactors, concurrency consistency, algorithm optimization, and hard-to-diagnose defects, rushing to an implementation often produces more holes and more rework.
Where Deeper Reasoning Helps
Many similar tools offer an “enhanced reasoning” capability (such as a deep-think toggle or higher reasoning effort). The idea is to have the model invest more thought before acting — completing analysis, decomposition, and approach derivation first, then executing step by step. It’s generally used for:
- Multi-module linked changes that require untangling the call chain and impact surface.
- Time-sensitive issues like concurrency, transactions, and cache consistency.
- Performance bottleneck diagnosis, where you need to rule out among several candidate causes.
- Hard production defects that require cross-inference from logs, call stacks, and code.
How to “Steer” Deeper Reasoning
Even if the tool has no toggle, you can achieve a similar effect with a prompt:
Here is the full background of the problem: <error message, relevant code, approaches already tried>First analyze the root cause and list all possible causes, ordered by likelihood;Explain how to verify each hypothesis at minimal cost;Do not give a final implementation before reaching a firm conclusion.
The last line is especially important. It forces the assistant to “prove first, implement later,” rather than “guess first, pile up after.”
Two Cautions
- Deeper reasoning increases response time and compute cost; don’t enable it for everyday small changes.
- The thinking process is only a reasoning draft; the final verdict still rests on tests and runtime results.
08 Repeating Project Background? Capture Knowledge in a Project Context File
What It Is
Repeatedly explaining to the assistant “what this project is, what stack it uses, how to run tests” is a common pain point early on. The fix is to place a description file (the convention filename differs by tool) in the project root; it’s loaded automatically at startup and becomes the baseline background for the whole session.
What to Write
This file should be “written for the AI,” not “for humans,” focusing on information highly relevant to collaboration:
# Project Overview- Project goal and core business- Tech stack and key dependency versions- How to start locally and common prerequisites# Directory Structure- src/api: interface layer- src/service: business logic layer- src/dao: data access layer# Dev and Verification Commands- Start: <command>- Test: <command>, run a single case: <command>- Static check: <command>- Format: <command># Code Conventions- Naming style, comment requirements- Error handling and logging conventions- Layered responsibility boundaries# Cautions- Do not modify auto-generated code under the xxx directory- Database changes must include a rollback script- New dependencies require a stated reason and a pinned version
Four Cautions
- Keep it lean: It consumes context in every session. Focus on “what the AI most easily gets wrong and most needs to know”; put redundant content in ordinary project docs and reference it on demand.
- Organize in layers: Put global info in the root, and place local notes in submodule directories to reduce per-load size.
- Let the AI help maintain it: When project conventions change, have the assistant update the file — but a human must review before committing.
- Keep secrets out of the repo: Never write keys, passwords, or internal addresses; use ignore rules to avoid accidental commits. Set sharing scope appropriately for files containing internal information.
09 What If the AI Breaks Something? Roll Back with Checkpoints
Why Rollback Matters
The AI breaking something is normal, not exceptional; the key is “how cheaply you can retreat after a break.” Tools with session and file-snapshot capabilities usually offer checkpoint rollback: state is recorded automatically after each round of changes, and you can return to any step at any time.
Comparing Three “Undo” Methods
| Method | Coverage | Granularity | Limitation |
|---|---|---|---|
| Checkpoint rollback (built-in) | Files the assistant modified and the conversation state | Per-round, undo as you go | Depends on the tool’s capability; manual changes made in the meantime may be reverted too |
| Version control | All files under version control | Per-commit, precise and controllable | Requires proactive commits; handle uncommitted changes before switching branches |
| Editor local history | Files opened and saved in the editor | Per-save, restore by timestamp | May be lost after changing machines or reinstalling the environment |
These three aren’t substitutes for one another, but complements:
- For quick, small mistakes within a session, checkpoint rollback is fastest.
- For historical versions beyond the session and cross-branch collaboration, you must rely on version control.
- Editor local history is good for recovering files that were “casually broken and not yet committed.”
Usage Recommendations
- Commit at important milestones, so small, frequent commits become your manual “checkpoints.”
- Always run Auto-Execute on a separate branch.
- Set physical isolation for core assets (databases, production config, keys); no “undo” should ever touch the production environment.
10 When the AI Starts Getting Confused? Compact First, Then Clear
Why It Gets “Confused”
It often shows up as: repeating the same mistake, ignoring earlier agreements, answering off-topic. Common causes include:
- The context is near its limit, and early key information has been “squeezed out.”
- Too much irrelevant content dilutes attention.
- Slowness or errors may also relate to overly long context.
Handling Order: Observe, Then Compact, Then Clear
Step 1: Check how much context is used. Judging whether it’s growing is a signal for whether to compact or clear first. Context is measured in tokens, which you can observe via the assistant’s status indicator. Rough estimate: English is about 1 token per 4 characters; Chinese is usually about 1–2 tokens per character, varying by tokenization.
Step 2: Try compacting first. Context compaction has the model produce a structured summary of earlier conversation — preserving the goal, key decisions, modified files, and to-dos — then continue with the summary. This suits continuous tasks where early decisions still hold. After compacting, immediately have the assistant restate “current goal + completed items + next step” to confirm the summary isn’t distorted.
Step 3: Then consider clearing. When the task switches, when context is heavily polluted by irrelevant logs or search results, or when the assistant has clearly drifted, fully clearing and restarting is often more efficient than continuing to patch things. Combined with the project context file and a freshly written “confirmed requirements description,” a new session can get back on track quickly.
A Practical Decision Rule
If the same class of problem fails twice in a row, stop and change approach.
- First judge whether the cause is a context problem or an approach problem.
- If context is too long, compact or clear.
- If the approach itself is flawed, switch back to plan mode or try a different implementation path.
- Either way, organize the error symptom, approaches tried, and expected behavior before communicating — never keep “patching” in the wrong direction.
11 Does the Conversation Vanish When You Close the Terminal? Resume with Session Restore
Long tasks spanning multiple days are the norm. Tools with session persistence save past sessions; the next time you enter the same project, you can choose to restore and continue from the previous context.
Three Habits When Restoring
- Confirm context first: Have the assistant briefly restate the last goal and progress to confirm you’re restoring the right session.
- Commit before restoring: Before switching branches or pulling new code, handle uncommitted changes to avoid mixing others’ edits after restore.
- Sync the baseline promptly: If project conventions or requirements have changed, update the project description file and requirements description in the first round after restoring.
Note that session restore solves “continuity,” while knowledge capture should rely on files and version control — both are essential.
12 Who Guards the Code After It’s Written? Use Sub-Agents for Code Review
What a Sub-Agent Is
A sub-agent is an independent work unit spawned by the main agent: it has its own context, dedicated instructions, and a restricted toolset, runs in the background in parallel, and returns only its conclusions to the main session. To use an analogy, the main agent is like the project lead, and sub-agents are like temporarily assigned specialist reviewers, each working with their own separate “notebook.”
Why Independent Review
- Independent perspective: Reviewing your own code makes it easy to “not see” problems.
- Context isolation: Reviewing involves looking up lots of code and dependencies without crowding out the main session’s context.
- Parallel efficiency: Multiple sub-agents can review different modules simultaneously.
Creating a Review Sub-Agent
---name: Code reviewerdescription: Review code changes, read-only analysis only, do not modify filestools: file reading, code search---You are a senior code reviewer. Review scope: all files involved in this change.Output along these dimensions:1. Correctness: boundary conditions, exception branches, concurrency issues2. Security: injection, privilege escalation, sensitive data leaks, dependency risks3. Maintainability: duplication, complexity, consistency with existing conventions4. Performance: unnecessary in-loop IO, N+1 queries, memory usage5. Tests: coverage of core and exception pathsFor each issue, note: file and approximate location, severity (blocking/suggestion/hint), description, and fix recommendation.Mark unconfirmed items as "needs human confirmation"; no guessing.
How to Use It
In the terminal, assign the review task to this sub-agent, with an optional emphasis: “focus on concurrency safety” or “focus on input validation.” Once you have the conclusions, decide which need the main agent to fix. You can also dispatch multiple sub-agents at once: one each for correctness, security, and performance review, returning in parallel.
The Difference Between Sub-Agents and Skills
| Dimension | Sub-Agent | Skill (custom instruction) |
|---|---|---|
| Nature | An independent execution unit | A reusable instruction package |
| Context | Independent, isolated | Loaded into the current session |
| Typical use | Parallel review, focused research, bulk search | Unifying work standards and output formats |
| Modifies code | Depends on permissions | Depends on the instruction content |
The two are often used together: the skill defines “how to review,” and the sub-agent provides “where to review.”
Sub-Agents Aren’t Just for Review
- Have a sub-agent investigate a feature’s call chain in a large codebase, returning only conclusions and key file paths.
- Have a sub-agent run tests and summarize failure causes, so a flood of test output doesn’t drown the main session.
- Have a sub-agent do comparative research on technical options to inform your main decision.
Human Review Is Indispensable
AI review finds many issues, but it can miss or misreport some, and it can’t fully grasp the business context and historical baggage. Position it as the “first filter”: blocking issues must be handled, suggestion-level items evaluated one by one, and “needs human confirmation” items resolved by a person. Final responsibility for quality always rests with humans.
13 Putting It Together: A Complete Flow from Requirement to Delivery
Stringing the above capabilities together gives a reusable collaboration pipeline:
- Start: Launch the assistant from the project root, auto-loading the project description.
- Clarify: When requirements are vague, have the assistant ask in reverse, forming a “confirmed requirements description.”
- Plan: Produce a plan in plan mode; a human reviews and confirms.
- Feed precisely: Reference key files, conventions, and tests as context.
- Tackle: Enable deeper reasoning for complex parts, or ask it to “prove first, implement later.”
- Protect the scene: Commit code at important milestones to form manual checkpoints.
- Execute: Use default mode with step-by-step confirmation for daily tasks; run batch tasks under Auto-Execute on a separate branch.
- Verify: Run tests and static checks; dispatch sub-agents for parallel review.
- Rollback: If unsatisfied, revert with checkpoints or version control, then fix and retry.
- Wrap up: Compact or clear context, save the session if needed, close the terminal.
- Capture: Lock reusable review checklists and generation conventions into skills.
14 Team Adoption and Security Boundaries
Beyond individual tips, teams adopting terminal AI coding assistants should establish basic conventions:
- Branches and permissions: AI-generated or modified code must go through the branch and merge-request flow, never pushed directly to the main branch.
- Key management: Inject sensitive credentials via a secrets management service or environment variables; never hardcode them.
- Least privilege: Assign repo read/write permissions by role; use dedicated, limited-permission credentials for automated tasks.
- Observability: Bring model calls and tool execution into a unified logging and monitoring/alerting system so anomalous behavior is traceable.
- Platform integration: Capabilities like code hosting, pipelines, and logging/monitoring can be connected through cloud platform products such as Baidu AI Cloud.
- Compliance review: Code leaving the organization and dependency introduction must meet the organization’s security and licensing requirements.
15 The Interview Angle: Common Follow-Ups and How to Prepare
If an interviewer brings up these tools, common questions fall into roughly these categories:
- Hands-on experience: What do you use it for daily? What pitfalls have you hit, and how did you solve them?
- Context management: How do you handle very long context? When do you compact vs. clear? How do you reduce ineffective context?
- Hallucination and correction: How do you verify AI output? How do you locate “wrong changes” and roll them back?
- Security and permissions: How do you control risk during auto-execution?
- Implementation principles: How does the agent loop run? How is the structured output of tool calls parsed? How do sub-agents and the main agent divide work?
The first four categories map directly to the methods in this article; the fifth requires systematic study of the underlying principles. Developers who can explain both “practical details + the reasons behind them” are often more persuasive than those who merely list feature names.
Quick Reference Table
| Scenario | Recommended Practice | One-Line Takeaway |
|---|---|---|
| Start and collaborate | Launch from the project root, keep step-by-step confirmation | It executes; you decide |
| Multi-file changes | Plan mode | Decide the plan before writing code |
| Vague requirements | Have the assistant ask in reverse | Align understanding before acting |
| Repeatedly correcting output format | Custom skills | Lock in standards, don’t repeat verbally |
| Need the assistant to inspect code | Precise file references | Fewer and precise beats more and messy |
| Complex logic / hard problems | Deeper reasoning | Prove first, implement later |
| Repeatedly explaining project background | Project description file | Lean, layered, under version control |
| Broke something | Checkpoint rollback + version control | Commit at important milestones |
| Repeated mistakes / slowing down | Compact first, then clear | Change approach after two failures |
| Continuing a task across days | Session restore | Confirm context and branch first |
| Guarding code quality | Parallel sub-agent review | First filter; humans make the final call |
Conclusion
The gap between the tools themselves is narrowing; what truly widens the productivity gap is the method of mastering them: knowing when to plan, how to provide context, how to correct mistakes, and who guards the outcome. Fold the 11 points of this article into your daily habits, add an understanding of the underlying principles, and a terminal AI coding assistant goes from “an occasional new toy to try” to “productivity infrastructure you can’t live without.”
