Skip to main content

Workflow Overview

NikCLI supports various workflow patterns optimized for different development scenarios. These proven patterns help you maximize productivity while maintaining code quality and consistency.

Feature Development

End-to-end feature implementation workflows

Maintenance & Refactoring

Code improvement and optimization patterns

Bug Fixing

Systematic debugging and issue resolution

Project Setup

New project initialization and configuration

Development Workflow Patterns

1. Feature Development Workflow

1

Requirements Analysis

Start with clear feature requirements and planning > /plan create "User authentication with social login" πŸ“‹ Feature Analysis: β”œβ”€β”€ Authentication methods (email, Google, GitHub) β”œβ”€β”€ User registration and login flows β”œβ”€β”€ Session management and security β”œβ”€β”€ Password reset functionality └── User profile management Estimated complexity: Medium-High Implementation time: 3-4 hours
2

Architecture Planning

Define technical architecture and approach > Plan the technical implementation approach πŸ—οΈ Architecture Plan: Backend Components: β”œβ”€β”€ User model with Mongoose/Prisma β”œβ”€β”€ JWT authentication middleware β”œβ”€β”€ OAuth integration (Passport.js) β”œβ”€β”€ Email verification system └── Password reset with secure tokens Frontend Components: β”œβ”€β”€ Authentication forms (login/register) β”œβ”€β”€ Social login buttons β”œβ”€β”€ Protected route wrapper β”œβ”€β”€ User profile management └── Authentication context/store
3

Implementation Phase

Execute the plan with coordinated development > /auto "Implement the authentication system according to the plan" πŸ€– Multi-agent execution: Backend Agent: β”œβ”€β”€ βœ… User model with validation β”œβ”€β”€ βœ… JWT middleware setup β”œβ”€β”€ πŸ”„ OAuth configuration └── ⏳ Email service integration Frontend Agent: β”œβ”€β”€ βœ… Login/register forms β”œβ”€β”€ πŸ”„ Social login integration └── ⏳ Authentication context Integration Agent: β”œβ”€β”€ πŸ”„ API endpoint testing └── ⏳ E2E flow validation
4

Testing & Validation

Comprehensive testing and quality assurance > Add comprehensive tests for the authentication system πŸ§ͺ Testing Implementation: Unit Tests: β”œβ”€β”€ User model validation β”œβ”€β”€ JWT token generation/verification β”œβ”€β”€ Password hashing functions └── OAuth callback handling Integration Tests: β”œβ”€β”€ Login/logout flows β”œβ”€β”€ Registration with email verification β”œβ”€β”€ Password reset workflow └── Social login integration E2E Tests: β”œβ”€β”€ Complete user journey β”œβ”€β”€ Cross-browser compatibility └── Mobile responsiveness
5

Documentation & Deployment

Finalize with documentation and deployment preparation > Document the authentication system and prepare for deployment πŸ“š Documentation: β”œβ”€β”€ API endpoint documentation β”œβ”€β”€ Frontend component usage β”œβ”€β”€ Configuration guide └── Security considerations πŸš€ Deployment Prep: β”œβ”€β”€ Environment variable setup β”œβ”€β”€ Database migration scripts β”œβ”€β”€ Security configuration └── Monitoring setup

2. Bug Fix Workflow

  • Issue Investigation
  • Solution Development
  • Validation & Monitoring
Systematic approach to understanding the problem > The user login is failing intermittently with 500 errors πŸ” Bug Investigation Process: 1. Reproduce the Issue: β”œβ”€β”€ Gather error logs and stack traces β”œβ”€β”€ Identify reproduction steps β”œβ”€β”€ Check environment differences └── Document failure patterns 2. Root Cause Analysis: β”œβ”€β”€ Database connection analysis β”œβ”€β”€ Authentication middleware review β”œβ”€β”€ Rate limiting investigation └── Concurrent request handling 3. Impact Assessment: β”œβ”€β”€ Affected user percentage β”œβ”€β”€ Business impact analysis β”œβ”€β”€ Temporary workaround options └── Fix priority determination

3. Refactoring Workflow

Analyze current state and identify improvement opportunities > Analyze the codebase and suggest refactoring opportunities πŸ“Š Code Quality Analysis: Technical Debt Assessment: β”œβ”€β”€ Cyclomatic complexity analysis β”œβ”€β”€ Code duplication detection β”œβ”€β”€ Dependency analysis β”œβ”€β”€ Test coverage evaluation └── Performance bottleneck identification Refactoring Opportunities: β”œβ”€β”€ Extract common components/utilities β”œβ”€β”€ Improve error handling patterns β”œβ”€β”€ Optimize database queries β”œβ”€β”€ Enhance type safety └── Modernize legacy code patterns Priority Matrix: β”œβ”€β”€ High Impact, Low Effort: Quick wins β”œβ”€β”€ High Impact, High Effort: Major initiatives β”œβ”€β”€ Low Impact, Low Effort: Maintenance tasks └── Low Impact, High Effort: Avoid unless necessary
Systematic approach to code improvement > Refactor the user management system to improve maintainability πŸ”„ Incremental Refactoring Plan: Phase 1: Foundation (1-2 days) β”œβ”€β”€ Extract reusable validation functions β”œβ”€β”€ Standardize error handling β”œβ”€β”€ Improve type definitions └── Add comprehensive tests Phase 2: Structure (2-3 days) β”œβ”€β”€ Separate concerns (controllers/services) β”œβ”€β”€ Implement repository pattern β”œβ”€β”€ Extract business logic └── Optimize database operations Phase 3: Enhancement (1-2 days) β”œβ”€β”€ Add caching layer β”œβ”€β”€ Improve API design β”œβ”€β”€ Enhance security measures └── Performance optimization Safety Measures: β”œβ”€β”€ Comprehensive test coverage before changes β”œβ”€β”€ Feature flags for gradual rollout β”œβ”€β”€ Database backup before migrations └── Rollback plan preparation
Systematic performance improvement workflow > Optimize application performance across frontend and backend ⚑ Performance Optimization Workflow: 1. Baseline Measurement: β”œβ”€β”€ Load time analysis β”œβ”€β”€ Bundle size audit β”œβ”€β”€ Database query profiling β”œβ”€β”€ Memory usage monitoring └── API response time tracking 2. Frontend Optimization: β”œβ”€β”€ Code splitting implementation β”œβ”€β”€ Image optimization and lazy loading β”œβ”€β”€ Component memoization β”œβ”€β”€ Bundle analysis and tree shaking └── Service worker caching 3. Backend Optimization: β”œβ”€β”€ Database indexing and query optimization β”œβ”€β”€ Redis caching implementation β”œβ”€β”€ API response compression β”œβ”€β”€ Connection pooling optimization └── Background job processing 4. Infrastructure Optimization: β”œβ”€β”€ CDN configuration β”œβ”€β”€ Load balancer setup β”œβ”€β”€ Database replication └── Monitoring and alerting

Project Setup Patterns

Full-Stack Application Setup

1

Project Initialization

Set up the project structure and tooling > /auto "Create a new full-stack TypeScript application with React frontend and Node.js backend" πŸ—οΈ Project Structure Creation: β”œβ”€β”€ client/ (React TypeScript) β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ components/ β”‚ β”‚ β”œβ”€β”€ pages/ β”‚ β”‚ β”œβ”€β”€ hooks/ β”‚ β”‚ β”œβ”€β”€ services/ β”‚ β”‚ └── types/ β”‚ β”œβ”€β”€ public/ β”‚ └── package.json β”‚ β”œβ”€β”€ server/ (Node.js TypeScript) β”‚ β”œβ”€β”€ src/ β”‚ β”‚ β”œβ”€β”€ routes/ β”‚ β”‚ β”œβ”€β”€ models/ β”‚ β”‚ β”œβ”€β”€ middleware/ β”‚ β”‚ β”œβ”€β”€ services/ β”‚ β”‚ └── types/ β”‚ └── package.json β”‚ β”œβ”€β”€ shared/ (Common types and utilities) β”œβ”€β”€ docker-compose.yml └── README.md
2

Development Environment

Configure development tools and workflows > Set up development environment with TypeScript, ESLint, Prettier, and testing πŸ”¨ Development Configuration: Code Quality: β”œβ”€β”€ TypeScript strict configuration β”œβ”€β”€ ESLint with TypeScript rules β”œβ”€β”€ Prettier formatting β”œβ”€β”€ Husky pre-commit hooks └── Lint-staged for optimized checks Testing Setup: β”œβ”€β”€ Vitest for unit testing β”œβ”€β”€ Testing Library for React components β”œβ”€β”€ Supertest for API testing β”œβ”€β”€ Playwright for E2E testing └── Coverage reporting configuration Development Tools: β”œβ”€β”€ Hot reload for both client and server β”œβ”€β”€ Environment variable management β”œβ”€β”€ Database setup with Docker β”œβ”€β”€ API documentation with OpenAPI └── Development scripts and aliases
3

CI/CD Pipeline

Automated testing and deployment pipeline > Set up CI/CD pipeline with GitHub Actions πŸš€ CI/CD Configuration: Continuous Integration: β”œβ”€β”€ Automated testing on pull requests β”œβ”€β”€ Code quality checks (lint, format) β”œβ”€β”€ Type checking validation β”œβ”€β”€ Security vulnerability scanning └── Build verification Continuous Deployment: β”œβ”€β”€ Staging environment deployment β”œβ”€β”€ Production deployment with approval β”œβ”€β”€ Database migration automation β”œβ”€β”€ Health check validation └── Rollback capability Monitoring & Alerts: β”œβ”€β”€ Application performance monitoring β”œβ”€β”€ Error tracking and reporting β”œβ”€β”€ Uptime monitoring β”œβ”€β”€ Performance regression alerts └── Security incident notifications

Microservices Architecture

  • Service Design
  • Implementation Strategy
  • DevOps Integration
Design microservices architecture > Design a microservices architecture for an e-commerce platform πŸ›οΈ Microservices Design: Core Services: β”œβ”€β”€ User Service (authentication, profiles) β”œβ”€β”€ Product Service (catalog, inventory) β”œβ”€β”€ Order Service (cart, checkout, orders) β”œβ”€β”€ Payment Service (payment processing) β”œβ”€β”€ Notification Service (email, SMS, push) └── Analytics Service (tracking, reporting) Infrastructure Services: β”œβ”€β”€ API Gateway (routing, authentication) β”œβ”€β”€ Service Discovery (Consul/Eureka) β”œβ”€β”€ Configuration Service (centralized config) β”œβ”€β”€ Logging Service (centralized logging) └── Monitoring Service (metrics, health checks) Communication Patterns: β”œβ”€β”€ Synchronous: REST APIs for real-time operations β”œβ”€β”€ Asynchronous: Message queues for event processing β”œβ”€β”€ Event Sourcing: For audit trails and state reconstruction └── CQRS: Separate read/write models for optimization

Team Collaboration Patterns

Code Review Workflow

Prepare code for effective review > Prepare my changes for code review πŸ“ Pre-Review Checklist: Code Quality: β”œβ”€β”€ Self-review for obvious issues β”œβ”€β”€ Run all tests and ensure they pass β”œβ”€β”€ Verify linting and formatting compliance β”œβ”€β”€ Check for TODOs and incomplete features └── Validate TypeScript compilation Documentation: β”œβ”€β”€ Update relevant documentation β”œβ”€β”€ Add or update code comments β”œβ”€β”€ Create/update API documentation β”œβ”€β”€ Update changelog if applicable └── Ensure commit messages are descriptive Testing: β”œβ”€β”€ Add tests for new functionality β”œβ”€β”€ Update existing tests if needed β”œβ”€β”€ Verify test coverage meets requirements β”œβ”€β”€ Include integration/E2E tests where appropriate └── Test edge cases and error scenarios
Systematic code review approach > Conduct a thorough code review πŸ” Review Process: Architecture Review: β”œβ”€β”€ Evaluate design decisions β”œβ”€β”€ Check consistency with existing patterns β”œβ”€β”€ Assess scalability implications β”œβ”€β”€ Review security considerations └── Validate performance impact Code Quality Review: β”œβ”€β”€ Check for code clarity and readability β”œβ”€β”€ Evaluate error handling β”œβ”€β”€ Review naming conventions β”œβ”€β”€ Assess code reusability └── Validate best practices adherence Testing Review: β”œβ”€β”€ Evaluate test coverage β”œβ”€β”€ Review test quality and maintainability β”œβ”€β”€ Check for missing test scenarios β”œβ”€β”€ Validate test isolation └── Assess integration test coverage Documentation Review: β”œβ”€β”€ Check API documentation accuracy β”œβ”€β”€ Review code comments usefulness β”œβ”€β”€ Validate README updates └── Ensure examples are working

Pair Programming with AI

  • AI-Assisted Development
  • Knowledge Sharing
Collaborative development with AI assistance > Let's work together on implementing the payment processing feature πŸ‘₯ Pair Programming Session: Session Setup: β”œβ”€β”€ Define clear objectives and scope β”œβ”€β”€ Establish roles (driver/navigator) β”œβ”€β”€ Set up shared development environment β”œβ”€β”€ Prepare relevant documentation and resources └── Configure AI assistant preferences Development Process: β”œβ”€β”€ Break down tasks into small chunks β”œβ”€β”€ Implement incrementally with AI assistance β”œβ”€β”€ Continuous testing and validation β”œβ”€β”€ Regular refactoring and cleanup └── Document decisions and learnings Quality Assurance: β”œβ”€β”€ Continuous code review β”œβ”€β”€ Test-driven development approach β”œβ”€β”€ Security consideration validation β”œβ”€β”€ Performance impact assessment └── Maintainability evaluation

Best Practices by Scenario

Feature Development

Structured Approach - Start with planning mode - Break into manageable phases - Use autonomous mode for implementation - Include comprehensive testing Quality Gates - Code review checkpoints - Automated testing validation - Performance impact assessment - Security consideration review

Bug Fixing

Investigation First - Reproduce reliably - Understand root cause - Assess impact and urgency - Plan comprehensive fix Prevention Focus - Add tests for the bug scenario - Implement monitoring/alerts - Document the issue and solution - Review related code areas

Refactoring

Safety First - Comprehensive test coverage - Incremental changes - Feature flags for gradual rollout - Rollback plan preparation Value Focused - Clear improvement objectives - Measurable success criteria - Stakeholder communication - Documentation updates

New Projects

Foundation First - Solid project structure - Development tooling setup - CI/CD pipeline early - Documentation from start Growth Oriented - Scalable architecture - Monitoring and observability - Security by design - Performance considerations

Workflow Customization

Custom Workflow Templates

// ~/.nikcli/workflows/feature-development.json
{
  "name": "Feature Development Workflow",
  "description": "End-to-end feature implementation",
  "phases": [
    {
      "name": "Planning",
      "mode": "plan",
      "agents": ["planner-agent"],
      "checkpoints": ["requirements-review", "architecture-approval"]
    },
    {
      "name": "Implementation", 
      "mode": "autonomous",
      "agents": ["universal-agent", "frontend-agent", "backend-agent"],
      "parallel": true,
      "checkpoints": ["code-review", "test-coverage"]
    },
    {
      "name": "Integration",
      "mode": "chat",
      "agents": ["integration-agent"],
      "checkpoints": ["e2e-tests", "performance-validation"]
    }
  ],
  "quality_gates": {
    "test_coverage": 80,
    "code_quality": "A",
    "security_scan": "pass"
  }
}
# Activate custom workflow
nikcli workflow use feature-development

# Run workflow with parameters
nikcli workflow run feature-development \
  --feature "user authentication" \
  --complexity high \
  --timeline "3 days"

# Monitor workflow progress
nikcli workflow status

# Customize workflow for project
nikcli workflow customize feature-development \
  --add-checkpoint security-review \
  --set-coverage 90

Next Steps

Workflows are most effective when tailored to your team’s specific needs. Start with the provided templates and customize them based on your project requirements and team preferences.