Loading...
Loading...
AI-powered command-line assistant for developers that provides code review, debugging, test generation, and development workflows directly in the terminal
npx skill4agent add aradotso/devtools-skills github-copilot-cliSkill by ara.so — Devtools Skills collection.
ghbrew install ghwinget install --id GitHub.clicurl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install ghgh extension install github/gh-copilotgh auth logingh copilot --versiongh copilotgh copilot explain "git rebase -i HEAD~3"gh copilot explain "docker-compose up -d"gh copilot suggest "find all python files modified in last 7 days"gh copilot suggest "compress all jpg files in current directory"gh copilot alias -- --shell bashghcsghceghcpghcs "list all running docker containers"
ghce "kubectl get pods -A"gh copilot> I need to review a Python Flask application for security issues
Copilot: I'll help you review your Flask application for security. Could you share:
1. The main application file
2. Any authentication/authorization code
3. Database interaction code
> @app.py @auth.py @models.py
Copilot: [Analyzes files and provides security review]gh copilot explain "awk '{print $2}' file.txt | sort -u"gh copilot explain "SELECT u.name, COUNT(o.id) FROM users u LEFT JOIN orders o ON u.id = o.user_id GROUP BY u.id"gh copilot suggest "recursively delete all node_modules folders"gh copilot suggest "monitor CPU and memory usage in real-time"gh copilot
> Review @server.py for potential race conditionsgh copilot
> Compare @config.dev.json and @config.prod.json and explain differencesgh copilot
> @models.py @views.py @serializers.py review this Django app for N+1 queriesgh copilot
> @src/ explain the architecture of this applicationgh copilot
> Review @pull_request_changes.diff for:
> - Security vulnerabilities
> - Performance issues
> - Code style violations
> - Missing error handlinggh copilot
> I'm getting "TypeError: Cannot read property 'map' of undefined" in @app.js line 42
> Here's the error stack: @error.loggh copilot
> Generate pytest unit tests for @calculator.py covering edge casesgh copilot
> Create Jest tests for @api-client.js including error scenariosgh copilot
> Write table-driven tests for @handler.gogh copilot
> Refactor @legacy-auth.js to use async/await instead of callbacksgh copilot
> Convert @class-component.jsx to a functional component with hooksmkdir -p ~/.config/gh-copilot/agents~/.config/gh-copilot/agents/security-reviewer.md# Security Reviewer Agent
You are a security-focused code reviewer specializing in:
- OWASP Top 10 vulnerabilities
- Input validation and sanitization
- Authentication and authorization flaws
- SQL injection and XSS prevention
- Secrets and credential management
Always:
1. Identify specific line numbers with issues
2. Explain the security impact
3. Provide secure code examples
4. Reference relevant OWASP guidelines~/.config/gh-copilot/agents/python-expert.md# Python Expert Agent
You are a Python expert focusing on:
- PEP 8 style compliance
- Type hints and mypy compatibility
- Pythonic idioms and patterns
- Performance optimization
- Testing with pytest
Provide:
- Specific improvement suggestions
- Code examples following best practices
- Performance benchmarks when relevantgh copilot
> @security-reviewer analyze @app.pygh copilot
> @python-expert review @data_processor.py for optimization opportunitiesmkdir -p ~/.config/gh-copilot~/.config/gh-copilot/instructions.md# My Development Preferences
- **Language**: Prefer TypeScript over JavaScript
- **Testing**: Use Jest with React Testing Library
- **Style**: Follow Airbnb style guide
- **Error Handling**: Always use try-catch and log errors
- **Comments**: Add JSDoc comments for public functions
- **Security**: Flag any hardcoded credentials or secrets.copilot/skills/mkdir -p .copilot/skills.copilot/skills/django-project.md# Django Project Configuration
## Stack
- Django 4.2
- PostgreSQL 15
- Redis for caching
- Celery for async tasks
## Code Standards
- Use Django REST Framework serializers
- Prefer class-based views
- Always use select_related/prefetch_related
- Write tests with pytest-django
## Database
- Use migrations for all schema changes
- Never use raw SQL without parameterization
- Connection: via DATABASE_URL environment variable.copilot/skills/react-conventions.md# React Project Conventions
## Stack
- React 18 with TypeScript
- Vite for bundling
- React Query for data fetching
- Zustand for state management
## Patterns
- Functional components with hooks
- Custom hooks for reusable logic
- Error boundaries for fault tolerance
- Suspense for loading states
## File Structure
- Components in src/components
- Hooks in src/hooks
- Utils in src/utilsgh copilot.copilot/skills/~/.config/gh-copilot/mcp.json{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}{
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}gh copilot
> Search GitHub for recent issues tagged "bug" in owner/repo{
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}gh copilot
> Query the database for users created in the last 30 days{
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"]
}
}{
"brave-search": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
"env": {
"BRAVE_API_KEY": "${BRAVE_API_KEY}"
}
}
}// my-mcp-server.js
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new Server({
name: 'my-custom-server',
version: '1.0.0',
});
// Define tools
server.setRequestHandler('tools/list', async () => ({
tools: [{
name: 'get_data',
description: 'Fetch data from custom source',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string' }
}
}
}]
}));
// Implement tool
server.setRequestHandler('tools/call', async (request) => {
const { name, arguments: args } = request.params;
if (name === 'get_data') {
const result = await fetchCustomData(args.query);
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
}
});
const transport = new StdioServerTransport();
await server.connect(transport);mcp.json{
"my-custom": {
"command": "node",
"args": ["/path/to/my-mcp-server.js"]
}
}# Start review session
gh copilot
> I need to review changes before committing. Review @src/auth.py @src/models.py for:
> 1. Security issues
> 2. Performance problems
> 3. Code style
> 4. Missing tests
# Copilot provides detailed review
> Generate pytest tests for the issues you found in @src/auth.py
# Copilot generates test code
> Now explain how to fix the SQL injection vulnerability you identifiedgh copilot
> My Flask app is returning 500 errors. Here's the traceback: @error.log
> And here's the relevant code: @app.py @database.py
# Copilot analyzes and suggests fixes
> Apply your suggested fix to @database.py and show me the corrected code
> Now write a test that would have caught this buggh copilot
> Generate comprehensive Jest tests for @api-client.ts covering:
> - Successful API calls
> - Network errors
> - Invalid responses
> - Timeout scenarios
> - Retry logic
# Copilot generates test suite
> Add tests for the edge case where the API returns 429 rate limitgh copilot
> I need to refactor @legacy-app/ to use modern React patterns:
> - Convert class components to functional components with hooks
> - Replace Redux with Zustand
> - Add TypeScript types
> Start with @legacy-app/components/UserList.jsx
# Copilot provides refactored code
> Continue with @legacy-app/components/UserDetail.jsx using the same patternsgh copilot
> @models.py contains Django ORM queries. Analyze for N+1 query problems
# Copilot identifies issues
> Show me how to fix the N+1 issue in the get_user_orders view using select_related
> Now generate a test that verifies the query count is optimized~/.config/gh-copilot/
├── instructions.md # Global instructions
├── mcp.json # MCP server configuration
└── agents/ # Custom agent definitions
├── security-reviewer.md
├── python-expert.md
└── react-specialist.mdyour-project/
├── .copilot/
│ └── skills/
│ ├── project-conventions.md
│ ├── api-documentation.md
│ └── deployment-guide.md
├── src/
└── tests/gh copilot
> I need to add user authentication to my Flask app
# Copilot outlines approach
> Start by showing me the User model with password hashing
> Now create the login endpoint with JWT tokens
> Generate tests for the authentication flow
> Show me how to protect routes with auth middlewaregh copilot
> @legacy-system/ is an old codebase I inherited. Help me understand:
> 1. The overall architecture
> 2. How data flows through the system
> 3. External dependencies
> 4. Potential technical debt
# Analyze incrementally
> Start with @legacy-system/main.py and @legacy-system/config.pygh copilot
> @security-reviewer perform a complete security audit of @api/
# Review findings
> Prioritize the vulnerabilities by severity
> For each critical issue, show me the fix with code examples
> Generate security tests that verify the fixesgh copilot
> Generate API documentation for @endpoints.py in OpenAPI format
> Create a README.md for @utils/ explaining each utility function
> Add inline comments to @complex-algorithm.py explaining the logicgh copilot
> I need to migrate from @old-api/ (REST) to @new-api/ (GraphQL)
> Create a migration plan with backwards compatibility
> Show me how to implement the first endpoint in both versions
> Generate tests that verify both APIs return identical datagh: command not found# Verify installation
which gh
# Reinstall GitHub CLI
brew reinstall gh # macOS# List installed extensions
gh extension list
# Remove and reinstall
gh extension remove gh-copilot
gh extension install github/gh-copilot# Check auth status
gh auth status
# Re-authenticate
gh auth login
# Verify Copilot access
gh copilot --versiongh auth status# Use absolute paths
gh copilot
> Review /full/path/to/file.py
# Or navigate to project directory first
cd /path/to/project
gh copilot
> Review @src/file.py# Be specific with file references
> Review @src/auth.py # Good
> Review @src/ # Too broad# Verify file location
ls ~/.config/gh-copilot/agents/
# Check file format (must be .md)
# Verify no syntax errors in frontmatter# Verify skill directory
ls .copilot/skills/
# Must run gh copilot from project directory
pwd # Should be in project root
# Restart copilot session
gh copilot# Verify mcp.json syntax
cat ~/.config/gh-copilot/mcp.json | jq .
# Check environment variables
echo $GITHUB_TOKEN
echo $DATABASE_URL
# Test server manually
npx -y @modelcontextprotocol/server-github.copilot/skills/suggestchat.copilot/skills/