-
Notifications
You must be signed in to change notification settings - Fork 116
Add comprehensive .github/copilot-instructions.md for agent onboarding and code review #5396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Copilot is not a collaborator of the repo |
|
@copilot The suggested instructions contain some information that can quickly get outdated (such as number of files written in specific programming languages). Remove any unnecessary information like that, so that the instructions are easier to maintain and require less frequent updates. At the same time include additional instructions for the agent to make sure that these instructions are kept up to date while working on the repo. If agent is used during code review it should also point out whenever it notices changes to the repo that should be reflected in the |
Removed outdated metrics (file counts, specific timings) and added a "Maintaining These Instructions" section. The new section guides agents to update this file when making relevant changes and to flag needed updates during code review. Commit: 7fcded5 |
|
@copilot In addition to all the instructions proposed currently for These instructions should include (but not be limited to):
On top of that feel free to include any other best practices for valuable code reviews. |
Added a "Code Review Guidelines" section covering:
The section emphasizes asking questions over making uncertain suggestions and provides concrete examples of conversational phrasing. Commit: 8eb2db4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive .github/copilot-instructions.md file to help GitHub Copilot coding agents work more efficiently with the snapcraft.io codebase, reducing exploration time and preventing common build/test failures.
Key changes:
- Complete onboarding documentation covering build sequence, project structure, and development workflows
- Detailed code review guidelines to help agents provide constructive feedback
- Maintenance instructions to keep the documentation current
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@copilot Add information about Vanilla framework being used as a component library and make sure agent follows the Vanilla documentation (https://vanillaframework.io/docs) and coding conventions from its repo (https://github.com/canonical/vanilla-framework/) when proposing and reviewing changes. |
Added Vanilla Framework information in the Repository Overview section with links to documentation (https://vanillaframework.io/docs) and repository conventions (https://github.com/canonical/vanilla-framework/). Also added guidance in Code Review Guidelines to verify UI changes follow Vanilla patterns and use Vanilla components instead of custom implementations where possible. Commit: 2f03466 |
|
It's starting to look pretty good, it might also double as a nice guide for human contributors. Some of the instructions in the code review sections might be a bit difficult to actually follow (can the bot detect when a block of HTML is implementing a Vanilla pattern that already exists?), but I guess we can only determine this once we merge this and test it with a few reviews. @copilot when introducing Vanilla, also add references to the React components implementation (https://github.com/canonical/react-components/) and the Store extension of this library (https://github.com/canonical/store-components). Make sure to highlight the difference between the base Vanilla package (it implements styles and HTML patterns as Jinja macros) and the React implementation (it implements components and patterns along with their associated JS logic to enable interactions). |
|
@copilot when introducing Vanilla, also add references to the React components implementation (https://github.com/canonical/react-components/) and the Store extension of this library (https://github.com/canonical/store-components). Make sure to highlight the difference between the base Vanilla package (it implements styles and HTML patterns as Jinja macros) and the React implementation (it implements components and patterns along with their associated JS logic to enable interactions). |
Added references to React Components (https://github.com/canonical/react-components/) and Store Components (https://github.com/canonical/store-components) in the UI Framework section. Clarified that Vanilla Framework base package implements styles/HTML patterns as Jinja macros, while React Components implements these patterns as React components with JS logic for interactions, and Store Components extends this with store-specific functionality. Commit: 2075d7d
Added references to React Components (https://github.com/canonical/react-components/) and Store Components (https://github.com/canonical/store-components) in the UI Framework section. Clarified that Vanilla Framework base package implements styles/HTML patterns as Jinja macros, while React Components implements these patterns as React components with JS logic for interactions, and Store Components extends this with store-specific functionality. Commit: 2075d7d |
|
@copilot Rebase the branch on top of fresh main branch, and add instruction to follow the contribution guidelines from CONTRIBUTING.md file. |
Rebased branch on fresh main (includes new CONTRIBUTING.md from commit f457fd7) and added references to CONTRIBUTING.md in the Code Review Guidelines and Key Files sections. Commit: dadcbce |
Co-authored-by: bartaz <83575+bartaz@users.noreply.github.com>
Co-authored-by: bartaz <83575+bartaz@users.noreply.github.com>
Co-authored-by: bartaz <83575+bartaz@users.noreply.github.com>
Co-authored-by: bartaz <83575+bartaz@users.noreply.github.com>
Co-authored-by: bartaz <83575+bartaz@users.noreply.github.com>
Co-authored-by: bartaz <83575+bartaz@users.noreply.github.com>
7627c4a to
39e286f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
Note
PR created by Copilot agent, following the official GH documentation and their provided prompt
Overview
This PR adds a
.github/copilot-instructions.mdfile to help GitHub Copilot coding agents work more efficiently with the snapcraft.io codebase. This "onboarding" document reduces the time agents spend exploring the repository and helps prevent common build/test failures. It also provides comprehensive guidance for agents performing code reviews.What's Included
The instructions file provides:
1. Repository Overview
2. Critical Build Sequence
Documents the required order of operations:
Key finding:
yarn run buildMUST be run before Flask app or Python tests, as templates reference Vite-built assets instatic/js/dist/vite/.3. Complete Linting & Testing Commands
SECRET_KEYenvironment variable and built assets4. Project Architecture
vite.config.js,webapp/config.py,.env,Dockerfile5. CI/CD Workflows
.github/workflows/pr.ymljobssudo chmod -R 777 .needed beforedotrun installin CI6. Known Issues & Workarounds
Documented 5 common issues:
7. Common Development Tasks
8. Critical Rules
Clear ALWAYS/NEVER guidelines to prevent common mistakes like skipping asset builds or running Python tests without SECRET_KEY.
9. Code Review Guidelines
Comprehensive guidance for agents performing code reviews:
10. Maintaining These Instructions
Validation
All commands in the instructions were validated:
Design Decisions
To improve maintainability:
Size
The file is 168 lines / 1118 words (approximately 2 pages), meeting the requirement to be concise while comprehensive.
Benefits
This will help coding agents:
Warning
download.cypress.io/usr/local/bin/node index.js --exec install(dns block)login.ubuntu.compython3 -m unittest discover tests(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Your task is to "onboard" this repository to Copilot coding agent by adding a .github/copilot-instructions.md file in the repository that contains information describing how a coding agent seeing it for the first time can work most efficiently.
You will do this task only one time per repository and doing a good job can SIGNIFICANTLY improve the quality of the agent's work, so take your time, think carefully, and search thoroughly before writing the instructions.
- Reduce the likelihood of a coding agent pull request getting rejected by the user due to generating code that fails the continuous integration build, fails a validation pipeline, or having misbehavior. - Minimize bash command and build failures. - Allow the agent to complete its task more quickly by minimizing the need for exploration using grep, find, str_replace_editor, and code search tools. - Instructions must be no longer than 2 pages. - Instructions must not be task specific.Add the following high level details about the codebase to reduce the amount of searching the agent has to do to understand the codebase each time:
Add information about how to build and validate changes so the agent does not need to search and find it each time.
List key facts about the layout and architecture of the codebase to help the agent find where to make changes with minimal searching.
- A description of the major architectural elements of the project, including the relative paths to the main project files, the location
- A description of the checks run prior to check in, including any GitHub workflows, continuous integration builds, or other validation pipelines.
- Document the steps so that the agent can replicate these itself.
- Any explicit validation steps that the agent can consider to have further confidence in its changes.
- Dependencies that aren't obvious from the layout or file structure.
- Finally, fill in any remaining space with detailed lists of the following, in order of priority: the list of files in the repo root, the
- Perform a comprehensive inventory of the codebase. Search for and view: - README.md, CONTRIBUTING.md, and all other documentation files. - Search the codebase for build steps and indications of workarounds like 'HACK', 'TODO', etc. - All scripts, particularly those pertaining to build and repo or environment setup. - All build and actions pipelines. - All project files. - All configuration and linting files. - For each file: - think: are the contents or the existence of the file information that the coding agent will need to implement, build, test, validate, or demo a code change? - If yes: - Document the command or information in detail. - Explicitly indicate which commands work and which do not and the order in which commands should be run. - Document any errors encountered as well as the steps taken to workaround them. - Document any other steps or information that the agent can use to reduce time spent exploring or trying and failing to run bash commands. - Finally, explicitly instruct the agent to trust the instructions and only perform a search if the information in the instruction...of configuration files for linting, compilation, testing, and preferences.
contents of the README, the contents of any key source files, the list of files in the next level down of directories, giving priority to the more structurally important and snippets of code from key source files, such as the one containing the main method.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.