Project: CLI Task Management Tool
Problem Statement
You're a software engineer working in a fast-paced startup. Your team uses various project management tools, but you find yourself constantly context-switching between your terminal and browser. You spend most of your day in the terminal running tests, deploying code, and managing servers.
The Challenge: You want a quick way to manage your personal tasks without leaving your terminal. You need to:
- Quickly add tasks during standup meetings
- Check your todo list while debugging
- Mark tasks complete without opening a browser
- Filter tasks by priority when planning your day
- Track long-term tasks that persist across terminal sessions
Commercial tools are either too complex, too expensive, or not terminal-friendly. You decide to build your own CLI task manager.
Real-World Scenario:
1# During a standup meeting
2$ taskmaster add -t "Fix authentication bug" -p high --tags backend,urgent
3
4# While debugging
5$ taskmaster list --status pending
6
7# After deploying a fix
8$ taskmaster complete 42
9
10# Planning your day
11$ taskmaster list --priority high
Requirements
Functional Requirements
Must Have:
- ✅ Create tasks with title, description, and priority
- ✅ List tasks with filtering
- ✅ Mark tasks as complete
- ✅ Delete tasks
- ✅ Persistent storage
- ✅ Fast performance
Should Have:
- ✅ Tag support for categorization
- ✅ Search functionality
- ✅ Statistics and reporting
- ✅ Colorized output for readability
- ✅ Configuration management
Nice to Have:
- Interactive mode with prompts
- Plugin system for extensibility
- Export/import functionality
Non-Functional Requirements
- Performance: Sub-second response times for all operations
- Usability: Intuitive CLI interface following Unix conventions
- Reliability: Never lose task data
- Portability: Works on Linux, macOS, Windows
- Maintainability: Clean architecture for future enhancements
Constraints
Technical Constraints:
- No Server Required: Must work offline, no cloud dependencies
- Minimal Dependencies: Single binary, no external installations
- Cross-Platform: SQLite for portability
- File-Based Storage: User's home directory for data
Business Constraints:
- Solo Developer: You're building this alone in spare time
- Quick to Build: Need a working prototype in a few days
- Low Maintenance: Can't spend time managing a database server
Design Considerations
Storage Strategy
Decision: SQLite with GORM ORM
- Get SQL power without server overhead
- GORM provides migrations and query builder
- Single file in ~/.taskmaster/tasks.db
- Zero server configuration, cross-platform, ACID compliance
Why Not Alternatives?
- JSON File: Poor performance for searching/filtering, concurrency issues
- PostgreSQL/MySQL: Requires server installation, overkill for personal tasks
CLI Structure
Decision: Cobra Framework with Subcommands
- Industry-standard CLI framework
- Clear action-oriented interface familiar to users
- Auto-generated help and documentation
- Easy to extend with new commands
Command Pattern: taskmaster [command] [flags]
Architecture
Decision: Clean Architecture with 4 Layers
Commands → Service → Repository → Database
Benefits:
- Test business logic without database
- Swap storage implementation later
- Add new commands without touching data layer
- Clear boundaries and responsibilities
Configuration Management
Decision: Viper for Configuration
- YAML config in ~/.taskmaster/taskmaster.yaml
- Sensible defaults
- Override with environment variables
- Example: database path, output colors, date format
Acceptance Criteria
Your implementation is complete when it meets these criteria:
Core Functionality
- ✅ Add tasks with title, description, priority, and tags
- ✅ List all tasks in a readable table format
- ✅ Filter tasks by status
- ✅ Filter tasks by priority
- ✅ Filter tasks by tags
- ✅ Search tasks by title or description
- ✅ Mark tasks as completed
- ✅ Delete tasks
- ✅ Display statistics
Data Persistence
- ✅ Tasks persist across application restarts
- ✅ Database stored in ~/.taskmaster/tasks.db
- ✅ GORM migrations create/update schema automatically
- ✅ No data loss on unexpected termination
User Experience
- ✅ Colorized output
- ✅ Clear error messages for invalid inputs
- ✅ Help text for all commands
- ✅ Tab-aligned output for task lists
- ✅ Response time < 100ms for all operations
Code Quality
- ✅ Follows Go best practices and conventions
- ✅ Clean architecture
- ✅ Proper error handling with wrapped errors
- ✅ Integration tests with in-memory database
- ✅ Test coverage > 70%
Cross-Platform Compatibility
- ✅ Builds on Linux, macOS, and Windows
- ✅ Single binary with no external dependencies
- ✅ Dockerfile for containerized deployment
Usage Examples
Quick Start
1# Build and install
2go build -o taskmaster cmd/taskmaster/main.go
3sudo mv taskmaster /usr/local/bin/
4
5# Or with Go
6go install cmd/taskmaster/main.go
7
8# Verify installation
9taskmaster --help
Common Workflows
1# Morning: Plan your day
2$ taskmaster add -t "Review pull requests" -p high --tags code-review
3$ taskmaster add -t "Update documentation" -p medium --tags docs
4$ taskmaster add -t "Fix CI pipeline" -p critical --tags devops,urgent
5
6# Check what's urgent
7$ taskmaster list --priority critical
8ID TITLE PRIORITY STATUS TAGS
942 Fix CI pipeline Critical Pending devops, urgent
10
11# During work: Complete tasks
12$ taskmaster complete 42
13✓ Task marked as completed!
14
15# End of day: Review progress
16$ taskmaster stats
17Task Statistics
18===============
19Total Tasks: 15
20Completed: 8
21Pending: 5
22In Progress: 2
23Cancelled: 0
24
25# Search for a specific task
26$ taskmaster list --search "documentation"
27ID TITLE PRIORITY STATUS TAGS
2843 Update documentation Medium Pending docs
29
30# Filter by tag
31$ taskmaster list --tag urgent
32ID TITLE PRIORITY STATUS TAGS
3342 Fix CI pipeline Critical Completed devops, urgent
Advanced Filtering
1# Combine multiple filters
2$ taskmaster list --status pending --priority high --tag backend
3
4# Find all completed tasks
5$ taskmaster list --status completed
6
7# Search within specific status
8$ taskmaster list --status pending --search "bug"
Docker Usage
1# Build image
2docker build -t taskmaster:latest .
3
4# Run interactively
5docker run -it --rm \
6 -v taskmaster-data:/root/.taskmaster \
7 taskmaster:latest list
8
9# Add alias for convenience
10alias tm='docker run -it --rm -v taskmaster-data:/root/.taskmaster taskmaster:latest'
11
12# Use like native command
13tm add -t "Docker task" -p high
14tm list
Key Takeaways
What We Built
✅ Functional CLI Tool: Production-ready task manager
✅ Clean Architecture: Maintainable 4-layer design
✅ Persistent Storage: SQLite with zero configuration
✅ Powerful Filtering: Status, priority, tags, search
✅ Great UX: Colorized output, helpful error messages
✅ Testable: Integration tests with in-memory database
✅ Deployable: Docker containerization
Design Decisions Recap
| Decision | Choice | Why |
|---|---|---|
| Storage | SQLite | Zero config, portable, full SQL power |
| CLI Framework | Cobra | Industry standard, great UX |
| Architecture | 4-layer clean architecture | Maintainable, testable |
| ORM | GORM | Developer-friendly, migrations |
| Data Location | ~/.taskmaster/ | Unix convention, user-specific |
Technology Stack
- CLI Framework: Cobra - Powerful CLI framework
- ORM: GORM - Developer-friendly ORM for Go
- Configuration: Viper - Configuration management
- Database: SQLite - Embedded, zero-config database
- Prompts: survey - Interactive prompts
- Colors: color - Terminal colors
- Testing: testify - Testing utilities
Lessons Learned
- Start Simple: MVP first, then add features
- Clean Architecture: Separation of concerns makes testing easy
- UX Matters: Colorized output and clear messages improve usability
- Test Early: Integration tests catch bugs before production
- Document Usage: Examples help users discover features
Next Steps
Want to extend this project? Here are ideas:
- Interactive Mode: Full TUI with keyboard navigation)
- Reminders: Desktop notifications for due tasks
- Sync: Cloud sync across devices
- Import/Export: JSON/CSV for data portability
- Templates: Task templates for recurring work
- Time Tracking: Track time spent on tasks
- Dependencies: Task dependencies and subtasks
- Git Integration: Auto-create tasks from GitHub issues
Download Complete Solution
📦 Download Complete Solution
Get all source code files as a ready-to-run project:
⬇️ Download SolutionContains: All Go files, Dockerfile, Makefile, tests, and README with complete implementation guide
The README includes detailed architecture breakdown, implementation phases, project structure, and step-by-step build instructions.
Congratulations! You've designed a production-ready CLI task manager with clean architecture, comprehensive testing, and great UX. This project demonstrates real-world Go application development patterns you can apply to any CLI tool.