Advanced Practices for AI Coding Assistants: Slash Commands, Custom Tools, and Multi-Agent Workflows
This article explains why basic prompt-and-response usage of AI coding assistants hits an efficiency ceiling, and presents three reusable techniques for environments with plugin support: slash commands to capture frequent operations, custom tools to extend execution boundaries, and multi-agent orchestration for complex tasks. It covers context compaction, session export, long-term goal locking, tool design principles, parallel task decomposition, and metrics for evaluating improvements.
Advanced Practices for AI Coding Assistants: Slash Commands, Custom Tools, and Multi-Agent Workflows
Once an AI coding assistant becomes part of the daily development workflow, a common pattern appears: getting started is fast, but staying productive eventually runs into an efficiency ceiling. You repeat the same background every turn, long sessions get slower over time, the assistant can only “talk” but not “act,” and complex tasks have to be stitched together by hand. The root cause is not model capability. It is that usage is still stuck at the most basic one-question-one-answer level.
This article takes the common form of AI coding assistants found in the industry and abstracts three general advanced capabilities: fixing high-frequency operations with slash commands, extending execution boundaries with custom tools, and completing complex tasks with multi-agent collaboration. Together they form a reusable methodology that applies to any AI coding environment with a plugin mechanism.
1. Why Basic Usage Hits a Bottleneck
The cost structure of basic interaction is not sound. First, there is input redundancy: project background, coding conventions, and directory structure have to be pasted again and again. Second, context keeps expanding: as turns accumulate, history piles up, the model’s attention is diluted, responses slow down, and token cost rises linearly. Finally, capability boundaries are limited: the model itself can only generate text, so reading and writing files, running commands, and calling external services all require a human in the middle.
The core idea of advanced usage is to turn “the things you have to explain every time” into reusable assets, hand “the things the model cannot do” to an extensible execution layer, and give “the things one person cannot coordinate alone” to collaborative orchestration.
2. Slash Commands: Turning Frequent Operations into Reusable Instructions
A slash command is essentially a command registration and dispatch mechanism. After the user types a slash in the input box, the interface reads the list of currently registered commands and offers autocomplete. Once a command is selected, the host program runs the corresponding logic and injects the result into the session context. Because this capability is usually registered by plugins, the commands visible in different versions and configurations will vary, which is normal.
2.1 Context Compaction
The typical problem with long sessions is too much historical baggage. A compaction command organizes the key conclusions, confirmed file changes, and unfinished to-dos from the current conversation into a structured summary, and later turns continue from that summary instead of the raw history. Good moments to use it: a task spans a long stretch but you do not want to start a new session, debugging has produced a large amount of intermediate output, or you need to switch between several subtasks in the same context. In practice, compact after a milestone is confirmed, so that unverified guesses do not end up in the summary.
2.2 Session Export
An export command packages the complete conversation into a compressed file for download, which makes archiving, review, and further processing easier. Compared with manual copying, its value is that it preserves order and structure, so the record can go straight into a documentation workflow or a knowledge base. A practical convention is to archive by “requirement - design - implementation - verification,” turning conversation records into searchable team assets.
2.3 Long-Term Goal Locking
A goal command declares a task objective that stays in effect across turns. From then on, every interaction automatically advances that objective, and even if a temporary issue interrupts the flow, the session returns to the main line. Common usage looks like this:
/goal Refactor the login module, add unit tests, and produce migration notes/goal Show the current goal/goal edit <new goal description>/goal pause Pause/goal resume Resume/goal clear Clear
The engineering value is that intent is pulled out of every prompt and turned into a single source of truth, which reduces goal drift. Note that a goal description should be verifiable: state the scope, the deliverables, and the acceptance criteria rather than something vague like “improve things a bit.”
3. Custom Tools: Giving the Assistant Hands and Feet
Tool extensions solve the execution boundary problem. The general structure is this: a unified description declares the tool’s name, purpose, input parameters, and return format; the host selects and calls it on demand during reasoning; and the execution result is written back into the context. A few design lessons are worth following.
First, keep the granularity moderate. A tool that is too coarse is hard to reuse, while a tool that is too fine makes the number of calls explode, so divide by “one verifiable business action.” Second, the description is the interface documentation: the model relies entirely on it to decide whether to call the tool, so spelling out when it applies and when it does not matters more than piling up parameters. Third, permission and risk control are mandatory: write operations, delete operations, and external network requests should have a confirmation step or a whitelist, and the accessible directories and resources should be scoped. Fourth, keep return results lean and send back only the necessary fields, or large blocks of raw output will end up in the context and cause the expansion problem all over again.
An illustrative tool declaration:
{"name": "run_tests","description": "Runs tests for the specified module and returns a summary of failing cases; does not modify any files","parameters": {"module": "string, module path","pattern": "string, optional, case filter expression"},"returns": ["number of passing cases", "list of failing cases", "elapsed time"]}
4. Multi-Agent Collaboration: Splitting Complex Tasks into a Parallel Pipeline
When a task has to move across modules and stages, serial execution in a single session is inefficient. The multi-agent approach introduces an orchestration layer: a main agent decomposes the task, dispatches subtasks, and aggregates results, while sub-agents complete individual units of work independently within a restricted context and a restricted tool set. Common role divisions include planner, implementer, tester, and reviewer.
Four points matter in practice. One, task boundaries must be clear, and subtasks should share as little mutable state as possible. Two, isolate context: each sub-agent receives only the information needed for its own task, which both speeds things up and lowers the risk of unintended changes. Three, outputs must be verifiable, so every subtask needs a clear acceptance method, such as passing tests or a static check with no warnings. Four, convergence must be complete: set a maximum number of rounds and a timeout to prevent a deadlock caused by agents waiting on each other.
It is worth stressing that parallelism is not free. Merge conflicts, duplicated changes, and inconsistent conclusions all add cost, so partition work at the file level and keep human review at key checkpoints.
5. Combining the Three and Measuring Results
The three work best stacked: use a long-term goal to lock the direction, custom tools to connect the execution chain, multi-agent parallelism to advance subtasks, and compaction plus export to control context cost and preserve knowledge. To judge whether the change actually helps, watch a few general metrics: the share of repeated input, the average number of turns per task, the context length growth curve, and the number of human rework rounds. If context keeps expanding while rework does not decrease, the goal description or the tool granularity usually needs adjustment.
If you use a cloud-hosted AI coding service, you can combine object storage to hold archived artifacts, a logging service with monitoring and alerting to track calls, and a container platform to host the tool execution environment, keeping permissions, auditing, and cost under control. Baidu AI Cloud offers a fairly complete combination of these general capabilities, which you can adopt as needed.
6. Conclusion
The essence of advanced usage is turning an AI coding assistant from a “conversation tool” into an “orchestratable execution unit.” Slash commands accumulate intent, custom tools extend reach, and multi-agent collaboration absorbs complexity. Together they determine how much real value a team can get from AI coding.
