diff --git a/docs/README.instructions.md b/docs/README.instructions.md index a2767af2..4c096365 100644 --- a/docs/README.instructions.md +++ b/docs/README.instructions.md @@ -8,9 +8,10 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for - Download the `*.instructions.md` file and manually add it to your project's instruction collection **To Use/Apply:** -- Copy these instructions to your `.github/copilot-instructions.md` file in your workspace -- Create task-specific `.github/.instructions.md` files in your workspace's `.github/instructions` folder +- Copy these instructions to your `.github/copilot-instructions.md` or `AGENTS.md` file in your workspace, or +- Create task-specific `*.instructions.md` files in your workspace's `.github/instructions/` folder - Instructions automatically apply to Copilot behavior once installed in your workspace +- You can reference task specific instructions (for one-off migrations) in the prompt | Title | Description | | ----- | ----------- | diff --git a/instructions/java.instructions.md b/instructions/java.instructions.md index 7a4258e1..041e88f7 100644 --- a/instructions/java.instructions.md +++ b/instructions/java.instructions.md @@ -26,6 +26,7 @@ applyTo: '**/*.java' - Enable SpotBugs, PMD, or Checkstyle as CI fallbacks. - Open a short tracker issue documenting the blocker and next steps. - If the user declines static analysis tools or wants to proceed without them, continue with implementing the Best practices, bug patterns and code smell prevention guidelines outlined below. +- Check the README.md and the project build instructions (`pom.xml` or `build.gradle`) for the Java release to use for source constructs as well as testing frameworks to use. - Address code smells proactively during development rather than accumulating technical debt. - Focus on readability, maintainability, and performance when refactoring identified issues. - Use IDE / Code editor reported warnings and suggestions to catch common patterns early in development. @@ -68,7 +69,7 @@ These patterns are phrased for humans; they map cleanly to checks in Sonar, Spot - Method size — Keep methods focused and small. Extract helper methods to improve readability and testability. - Cognitive complexity — Reduce nested conditionals and heavy branching by extracting methods, using polymorphism, or applying the Strategy pattern. - Duplicated literals — Extract repeated strings and numbers into named constants or enums to reduce errors and ease changes. -- Dead code — Remove unused variables and assignments. They confuse readers and can hide bugs. +- Dead code — Remove unused variables, imports and assignments. They confuse readers and can hide bugs. - Magic numbers — Replace numeric literals with named constants that explain intent (e.g., MAX_RETRIES). If you run a static analyzer like Sonar or SonarLint — direct Sonar connections are preferred and should override this ruleset. Sonar rule keys are useful for automation and suppression, but they are not required in day-to-day developer guidance. @@ -76,6 +77,7 @@ If you run a static analyzer like Sonar or SonarLint — direct Sonar connection ## Build and Verification - After adding or modifying code, verify the project continues to build successfully. -- If the project uses Maven, run `mvn clean install`. +- Suggest new unit tests for added functionality to maintain high coverage. +- If the project uses Maven, run `mvn clean verify`. - If the project uses Gradle, run `./gradlew build` (or `gradlew.bat build` on Windows). - Ensure all tests pass as part of the build.