From 70b5aee381dd4a57b8a0932edb2f063fc6b3ceff Mon Sep 17 00:00:00 2001 From: joeytoday Date: Tue, 9 Dec 2025 14:05:26 +0800 Subject: [PATCH] docs: Add documentation for Sub Agents feature and update user guides - Introduced a new documentation file for Sub Agents, detailing their purpose, benefits, configuration, and usage examples. - Updated the overview and quickstart guides to improve clarity and remove outdated information. - Created a comprehensive command reference document for Qwen Code, detailing slash commands, at commands, and exclamation commands for better user guidance. - Enhanced the formatting and organization of existing documentation for improved readability and usability. --- docs/users/common-workflow.md | 166 +---- docs/users/features/mcp.md | 586 ++++++++++++++++++ .../features/{subagents.md => sub-agents.md} | 338 ++++------ docs/users/overview.md | 64 +- docs/users/quickstart.md | 60 +- docs/users/reference/cil-reference.md | 259 ++++++++ 6 files changed, 1014 insertions(+), 459 deletions(-) rename docs/users/features/{subagents.md => sub-agents.md} (70%) create mode 100644 docs/users/reference/cil-reference.md diff --git a/docs/users/common-workflow.md b/docs/users/common-workflow.md index 554292a5..a0c47fe6 100644 --- a/docs/users/common-workflow.md +++ b/docs/users/common-workflow.md @@ -49,7 +49,6 @@ how is authentication handled? > - Ask about coding conventions and patterns used in the project > - Request a glossary of project-specific terms - ### Find relevant code Suppose you need to locate code related to a specific feature or functionality. @@ -88,12 +87,12 @@ I'm seeing an error when I run npm test 2. Ask for fix recommendations ``` -suggest a few ways to fix the @ts-ignore in user. ts +suggest a few ways to fix the @ts-ignore in user.ts ``` 3. Apply the fix ``` -update user. ts to add the null check you suggested +update user.tsto add the null check you suggested ``` > [!tip] Tips: @@ -185,15 +184,15 @@ Then select "Create New subagent" and follow the prompts to define: > [!tip] Tips: > -> - Create project-specific subagents in `.qwen-code/agents/` for team sharing +> - Create project-specific subagents in `.qwen/agents/` for team sharing > - Use descriptive `description` fields to enable automatic delegation > - Limit tool access to what each subagent actually needs -> - Check the [subagents documentation](/sub-agents) for detailed examples +> - Know more [Sub Agents](/sub-agents) ## Use Plan Mode for safe code analysis -Plan Mode instructs Claude to create a plan by analyzing the codebase with read-only operations, perfect for exploring codebases, planning complex changes, or reviewing code safely. +Plan Mode instructs Qwen Code to create a plan by analyzing the codebase with read-only operations, perfect for exploring codebases, planning complex changes, or reviewing code safely. ### When to use Plan Mode @@ -219,10 +218,10 @@ To start a new session in Plan Mode, use the `/approval-mode` then select `plan` **Run "headless" queries in Plan Mode** -You can also run a query in Plan Mode directly with `-p` (that is, in ["headless mode"](/en/headless)): +You can also run a query in Plan Mode directly with `-p` or `prompt`: ```bash -/approval-mode plan -p "Analyze the authentication system and suggest improvements" +qwen --prompt "What is machine learning?" ``` ### Example: Planning a complex refactor @@ -245,7 +244,7 @@ How should we handle database migration? ### Configure Plan Mode as default ```json -// .qwen-code/settings.json +// .qwen/settings.json { "permissions": { "defaultMode": "plan" @@ -253,8 +252,6 @@ How should we handle database migration? } ``` -See [settings documentation](/en/settings#available-settings) for more configuration options. - ## Work with tests Suppose you need to add tests for uncovered code. @@ -335,7 +332,7 @@ improve the generated documentation with more context and examples 4. Verify documentation ``` -> check if the documentation follows our project standards +check if the documentation follows our project standards ``` > [!tip] Tips: @@ -354,9 +351,9 @@ You can use any of these methods: 1) Drag and drop an image into the Qwen Code window 2) Copy an image and paste it into the CLI with ctrl+v (Do not use cmd+v) -3) Provide an image path to Claude. E.g., "Analyze this image: /path/to/your/image. png" +3) Provide an image path to Qwen Code. E.g., "Analyze this image: /path/to/your/image. png" - 3. Ask Claude to analyze the image + 4. Ask Qwen Code to analyze the image ``` What does this image show? ``` @@ -394,7 +391,6 @@ What HTML structure would recreate this component? > - You can work with multiple images in a conversation > - Image analysis works with diagrams, screenshots, mockups, and more - ## Reference files and directories Use `@` to quickly include files or directories without waiting for Qwen Code to read them. @@ -418,7 +414,7 @@ This provides a directory listing with file information. Show me the data from @github: repos/owner/repo/issues ``` -This fetches data from connected MCP servers using the format @server: resource. See [MCP resources](/en/mcp#use-mcp-resources) for details. +This fetches data from connected MCP servers using the format @server: resource. See [MCP](/mcp) for details. > [!tip] Tips: > @@ -432,10 +428,6 @@ This fetches data from connected MCP servers using the format @server: resource. Suppose you're working on complex architectural decisions, challenging bugs, or planning multi-step implementations that require deep reasoning. -> [!note] -> -> [Extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) is disabled by default in Qwen Code. You can enable it on-demand by using `Tab` to toggle Thinking on, or by using prompts like "think" or "think hard". You can also enable it permanently by setting the [`MAX_THINKING_TOKENS` environment variable](/en/settings#environment-variables) in your settings. - 1. Provide context and ask Qwen Code to think ``` I need to implement a new authentication system using OAuth 2 for our API. Think deeply about the best approach for implementing this in our codebase. @@ -443,7 +435,8 @@ I need to implement a new authentication system using OAuth 2 for our API. Think Qwen Code gathers relevant information from your codebase and uses extended thinking, which is visible in the interface. - 2. Refine the thinking with follow-up prompts +2. Refine the thinking with follow-up prompts + ``` think about potential security vulnerabilities in this approach ``` @@ -452,26 +445,6 @@ think about potential security vulnerabilities in this approach think hard about edge cases we should handle ``` -> [!tip] -> Tips to get the most value out of extended thinking: -> -> [Extended thinking](https://docs.claude.com/en/docs/build-with-claude/extended-thinking) is most valuable for complex tasks such as: -> -> - Planning complex architectural changes -> - Debugging intricate issues -> - Creating implementation plans for new features -> - Understanding complex codebases -> - Evaluating tradeoffs between different approaches -> -> Use `Tab` to toggle Thinking on and off during a session. -> -> The way you prompt for thinking results in varying levels of thinking depth: -> -> - "think" triggers basic extended thinking -> - intensifying phrases such as "keep hard", "think more", "think a lot", or "think longer" triggers deeper thinking -> -> For more extended thinking prompting tips, see [Extended thinking tips](https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/extended-thinking-tips). - > [!note] > Qwen Code displays its thinking process as italic gray text above the response. @@ -575,7 +548,7 @@ qwen ``` -5. Run Claude in another worktree +5. Run Qwen Code in another worktree ```bash cd ../project-bugfix qwen @@ -594,7 +567,7 @@ git worktree remove ../project-feature-a > [!tip] Tips: > > - Each worktree has its own independent file state, making it perfect for parallel Qwen Code sessions -> - Changes made in one worktree won't affect others, preventing Claude instances from interfering with each other +> - Changes made in one worktree won't affect others, preventing Qwen Code instances from interfering with each other > - All worktrees share the same Git history and remote connections > - For long-running tasks, you can have Qwen Code working in one worktree while you continue development in another > - Use descriptive directory names to easily identify which task each worktree is for @@ -604,9 +577,9 @@ git worktree remove ../project-feature-a > - Other languages: Following your project's standard setup process -## Use Claude as a unix-style utility +## Use Qwen Code as a unix-style utility -### Add Claude to your verification process +### Add Qwen Code to your verification process Suppose you want to use Qwen Code as a linter or code reviewer. @@ -634,7 +607,7 @@ Suppose you want to use Qwen Code as a linter or code reviewer. Suppose you want to pipe data into Qwen Code, and get back data in a structured format. -**Pipe data through Claude:** +**Pipe data through Qwen Code:** ```bash cat build-error.txt | qwen-code -p 'concisely explain the root cause of this build error' > output.txt @@ -676,102 +649,10 @@ This outputs a series of JSON objects in real-time as Qwen Code processes the re > [!tip] Tips: > -> - Use `--output-format text` for simple integrations where you just need Claude's response +> - Use `--output-format text` for simple integrations where you just need Qwen Code's response > - Use `--output-format json` when you need the full conversation log > - Use `--output-format stream-json` for real-time output of each conversation turn -## Create custom slash commands - -Qwen Code supports custom slash commands that you can create to quickly execute specific prompts or tasks. - -For more details, see the [Slash commands](/en/slash-commands) reference page. - -### Create project-specific commands - -Suppose you want to create reusable slash commands for your project that all team members can use. - -1. Create a commands directory in your project - -```bash -mkdir -p .qwen-code/commands -``` - -2. Create a Markdown file for each command -```bash -echo "Analyze the performance of this code and suggest three specific optimizations: " > .qwen-code/commands/optimize.md -``` - -3. Use your custom command in Qwen Code -``` -> /optimize -``` - -> [!tip] Tips: -> -> - Command names are derived from the filename (for example, `optimize.md` becomes `/optimize`) -> - You can organize commands in subdirectories (for example, `.qwen-code/commands/frontend/component.md` creates `/component` with " (project:frontend)" shown in the description) -> - Project commands are available to everyone who clones the repository -> - The Markdown file content becomes the prompt sent to Claude when the command is invoked - -### Add command arguments with \$ARGUMENTS - -Suppose you want to create flexible slash commands that can accept additional input from users. - -1. Create a command file with the $ARGUMENTS placeholder -```bash -echo 'Find and fix issue #$ARGUMENTS. Follow these steps: -1.Understand the issue described in the ticket -2. Locate the relevant code in -our codebase -3. Implement a solution that addresses the root cause -4. Add -appropriate tests -5. Prepare a concise PR description' > -.qwen-code/commands/fix-issue.md -``` - - 2. Use the command with an issue number - In your Claude session, use the command with arguments. - -``` -> /fix-issue 123 -``` - -This replaces \$ARGUMENTS with "123" in the prompt. - -> [!tip] Tips: -> -> - The \$ARGUMENTS placeholder is replaced with any text that follows the command -> - You can position \$ARGUMENTS anywhere in your command template -> - Other useful applications: generating test cases for specific functions, creating documentation for components, reviewing code in particular files, or translating content to specified languages - -### Create personal slash commands - -Suppose you want to create personal slash commands that work across all your projects. - -1. Create a commands directory in your home folder -```bash -mkdir -p ~/.qwen-code/commands -``` - - 2. Create a Markdown file for each command -```bash -echo "Review this code for security vulnerabilities, focusing on: " > -~/.qwen-code/commands/security-review.md -``` - -3. Use your personal custom command -``` -> /security-review -``` - -> [!tip] Tips: -> -> - Personal commands show " (user)" in their description when listed with `/help` -> - Personal commands are only available to you and not shared with your team -> - Personal commands work across all your projects -> - You can use these for consistent workflows across different codebases - ## Ask Qwen Code about its capabilities Qwen Code has built-in access to its documentation and can answer questions about its own features and limitations. @@ -802,6 +683,7 @@ how do I configure Qwen Code for Amazon Bedrock? what are the limitations of Qwen Code? ``` + > [!note] > > Qwen Code provides documentation-based answers to these questions. For executable examples and hands-on demonstrations, refer to the specific workflow sections above. @@ -811,9 +693,3 @@ what are the limitations of Qwen Code? > - Qwen Code always has access to the latest Qwen Code documentation, regardless of the version you're using > - Ask specific questions to get detailed answers > - Qwen Code can explain complex features like MCP integration, enterprise configurations, and advanced workflows - -## Next steps - - ({ messages: [ { role: 'user', content: { type: 'text', text: `Write a haiku${mood ? ` with the mood ${mood}` : ''} called ${title}. Note that a haiku is 5 syllables followed by 7 syllables followed by 5 syllables `, }, }, ], }),); const transport = new StdioServerTransport();await server.connect(transport);`` + +This can be included in `settings.json` under `mcpServers` with: + +`{ "mcpServers": { "nodeServer": { "command": "node", "args": ["filename.ts"] } }}` + +### Invoking Prompts + +Once a prompt is discovered, you can invoke it using its name as a slash command. The CLI will automatically handle parsing arguments. + +`/poem-writer --title="Qwen Code" --mood="reverent"` + +or, using positional arguments: + +`/poem-writer "Qwen Code" reverent` + +When you run this command, the CLI executes the `prompts/get` method on the MCP server with the provided arguments. The server is responsible for substituting the arguments into the prompt template and returning the final prompt text. The CLI then sends this prompt to the model for execution. This provides a convenient way to automate and share common workflows. + +## Managing MCP Servers with `qwen mcp` + +While you can always configure MCP servers by manually editing your `settings.json` file, the CLI provides a convenient set of commands to manage your server configurations programmatically. These commands streamline the process of adding, listing, and removing MCP servers without needing to directly edit JSON files. + +### Adding a Server (`qwen mcp add`) + +The `add` command configures a new MCP server in your `settings.json`. Based on the scope (`-s, --scope`), it will be added to either the user config `~/.qwen/settings.json` or the project config `.qwen/settings.json`file. + +**Command:** + +`qwen mcp add [options] [args...]` + +- ``: A unique name for the server. +- ``: The command to execute (for `stdio`) or the URL (for `http`/`sse`). +- `[args...]`: Optional arguments for a `stdio` command. + +**Options (Flags):** + +- `-s, --scope`: Configuration scope (user or project). [default: “project”] +- `-t, --transport`: Transport type (stdio, sse, http). [default: “stdio”] +- `-e, --env`: Set environment variables (e.g. -e KEY=value). +- `-H, --header`: Set HTTP headers for SSE and HTTP transports (e.g. -H “X-Api-Key: abc123” -H “Authorization: Bearer abc123”). +- `--timeout`: Set connection timeout in milliseconds. +- `--trust`: Trust the server (bypass all tool call confirmation prompts). +- `--description`: Set the description for the server. +- `--include-tools`: A comma-separated list of tools to include. +- `--exclude-tools`: A comma-separated list of tools to exclude. + +#### Adding an stdio server + +This is the default transport for running local servers. + +`# Basic syntaxqwen mcp add [args...] # Example: Adding a local serverqwen mcp add my-stdio-server -e API_KEY=123 /path/to/server arg1 arg2 arg3 # Example: Adding a local python serverqwen mcp add python-server python server.py --port 8080` + +#### Adding an HTTP server + +This transport is for servers that use the streamable HTTP transport. + +`# Basic syntaxqwen mcp add --transport http # Example: Adding an HTTP serverqwen mcp add --transport http http-server https://api.example.com/mcp/ # Example: Adding an HTTP server with an authentication headerqwen mcp add --transport http secure-http https://api.example.com/mcp/ --header "Authorization: Bearer abc123"` + +#### Adding an SSE server + +This transport is for servers that use Server-Sent Events (SSE). + +`# Basic syntaxqwen mcp add --transport sse # Example: Adding an SSE serverqwen mcp add --transport sse sse-server https://api.example.com/sse/ # Example: Adding an SSE server with an authentication headerqwen mcp add --transport sse secure-sse https://api.example.com/sse/ --header "Authorization: Bearer abc123"` + +### Listing Servers (`qwen mcp list`) + +To view all MCP servers currently configured, use the `list` command. It displays each server’s name, configuration details, and connection status. + +**Command:** + +`qwen mcp list` + +**Example Output:** + +`✓ stdio-server: command: python3 server.py (stdio) - Connected✓ http-server: https://api.example.com/mcp (http) - Connected✗ sse-server: https://api.example.com/sse (sse) - Disconnected` + +### Removing a Server (`qwen mcp remove`) + +To delete a server from your configuration, use the `remove` command with the server’s name. + +**Command:** + +`qwen mcp remove ` + +**Example:** + +`qwen mcp remove my-server` + +This will find and delete the “my-server” entry from the `mcpServers` object in the appropriate `settings.json`file based on the scope (`-s, --scope`). \ No newline at end of file diff --git a/docs/users/features/subagents.md b/docs/users/features/sub-agents.md similarity index 70% rename from docs/users/features/subagents.md rename to docs/users/features/sub-agents.md index 506d856f..4d4fc370 100644 --- a/docs/users/features/subagents.md +++ b/docs/users/features/sub-agents.md @@ -1,172 +1,121 @@ -# Subagents - -Subagents are specialized AI assistants that handle specific types of tasks within Qwen Code. They allow you to delegate focused work to AI agents that are configured with task-specific prompts, tools, and behaviors. - -## What are Subagents? - -Subagents are independent AI assistants that: - -- **Specialize in specific tasks** - Each subagent is configured with a focused system prompt for particular types of work -- **Have separate context** - They maintain their own conversation history, separate from your main chat -- **Use controlled tools** - You can configure which tools each subagent has access to -- **Work autonomously** - Once given a task, they work independently until completion or failure -- **Provide detailed feedback** - You can see their progress, tool usage, and execution statistics in real-time +# Sub Agents +Sub Agents are specialized AI assistants that handle specific types of tasks within Qwen Code. They allow you to delegate focused work to AI agents that are configured with task-specific prompts, tools, and behaviors. +## What are Sub Agents? +Sub Agents are independent AI assistants that: +- **Specialize in specific tasks** - Each Sub Agents is configured with a focused system prompt for particular types of work +- **Have separate context** - They maintain their own conversation history, separate from your main chat +- **Use controlled tools** - You can configure which tools each Sub Agents has access to +- **Work autonomously** - Once given a task, they work independently until completion or failure +- **Provide detailed feedback** - You can see their progress, tool usage, and execution statistics in real-time ## Key Benefits - - **Task Specialization**: Create agents optimized for specific workflows (testing, documentation, refactoring, etc.) - **Context Isolation**: Keep specialized work separate from your main conversation - **Reusability**: Save and reuse agent configurations across projects and sessions - **Controlled Access**: Limit which tools each agent can use for security and focus - **Progress Visibility**: Monitor agent execution with real-time progress updates -## How Subagents Work - -1. **Configuration**: You create subagent configurations that define their behavior, tools, and system prompts -2. **Delegation**: The main AI can automatically delegate tasks to appropriate subagents -3. **Execution**: Subagents work independently, using their configured tools to complete tasks +## How Sub Agents Work +1. **Configuration**: You create Sub Agents configurations that define their behavior, tools, and system prompts +2. **Delegation**: The main AI can automatically delegate tasks to appropriate Sub Agents +3. **Execution**: Sub Agents work independently, using their configured tools to complete tasks 4. **Results**: They return results and execution summaries back to the main conversation ## Getting Started - ### Quick Start +1. **Create your first Sub Agents**: -1. **Create your first subagent**: + `/agents create` - ``` - /agents create - ``` - - Follow the guided wizard to create a specialized agent. + Follow the guided wizard to create a specialized agent. 2. **Manage existing agents**: - ``` - /agents manage - ``` + `/agents manage` - View and manage your configured subagents. - -3. **Use subagents automatically**: - Simply ask the main AI to perform tasks that match your subagents' specializations. The AI will automatically delegate appropriate work. + View and manage your configured Sub Agents. +3. **Use Sub Agents automatically**: Simply ask the main AI to perform tasks that match your Sub Agents’ specializations. The AI will automatically delegate appropriate work. + ### Example Usage - ``` User: "Please write comprehensive tests for the authentication module" - -AI: I'll delegate this to your testing specialist subagent. -[Delegates to "testing-expert" subagent] +AI: I'll delegate this to your testing specialist Sub Agents. +[Delegates to "testing-expert" Sub Agents] [Shows real-time progress of test creation] -[Returns with completed test files and execution summary] +[Returns with completed test files and execution summary]` ``` - ## Management - ### CLI Commands - -Subagents are managed through the `/agents` slash command and its subcommands: - -#### `/agents create` - -Creates a new subagent through a guided step wizard. - +Sub Agents are managed through the `/agents` slash command and its subcommands: +#### /agents create +Creates a new Sub Agents through a guided step wizard. **Usage:** - -``` -/agents create -``` - -#### `/agents manage` - -Opens an interactive management dialog for viewing and managing existing subagents. - +`/agents create` +#### /agents manage +Opens an interactive management dialog for viewing and managing existing Sub Agents. **Usage:** - -``` -/agents manage -``` - +`/agents manage` ### Storage Locations - -Subagents are stored as Markdown files in two locations: - -- **Project-level**: `.qwen/agents/` (takes precedence) -- **User-level**: `~/.qwen/agents/` (fallback) +Sub Agents are stored as Markdown files in two locations: +- **Project-level**: `.qwen/agents/` (takes precedence) +- **User-level**: `~/.qwen/agents/` (fallback) This allows you to have both project-specific agents and personal agents that work across all projects. - ### File Format - -Subagents are configured using Markdown files with YAML frontmatter. This format is human-readable and easy to edit with any text editor. - +Sub Agents are configured using Markdown files with YAML frontmatter. This format is human-readable and easy to edit with any text editor. #### Basic Structure - -```markdown +``` --- name: agent-name description: Brief description of when and how to use this agent -tools: - - tool1 - - tool2 - - tool3 # Optional +tools: + - tool1 + - tool2 + - tool3 # Optional --- System prompt content goes here. Multiple paragraphs are supported. You can use ${variable} templating for dynamic content. ``` - #### Example Usage - -```markdown +``` --- name: project-documenter description: Creates project documentation and README files --- - + You are a documentation specialist for the ${project_name} project. - + Your task: ${task_description} - + Working directory: ${current_directory} Generated on: ${timestamp} - + Focus on creating clear, comprehensive documentation that helps both new contributors and end users understand the project. ``` - -## Using Subagents Effectively - +## Using Sub Agents Effectively ### Automatic Delegation - Qwen Code proactively delegates tasks based on: - - The task description in your request -- The description field in subagent configurations +- The description field in Sub Agents configurations - Current context and available tools -To encourage more proactive subagent use, include phrases like "use PROACTIVELY" or "MUST BE USED" in your description field. - +To encourage more proactive Sub Agents use, include phrases like “use PROACTIVELY” or “MUST BE USED” in your description field. ### Explicit Invocation - -Request a specific subagent by mentioning it in your command: - +Request a specific Sub Agents by mentioning it in your command: ``` -> Let the testing-expert subagent create unit tests for the payment module -> Have the documentation-writer subagent update the API reference -> Get the react-specialist subagent to optimize this component's performance +Let the testing-expert Sub Agents create unit tests for the payment module +Have the documentation-writer Sub Agents update the API reference +Get the react-specialist Sub Agents to optimize this component's performance ``` - ## Examples - ### Development Workflow Agents - #### Testing Specialist - Perfect for comprehensive test creation and test-driven development. - -```markdown +``` --- name: testing-expert description: Writes comprehensive unit tests, integration tests, and handles test automation with best practices @@ -176,41 +125,38 @@ tools: - read_many_files - run_shell_command --- - + You are a testing specialist focused on creating high-quality, maintainable tests. - + Your expertise includes: - + - Unit testing with appropriate mocking and isolation - Integration testing for component interactions - Test-driven development practices - Edge case identification and comprehensive coverage - Performance and load testing when appropriate - + For each testing task: - + 1. Analyze the code structure and dependencies 2. Identify key functionality, edge cases, and error conditions 3. Create comprehensive test suites with descriptive names 4. Include proper setup/teardown and meaningful assertions 5. Add comments explaining complex test scenarios 6. Ensure tests are maintainable and follow DRY principles - + Always follow testing best practices for the detected language and framework. Focus on both positive and negative test cases. ``` **Use Cases:** - -- "Write unit tests for the authentication service" -- "Create integration tests for the payment processing workflow" -- "Add test coverage for edge cases in the data validation module" +- “Write unit tests for the authentication service” +- “Create integration tests for the payment processing workflow” +- “Add test coverage for edge cases in the data validation module” #### Documentation Writer - Specialized in creating clear, comprehensive documentation. - -```markdown +``` --- name: documentation-writer description: Creates comprehensive documentation, README files, API docs, and user guides @@ -220,50 +166,47 @@ tools: - read_many_files - web_search --- - + You are a technical documentation specialist for ${project_name}. - + Your role is to create clear, comprehensive documentation that serves both developers and end users. Focus on: - + **For API Documentation:** - + - Clear endpoint descriptions with examples - Parameter details with types and constraints - Response format documentation - Error code explanations - Authentication requirements - + **For User Documentation:** - + - Step-by-step instructions with screenshots when helpful - Installation and setup guides - Configuration options and examples - Troubleshooting sections for common issues - FAQ sections based on common user questions - + **For Developer Documentation:** - + - Architecture overviews and design decisions - Code examples that actually work - Contributing guidelines - Development environment setup - + Always verify code examples and ensure documentation stays current with the actual implementation. Use clear headings, bullet points, and examples. ``` **Use Cases:** - -- "Create API documentation for the user management endpoints" -- "Write a comprehensive README for this project" -- "Document the deployment process with troubleshooting steps" +- “Create API documentation for the user management endpoints” +- “Write a comprehensive README for this project” +- “Document the deployment process with troubleshooting steps” #### Code Reviewer - Focused on code quality, security, and best practices. - -```markdown +``` --- name: code-reviewer description: Reviews code for best practices, security issues, performance, and maintainability @@ -271,11 +214,11 @@ tools: - read_file - read_many_files --- - + You are an experienced code reviewer focused on quality, security, and maintainability. - + Review criteria: - + - **Code Structure**: Organization, modularity, and separation of concerns - **Performance**: Algorithmic efficiency and resource usage - **Security**: Vulnerability assessment and secure coding practices @@ -283,31 +226,27 @@ Review criteria: - **Error Handling**: Proper exception handling and edge case coverage - **Readability**: Clear naming, comments, and code organization - **Testing**: Test coverage and testability considerations - + Provide constructive feedback with: - + 1. **Critical Issues**: Security vulnerabilities, major bugs 2. **Important Improvements**: Performance issues, design problems 3. **Minor Suggestions**: Style improvements, refactoring opportunities 4. **Positive Feedback**: Well-implemented patterns and good practices - + Focus on actionable feedback with specific examples and suggested solutions. Prioritize issues by impact and provide rationale for recommendations. ``` **Use Cases:** - -- "Review this authentication implementation for security issues" -- "Check the performance implications of this database query logic" -- "Evaluate the code structure and suggest improvements" +- “Review this authentication implementation for security issues” +- “Check the performance implications of this database query logic” +- “Evaluate the code structure and suggest improvements” ### Technology-Specific Agents - #### React Specialist - Optimized for React development, hooks, and component patterns. - -```markdown +``` --- name: react-specialist description: Expert in React development, hooks, component patterns, and modern React best practices @@ -317,42 +256,39 @@ tools: - read_many_files - run_shell_command --- - + You are a React specialist with deep expertise in modern React development. - + Your expertise covers: - + - **Component Design**: Functional components, custom hooks, composition patterns - **State Management**: useState, useReducer, Context API, and external libraries - **Performance**: React.memo, useMemo, useCallback, code splitting - **Testing**: React Testing Library, Jest, component testing strategies - **TypeScript Integration**: Proper typing for props, hooks, and components - **Modern Patterns**: Suspense, Error Boundaries, Concurrent Features - + For React tasks: - + 1. Use functional components and hooks by default 2. Implement proper TypeScript typing 3. Follow React best practices and conventions 4. Consider performance implications 5. Include appropriate error handling 6. Write testable, maintainable code - + Always stay current with React best practices and avoid deprecated patterns. Focus on accessibility and user experience considerations. ``` **Use Cases:** - -- "Create a reusable data table component with sorting and filtering" -- "Implement a custom hook for API data fetching with caching" -- "Refactor this class component to use modern React patterns" +- “Create a reusable data table component with sorting and filtering” +- “Implement a custom hook for API data fetching with caching” +- “Refactor this class component to use modern React patterns” #### Python Expert - Specialized in Python development, frameworks, and best practices. - -```markdown +``` --- name: python-expert description: Expert in Python development, frameworks, testing, and Python-specific best practices @@ -362,11 +298,11 @@ tools: - read_many_files - run_shell_command --- - + You are a Python expert with deep knowledge of the Python ecosystem. - + Your expertise includes: - + - **Core Python**: Pythonic patterns, data structures, algorithms - **Frameworks**: Django, Flask, FastAPI, SQLAlchemy - **Testing**: pytest, unittest, mocking, test-driven development @@ -374,9 +310,9 @@ Your expertise includes: - **Async Programming**: asyncio, async/await patterns - **Package Management**: pip, poetry, virtual environments - **Code Quality**: PEP 8, type hints, linting with pylint/flake8 - + For Python tasks: - + 1. Follow PEP 8 style guidelines 2. Use type hints for better code documentation 3. Implement proper error handling with specific exceptions @@ -384,95 +320,68 @@ For Python tasks: 5. Consider performance and memory usage 6. Include appropriate logging 7. Write testable, modular code - + Focus on writing clean, maintainable Python code that follows community standards. ``` **Use Cases:** - -- "Create a FastAPI service for user authentication with JWT tokens" -- "Implement a data processing pipeline with pandas and error handling" -- "Write a CLI tool using argparse with comprehensive help documentation" +- “Create a FastAPI service for user authentication with JWT tokens” +- “Implement a data processing pipeline with pandas and error handling” +- “Write a CLI tool using argparse with comprehensive help documentation” ## Best Practices - ### Design Principles - #### Single Responsibility Principle - -Each subagent should have a clear, focused purpose. - +Each Sub Agents should have a clear, focused purpose. **✅ Good:** - -```markdown +``` --- name: testing-expert description: Writes comprehensive unit tests and integration tests --- ``` - **❌ Avoid:** - -```markdown +``` --- name: general-helper description: Helps with testing, documentation, code review, and deployment --- ``` - -**Why:** Focused agents produce better results and are easier to maintain. - +**Why:** Focused agents produce better results and are easier to maintain. #### Clear Specialization - Define specific expertise areas rather than broad capabilities. - **✅ Good:** - -```markdown +``` --- name: react-performance-optimizer description: Optimizes React applications for performance using profiling and best practices --- ``` - **❌ Avoid:** - -```markdown +``` --- name: frontend-developer description: Works on frontend development tasks --- ``` - -**Why:** Specific expertise leads to more targeted and effective assistance. - +**Why:** Specific expertise leads to more targeted and effective assistance. #### Actionable Descriptions - Write descriptions that clearly indicate when to use the agent. - **✅ Good:** - -```markdown +``` description: Reviews code for security vulnerabilities, performance issues, and maintainability concerns ``` - **❌ Avoid:** - -```markdown +``` description: A helpful code reviewer ``` - -**Why:** Clear descriptions help the main AI choose the right agent for each task. - +**Why:** Clear descriptions help the main AI choose the right agent for each task. ### Configuration Best Practices - #### System Prompt Guidelines - **Be Specific About Expertise:** - -```markdown +``` You are a Python testing specialist with expertise in: - + - pytest framework and fixtures - Mock objects and dependency injection - Test-driven development practices @@ -480,10 +389,9 @@ You are a Python testing specialist with expertise in: ``` **Include Step-by-Step Approaches:** - -```markdown +``` For each testing task: - + 1. Analyze the code structure and dependencies 2. Identify key functionality and edge cases 3. Create comprehensive test suites with clear naming @@ -492,10 +400,9 @@ For each testing task: ``` **Specify Output Standards:** - -```markdown +``` Always follow these standards: - + - Use descriptive test names that explain the scenario - Include both positive and negative test cases - Add docstrings for complex test functions @@ -503,10 +410,9 @@ Always follow these standards: ``` ## Security Considerations - -- **Tool Restrictions**: Subagents only have access to their configured tools +- **Tool Restrictions**: Sub Agents only have access to their configured tools - **Sandboxing**: All tool execution follows the same security model as direct tool use -- **Audit Trail**: All subagent actions are logged and visible in real-time +- **Audit Trail**: All Sub Agents actions are logged and visible in real-time - **Access Control**: Project and user-level separation provides appropriate boundaries - **Sensitive Information**: Avoid including secrets or credentials in agent configurations - **Production Environments**: Consider separate agents for production vs development environments diff --git a/docs/users/overview.md b/docs/users/overview.md index 09e2c629..496e4522 100644 --- a/docs/users/overview.md +++ b/docs/users/overview.md @@ -7,7 +7,7 @@ Prerequisites: - A [Qwen Code](https://chat.qwen.ai/auth?mode=register) account -- Requires [Node.js 20+](https://nodejs.org/download), you can use `node -v` check the version. If it's not installed, use the following command to install it. +- Requires [Node.js 20+](https://nodejs.org/download), you can use `node -v` to check the version. If it's not installed, use the following command to install it. ```bash curl -qL https://www.npmjs.com/install.sh | sh @@ -54,11 +54,13 @@ You'll be prompted to log in on first use. That's it! [Continue with Quickstart > [!tip] > -> See [advanced setup](/setup) for installation options or [troubleshooting](/troubleshooting) if you hit issues. +> See [troubleshooting](/troubleshooting) if you hit issues. > [!note] > -> **New VS Code Extension (Beta)**: Prefer a graphical interface? Our new [VS Code extension](/vs-code) provides an easy-to-use native IDE experience without requiring terminal familiarity. Simply install from the marketplace and start coding with Qwen Code directly in your sidebar. +> **New VS Code Extension (Beta)**: Prefer a graphical interface? Our new **VS Code extension** provides an easy-to-use native IDE experience without requiring terminal familiarity. Simply install from the marketplace and start coding with Qwen Code directly in your sidebar. +> +> ![](https://gw.alicdn.com/imgextra/i3/O1CN01E6lixr1Ry28a3EvGw_!!6000000002179-2-tps-1198-646.png) ## What Qwen Code does for you @@ -71,58 +73,4 @@ You'll be prompted to log in on first use. That's it! [Continue with Quickstart * **Works in your terminal**: Not another chat window. Not another IDE. Qwen Code meets you where you already work, with the tools you already love. * **Takes action**: Qwen Code can directly edit files, run commands, and create commits. Need more? [MCP](/mcp) lets Qwen Code read your design docs in Google Drive, update your tickets in Jira, or use *your* custom developer tooling. -* **Unix philosophy**: Qwen Code is composable and scriptable. `tail -f app.log | qwen -p "Slack me if you see any anomalies appear in this log stream"` *works*. Your CI can run `qwen -p "If there are new text strings, translate them into French and raise a PR for @lang-fr-team to review"`. -* **Enterprise-ready**: Use the Qwen Code API, or host on AWS or GCP. Enterprise-grade [security](/security) and [Terms of Service](https://qwenlm.github.io/qwen-code-docs/support/tos-privacy/) is built-in. - -## Next steps - - - - See Qwen Code in action with practical examples - - - - Step-by-step guides for common workflows - - - - Solutions for common issues with Qwen Code - - - - Add Qwen Code to your IDE - - - - -## Additional resources - - - - Create custom AI agents with the Claude Agent SDK - - - - Configure Qwen Code with Amazon Bedrock or Google Vertex AI - - - - Customize Qwen Code for your workflow - - - - Learn about CLI commands and controls - - - - Clone our development container reference implementation - - - - Discover Qwen Code's safeguards and best practices for safe usage - - - - Understand how Qwen Code handles your data - - +* **Unix philosophy**: Qwen Code is composable and scriptable. `tail -f app.log | qwen -p "Slack me if you see any anomalies appear in this log stream"` *works*. Your CI can run `qwen -p "If there are new text strings, translate them into French and raise a PR for @lang-fr-team to review"`. \ No newline at end of file diff --git a/docs/users/quickstart.md b/docs/users/quickstart.md index cfb63a29..6cd82a3a 100644 --- a/docs/users/quickstart.md +++ b/docs/users/quickstart.md @@ -91,10 +91,6 @@ You'll see the Qwen Code welcome screen with your session information, recent co ![](https://img.alicdn.com/imgextra/i3/O1CN01PwceZB1esA42wuQQH_!!6000000003926-2-tps-2104-1592.png) -> [!caution] -> -> After logging in (Step 2), your credentials are stored on your system. If you need OpenAI API authentication, you can refer to [Authentication](/authentication). - ## Chat with Qwen Code ### Ask your first question @@ -238,17 +234,25 @@ review my changes and suggest improvements Here are the most important commands for daily use: -| Command | What it does | Example | -| ------------------- | --------------------------------- | ----------------------------------- | -| `qwen` | Start interactive mode | `qwen` | -| `qwen-code "task"` | Run a one-time task | `qwen-code "fix the build error"` | -| `qwen-code -p "query"` | Run one-off query, then exit | `qwen-code -p "explain this function"` | -| `qwen-code -c` | Continue most recent conversation | `qwen-code -c` | -| `qwen-code -r` | Resume a previous conversation | `qwen-code -r` | -| `qwen-code commit` | Create a Git commit | `qwen-code commit` | -| `/clear` | Clear conversation history | `/clear` | -| `/help` | Show available commands | `/help` | -| `quit` or Ctrl+C | Exit Qwen Code | `/quit` | +| Command | What it does | Example | +| --------------------- | ------------------------------------------------------ | ---------------------------------- | +| `qwen` | start Qwen Code | `qwen` | +| `/chat` | Manually save and restore conversation history | Requires sub-commands | +| → `save