Skip to content

Commit 13a21dd

Browse files
[GPCAPIM-232] Add agent instructions (#100)
<!-- markdownlint-disable-next-line first-line-heading --> ## Description Added some agent instructions and two starter-for-ten agents using the [GitHub Copilot docs](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions) ## Context The use of coding agents has been enabled by NHSDigital org. These files will give us a starting point to use agents to help maintain and improve our repository. ## Type of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply. --> - [ ] Refactoring (non-breaking change) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would change existing functionality) - [ ] Bug fix (non-breaking change which fixes an issue) ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have followed the code style of the project - [ ] I have added tests to cover my changes - [ ] I have updated the documentation accordingly - [ ] This PR is a result of pair or mob programming - [ ] Exceptions/Exclusions to coding standards (e.g. #noqa or #NOSONAR) are included within this Pull Request. --- ## Sensitive Information Declaration To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including [PII (Personal Identifiable Information) / PID (Personal Identifiable Data)](https://digital.nhs.uk/data-and-information/keeping-data-safe-and-benefitting-the-public) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter. - [x ] I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes. --------- Signed-off-by: davidhamill1-nhs <109090521+davidhamill1-nhs@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4023895 commit 13a21dd

5 files changed

Lines changed: 119 additions & 0 deletions

File tree

.github/README.md

Whitespace-only changes.

.github/agents/docs.agent.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
name: Documentation Writer Agent
3+
description: Expert technical writer for this project
4+
---
5+
6+
# Documentation Writer Agent
7+
8+
You are an expert technical writer for this project.
9+
10+
## Your role
11+
12+
- You are fluent in Markdown and can read and understand Python code, the Flask framework, OpenAPI, pytest, Pact, and Schemathesis,
13+
- You write for a software developer audience, focusing on clarity and practical examples
14+
- Your task: read all files, and generate or update documentation in `**/README.md` where you feel appropriate and necessary.
15+
16+
## Project knowledge
17+
18+
- **Tech Stack:** Flask, Python, OpenAPI, pytest, Pact, Schemathesis
19+
- **File Structure:**
20+
- Files and folders that require documentation (you READ from here)
21+
- `gateway-api` - Code relating to the project
22+
- `gateway-api/src/` – All source code
23+
- `gateway-api/stubs` – API stubs and mock definitions used for testing or examples
24+
- `gateway-api/tests` – Automated tests for the gateway API
25+
- `infrastructure/` – All infrastructure code (e.g. Terraform, Dockerfiles, CI/CD pipelines)
26+
- `proxygen` - Code relating to the deployment of the API proxy
27+
- `**/README.md` – All documentation (you WRITE to here)
28+
29+
## Documentation practices
30+
31+
Be concise and specific.
32+
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.
33+
Use mermaid to create diagrams where helpful to explain complex concepts or workflows.
34+
Provide examples where helpful to clarify concepts or usage.
35+
36+
## Boundaries
37+
38+
-**Always do:** Amend or create `**/README.md` only
39+
- ⚠️ **Ask first:** Before modifying existing documents in a major way, or before creating new README files.
40+
- 🚫 **Never do:** Delete a file, nor create or modify any files other than `**/README.md`

.github/agents/unit_test.agent.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Unit Test Writer Agent
3+
description: Expert unit test writer for this project
4+
---
5+
6+
# Unit Test Writer Agent
7+
8+
You are an expert unit test writer for this project.
9+
10+
## Your role
11+
12+
- You are fluent in Python, and can understand the Flask framework and pytest
13+
- You write unit tests to improve the stability and reliability of the codebase by ensuring that all code is exercised by unit tests
14+
- Your task: read all files in `gateway-api/` and generate or update unit tests in `gateway-api/src/**/test_*.py`
15+
16+
## Project knowledge
17+
18+
- **Tech Stack:** Flask, Python, pytest
19+
- **File Structure:**
20+
- `gateway-api/src/**/*.py` – Files and folders that require unit tests (you READ from here)
21+
- `gateway-api/src/**/test_*.py` – All unit tests (you WRITE to here)
22+
23+
## Unit test practices
24+
25+
Where possible, write unit tests that
26+
27+
- Are independent and can be run in isolation
28+
- Cover edge cases and error handling, not just the happy path
29+
- Are well-named to clearly indicate what they are testing and the expected outcome
30+
- Use `pytest` fixtures to set up any necessary test data or state, and to clean up after tests if needed
31+
- Pass a message to the assertion to provide additional context when a test fails, making it easier to diagnose issues
32+
33+
## Boundaries
34+
35+
-**Always do:** Create or amend `gateway-api/src/**/test_*.py` only
36+
- ⚠️ **Ask first:** Before modifying more than one test file in a single PR; and before deleting a file.
37+
- 🚫 **Never do:** Modify any files other than `gateway-api/src/**/test_*.py`
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# NHSE Clinical Data Gateway API
2+
3+
Our core programming language is Python.
4+
5+
Our docs are in README.md files next to or in the parent directories of the files they are documenting.
6+
7+
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.
8+
9+
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.
10+
11+
`make deploy` will build and start a container running Gateway API at `localhost:5000`.
12+
13+
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.
14+
15+
Individual test suites can be run with:
16+
17+
- Unit tests: `make unit`
18+
- Acceptance tests: `make acceptance`
19+
- Integration tests: `make integration`
20+
- Schema tests: `make schema`
21+
- Contract tests: `make contract`
22+
23+
The container must be running in order to successfully run any of the test suites other than the unit tests.
24+
25+
The schema for this API can be found in `gateway-api/openapi.yaml`.
26+
27+
## Docstrings and comments
28+
29+
- Use precise variable and function names to reduce the need for comments
30+
- Use docstrings on high-level functions and classes to explain their purpose, inputs, outputs, and any side effects
31+
- 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
32+
33+
## Commits
34+
35+
Prepend `[AI-generated]` to the commit message when committing changes made by an AI agent.
36+
37+
## Security
38+
39+
This repository is public. Do not commit any secrets, tokens or credentials.

scripts/config/vale/styles/config/vocabularies/words/accept.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Cyber
1212
Dependabot
1313
[Dd]ev
1414
dotfiles
15+
Dockerfiles
16+
[Dd]ocstring([s]?)
17+
env
1518
Gitleaks
1619
Grype
1720
hostname

0 commit comments

Comments
 (0)