Skip to content

Add copilot custom instructions#591

Merged
marcos-iov merged 3 commits into
masterfrom
copilot-instructions
Jun 5, 2026
Merged

Add copilot custom instructions#591
marcos-iov merged 3 commits into
masterfrom
copilot-instructions

Conversation

@marcos-iov

Copy link
Copy Markdown
Collaborator

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:

  • Added .github/copilot-instructions.md to provide Copilot and human contributors with detailed repository context, security-critical areas, PR review priorities, build/test commands, and sensitive areas requiring extra scrutiny.
  • Defined strict rules for handling secrets, configuration, and behavioral changes in security-sensitive code, with clear instructions for reviewers and contributors.

Coding and style standards:

  • Added 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.
  • Provided Java-specific style guidance, including naming conventions, use of enums, constructor injection, and handling of nullable values.

Testing and PR process:

  • Established clear expectations for test coverage, test isolation, and CI workflows, including which files and behaviors require extra tests and scrutiny. [1] [2]

Copilot AI review requested due to automatic review settings June 4, 2026 16:25
@marcos-iov marcos-iov requested a review from a team as a code owner June 4, 2026 16:25
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md with Rootstock-oriented coding, testing, and refactoring guidelines.
  • Added .github/copilot-instructions.md with 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.

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread docs/coding-principles.md Outdated
Copilot AI review requested due to automatic review settings June 4, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread docs/coding-principles.md Outdated
* 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.
Comment thread .github/copilot-instructions.md Outdated

* 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 julia-zack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking very good, left some minor suggestions

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md
Comment thread .github/copilot-instructions.md Outdated
* 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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 :)

Comment thread .github/copilot-instructions.md
Comment thread .github/copilot-instructions.md
Comment thread docs/coding-principles.md
* 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Comment thread docs/coding-principles.md
Comment thread docs/coding-principles.md
Comment thread docs/coding-principles.md
* Do not add journal-style comments describing historical changes.
* A useful comment should be accurate, clear, and maintained with the code.

## Testing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt about adding a "prefer TDD approach when possible" point?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure it can be detected in a PR if tests were written first or afterwards

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess only if tests are committed first. But nevermind, it'd make sense for a copilot coder eventually

Comment thread docs/coding-principles.md Outdated
* 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Suggested change
* AI-generated refactorings must improve clarity, maintainability, or correctness.
* Refactorings must improve clarity, maintainability, or correctness.

@julianlen julianlen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread .github/copilot-instructions.md
Comment thread docs/coding-principles.md
Comment thread docs/coding-principles.md
* 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also to keep consistency with what is already written

Comment thread docs/coding-principles.md
Comment thread docs/coding-principles.md
marcos-iov and others added 3 commits June 5, 2026 11:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@marcos-iov marcos-iov force-pushed the copilot-instructions branch from 30d46b6 to 7e17ac5 Compare June 5, 2026 14:43
@sonarqubecloud

sonarqubecloud Bot commented Jun 5, 2026

Copy link
Copy Markdown

@julianlen julianlen self-requested a review June 5, 2026 14:54
@marcos-iov marcos-iov merged commit 04f42c1 into master Jun 5, 2026
11 checks passed
@marcos-iov marcos-iov deleted the copilot-instructions branch June 5, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants