The --plan option (via --approval-mode plan) runs Qwen Code in plan-only mode, where the AI generates detailed execution plans without actually executing any tools or making changes. This is perfect for reviewing what actions would be taken before committing to them.
With plan mode enabled:✅ Generates detailed execution plans
✅ Lists all tools that would be called
✅ Describes what each action would do
❌ Does NOT execute any actions
❌ Does NOT modify any files
❌ Does NOT run any commands
# Generate plan firstqwen --approval-mode plan --prompt "Refactor entire codebase to use async/await"# Review the plan# If satisfied, executeqwen --yolo --prompt "Refactor entire codebase to use async/await"
# Get AI's proposed approachqwen --approval-mode plan --prompt "Fix the memory leak in Worker class"# Share plan with team for review# Execute if approved
# Generate plan as part of PR reviewqwen --approval-mode plan --prompt "Implement requested feature" \ --output-format json > ai-plan.json# Review plan in PR comments
# If satisfied with plan, executeqwen --yolo --prompt "Refactor payment processing"# Or execute with manual approvalqwen --prompt "Refactor payment processing"
#!/bin/bash# generate-plans.shTASKS=( "Add unit tests for all services" "Implement caching layer" "Add API documentation" "Setup CI/CD pipeline")for task in "${TASKS[@]}"; do echo "Generating plan for: $task" qwen --approval-mode plan --prompt "$task" \ --output-format json > "plan-$(echo $task | tr ' ' '-').json"doneecho "All plans generated!"
#!/bin/bash# compare-approaches.shAPPROACHES=( "Use Redux for state management" "Use Context API for state management" "Use Zustand for state management")for approach in "${APPROACHES[@]}"; do qwen --approval-mode plan --prompt "$approach" \ --output-format json > "plan-${approach// /-}.json"done# Compare plansecho "Compare the generated plans to choose the best approach"
#!/bin/bash# weekly-plan.sh# Generate plans for the week's tasksqwen --approval-mode plan --prompt "Review backlog and create implementation plans" \ --output-format text > weekly-plan.mdecho "Weekly plan saved to weekly-plan.md"
# Get overall planqwen --approval-mode plan --prompt "Task"# Execute step-by-step with feedbackqwen --prompt "Do step 1 from the plan"> Review resultqwen --prompt "Do step 2 from the plan"> Review result
# Get initial planqwen --approval-mode plan --prompt "Implement feature"# Refine the approachqwen --approval-mode plan --prompt "Implement feature using approach B instead"# Execute final planqwen --yolo --prompt "Implement feature using approach B"
# Stage 1: High-level planqwen --approval-mode plan --prompt "Migrate to microservices architecture"# Stage 2: Detailed plan for each serviceqwen --approval-mode plan --prompt "Detailed plan for User service migration"qwen --approval-mode plan --prompt "Detailed plan for Order service migration"# Execute incrementallyqwen --yolo --prompt "Migrate User service"# Testqwen --yolo --prompt "Migrate Order service"
# Create reusable plan templatescat > plan-template.txt << 'EOF'Generate a plan to:1. Analyze current implementation2. Identify issues and improvements3. Propose refactoring approach4. List required changes5. Suggest testing strategyEOFqwen --approval-mode plan --prompt "$(cat plan-template.txt) for the authentication module"
#!/bin/bash# Generate different plans based on conditionsif [ "$PROJECT_TYPE" = "microservices" ]; then qwen --approval-mode plan --prompt "Add service mesh"else qwen --approval-mode plan --prompt "Add API gateway"fi
# Vague prompt = vague planqwen --approval-mode plan --prompt "Improve the code"# Specific prompt = detailed planqwen --approval-mode plan --prompt "Reduce response time of /api/users endpoint from 500ms to 100ms"
# Ask for comprehensive planqwen --approval-mode plan --prompt "Create a comprehensive plan including:- All file changes- Dependency updates- Configuration changes- Testing strategy- Deployment stepsFor: Implementing user authentication"
# Specify constraintsqwen --approval-mode plan --prompt "Plan for adding caching, but:- Don't use Redis (not available)- Must work in serverless environment- Prefer in-memory caching"