Copilot CLI Command Reference
Complete guide to every Copilot CLI command with real-world PM examples.
�� Discovery Commands - Understanding Codebases
$ copilot explain 'authentication system'$ copilot explain --file src/auth.ts
PM Use Case: "Explain how our user authentication works" to understand security architecture.
$ copilot search 'database query' --language sql$ copilot search 'performance' --all-branches
PM Use Case: "Find all places where we're accessing the user database" to understand data flow.
$ copilot codebase --analyze$ copilot codebase 'test' --type coverage
PM Use Case: "Analyze test coverage across the codebase" to assess engineering health.
🔍 Analysis Commands - Deep Dives & Investigations
$ copilot analyze --performance$ copilot analyze 'memory usage' --context mobile
PM Use Case: "Analyze performance bottlenecks in the mobile app" to identify optimization opportunities.
$ copilot diff main staging$ copilot diff commit1 commit2 --explain
PM Use Case: "What changed between last release and staging?" to review upcoming features.
$ copilot estimate 'add dark mode'$ copilot estimate 'refactor database layer'
PM Use Case: "How much effort would it take to implement feature X?" for roadmap planning.
⚖️ Decision Commands - Making Technical Choices
$ copilot compare 'REST vs GraphQL'$ copilot compare implementation1 implementation2
PM Use Case: "Should we use GraphQL or REST for our new API?" to evaluate architecture options.
$ copilot recommend 'caching strategy' --context 'mobile app'$ copilot recommend --for-pattern 'database'
PM Use Case: "What's the best approach for handling offline sync?" to drive architecture decisions.
$ copilot audit --security$ copilot audit 'GDPR compliance'
PM Use Case: "Audit our codebase for security vulnerabilities" for compliance and risk assessment.
📢 Communication Commands - Explaining to Others
$ copilot document --generate readme$ copilot document 'API endpoints' --format markdown
PM Use Case: "Generate API documentation for stakeholders" to communicate technical capabilities.
$ copilot summarize --commits last-week$ copilot summarize 'technical debt'
PM Use Case: "Summarize engineering progress for the exec team" for stakeholder updates.
$ copilot explain 'microservices' --for-audience executives$ copilot explain --for-audience non-technical
PM Use Case: "Explain this architecture decision to our CEO" for executive communication.
🚀 Advanced Commands - Power User Features
$ copilot custom-query 'find all payment processing'
PM Use Case: Create targeted searches for specific business concerns (compliance, payment, etc.)
$ copilot context --set industry healthcare$ copilot context --add focus performance optimization
PM Use Case: "Set context to healthcare industry" for compliance-specific analysis.
$ copilot export --format pdf --file report.pdf$ copilot export --format json --context audit
PM Use Case: "Export security audit as PDF" for documentation and compliance records.
⚙️ Common Flags & Options
Filter by programming language (javascript, python, go, rust, etc.)
Provide additional context for more accurate results (mobile, backend, security, etc.)
Search/analyze across all branches, not just current branch
Output format (json, markdown, pdf, html, csv)
Analysis depth (shallow, normal, deep)
Compare against best practices, benchmarks, or other codebases
🎯 Quick Command Matrix - Choose Based on Your Need
| I Need To... | Command | Example |
|---|---|---|
| Understand a feature | explain |
copilot explain 'payment flow' |
| Find related code | search |
copilot search 'database' |
| Assess code health | codebase --analyze |
copilot codebase --analyze |
| Estimate effort | estimate |
copilot estimate 'dark mode' |
| Compare approaches | compare |
copilot compare 'REST vs GraphQL' |
| Check security | audit --security |
copilot audit --security |