A Deep Dive into Slash Commands for AI Coding CLI Assistants

    This article explains the most common slash commands found in AI coding CLI assistants and the engineering value behind them. It groups these commands into six categories, task and agent management, context and session control, planning and model selection, code review and task initialization, status diagnostics and feedback, and permissions, configuration, and extensions, and shows how to combine them into stable, reusable workflows. Developers will learn how to split and parallelize work with `/agents` and `/tasks`, manage long sessions with `/context`, `/compact`, and `/memory`, choose the right model and reasoning depth with `/model` and `/effort`, enforce quality with `/review`, `/hooks`, and `/skills`, and set safe boundaries with `/permissions`, `/config`, and `/status`. The goal is to move from passively accepting output to actively driving an auditable, controllable, and maintainable AI-assisted development process.

    As AI coding tools become part of everyday development, command-line interaction is emerging as one of the most important entry points for AI-assisted coding. It is lightweight, scriptable, and easy to fit into an engineering environment. Compared with relying purely on natural-language descriptions, slash commands usually offer a clearer structure, more stable semantics, and stronger controllability. Through slash commands, argument options, and status feedback, developers can make an AI coding assistant perform tasks as expected instead of repeatedly probing vague phrasing.

    This article uses a generic AI coding CLI assistant as its subject and systematically explains the design principles, usage scenarios, and engineering value of common slash commands. It does not depend on any specific product. Instead, it abstracts the command system commonly found in AI coding CLIs so that developers can build a portable, practical set of methods.

    1. Why Shortcut Commands Matter

    The core value of an AI coding assistant lies in understanding intent, generating code, explaining problems, assisting with review, and chaining engineering tasks together. Natural language, however, is inherently ambiguous, especially in complex development scenarios where users often want the tool not just to “answer a question” but to “perform an action.” For example:

    • You want the assistant to propose a plan first, then decide whether to modify files.
    • You need to check background progress during a long-running task.
    • You need to summarize and compress context when it grows too long.
    • You need to roll back to a previous state when a change turns out to be wrong.
    • You need to restrict tool permissions to avoid mistakes.
    • You need to connect project conventions, test workflows, and external systems.

    Relying entirely on natural-language descriptions tends to create three problems. First, expressions are not structured enough, which leads to misunderstandings. Second, the results of operations are not visible, so developers struggle to judge the current state. Third, there are no clear permission boundaries, which can trigger unnecessary or even high-risk actions.

    Slash commands are designed precisely to solve these problems. They abstract common operations into explicit commands, letting developers control state, manage context, schedule tasks, and enforce safety constraints at a much lower cost.

    2. Core Categories of Slash Commands

    By capability, slash commands in an AI coding CLI usually fall into the following categories: task and agent management, context and session control, planning and model selection, status diagnostics and feedback, and permission, configuration, and integration. Each category solves problems at a different level and maps to different engineering practices.

    2.1 Task and Agent Management: Turning Complex Work into Controllable Units

    /agents: Sub-agent management

    The goal of a sub-agent mechanism is to split one complex task into several relatively independent execution units. For example, in a large project a user might need to run code migration, test supplementation, documentation updates, and static checks at the same time. If everything is handled in a single context, the context bloats, tasks interfere with one another, and results become hard to track.

    Commands like /agents typically provide the ability to view, create, and edit sub-agents. Their engineering value comes mainly from three points:

    1. Parallelization: Multiple subtasks can progress at once, improving overall efficiency.
    2. Context isolation: Each sub-agent has a relatively independent task environment, reducing interference from irrelevant information.
    3. Clear ownership: Each agent focuses on a single subgoal, which makes it easier to aggregate results and control quality.

    In practice, sub-agents are best suited to well-bounded subtasks, such as “check the boundary conditions of a given module,” “add test cases for a given function,” or “generate API documentation.” For tasks that depend heavily on a global understanding, over-splitting is unwise, because incomplete context can lower quality.

    /tasks: Viewing background tasks

    Commands like /tasks are usually used to view the tasks currently running in the background, such as long-running generation, checking, build, or test operations. Their value is that they free developers from synchronous waiting and let them manage task status asynchronously.

    These commands suit long-running scenarios, such as full-codebase scans, dependency analysis, or test-case generation. When using them, pay attention to how many tasks run concurrently. Starting too many background tasks at once can cause excessive resource usage, mixed-up logs, or results that overwrite one another. It is better to run tasks in stages according to priority and to inspect task output at key checkpoints.

    2.2 Context and Session Control: Keeping Long Sessions Usable

    The quality of an AI coding assistant depends heavily on context. Context can come from user input, file contents, command output, conversation history, tool-call results, and project memory. As context accumulates, you may see slower responses, lost focus, and growing noise.

    /context: Visualizing context usage

    Commands like /context mainly show how much of the current context window is occupied, including the breakdown across system instructions, message history, tool results, project files, and other components. Their value is that they help developers build an awareness of “context cost.”

    Many developers focus only on answer quality during long sessions while overlooking the fact that the context is approaching its limit. If the conversation continues, the model may miss earlier constraints or repeatedly misinterpret recent errors. With context visualization, developers can judge:

    • Whether historical content needs to be compressed;
    • Whether irrelevant tasks should be closed;
    • Whether a new session should be started;
    • Whether key constraints should be written into a project memory file.

    /compact: Compressing and summarizing context

    Commands like /compact compress the content of the current session. This is usually not a simple deletion of history; instead, it preserves key decisions, constraints, and interim conclusions while summarizing lengthy process information.

    When context usage exceeds roughly eighty percent, it is best to compress first. Compression fits well at these points:

    • After completing a feature module;
    • When several rounds of debugging in a row reach no conclusion;
    • Before starting a new task;
    • When a long session shows repeated explanations or slower responses.

    Note that compression is not lossless. If the session contains critical API definitions, strict constraints, or business rules that must not be lost, fix them in advance in a project memory file or a task description. Otherwise, compression may drop important information.

    /memory: Project memory management

    A project memory file stores relatively stable project knowledge, such as directory structure, coding conventions, testing approach, build commands, prohibited actions, and descriptions of common modules. Unlike temporary conversation, project memory is meant for information that stays valid over the long term.

    Commands like /memory typically support viewing, editing, or switching project memory files. Their engineering value is that they give the assistant baseline background at the start of every session, reducing repeated explanation. For example, you can record:

    • The location of the project entry file;
    • The responsibilities of core modules;
    • Testing and static-check commands;
    • Naming conventions;
    • The scope of files that must not be modified;
    • Checks that must be completed before release.

    Do not put sensitive information such as keys, accounts, or tokens into a project memory file. Also keep memory content concise; if it grows into a long document, it will consume context too.

    /rewind: Rolling back session state

    Commands like /rewind roll the session state back to a previous checkpoint. Compared with abruptly interrupting a task, a rollback usually preserves the scene and reduces the uncertainty caused by a forced stop.

    Rollback is especially important in AI coding scenarios, because model output may involve a sequence of actions such as file modifications, command execution, and test verification. If one step goes wrong, forcibly stopping can leave a half-finished state; a rollback instead returns to a safe point before the change so you can choose a different strategy.

    Use rollback in these situations:

    • Large-scale automated changes were made that did not match expectations;
    • A file modification or command was executed incorrectly;
    • The conversation drifted off course but the earlier context is still valuable;
    • You want to keep the session history and switch execution paths.

    /btw: Side questions

    Commands like /btw usually indicate a side question, meaning an ad hoc query for supplementary information that is not written into the main conversation flow. Their value is that they reduce pollution of the main context by temporary questions.

    For example, while a main task is running, a developer suddenly wants to confirm a concept, a command’s meaning, or an implementation detail. Inserting that directly into the main conversation may create confusion; a side question handles the temporary query separately without affecting the main line of work.

    These commands suit quick confirmations, ad hoc explanations, and local information lookups. They are not suitable for carrying key decisions or information that later steps must remember.

    2.3 Planning and Model Selection: Think First, Then Act

    /plan: Planning mode

    Commands like /plan enter planning mode. In this mode the assistant mainly outputs ideas, steps, risk points, and an implementation plan rather than directly modifying files or executing commands.

    Planning mode is important for complex tasks. Many quality problems do not come from insufficient coding ability but from incomplete requirement understanding, an unreasonable implementation path, or inadequate risk consideration. By planning first, developers can catch plan-level problems at a low-cost stage and avoid discovering a wrong direction only after coding has begun.

    Scenarios that suit planning mode include:

    • Cross-module refactoring;
    • Architecture changes;
    • Coordinated changes across multiple files;
    • Unclear requirement boundaries;
    • Situations that require reviewing a plan before implementation.

    The key value of planning mode is “align first, then execute.” It surfaces hidden risks and breaks a single large change into smaller, verifiable steps.

    /model: Switching models

    Commands like /model switch between different models. Models usually differ in reasoning depth, response speed, cost, code understanding, and tool-calling ability. Switching models sensibly is an important way to improve efficiency and control cost.

    In general, consider the following strategy:

    • For simple Q&A, formatting, and basic completion, prefer a fast model;
    • For complex architecture design, difficult problem localization, and cross-file analysis, choose a model with stronger reasoning;
    • For high-frequency, batch, low-complexity tasks, choose a lower-cost model;
    • For security-sensitive tasks, focus on the model and tool permission configuration rather than simply pursuing a higher capability tier.

    Switching models is not “the more advanced, the better.” High-intensity models usually come with higher resource consumption, and using them for simple tasks can cause unnecessary cost.

    /effort: Adjusting reasoning depth

    Commands like /effort adjust reasoning depth. The usual logic is that deeper reasoning suits complex problems but costs more time and resources. For simple tasks, excessive reasoning depth does not necessarily pay off and may increase cost.

    Reasoning depth is well suited to:

    • Complex defect localization;
    • Algorithm design;
    • Architecture trade-off analysis;
    • Comparing multiple approaches;
    • High-difficulty code review.

    For routine code generation, simple refactoring, and formatting, a lower reasoning depth can be used to improve response speed and reduce cost.

    2.4 Code Review and Task Initialization: Raising Output Quality

    /review: Code review

    Code review commands review the current code diff, checking not only correctness but also reusability, maintainability, and performance. A good review should do more than answer “does it run” and should also address:

    • Whether any boundary conditions are missed;
    • Whether exception handling is insufficient;
    • Whether there is duplicate code;
    • Whether any logic can be simplified;
    • Whether there are performance risks;
    • Whether the code follows project conventions.

    Some tools also support applying fixes directly after the review. But automated fixes still require human review, especially for critical logic involving permissions, data, network requests, payments, or login, where you should not rely entirely on automatic changes.

    Make code review a fixed step in the commit workflow. It helps developers catch potential problems before merging and reduces later maintenance cost.

    /init: Project initialization

    Commands like /init initialize the project context, usually by generating a project description file that helps the assistant understand the project structure and development conventions. Its value is that it moves AI coding tools from “ad hoc Q&A” toward “long-term collaboration.”

    Initialization content typically includes:

    • Project directory structure;
    • Responsibilities of main modules;
    • Common commands;
    • Coding style;
    • Testing approach;
    • Build and release workflow;
    • Areas that must not be modified.

    High-quality project initialization can significantly reduce repeated explanation in every session and help the assistant enter a productive state faster.

    2.5 Status Diagnostics and Feedback: Making the Process Transparent

    /status: Checking runtime status

    Commands like /status show the current runtime status, typically including the logged-in account, the current model, the working directory, and the software version. Their significance is that they help developers confirm the environment is correct.

    In complex projects, environment issues are often overlooked. For example, a wrong working directory may cause the assistant to read the wrong project; a capability change after switching models may lead to inconsistent output style; an outdated version may make some commands unavailable. Checking status lets you quickly rule out environment-level interference.

    /cost and usage statistics

    Cost and usage commands show the resource consumption and cost estimate for the current session. For team and enterprise users this information is especially important. The cost of using AI coding tools depends not only on the number of calls but also on context length, reasoning depth, task complexity, and the number of background tasks.

    With cost statistics, developers can build more rational usage habits:

    • Avoid meaningless long sessions;
    • Compress context in time;
    • Choose the right model tier;
    • Control background-task concurrency;
    • Concentrate high-cost tasks at key points.

    /feedback: Feedback and issue reporting

    Feedback commands submit issues or suggestions. Their value is that they lower the cost of giving feedback. If a tool automatically attaches the current session context, developers do not have to copy logs manually, which also reduces the risk of missing information.

    Even so, before submitting feedback, take care to redact sensitive information. Content involving internal code, account information, configuration parameters, and keys should not be uploaded directly.

    /help: Command overview

    Commands like /help list all available commands, including built-in, custom, and extension commands. For new users this is the entry point for understanding the tool’s capabilities; for experienced users it helps discover uncommon but useful features.

    Help output usually also includes parameter descriptions, aliases, and examples. It is a good idea for developers to review help regularly, because tool capabilities keep evolving and some commands may gain new parameters or improved behavior.

    2.6 Permissions, Configuration, and Extensions: Building a Safe, Controllable Environment

    /permissions: Tool-call permissions

    Permission management is an essential part of an AI coding CLI. Because the assistant may read and write files, run commands, and access the network, you must set boundaries for tool calls.

    Commands like /permissions usually control the invocation policy for different tools, for example:

    • Whether confirmation is required each time;
    • Which operations can run automatically;
    • Which paths are forbidden to access;
    • Which commands require manual approval;
    • Whether modifying configuration or running external scripts is allowed.

    Permission design should follow the principle of least privilege. Read-only query operations can be relaxed appropriately, while high-risk operations such as file writes, deletions, deployments, and database changes should retain a manual confirmation step.

    /config: Configuration panel

    Configuration commands adjust the interface theme, default parameters, editor mode, output style, and so on. Although these settings do not directly affect core capability, they affect the long-term usage experience. Reasonable configuration reduces repeated input and makes the workflow more stable.

    For example, you can set a default model, default review policy, default permission level, and default log verbosity. In team scenarios, unified configuration helps reduce collaboration differences.

    /integrations: External system connections

    External system integration connects the AI coding assistant with requirement management, code hosting, database queries, logging services, and monitoring and alerting. Through integration, the assistant can read a wider range of information and therefore provide more accurate context.

    For example, in a troubleshooting scenario the assistant can combine error records from a logging service, monitoring metrics, and the code implementation to analyze a problem; in a feature-development scenario it can combine the requirement description, API documentation, and change history to generate an implementation plan.

    Note that external integrations must consider permission isolation and data security. Different systems should have independent authorization mechanisms so that a single connection does not expose too much sensitive information.

    /hooks: The hook mechanism

    The hook mechanism automatically runs actions before or after specific events. For example, formatting automatically after code generation, running static checks automatically before a task completes, or logging automatically before a command executes.

    The value of hooks is that they automate repetitive steps and reduce manual intervention. Common uses include:

    • Unifying formatting after files are generated;
    • Running static checks after code changes;
    • Emitting a warning before high-risk commands run;
    • Archiving results when a task ends;
    • Automatically logging key operations.

    Hooks should be lightweight, controllable, and auditable. Overly complex hooks may introduce new points of failure and end up reducing development efficiency.

    /skills: Skill-package management

    A skill package usually represents a set of reusable workflow capabilities, such as a code review flow, a test generation flow, a documentation generation flow, or a problem localization flow. Commands like /skills show the currently loaded skill packages and support invoking them on demand.

    The point of skill packages is to turn good practices into reusable assets. Developers can package team conventions, project experience, and common problem-handling approaches into skill packages so that the assistant behaves consistently across different tasks.

    3. Quick Reference: Common Commands and Their Scenarios

    The commands below are generalized examples. Actual names, parameters, and implementations may differ between tools.

    Command Main capability Recommended scenario Notes
    /agents Manage sub-agents Parallel tasks, decomposing complex requirements Avoid over-splitting that breaks context
    /tasks View background tasks Long-running generation, checks, tests Control concurrency to avoid resource contention
    /status Check runtime status Troubleshoot environment, model, directory issues Periodically confirm working directory and version
    /help List commands New-user onboarding, capability discovery Use together with parameter descriptions
    /init Initialize project context New project onboarding, long-term collaboration Keep content concise; avoid bloat
    /compact Compress context Long sessions, context near its limit Confirm key info is preserved before compressing
    /context View context usage Slower sessions, lost focus Use to decide whether to compress or start fresh
    /memory Manage project memory Fix project conventions and structure Never store secrets or sensitive data
    /rewind Roll back session state Wrong changes, off-course direction Better than a forced stop, but confirm the checkpoint
    /btw Side question Ad hoc detail confirmation Not for carrying key decisions
    /plan Planning mode Complex refactoring, plan review Align on the plan before executing
    /model Switch models Tasks of different complexity Simple tasks need not use a high-tier model
    /effort Adjust reasoning depth Deep analysis of complex problems High depth costs more
    /review Code review Pre-commit quality check Automated fixes still need human review
    /cost Cost statistics Control resource usage Watch long context and background tasks
    /feedback Submit feedback Issue reports, experience improvement Redact sensitive information
    /permissions Permission management Control high-risk operations Follow the principle of least privilege
    /config Adjust configuration Personalization Unify conventions in team scenarios
    /hooks Automation hooks Formatting, static checks, logging Hooks should be lightweight and auditable
    /skills Manage skill packages Reuse team workflows Skill content needs ongoing maintenance

    4. Typical Combination Strategies

    A single command solves only a local problem. Real efficiency gains come from combining commands. Here are a few typical workflows.

    4.1 Complex feature-development workflow

    Recommended flow:

    1. Use /plan to enter planning mode and produce a plan first;
    2. Use /review or manual review to check the plan for risks;
    3. Use /model to select a model suited to complex reasoning;
    4. Use /agents to break the work into subtasks;
    5. Use /tasks to track background tasks;
    6. Use /review to review the final diff;
    7. Use /hooks to automatically run formatting and static checks after generation.

    This flow suits cross-module development, refactoring, migration, and complex defect fixes.

    4.2 Long-session context-governance workflow

    Recommended flow:

    1. Use /context to check context usage;
    2. Run /compact when usage exceeds roughly eighty percent;
    3. Persist key constraints into /memory;
    4. Use /btw for ad hoc questions to avoid polluting the main session;
    5. Use /rewind to roll back to a checkpoint if execution drifts;
    6. If necessary, start a new session and reload project memory.

    This flow suits long development stretches, continuous debugging, and multi-round iteration.

    4.3 Code-quality assurance workflow

    Recommended flow:

    1. Use /review to review the current diff;
    2. Fix correctness problems first;
    3. Clean up duplicate code, complex conditions, and naming issues;
    4. Use /hooks to automatically trigger formatting and static checks;
    5. Use /tasks to view background test results;
    6. Before committing, use /cost to check the session’s resource usage.

    This flow suits finishing feature development, pre-merge checks, and defect-fix verification.

    4.4 Permission and security-control workflow

    Recommended flow:

    1. Use /permissions to set a default approval policy;
    2. Authorize file writes, command execution, and external access separately;
    3. Keep manual confirmation for high-risk operations;
    4. Use /hooks to log key operations;
    5. Periodically check /status and configuration to confirm there is no unintended authorization.

    This flow suits enterprise R&D, multi-person collaboration, and sensitive codebases.

    5. Best Practices for Using Slash Commands

    5.1 Establish context before executing commands

    Many developers habitually type a requirement and immediately ask for code. A more reliable approach is to first establish baseline information through project initialization, project memory, and context checks, then move on to the specific task. This reduces the assistant’s misjudgment of the environment.

    5.2 Plan first for complex tasks

    For tasks involving multiple modules, multiple files, or critical business logic, use planning mode first. Clarify the goal, constraints, steps, risks, and verification approach before entering execution. This significantly lowers the chance of rework.

    5.3 Compress context on a rhythm

    Do not wait until the context is completely unusable before compressing. It is better to compress proactively at the end of a stage task, when the session slows down, or when context nears its limit. Before compressing, write important constraints into project memory to prevent the loss of key information.

    5.4 Match model choice to task complexity

    Different models suit different tasks. Use low-cost models for simple tasks and high-capability models for complex ones. Using a high-tier model blindly not only raises cost but can also make a simple task unnecessarily complicated.

    5.5 Follow least privilege for permissions

    The more powerful an AI coding tool becomes, the more it needs permission control. Read-only, query, and analysis operations can be opened up moderately, while high-risk behaviors such as modification, deletion, deployment, and database operations should retain a confirmation step. Permissions that are too broad reduce efficiency but, more importantly, risk bringing in uncontrollable outcomes.

    5.6 Automated fixes cannot replace human review

    Even if a tool supports automated fixes, developers should still review the changes. For code involving core business logic, permission checks, data consistency, and external API calls, manual confirmation is mandatory.

    5.7 Turn repeated experience into skills or hooks

    If a certain kind of task keeps recurring, such as formatting, static checks, and documentation updates before every commit, turn it into a skill package or a hook. This keeps behavior consistent and reduces repetitive work.

    6. Common Pitfalls and How to Avoid Them

    Pitfall 1: Treating slash commands like ordinary chat

    The core value of slash commands is controlling state and flow, not simply initiating a question. If you treat them as chat commands, you waste their task-management, permission-control, and context-governance capabilities.

    Pitfall 2: Assuming longer context is always better

    Longer context is not necessarily more effective. Overly long context introduces noise, raises cost, and can drown out the important points. Compress, distill, and summarize regularly.

    Pitfall 3: Frequently switching models or parameters

    Frequently switching models, reasoning depth, or configuration can make output style inconsistent and increase debugging cost. It is better to establish fixed policies for different task types.

    Pitfall 4: Ignoring permissions and auditability

    In team environments, permissions and auditability matter more than individual convenience. An AI coding tool without permission control may bring risks such as code leakage, unintended modification, or unintended execution.

    Pitfall 5: Over-relying on automatic execution

    Automation improves efficiency, but it can also amplify errors. For critical flows, keep checkpoints, rollback mechanisms, and manual confirmation points.

    7. Conclusion

    Slash commands in an AI coding CLI are, in essence, a way of turning a complex AI collaboration process into a manageable, controllable, and reusable engineering workflow. Through task splitting, context management, planning mode, model selection, code review, permission control, and automation extensions, they help developers move from “passively accepting output” to “actively steering the process.”

    The truly efficient way to use AI coding tools is not to pile up commands, but to understand the mechanism behind each category:

    • Use /agents and /tasks to solve task splitting and parallel execution;
    • Use /context, /compact, and /memory to solve context governance;
    • Use /plan, /model, and /effort to solve complex-problem decomposition and resource allocation;
    • Use /review, /hooks, and /skills to solve quality assurance and experience reuse;
    • Use /permissions, /config, and /status to solve security boundaries and environment stability.

    When these capabilities are combined into a stable workflow, an AI coding tool stops being just a code generator and becomes a reliable assistant in the development process. For both developers and teams, the meaning of mastering these slash commands is not only to speed up a single coding task, but to build a sustainable, governable, and evolvable way of doing AI-assisted development.