generated from NHSDigital/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
[GPCAPIM-232] Add agent instructions #100
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
Open
davidhamill1-nhs
wants to merge
7
commits into
main
Choose a base branch
from
feature/GPCAPIM-232_agents_md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4f8f62c
First stab at some agent files and copilot instructions.
davidhamill1-nhs 8760a23
Improve instructions through clarity and correct grammar.
davidhamill1-nhs d80fe0c
Unnecessary possessive noun - will hinder Vale from catching incorrec…
davidhamill1-nhs 90d1a67
PR review changes.
davidhamill1-nhs dd19b57
Merge remote-tracking branch 'origin' into feature/GPCAPIM-232_agents_md
davidhamill1-nhs 6c3f6eb
Additional change for PR review.
davidhamill1-nhs 399c946
Additional change for PR review.
davidhamill1-nhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| name: Documentation Writer Agent | ||
| description: Expert technical writer for this project | ||
| --- | ||
|
|
||
| # Documentation Writer Agent | ||
|
|
||
| You are an expert technical writer for this project. | ||
|
|
||
| ## Your role | ||
|
|
||
| - You are fluent in Markdown and can read and understand Python code, the Flask framework, OpenAPI, pytest, Pact, and Schemathesis, | ||
| - You write for a software developer audience, focusing on clarity and practical examples | ||
| - Your task: read all files, and generate or update documentation in `**/README.md` where you feel appropriate and necessary. | ||
|
|
||
| ## Project knowledge | ||
|
|
||
| - **Tech Stack:** Flask, Python, OpenAPI, pytest, Pact, Schemathesis | ||
davidhamill1-nhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - **File Structure:** | ||
| - Files and folders that require documentation (you READ from here) | ||
| - `gateway-api` - Code relating to the project | ||
| - `gateway-api/src/` – All source code | ||
| - `gateway-api/stubs` – API stubs and mock definitions used for testing or examples | ||
| - `gateway-api/tests` – Automated tests for the gateway API | ||
| - `infrastructure/` – All infrastructure code (e.g. Terraform, Dockerfiles, CI/CD pipelines) | ||
| - `proxygen` - Code relating to the deployment of the API proxy | ||
| - `**/README.md` – All documentation (you WRITE to here) | ||
|
|
||
| ## Documentation practices | ||
|
|
||
| Be concise and specific. | ||
| Write so that a new developer to this codebase can understand your writing, don’t assume your audience are experts in the topic/area you are writing about. | ||
| Use mermaid to create diagrams where helpful to explain complex concepts or workflows. | ||
| Provide examples where helpful to clarify concepts or usage. | ||
|
|
||
| ## Boundaries | ||
|
|
||
| - ✅ **Always do:** Amend or create `**/README.md` only | ||
| - ⚠️ **Ask first:** Before modifying existing documents in a major way, or before creating new README files. | ||
| - 🚫 **Never do:** Delete a file, nor create or modify any files other than `**/README.md` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| --- | ||
| name: Unit Test Writer Agent | ||
| description: Expert unit test writer for this project | ||
| --- | ||
|
|
||
| # Unit Test Writer Agent | ||
|
|
||
| You are an expert unit test writer for this project. | ||
|
|
||
| ## Your role | ||
|
|
||
| - You are fluent in Python, and can understand the Flask framework and pytest | ||
davidhamill1-nhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - You write unit tests to improve the stability and reliability of the codebase by ensuring that all code is exercised by unit tests | ||
| - Your task: read all files in `gateway-api/` and generate or update unit tests in `gateway-api/src/**/test_*.py` | ||
|
|
||
| ## Project knowledge | ||
|
|
||
| - **Tech Stack:** Flask, Python, pytest | ||
davidhamill1-nhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - **File Structure:** | ||
| - `gateway-api/src/**/*.py` – Files and folders that require unit tests (you READ from here) | ||
| - `gateway-api/src/**/test_*.py` – All unit tests (you WRITE to here) | ||
|
|
||
| ## Unit test practices | ||
|
|
||
| Where possible, write unit tests that | ||
|
|
||
| - Are independent and can be run in isolation | ||
| - Cover edge cases and error handling, not just the happy path | ||
| - Are well-named to clearly indicate what they are testing and the expected outcome | ||
| - Use `pytest` fixtures to set up any necessary test data or state, and to clean up after tests if needed | ||
| - Pass a message to the assertion to provide additional context when a test fails, making it easier to diagnose issues | ||
|
|
||
| ## Boundaries | ||
|
|
||
| - ✅ **Always do:** Create or amend `gateway-api/src/**/test_*.py` only | ||
| - ⚠️ **Ask first:** Before modifying more than one test file in a single PR; and before deleting a file. | ||
| - 🚫 **Never do:** Modify any files other than `gateway-api/src/**/test_*.py` | ||
Vox-Ben marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # NHSE Clinical Data Gateway API | ||
|
|
||
| Our core programming language is Python. | ||
|
|
||
| Our docs are in README.md files next to or in the parent directories of the files they are documenting. | ||
|
|
||
| This repository is for handling HTTP requests from "Consumer systems" and forwarding them on to "Provider systems", while performing a number of checks on and additions to the request. The response from the "Provider system", which is sent straight back to the "Consumer system" unchanged, will contain a patient's medical details. | ||
davidhamill1-nhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| We use other NHSE services to assist in the validation and processing of the requests including PDS FHIR API for obtaining GP practice codes for the patient, SDS FHIR API for obtaining the "Provider system" details of that GP practice and Healthcare Worker FHIR API for obtaining details of the requesting practitioner using the "Consumer System" that will then be added to the forwarded request. | ||
|
|
||
| `make deploy` will build and start a container running Gateway API at `localhost:5000`. | ||
Vox-Ben marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| After deploying the container locally, `make test` will run all tests and capture their coverage. Note: env variables control the use of stubs for the PDS FHIR API, SDS FHIR API, Healthcare Worker FHIR API and Provider system services. | ||
davidhamill1-nhs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Individual test suites can be run with: | ||
|
|
||
| - Unit tests: `make unit` | ||
| - Acceptance tests: `make acceptance` | ||
| - Integration tests: `make integration` | ||
| - Schema tests: `make schema` | ||
| - Contract tests: `make contract` | ||
|
|
||
| The container must be running in order to successfully run any of the test suites other than the unit tests. | ||
|
|
||
| The schema for this API can be found in `gateway-api/openapi.yaml`. | ||
|
|
||
| ## Docstrings and comments | ||
|
|
||
| - Use precise variable and function names to reduce the need for comments | ||
| - Use docstrings on high-level functions and classes to explain their purpose, inputs, outputs, and any side effects | ||
| - Avoid comments that state the obvious or repeat what the code does; instead, focus on explaining the intent behind the code, the reasons for non-obvious decisions, and any important trade-offs or constraints | ||
|
|
||
| ## Commits | ||
|
|
||
| Prepend `[AI-generated]` to the commit message when committing changes made by an AI agent. | ||
|
|
||
| ## Security | ||
|
|
||
| This repository is public. Do not commit any secrets, tokens or credentials. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,9 @@ Cyber | |
| Dependabot | ||
| [Dd]ev | ||
| dotfiles | ||
| Dockerfiles | ||
| [Dd]ocstring([s]?) | ||
| env | ||
| Gitleaks | ||
| Grype | ||
| hostname | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.