Smart Development Practices with Editors, AI CLI Tools, and a Proxy Layer
This article explains how to organize an AI-assisted development environment around three components: a code editor with an AI panel, an AI command-line tool, and a proxy layer that handles provider routing and MCP servers. It covers installation and verification, provider switching, centralized MCP management, syncing prompts and skills across a team, defining skills with permissions and failure handling, plus a pre-launch checklist and common pitfalls around cost, context, and data privacy.
Prerequisites and Scope
This article is intended for developers who already use code editors and AI CLI tools in their daily work. Before reading, you need three things: an editor that supports AI extensions or a native AI panel, an AI CLI capable of executing non-interactive commands, and an API key from at least one model provider. The configuration snippets in this article are generic examples; for installation commands, field names, and version requirements, refer to the official documentation of the tools you use. This article does not cover model training or model selection—it focuses solely on how to organize the development environment.
1. The End-to-End Flow Through a Real Task
Consider a common task: adding unit tests for a service module. The developer selects the module file in the editor’s side panel and types an instruction. The panel reads the selected code and its directory, then hands them to the proxy layer along with the instruction. The proxy layer selects a model based on the task type and attaches project context provided by MCP servers. The AI CLI receives the request, runs the test command, reads the failure output, and passes the results back to the model for correction.
The editor handles input and display, the proxy layer handles routing and configuration, and the CLI handles execution. With clear responsibility boundaries, problems can be isolated layer by layer.
2. The Editor Side: Installation and Session Entry Points
There are typically two ways to integrate AI into an editor. The first is installing an AI extension, which provides a chat panel in the sidebar. The second is launching the AI CLI directly in the integrated terminal. The panel works well for explaining, completing, and making small fixes to a single file; the terminal is better suited for batch operations across multiple files.
It is recommended to first verify in the terminal that the CLI can call the model correctly, and only then point the editor extension to the same proxy address. This way, when something goes wrong, you can tell whether the problem lies with the CLI or with the extension.
API keys should be stored in environment variables, never in configuration files that might be committed to Git:
export PROVIDER_A_KEY="your-key-here"export PROVIDER_B_KEY="your-key-here"
3. The Proxy Layer: Provider Switching, MCP Management, and Sync
3.1 Provider Switching
The proxy configuration defines an alias for each provider, and tasks select a model by alias. For example, a lightweight model handles completions while a high-performance model handles architectural design.
{"providers": {"fast": { "baseUrl": "https://provider-a.example.com/v1", "model": "small-model", "apiKeyEnv": "PROVIDER_A_KEY" },"strong": { "baseUrl": "https://provider-b.example.com/v1", "model": "large-model", "apiKeyEnv": "PROVIDER_B_KEY" }},"defaultProvider": "fast"}
Three points require attention when switching providers.
- Whether session history survives a provider switch depends on whether the proxy stores history in a provider-agnostic format. If the proxy merely forwards raw requests, context may be lost or produce errors after switching.
- Different models have different context window sizes. Before switching to a model with a smaller window, old history needs to be truncated or summarized.
- Tool-calling formats may be incompatible across providers. After switching, run a smoke test first—for example, have the model read a file and answer a question about it.
3.2 Centralized MCP Server Management
Define all MCP servers in a single configuration file for easier auditing. Set permissions according to the principle of least privilege. The following example only exposes the project’s source directory:
{"mcpServers": {"project-src": {"command": "npx","args": ["-y", "@modelcontextprotocol/server-filesystem", "./src"]}}}
Do not write credentials into configuration files. Accounts for database or API connectors should use read-only permissions, with passwords read from environment variables or the system keychain. Record the purpose and owner of each server. Servers that connect to databases should also have access logging enabled.
3.3 Syncing Prompts and Skills
A team can place standardized prompts and skills in a dedicated Git repository with a structure like this:
ai-config/├── prompts/│ ├── code-style.md│ └── review-checklist.md├── skills/│ ├── unit-test-gen.yaml│ └── dep-upgrade.yaml└── providers.example.json
Each developer pulls the repository with a script and links it to their local configuration directory. When conflicts arise, the merged result that has passed code review takes precedence—do not blindly overwrite local changes. If a new version causes problems, roll back to the previous tagged commit.
4. The CLI Execution Layer: Skill Definition, Permissions, and Failure Handling
Skills are pre-written, multi-step workflows. A maintainable skill should contain at least the following fields:
name: unit-test-gendescription: Generate unit tests for a specified moduletrigger: /testallowed_tools:- read_file- run_tests- write_file:tests/max_model_calls: 6on_failure: rollbackaudit_log: true
Field names are examples only; refer to your CLI’s specification for the actual schema. This definition imposes four constraints. First, allowed_tools restricts the tool scope, so write operations can only occur in the tests/ directory. Second, max_model_calls caps the number of model calls per task to prevent runaway loops from consuming budget. Third, on_failure defines how failures are handled. Fourth, audit_log requires recording every tool call and its parameters.
The key to failure handling is making every automated change reversible. Before running a skill, create a new branch or commit the current changes. If the skill fails, roll back to that commit and review the logs manually. Never let a skill perform batch rewrites directly on the main branch.
MCP transmits messages based on JSON-RPC 2.0. Tool calls produced by the model are converted into requests to MCP servers, and the results are returned to the model. The protocol versions of the client and server must match; when they don’t, common symptoms include an empty tool list or call errors.
5. Pre-Launch Checklist
- All keys come from environment variables; no plaintext keys can be found by searching the repository.
- Each MCP server exposes only the required paths or is granted read-only access.
- Each provider has passed a smoke test that includes tool calls.
- High-cost tasks have call limits; simple tasks are routed to the lightweight model.
- There is a branch or commit before any batch modification, and the rollback command has been verified to work.
- The storage location of audit logs is defined, and logs do not record keys.
- Locally stored session history has a defined cleanup schedule.
6. Common Errors and Caveats
An empty tool list usually means the MCP server failed to start or a path argument is wrong. A drop in answer quality after switching providers typically means the history was truncated—check the summarization strategy. When tests pass after a batch refactor but behavior is wrong, a common cause is that the skill only modified the tests without covering boundary conditions; the diff needs human review.
On cost: long contexts are billed by input volume. Feeding the entire repository to the model is often more expensive than precisely including three relevant files, and it dilutes key information. On data: code sent to a provider may be logged. When working with non-public code, confirm the provider’s data retention policy first.
Start with a pilot on a single module, and expand to the whole team once the workflow runs smoothly.
