From de6ceb0534e2c99fd70341d553eb4a9cf599fa29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 7 Oct 2025 17:03:44 +0200 Subject: [PATCH] chore: refine github copilot instructions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .github/copilot-instructions.md | 54 ++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 45a49ae08..3db53ec2a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -7,6 +7,31 @@ These instructions guide GitHub Copilot to generate changes consistent with this - **Tunables**: user-adjustable parameters that shape behavior, exposed via options or configuration files. - **Canonical defaults**: the single, authoritative definition of all tunables and their defaults. +## Implementation guidance for Copilot + +- **Before coding**: + - Perform a comprehensive inventory of the codebase. Search for and read: + - README.md, CONTRIBUTING.md, and all other documentation files. + - code files related to the task. + - Identify existing code architecture, design patterns, canonical defaults, naming patterns and coding styles. +- **When coding**: + - Follow the core principles and TypeScript/Node.js conventions below. + - Follow identified design patterns, naming patterns and coding styles. + - Write minimal, verifiable changes that preserve existing behavior when possible. +- **After coding**: + - Ensure changes pass quality gates below. +- **When adding a tunable**: + - Add to canonical defaults with safe value. + - Ensure the options and configuration section below is respected. + - Update documentation and serialization. +- **When implementing analytical methods**: + - Follow statistical conventions below. +- **When refactoring**: + - Keep APIs stable; provide aliases if renaming. + - Update code, tests, and documentation atomically. +- **When documenting**: + - Follow documentation conventions below. + ## Core principles - **Design patterns**: prefer established patterns (e.g., factory, singleton, strategy) for code organization and extensibility. @@ -65,34 +90,13 @@ Documentation serves as an operational specification, not narrative prose. - **Promise patterns**: Return Promises from async operations; store resolvers/rejectors in Maps for request/response flows. - **Immutability**: Avoid mutating shared state; clone objects before modification when needed. -## Implementation guidance for Copilot - -- **Before coding**: - - Locate and analyze thoroughly existing relevant code. - - Identify existing code architecture, design patterns, canonical defaults, naming patterns and coding styles. -- **When coding**: - - Follow identified design patterns, naming patterns and coding styles. - - Prioritize algorithmic efficiency. - - Write minimal, verifiable changes that preserve existing behavior when possible. - - Follow TypeScript/Node.js conventions above. -- **When adding a tunable**: - - Add to canonical defaults with safe value. - - Update documentation and serialization. -- **When implementing analytical methods**: - - Follow statistical conventions above. -- **When refactoring**: - - Keep APIs stable; provide aliases if renaming. - - Update code, tests, and documentations atomically. -- **When documenting**: - - Follow documentation conventions above. - ## Quality gates -- Build/lint/type checks pass (where applicable). -- Tests pass (where applicable). -- Documentation updated to reflect changes. +- Documented build/lint/type checks pass (where applicable). +- Documented tests pass (where applicable). +- Documentation updated to reflect changes when necessary. - Logs use appropriate levels (error, warn, info, debug). -- PR title and commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) format. +- Pull request title and commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) format. ## Examples -- 2.43.0