Skip to content

Commit 27ccce1

Browse files
committed
Adds Copilot instructions and coding guidelines
Introduces instructions for the Copilot AI coding agent, providing guidelines for code style, testing, security, and development workflows. This ensures consistent, high-quality contributions and adherence to best practices throughout the project.
1 parent fd6ebb0 commit 27ccce1

File tree

4 files changed

+139
-1
lines changed

4 files changed

+139
-1
lines changed

.github/copilot-instructions.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Copilot AI Coding Agent Instructions for Foundatio.RabbitMQ
2+
3+
## Key Principles
4+
5+
All contributions must respect existing formatting and conventions specified in the `.editorconfig` file. You are a distinguished engineer and are expected to deliver high-quality code that adheres to the guidelines in the instruction files.
6+
7+
Let's keep pushing for clarity, usability, and excellence—both in code and user experience.
8+
9+
**See also:**
10+
- [General Coding Guidelines](instructions/general.instructions.md)
11+
- [Testing Guidelines](instructions/testing.instructions.md)
12+
13+
## Key Directories & Files
14+
- `src/Exceptionless.DateTimeExtensions/` — Main library code for DateTime extensions.
15+
- `tests/Exceptionless.DateTimeExtensions.Tests/` — Unit and integration tests for DateTime extension features.
16+
- `build/` — Shared build props, strong naming key, and assets.
17+
- `Exceptionless.DateTimeExtensions.slnx` — Solution file for development.
18+
19+
## Developer Workflows
20+
- **Build:** Use the VS Code task `build` or run `dotnet build` at the repo root.
21+
- **Test:** Use the VS Code task `test` or run `dotnet test tests/Exceptionless.DateTimeExtensions.Tests`.
22+
23+
## References & Further Reading
24+
- [README.md](../README.md) — Full documentation.
25+
26+
---
27+
28+
**If you are unsure about a pattern or workflow, check the README or look for similar patterns in the `src/` and `tests/` folders.**
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
description: "General coding guidelines"
3+
applyTo: "**"
4+
---
5+
6+
# General Coding Guidelines
7+
8+
You are a distinguished engineer and are expected to deliver high-quality code that adheres to the guidelines below.
9+
All contributions must respect existing formatting and conventions specified in the `.editorconfig` file and
10+
Microsoft's [coding conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions).
11+
12+
Code can be formatted with `dotnet format` and checked for errors with `dotnet build`.
13+
14+
Use context7 for documentation
15+
16+
## Code Style & Minimal Diffs
17+
18+
- Match the file's existing style; use `.editorconfig` when unsure.
19+
- Preserve extra spaces, comments, and minimize diffs.
20+
- Always ask before creating new files, directories, or changing existing structures.
21+
- Always look at existing usages before refactoring or changing code to prevent new code from breaking existing code.
22+
- Assume any existing uncommitted code is correct and ask before changing it.
23+
- Don't add code comments unless necessary. Code should be self-explanatory.
24+
- Don't use deprecated or insecure libraries, algorithms or features.
25+
26+
## Modern Code Practices
27+
28+
- Write complete, runnable code—no placeholders or TODOs.
29+
- Use modern language features, clear naming conventions, and defensive coding when necessary.
30+
- Follow SOLID, DRY, and clean code principles. Remove unused code.
31+
32+
## Behavior Management
33+
34+
- Flag any user-visible changes for review.
35+
- Deliver exactly what's requested—avoid adding unnecessary features unless explicitly instructed.
36+
37+
## Security Guidelines
38+
39+
- Sanitize all user inputs and rigorously validate data.
40+
- Follow OWASP guidelines and implement a robust Content Security Policy.
41+
- Adopt Shift-Left security practices to identify vulnerabilities early.
42+
43+
## Developer Planning & Reflection
44+
45+
### Pre-Coding Reflection
46+
47+
1. Identify the problem or feature you're solving.
48+
2. Consider three possible approaches.
49+
3. Choose the simplest approach that satisfies all requirements.
50+
4. Clarify:
51+
- Can the solution be modularized into smaller functions?
52+
- Are there unnecessary abstractions?
53+
- Will the implementation be clear to a junior developer?
54+
55+
### Post-Coding Reflection
56+
57+
1. Review for refactor opportunities—can clarity or maintainability be improved?
58+
2. Identify potential edge cases or areas prone to bugs.
59+
3. Verify robust error handling and validation mechanisms.
60+
61+
## Code Reviews
62+
63+
- Ensure adherence to complexity, consistency, and clean code standards.
64+
- Validate robust error handling and defensive coding practices.
65+
- Check for duplication and maintainable solutions.
66+
67+
## Debugging Guidelines
68+
69+
1. **Reproduce** the issue with minimal steps and code.
70+
2. **Understand** the underlying problem thoroughly.
71+
3. **Form Hypotheses** about the cause.
72+
4. **Test & Verify** potential solutions.
73+
5. **Document** fixes and adjustments clearly for future reference.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
description: "C# testing guidelines"
3+
applyTo: "tests/**/*.cs"
4+
---
5+
6+
# Testing Guidelines (C#)
7+
8+
## Framework & Best Practices
9+
10+
- Follow Microsoft's [unit testing best practices](https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices).
11+
- Use xUnit as the primary testing framework.
12+
13+
## Test Principles
14+
15+
- **Fast & Isolated**: Tests should execute quickly and not depend on external factors or the order of execution.
16+
- **Repeatable & Self-Checking**: Tests must be consistent and validate their own outcomes without manual checks.
17+
- **Timely**: Write tests alongside your code to ensure relevance and improve design.
18+
19+
## Test Structure & Naming
20+
21+
- Write complete, runnable tests—no placeholders or TODOs.
22+
- Use clear, descriptive naming conventions for test methods:
23+
- `MethodName_StateUnderTest_ExpectedBehavior`
24+
- Follow AAA pattern (Arrange, Act, Assert).
25+
26+
## Test Organization
27+
28+
- Use `[Theory]` and `[InlineData]` for parameterized tests.
29+
- Implement proper setup and teardown using constructors and `IDisposable`.
30+
- Tests are organized to mirror the main code structure (e.g., `FormatParsers/` in both `src` and `tests`).
31+
32+
## Integration Testing
33+
34+
- Inject `ITestOutputHelper` into the test class constructor to get access to the test output.
35+
- Isolate dependencies using test containers, in-memory providers, or stubs to ensure reliable test execution.
36+
- Verify data persistence and side effects.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Exceptionless.DateTimeExtensions
2+
23
[![Build status](https://github.com/Exceptionless/Exceptionless.DateTimeExtensions/workflows/Build/badge.svg)](https://github.com/Exceptionless/Exceptionless.DateTimeExtensions/actions)
3-
[![NuGet Version](http://img.shields.io/nuget/v/Exceptionless.DateTimeExtensions.svg?style=flat)](https://www.nuget.org/packages/Exceptionless.DateTimeExtensions/)
4+
[![NuGet Version](http://img.shields.io/nuget/v/Exceptionless.DateTimeExtensions.svg?style=flat)](https://www.nuget.org/packages/Exceptionless.DateTimeExtensions/)
45
[![Discord](https://img.shields.io/discord/715744504891703319)](https://discord.gg/6HxgFCx)
56
[![Donate](https://img.shields.io/badge/donorbox-donate-blue.svg)](https://donorbox.org/exceptionless?recurring=true)
67

0 commit comments

Comments
 (0)