|
| 1 | +# .github Folder - AI Coding Assistant Instructions |
| 2 | + |
| 3 | +This folder contains instructions and configurations for AI coding assistants working on the .NET MAUI repository. |
| 4 | + |
| 5 | +## Quick Start: Using the PR Reviewer Agent |
| 6 | + |
| 7 | +The PR reviewer agent conducts thorough, constructive code reviews of .NET MAUI pull requests with hands-on testing and validation. |
| 8 | + |
| 9 | +### How to Use |
| 10 | + |
| 11 | +```bash |
| 12 | +# Start GitHub Copilot CLI with agent support |
| 13 | +copilot --allow-all-tools --allow-all-paths |
| 14 | + |
| 15 | +# Invoke the pr-reviewer agent |
| 16 | +/agent pr-reviewer |
| 17 | + |
| 18 | +# Request a review |
| 19 | +please review <link to PR> |
| 20 | +``` |
| 21 | + |
| 22 | +### Example |
| 23 | + |
| 24 | +```bash |
| 25 | +copilot --allow-all-tools --allow-all-paths |
| 26 | +/agent pr-reviewer |
| 27 | +please review https://github.com/dotnet/maui/pull/32372 |
| 28 | +``` |
| 29 | + |
| 30 | +## What the Agent Does |
| 31 | + |
| 32 | +Every PR review includes: |
| 33 | + |
| 34 | +1. **Code Analysis** - Reviews code for correctness, style, and best practices |
| 35 | +2. **Build & Deploy** - Builds the Sandbox app and deploys to simulator/emulator |
| 36 | +3. **Real Testing** - Tests PR changes on actual devices with measurements |
| 37 | +4. **Before/After Comparison** - Compares behavior with and without PR changes |
| 38 | +5. **Edge Case Testing** - Tests scenarios not mentioned by the PR author |
| 39 | +6. **Documented Results** - Provides review with actual test data and evidence |
| 40 | + |
| 41 | +The agent will pause and ask for help if it encounters: |
| 42 | +- Merge conflicts when applying PR changes |
| 43 | +- Build errors that prevent testing |
| 44 | +- Test results that are unexpected or confusing |
| 45 | +- Any step that prevents thorough validation |
| 46 | + |
| 47 | +## Important Notes |
| 48 | + |
| 49 | +⚠️ **We're still refining the agent instructions** to ensure it consistently follows the testing workflow. |
| 50 | + |
| 51 | +**The agent will pause and ask for help if:** |
| 52 | +- Merge conflicts occur when applying PR changes |
| 53 | +- Build errors prevent testing |
| 54 | +- Test results are unexpected or confusing |
| 55 | +- Any step fails that prevents thorough validation |
| 56 | + |
| 57 | +This is by design - it's better to pause and get guidance than provide incomplete or misleading reviews. |
| 58 | + |
| 59 | +## File Structure |
| 60 | + |
| 61 | +### Agent Definitions |
| 62 | +- **`agents/pr-reviewer.md`** - Main PR reviewer agent instructions and workflows |
| 63 | + |
| 64 | +### Instruction Files |
| 65 | +These files provide specialized guidance for specific scenarios: |
| 66 | + |
| 67 | +- **`instructions/uitests.instructions.md`** - UI testing guidelines (when to use HostApp vs Sandbox) |
| 68 | +- **`instructions/safearea-testing.instructions.md`** - SafeArea testing patterns (measure children, not parents) |
| 69 | +- **`instructions/instrumentation.instructions.md`** - Code instrumentation patterns for debugging and testing |
| 70 | +- **`instructions/templates.instructions.md`** - Template modification rules and conventions |
| 71 | + |
| 72 | +### General Guidelines |
| 73 | +- **`copilot-instructions.md`** - General coding standards, build requirements, file conventions for the entire repository |
| 74 | + |
| 75 | +### Prompts |
| 76 | +- **`prompts/pr-reviewer.prompt.md`** - Ready-to-use prompt templates for PR reviews |
| 77 | + |
| 78 | +## For GitHub Copilot (General Development) |
| 79 | + |
| 80 | +When working on code in this repository, GitHub Copilot automatically uses: |
| 81 | +- `.github/copilot-instructions.md` - General coding standards |
| 82 | +- `.github/instructions/*.instructions.md` - Specialized instructions based on file patterns |
| 83 | + |
| 84 | +See `.github/copilot-instructions.md` for comprehensive development guidelines including: |
| 85 | +- Repository structure and setup |
| 86 | +- Build and test workflows |
| 87 | +- Platform-specific development |
| 88 | +- Contribution guidelines |
| 89 | + |
| 90 | +## Instruction Precedence |
| 91 | + |
| 92 | +When multiple instruction files exist, follow this priority order: |
| 93 | + |
| 94 | +1. **Highest Priority**: Agent-specific instructions (`.github/agents/*.md`) |
| 95 | +2. **Secondary**: Specialized instructions (`.github/instructions/*.instructions.md`) |
| 96 | +3. **General Guidance**: `.github/copilot-instructions.md` |
| 97 | + |
| 98 | +If instructions conflict, higher priority files win. |
| 99 | + |
| 100 | +## Contributing to Instructions |
| 101 | + |
| 102 | +When updating agent instructions or guidelines: |
| 103 | + |
| 104 | +1. **Keep them synchronized**: Changes to agent instructions may need corresponding updates to general instructions |
| 105 | +2. **Test the changes**: Verify the agent/assistant behaves as expected |
| 106 | +3. **Document your changes**: Update this README if you add new instruction files |
| 107 | +4. **Be specific**: Clear, actionable instructions work better than vague guidance |
| 108 | + |
| 109 | +## Related Documentation |
| 110 | + |
| 111 | +- **Repository root**: `AGENTS.md` - Universal guidance for all AI coding assistants |
| 112 | +- **Development**: `DEVELOPMENT.md` - Development environment setup |
| 113 | +- **Contributing**: `CONTRIBUTING.md` - Contribution guidelines |
| 114 | +- **Wiki**: [.NET MAUI GitHub Wiki](https://github.com/dotnet/maui/wiki) - Additional resources |
| 115 | + |
| 116 | +## Troubleshooting |
| 117 | + |
| 118 | +### GitHub Copilot CLI Issues |
| 119 | + |
| 120 | +**If you have errors with the CLI working or authentication issues:** |
| 121 | + |
| 122 | +Follow these steps to reset your authentication: |
| 123 | + |
| 124 | +```bash |
| 125 | +# Start Copilot CLI |
| 126 | +copilot |
| 127 | + |
| 128 | +# Logout from current session |
| 129 | +/logout |
| 130 | + |
| 131 | +# Exit Copilot CLI |
| 132 | +exit |
| 133 | + |
| 134 | +# Re-authenticate with GitHub |
| 135 | +gh auth login |
| 136 | + |
| 137 | +# Start Copilot CLI again |
| 138 | +copilot |
| 139 | +``` |
| 140 | + |
| 141 | +This will refresh your GitHub authentication and resolve most CLI-related issues. |
| 142 | + |
| 143 | +### Agent Issues |
| 144 | + |
| 145 | +**Agent doesn't complete testing:** |
| 146 | +- Check the agent's output for error messages |
| 147 | +- The agent should pause and ask for help if it encounters issues |
| 148 | +- If it silently stops, let us know so we can improve the instructions |
| 149 | + |
| 150 | +**Build or test failures:** |
| 151 | +- The agent is designed to pause and ask for help rather than proceeding |
| 152 | +- Work with the agent to resolve the issue before continuing the review |
| 153 | +- This ensures reviews are based on actual working code |
| 154 | + |
| 155 | +## Support |
| 156 | + |
| 157 | +For issues or questions about the AI agent instructions: |
| 158 | +1. Check this README and referenced instruction files |
| 159 | +2. Review recent PR reviews to see examples |
| 160 | +3. Ask in the repository discussions or issues |
| 161 | +4. Propose changes via PR to improve the instructions |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +**Last Updated**: 2025-11-06 |
| 166 | + |
| 167 | +**Note**: These instructions are actively being refined. Feedback and improvements are welcome! |
0 commit comments