Add copilot custom instructions#591
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds repository-specific contributor/reviewer guidance by introducing a Copilot instructions document and a Rootstock-focused coding principles document, aimed at improving security-awareness, reviewability, and consistency in this security-critical codebase.
Changes:
- Added
docs/coding-principles.mdwith Rootstock-oriented coding, testing, and refactoring guidelines. - Added
.github/copilot-instructions.mdwith repository context, security-sensitive areas, CI expectations, and build/test commands.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
docs/coding-principles.md |
Introduces coding principles and Java guidance intended to standardize readable, safe changes. |
.github/copilot-instructions.md |
Provides Copilot/human reviewers with repo context, security-critical guidance, CI gates, and build/test/run instructions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * Use intention-revealing names. | ||
| * Prefer names that reveal intent without requiring comments. | ||
| * Names should describe domain concepts, not implementation details. | ||
| * Include units in names when working with monetary values, time values, or measurements, such as amountInSatoshis, amountInWeis, amountInRBTC, timeoutMillis, and blockHeight. |
|
|
||
| * Code is read more often than written. Optimize for readability and maintainability. | ||
| * Use intention-revealing names. | ||
| * Include units in monetary and time-related names, such as amountInSatoshis, amountInWeis, amountInRBTC, and timeoutMillis. |
julia-zack
left a comment
There was a problem hiding this comment.
looking very good, left some minor suggestions
| * Eliminate duplication when practical. | ||
| * Prefer self-explanatory code over explanatory comments. | ||
| * Tests should be readable, independent, and cover boundary/error cases. | ||
| * AI-generated refactorings must improve clarity, maintainability, or correctness. Do not introduce abstractions, indirection, or code movement without a clear benefit. |
There was a problem hiding this comment.
| * AI-generated refactorings must improve clarity, maintainability, or correctness. Do not introduce abstractions, indirection, or code movement without a clear benefit. | |
| * Refactorings must improve clarity, maintainability, or correctness. Do not introduce abstractions, indirection, or code movement without a clear benefit. |
prob all refactors should follow this :)
| * Clarity is more important than cleverness. | ||
| * Avoid introducing unnecessary dependencies. | ||
| * Prefer boring, obvious code over surprising code. | ||
| * Code should look like it was written by someone who cared. |
| * Do not add journal-style comments describing historical changes. | ||
| * A useful comment should be accurate, clear, and maintained with the code. | ||
|
|
||
| ## Testing |
There was a problem hiding this comment.
wdyt about adding a "prefer TDD approach when possible" point?
There was a problem hiding this comment.
Not sure it can be detected in a PR if tests were written first or afterwards
There was a problem hiding this comment.
i guess only if tests are committed first. But nevermind, it'd make sense for a copilot coder eventually
| * Do not mix formatting-only changes with behavioral changes. | ||
| * If a cleanup would significantly obscure the purpose of a PR, perform it separately. | ||
| * AI-generated suggestions are not automatically improvements. Evaluate them critically. | ||
| * AI-generated refactorings must improve clarity, maintainability, or correctness. |
There was a problem hiding this comment.
same here
| * AI-generated refactorings must improve clarity, maintainability, or correctness. | |
| * Refactorings must improve clarity, maintainability, or correctness. |
julianlen
left a comment
There was a problem hiding this comment.
Great! Here are more instructions to consider
- Avoid having more than one unnecessary blank space.
- Never assign a constant to a variable
- Always leave one blank line at the end of every file.
- Remove anything that is not used: variables, functions, imports.
- Use functional style whenever possible, but avoid large-scale refactoring to functional code in a single PR.
- Keep consistency with the rest of the codebase whenever possible
Perhaps having a Codestyle section?
| * Avoid names that differ only in small or unclear ways. | ||
| * Prefer searchable names over overly short names. | ||
| * Prefer pronounceable names. | ||
| * Use one word for one concept and use it consistently. |
There was a problem hiding this comment.
also to keep consistency with what is already written
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
30d46b6 to
7e17ac5
Compare
|



This pull request introduces comprehensive documentation to guide contributors and reviewers working on the powpeg-node project. It adds a Copilot custom instructions file tailored to the repository and establishes a set of Rootstock-specific coding principles. These documents emphasize security, reviewability, and maintainability, especially in critical code paths.
The most important changes are:
Repository guidance and security practices:
.github/copilot-instructions.mdto provide Copilot and human contributors with detailed repository context, security-critical areas, PR review priorities, build/test commands, and sensitive areas requiring extra scrutiny.Coding and style standards:
docs/coding-principles.md, documenting Rootstock-specific coding principles for naming, functions, classes, abstractions, error handling, comments, and testing. These guidelines prioritize clarity, maintainability, and correctness, especially for blockchain and money-handling code.Testing and PR process: