Examples & Workflows
Real-world examples showing how to use XibeCode for common development tasks. Build features, fix bugs, refactor, test, review, and automate with 20+ examples.
Real-world examples showing how to use XibeCode for common development tasks. Each example demonstrates autonomous AI-assisted coding.
Building Features
Add User Authentication
xibecode run "Add JWT authentication:
1. Install jsonwebtoken and bcrypt
2. Create auth middleware
3. Add /login and /register endpoints
4. Protect existing routes
5. Add tests"Create a REST API
xibecode run "Create a REST API with Express for a todo app:
- GET /todos - List all todos
- POST /todos - Create a todo
- PUT /todos/:id - Update a todo
- DELETE /todos/:id - Delete a todo
- Add input validation
- Include error handling"Add Database Integration
xibecode run "Add PostgreSQL database integration:
- Set up Prisma ORM
- Create user and post models
- Add migration scripts
- Create seed data"Build a React Component
xibecode run "Create a DataTable component in React:
- Sortable columns
- Pagination
- Search/filter functionality
- Loading and empty states
- Use TypeScript and Tailwind CSS"Fixing Bugs
Debug Failing Tests
xibecode run "The tests in test/user.test.js are failing.
Debug and fix." --verbose --mode debuggerDex the Debugger will: run tests, read source code, identify root cause, apply minimal fix, re-run tests to verify.
Fix a Production Error
xibecode run "Production error: 'Cannot read property x of undefined'
in userController.js line 42. Fix it." --verbose --mode debuggerFix Type Errors
xibecode run "Fix all TypeScript errors in the src/ directory" --verboseFix Linting Errors
xibecode run "Fix linting errors in changed files" --changed-onlyMemory Leak Investigation
xibecode run "There's a memory leak in the WebSocket handler.
Investigate and fix it." --mode debugger --verboseRefactoring
Convert to TypeScript
xibecode run "Refactor src/ to use TypeScript:
- Convert all .js files to .ts
- Add type annotations
- Create types.ts for shared types
- Update tsconfig.json
- Fix any type errors"Improve Code Quality
xibecode run "Refactor the authentication module to follow SOLID principles"Extract Common Logic
xibecode run "Extract duplicate validation logic into a shared utils file:
- Find all validation patterns
- Create a validation.ts utility
- Update all files to use the new utility
- Add tests for the utility"Modernize Legacy Code
xibecode run "Modernize the callback-based API to use async/await:
- Convert callbacks to Promises
- Use async/await syntax
- Maintain backwards compatibility
- Update tests"Testing
Generate Tests for a Module
xibecode run "Write comprehensive tests for userController.js:
- Test all endpoints
- Test error cases and edge cases
- Test validation
- Use Jest
- Achieve >80% coverage" --mode testerAdd Integration Tests
xibecode run "Add integration tests for the checkout flow:
- Test the complete purchase flow
- Test payment processing
- Test inventory updates
- Test email notifications" --mode testerFix Flaky Tests
xibecode run "The test 'should handle concurrent requests' is flaky.
Investigate and fix it." --mode debuggerCode Review & Security
Security Audit
xibecode run "Perform a security audit on the auth module:
- Check for injection vulnerabilities
- Review authentication flow
- Check for data exposure risks
- Suggest improvements" --mode securityCode Review
xibecode run "Review the recent changes in the payment module:
- Check code quality
- Identify potential issues
- Suggest improvements" --mode reviewDependency Audit
xibecode run "Check all dependencies for security vulnerabilities
and suggest updates" --mode securityFull Pentest of a Project
xibecode run "Pentest this project and generate pentest-report.md with:
- HTTP attacks (SQL injection, XSS, auth bypass, path traversal)
- A table of vulnerabilities with severity
- A security score out of 100
- Concrete remediation steps" --mode pentestThis will:
- Start or connect to your dev server.
- Use HTTP and agent-browser (via
run_command) to probe endpoints and UI flows. - Write
pentest-report.mdin the project root with findings and a score.
After the pentest, you can open the WebUI, view the report card, and click Fix to switch to a debugging-focused mode and apply fixes.
Git Workflows
Safe Refactoring with Checkpoints
xibecode run "Refactor the database layer (create checkpoint first)"XibeCode creates a git checkpoint before making changes, so you can revert if anything goes wrong.
Focus on Changed Files
xibecode run "Review and fix issues in changed files only" --changed-onlyPrepare for Code Review
xibecode run "Prepare this branch for code review:
- Run tests
- Fix linting errors
- Add missing documentation
- Generate a summary of changes"Using Different Modes
Planning Mode
xibecode run "Analyze the codebase and create a plan for adding
real-time notifications" --mode planAria the Architect will analyze and create a detailed plan without making changes.
Debug Mode
xibecode run "The API is returning 500 errors intermittently.
Investigate and fix." --mode debuggerTeam Leader Mode
xibecode run "Build a complete user management system with
registration, login, and profile editing" --mode team_leaderArya the Team Leader will coordinate tasks and delegate to specialized agents.
Using Dry-Run Mode
Preview changes before they're made:
xibecode run "Refactor the auth module" --dry-runOutput will show:
[DRY RUN] Would replace lines 15-20 with 8 new lines
[DRY RUN] Would write 150 lines to src/auth/index.ts
[DRY RUN] Would create stash checkpoint: "before auth refactor"Smart Context in Action
When you ask XibeCode to modify a file, it automatically discovers related files:
xibecode run "Add error handling to userController.js"XibeCode will:
- Read
userController.js - Extract and follow imports (User model, auth middleware)
- Find related test files
- Check config files (package.json, tsconfig.json)
- Make edits with full understanding of the codebase
Multi-Step Workflows
Full Feature Implementation
xibecode run "Implement a complete user profile system:
1. Create database schema for profiles
2. Add API endpoints (GET, PUT)
3. Create React components
4. Add form validation
5. Write tests
6. Update documentation"Migration Workflow
xibecode run "Migrate from Express to Fastify:
1. Set up Fastify with similar middleware
2. Convert routes one by one
3. Update error handling
4. Update tests
5. Verify all endpoints work"Tips & Best Practices
- Be specific about files —
"Fix src/api/users.js"is better than"Fix the users file" - Mention line numbers for large files —
"Bug around line 500 in data-processor.js" - Use the right mode —
--mode debuggerfor bugs,--mode testerfor tests - Use verbose mode for complex tasks —
--verboseshows every tool call - Preview with dry-run —
--dry-runfor risky changes - Break down huge tasks — Do it module by module instead of "Build entire platform"
- Let AI discover context — Don't manually list imports, XibeCode finds them
- Use checkpoints — Ask for checkpoints before major refactors
Next Steps
- Agent Modes — Learn about all 13 personas
- Tools Reference — Explore all 40+ tools
- Configuration — Configure XibeCode for your workflow
- Plugins — Create custom plugins