Add path-specific Copilot instructions, code-reviewer agent, skill prompts, and setup workflow#33
Add path-specific Copilot instructions, code-reviewer agent, skill prompts, and setup workflow#33Copilot wants to merge 2 commits into
Conversation
…ilot setup workflow Co-authored-by: yortch <4576246+yortch@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Bootstraps a Copilot “context layer” for this repo by adding scoped instruction files, reusable agent prompt templates, and a dedicated code-review agent to enforce project conventions across backend/frontend/testing/Docker.
Changes:
- Added
applyTo-scoped instruction files under.github/instructions/for Java, JUnit tests, React, Docker, documentation, and code review. - Added reusable agent prompt files under
.github/prompts/for Spring Boot, JUnit, Javadoc, and PR code review. - Added a custom code-reviewer agent definition and a Copilot setup steps workflow/config.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/prompts/java-springboot.prompt.md | Adds Spring Boot best-practices prompt aligned to repo architecture (DTOs, circuit breaker, caching). |
| .github/prompts/java-junit.prompt.md | Adds JUnit 5 prompt covering AAA, slices, Mockito/WireMock, and naming conventions. |
| .github/prompts/java-docs.prompt.md | Adds Javadoc best-practices prompt and example. |
| .github/prompts/code-review.prompt.md | Adds reusable PR review prompt that delegates to scoped instruction files. |
| .github/instructions/react.instructions.md | Enforces React Query + MUI theme + directory conventions for frontend JS/JSX. |
| .github/instructions/java.instructions.md | Enforces backend Java standards (no wildcard imports, DTO boundaries, SLF4J, circuit breaker). |
| .github/instructions/java-testing.instructions.md | Enforces JUnit standards for backend tests (AAA, slices, naming, no wildcard imports). |
| .github/instructions/documentation.instructions.md | Enforces Javadoc coverage/format for backend main Java sources. |
| .github/instructions/docker.instructions.md | Enforces Docker best practices (multi-stage, pinned base images, non-root, healthchecks). |
| .github/instructions/code-review.instructions.md | Establishes review gate checklist (security, DTOs, circuit breaker, React Query, Docker). |
| .github/copilot-setup-steps.yml | Adds an environment provisioning workflow/config for backend/frontend dependencies. |
| .github/agents/code-reviewer.agent.md | Adds a dedicated code-review agent with severity-tiered checklist. |
| name: "Copilot Setup Steps" | ||
| on: workflow_dispatch | ||
|
|
||
| jobs: | ||
| copilot-setup: | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
.github/copilot-setup-steps.yml is written as a GitHub Actions workflow (on: workflow_dispatch, jobs:), but it’s not located under .github/workflows/, so GitHub will not load or allow dispatching it. Either move it to .github/workflows/ (and keep the workflow syntax), or (if this file is intended for Copilot coding-agent setup steps) switch it to the Copilot setup-steps file format and remove the Actions-specific on/jobs keys.
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' |
There was a problem hiding this comment.
The setup steps pin Node.js to 18, but the repo’s existing CI workflow (.github/workflows/deploy.yml) uses Node 20. To avoid “works in CI but not in Copilot setup” drift (or vice versa), align the Node version here with the version used by the main workflow.
| node-version: '18' | |
| node-version: '20' |
Bootstraps the repo's Copilot context layer with scoped instruction files, a code-review agent, reusable skill prompts sourced from
github/awesome-copilot, and a Copilot coding-agent setup workflow..github/instructions/— six newapplyTo-scoped filesapplyTojava.instructions.mdbackend/**/*.java@Transactional, BIAN via circuit breakerjava-testing.instructions.mdbackend/src/test/**/*.javamethodName_should_expectedBehavior_when_scenarionaming,@WebMvcTest/@DataJpaTestslices, WireMock for BIANreact.instructions.mdfrontend/src/**/*.{jsx,js}docker.instructions.mddocker/**HEALTHCHECK,threeriversbank/{backend|frontend}namingcode-review.instructions.md**System.outflagging, test coverage gatesdocumentation.instructions.mdbackend/src/main/**/*.javapublic/protectedmembers,@param/@return/@throws,{@code}for inline references.github/agents/code-reviewer.agent.mdNew specialist agent (
Claude Sonnet 4, tools:codebase,search,changes) with a tiered checklist:System.out, direct BIAN calls@Transactional, React Query usage, test slice selectionassertAll, theme color consistency.github/prompts/— four new prompt filesjava-springboot.prompt.md— Full Spring Boot best practices adapted fromawesome-copilot, extended with BIAN circuit-breaker and caching rulesjava-junit.prompt.md— JUnit 5 best practices with WireMock and test-slice guidancejava-docs.prompt.md— Javadoc best practices with a workedfindByIdexamplecode-review.prompt.md— Reusable review prompt that delegates to the instruction files above.github/copilot-setup-steps.ymlworkflow_dispatchworkflow that provisions the Copilot coding-agent environment: JDK 17 (Temurin) + Maven build (-DskipTests) + Node 18 +npm install.Original prompt
Goal
Initialize the
agentic-devops-demorepo to provide better context to GitHub Copilot. The repo already has.github/copilot-instructions.mdand several agents (coder, planner, orchestrator, designer, enterprise-architect). We need to add path-specific instruction files, a code-review custom agent, and relevant agent skills sourced from the awesome-copilot repo.Repo context
This is a full-stack Three Rivers Bank credit card comparison platform:
com.threeriversbank/{controller,service,repository,model/{entity,dto},client,config}Files to create
1. Path-specific instruction files in
.github/instructions/Per the guidance in https://github.blog/ai-and-ml/unlocking-the-full-power-of-copilot-code-review-master-your-instructions-files, instruction files work best with Copilot code reviews when they:
applyTofrontmatter with glob patterns to target specific file typesCreate the following instruction files:
a.
.github/instructions/java.instructions.mdInclude rules from the java-springboot skill adapted for this project:
import java.util.*). Always use explicit imports for each class. This is a hard rule from enterprise standards.private finalfields@Service,@Repository,@RestControllerstereotypes appropriately@Serviceclasses, keep controllers thin@Transactionalon service methodsapplication.ymlfor configuration,@ConfigurationPropertiesfor type-safe binding@Valid,@NotNull,@Size) on DTOs@ControllerAdviceb.
.github/instructions/java-testing.instructions.mdInclude rules from the java-junit skill:
methodName_should_expectedBehavior_when_scenario{Class}Test.java@WebMvcTestfor controller tests,@DataJpaTestfor repository tests@Mock,@InjectMocks)@DisplayNamefor readable test namesassertAllfor grouping related assertionsc.
.github/instructions/react.instructions.mdInclude:
frontend/src/theme.js/pages/, reusable components in/components/{cards,common,layout}d.
.github/instructions/docker.instructions.mdInclude:
:latestin production)threeriversbank/{backend|frontend}:lateste.
.github/instructions/code-review.instructions.mdThis file is specifically for Copilot Code Review. Per the blog post guidance, include:
This pull request was created from Copilot chat.
💡 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.