← Back to Mission Control

Custom Instructions Calibration

Teaching Copilot Your Git Culture

Mission Phase 38 • Difficulty: Advanced

Mission Briefing

Every space mission operates according to specific protocols, safety guidelines, and communication standards. These aren't just suggestions—they're mission-critical rules that ensure consistency, safety, and success across all operations.

Similarly, every development team has its own "Git culture"—specific conventions for commit messages, branch naming, pull request formats, and code review processes. The challenge is ensuring that these standards are consistently applied, especially when using AI assistance.

GitHub Copilot can learn and follow your team's specific conventions when you provide clear, repository-specific instructions. This ensures that AI suggestions align with your team's established practices rather than generic conventions.

Mission Objectives

Step 1: Repository Custom Instructions

Create a `.github/copilot-instructions.md` file in your repository root:

# Copilot Instructions for [Project Name]

## Git Commit Conventions
- Use conventional commits format: type(scope): description
- Types: feat, fix, docs, style, refactor, test, chore
- Always include ticket number: feat(auth): add OAuth login [PROJ-123]
- Keep description under 72 characters
- Use present tense: "add" not "added"

## Branch Naming
- Format: type/ticket-description
- Types: feature, bugfix, hotfix, refactor
- Use kebab-case: feature/user-authentication
- Include ticket: feature/PROJ-123-user-auth

## Pull Request Standards
- Title: "[TICKET] Brief description"
- Include: What, Why, Testing notes
- Link related issues
- Request specific reviewers for domain expertise

## Code Review Guidelines
- Focus on logic, performance, security
- Suggest improvements, don't just approve
- Test the changes locally when possible
- Check for proper error handling

Step 2: Advanced Configuration Examples

Comprehensive instruction templates for different team styles:

# Enterprise Team Instructions
## Git Workflow
- All work must happen in feature branches
- Require 2 approvals before merge
- Use squash merge for clean history
- Delete branches after merge

## Security Requirements
- Never commit secrets or API keys
- Use environment variables for configuration
- Include security review for auth changes
- Scan dependencies for vulnerabilities

## Documentation Standards
- Update README for new features
- Include inline comments for complex logic
- Maintain CHANGELOG.md
- Document API changes in separate file

Step 3: Team-Specific Conventions

Tailor instructions to your team's unique practices:

# Startup Team Instructions
## Fast-Moving Development
- Commit often, push daily
- Use descriptive branch names
- Quick code reviews (same day)
- Prioritize shipping over perfection

## Communication Style
- Commit messages can be informal but clear
- Use emojis in commit messages: ✨ feat: 🐛 fix: 📚 docs:
- Tag team members in PR descriptions
- Celebrate wins in commit messages

## Technical Preferences
- Prefer functional programming patterns
- Use TypeScript for new JavaScript code
- Write tests for critical paths
- Deploy to staging automatically

Step 4: Language and Framework Specific

Include technology-specific guidance for Copilot:

# Frontend React Project
## React Conventions
- Use functional components with hooks
- Implement proper TypeScript types
- Follow established file structure: components/hooks/utils
- Use styled-components for styling

## Git Conventions for Frontend
- Include "frontend:" prefix for UI changes
- Screenshot before/after in PR description
- Test on multiple browsers
- Check responsive design

## Testing Requirements
- Unit tests for custom hooks
- Integration tests for user flows
- Visual regression tests for UI changes
- Accessibility testing with axe-core

Step 5: Validation and Testing

Test your custom instructions to ensure they work effectively:

// Test prompts to validate custom instructions:

1. "Generate a commit message for adding user authentication"
   Expected: Follows your commit format

2. "Create a branch name for fixing login validation"
   Expected: Uses your branch naming convention

3. "Write a pull request template for this feature"
   Expected: Includes your required sections

4. "Suggest code review comments for this change"
   Expected: Focuses on your team's priorities

Step 6: Iteration and Improvement

Continuously refine your instructions based on team feedback:

# Version your instructions file:
# v1.0 - Initial team conventions
# v1.1 - Added security requirements  
# v1.2 - Updated for new CI/CD pipeline
# v2.0 - Major revision after team retro

## Changelog
- 2024-01-15: Added TypeScript requirements
- 2024-01-10: Updated commit message format
- 2024-01-05: Initial version created

Advanced Techniques

Conditional Instructions

# Environment-Specific Rules
## Production Changes
- Require additional approval from DevOps team
- Include rollback plan in PR description
- Test in staging environment first
- Schedule deployment during maintenance window

## Hotfix Process
- Create from main branch
- Skip normal review process if critical
- Deploy immediately after merge
- Create post-mortem issue for analysis

Integration with Tools

# Tool Integration Instructions
## Jira Integration
- Include ticket number in all commits
- Update ticket status when PR is merged
- Link related tickets in PR description
- Use Jira smart commits when possible

## Slack Notifications
- Mention @channel for breaking changes
- Use thread replies for PR discussions
- Post deployment notifications to #deploys
- Share learning notes in #dev-tips

Common Patterns and Examples

Commit Message Examples

Before Custom Instructions:

fix: bug fix
update readme
added new feature

After Custom Instructions:

fix(auth): resolve session timeout issue [AUTH-456]
docs(readme): update installation instructions [DOC-123]
feat(dashboard): add user analytics view [DASH-789]

Best Practices

✅ Do:

❌ Don't:

Mission Challenge

Your Task:

  1. Create a comprehensive `.github/copilot-instructions.md` file for your team
  2. Include at least 5 different types of conventions (commits, branches, PRs, etc.)
  3. Test the instructions with Copilot Chat using various prompts
  4. Refine the instructions based on the AI responses
  5. Share with your team and gather feedback for improvements

Mission Summary

Outstanding work, Commander! You've successfully configured your AI co-pilot to understand and follow your team's unique Git culture. You can now:

Key Achievements:

Next Mission: Now you're ready for the final chapter where you'll master intelligent branch naming and management!