durabletask-dotnet
Copilot instructions193 starsChanged 8 months agoMITView on GitHub
This repository contains C# code. The purpose of this code is to provide a standalone SDK that can be used to interact with the Durable Task coding paradigm, both through Azure Functions (Durable Functions) and non-function based Durable Task Scheduler (DTS). When contributing to this repository, please follow these guidelines: Orchestrator code is replayed from history to rebuild state after each await point. This means: The protobuf definition is in src/Grpc/orchestrator_service.proto. C# stubs are generated at build time by Grpc.Tools…
In this repositoryOne other file it gives its agents.
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
22 rules. About 0 are common, 18 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈18
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
When contributing to this repository, please follow these guidelines:
- Distinctive: line 14
Do not add I/O, network calls, or file system access inside orchestrator logic.
- Very specific: line 15
If changing TaskOrchestrationContext, FuncTaskOrchestrator, or any type under src/Abstractions/ that orchestrators call directly, verify …
- Very specific: line 25
Run src/Grpc/refresh-protos.ps1 to pull the latest proto version from upstream.
- Distinctive: line 26
Before renaming any file path referenced in another file, confirm the full impact with the user — do not assume file locations without …
- Distinctive: line 37
All public methods and classes should have XML documentation comments.
- Distinctive: line 38
No change should introduce a breaking change unless an exception is otherwise noted in the PR Summary, linked github issue, or discussion.
- Very specific: line 40
Use this. for accessing class members.
- Distinctive: line 41
Use the Async suffix on the name of all async methods.
- Distinctive: line 42
Ensure that all private classes, that do not serve as base classes, are sealed.
- Distinctive: line 48
When adding a new sample, follow these steps:
- Very specific: line 68
Prefer inline literals over constants for values that are not reused.
- Distinctive: line 69
Prefer defining variables using types rather than var, to help users understand the types involved.
- Distinctive: line 70
Follow the patterns in the samples in the same directories where new samples are being added.
- Distinctive: line 72
Add a comment describing what the sample is demonstrating.
- Distinctive: line 83
Add Arrange, Act and Assert comments for each
- Distinctive: line 84
Use the Moq library for mocking objects where possible.
- Distinctive: line 86
Avoid adding excessive comments to tests.
- Distinctive: line 87
Follow the patterns in the unit tests in the same project or classes to which new tests are being added.
- Distinctive: line 91
When reviewing code, follow these guidelines:
- Distinctive: line 94
Do not generate false-positive or already-resolved comments when new commits are pushed.
- Distinctive: line 95
Do not re-post a review comment if a user has directly responded to it with justification for why the code exists as written.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Copilot Instructions
This repository contains C# code.
The purpose of this code is to provide a standalone SDK that can be used to interact with the Durable Task coding paradigm, both through Azure Functions (Durable Functions) and non-function based Durable Task Scheduler (DTS).
When contributing to this repository, please follow these guidelines:
Replay Determinism — Critical Invariant
Orchestrator code is replayed from history to rebuild state after each await point. This means:
- Orchestrator methods must be fully deterministic: never call
DateTime.Now,Guid.NewGuid(),Random, or any non-deterministic API directly inside an orchestrator. Usecontext.CurrentUtcDateTimeandcontext.NewGuid()instead. - Do not add I/O, network calls, or file system access inside orchestrator logic. These belong in activities.
- If changing
TaskOrchestrationContext,FuncTaskOrchestrator, or any type undersrc/Abstractions/that orchestrators call directly, verify the change does not break replay of existing history. - Source generator output in
src/Generators/implements the abstract orchestrator/activity interfaces — any change to those interfaces must be reflected consistently in the generator output (see// IMPORTANTcomments inTaskActivityContext.csandTypeExtensions.cs).
gRPC / Protobuf Layer
The protobuf definition is in src/Grpc/orchestrator_service.proto. C# stubs are generated at build time by Grpc.Tools and are not committed to source.
- Preserve all existing field numbers in the proto — removing or renumbering a field breaks wire compatibility with in-flight orchestrations.
- Adding new optional fields is backward-compatible. Adding fields that the SDK or sidecar treats as required, adding fields without safe defaults, or changing existing field types is not.
- Changing default serialization options in
JsonDataConverter.cscould potentially be breaking for in-flight orchestrations (see// WARNINGcomment there). - Run
src/Grpc/refresh-protos.ps1to pull the latest proto version from upstream. - Before renaming any file path referenced in another file, confirm the full impact with the user — do not assume file locations without verification.
C# Code Guidelines
Here are some general guidelines that apply to all code.
- The top of all *.cs files should have a copyright notice:
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. - All public methods and classes should have XML documentation comments.
- No change should introduce a breaking change unless an exception is otherwise noted in the PR Summary, linked github issue, or discussion.
- Breaking change reference: https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/breaking-change-rules.md
- Use
this.for accessing class members. - Use the Async suffix on the name of all async methods.
- Ensure that all private classes, that do not serve as base classes, are sealed.
C# Sample Code Guidelines
Sample code is located in the samples directory.
When adding a new sample, follow these steps:
- The sample should be a standalone .NET project in one of the subdirectories of the samples directory.
- The directory name should be the same as the project name.
- The directory should contain a README.md file that explains what the sample does and how to run it.
- The README.md file should follow the same format as other samples.
- The csproj file should match the directory name.
- The csproj file should be configured in the same way as other samples.
- The project should preferably contain a single Program.cs file that contains all the sample code.
- The sample should be added to the solution file in the samples directory.
- The sample should be tested to ensure it works as expected.
- A reference to the new sample should be added to the README.md file in the parent directory of the new sample.
The sample code should follow these guidelines:
- Configuration settings should be read from environment variables, e.g.
var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set.");. - Environment variables should use upper snake_case naming convention.
- Secrets should not be hardcoded in the code or committed to the repository.
- The code should be well-documented with comments explaining the purpose of each step.
- The code should be simple and to the point, avoiding unnecessary complexity.
- Prefer inline literals over constants for values that are not reused. For example, use
new ChatClientAgent(chatClient, instructions: "You are a helpful assistant.")instead of defining a constant for "instructions". - Prefer defining variables using types rather than var, to help users understand the types involved.
- Follow the patterns in the samples in the same directories where new samples are being added.
- The structure of the sample should be as follows:
- Add a comment describing what the sample is demonstrating.
- Then add the necessary using statements.
- Then add the main code logic.
- Finally, add any helper methods or classes at the bottom of the file.
C# Unit Test Guidelines
Unit tests are located in the test root directory in projects with a .Tests.csproj suffix.
Unit tests should follow these guidelines:
- Add Arrange, Act and Assert comments for each
- Use the Moq library for mocking objects where possible.
- Validate that each test actually tests the target behavior, e.g. we should not have tests that create a mock, call the mock and then verify that the mock was called, without the target code being involved. We also shouldn't have tests that test language features, e.g. something that the compiler would catch anyway.
- Avoid adding excessive comments to tests. Instead favor clear easy to understand code.
- Follow the patterns in the unit tests in the same project or classes to which new tests are being added.
Code Review Guidelines
When reviewing code, follow these guidelines:
- Provide all review comments in a single review pass. Avoid scattering feedback across multiple partial reviews; consolidate findings into one coherent review round.
- Do not generate false-positive or already-resolved comments when new commits are pushed. Only surface issues that still apply after the latest changes, and avoid re-posting comments that have been addressed or are no longer relevant.
- Do not re-post a review comment if a user has directly responded to it with justification for why the code exists as written. Respect user explanations and avoid redundant feedback on justified code decisions.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

