Master technical decision-making with GitHub Copilot CLI

�� Discovery Commands - Understanding Codebases

copilot explain
Get AI-powered explanations of code, features, or architecture
$ 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
Find code patterns, functions, or keywords across the codebase
$ 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 entire codebase for metrics, patterns, or statistics
$ 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
Perform deep analysis on code quality, performance, or architecture
$ 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
Understand changes between branches or commits
$ 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
Get effort estimates for features or refactoring
$ 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
Compare different technical approaches or implementations
$ 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
Get recommendations for architecture, patterns, or approaches
$ 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
Comprehensive audit for security, performance, or best practices
$ 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 documentation from code
$ copilot document --generate readme
$ copilot document 'API endpoints' --format markdown

PM Use Case: "Generate API documentation for stakeholders" to communicate technical capabilities.

copilot summarize
Create executive summaries of technical work
$ copilot summarize --commits last-week
$ copilot summarize 'technical debt'

PM Use Case: "Summarize engineering progress for the exec team" for stakeholder updates.

copilot explain --for-audience
Explain technical concepts at different levels
$ 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
Create custom queries for specialized analysis
$ copilot custom-query 'find all payment processing'

PM Use Case: Create targeted searches for specific business concerns (compliance, payment, etc.)

copilot context --set
Provide context for more accurate analysis
$ 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
Export analysis results for reports and presentations
$ 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

--language

Filter by programming language (javascript, python, go, rust, etc.)

--context

Provide additional context for more accurate results (mobile, backend, security, etc.)

--all-branches

Search/analyze across all branches, not just current branch

--format

Output format (json, markdown, pdf, html, csv)

--depth

Analysis depth (shallow, normal, deep)

--compare-with

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