- .NET SDK 10.0+ (required by
global.json; multi-targetsnet8.0;net9.0;net10.0)
-
Dual-Mode - Changes to core engine metadata collection MUST work in both source-gen (
TUnit.Core.SourceGenerator) AND reflection (TUnit.Engine) modes. -
Snapshot Testing - Changes to source generator output or public APIs require running snapshot tests. Commit
.verified.txtfiles. NEVER commit.received.txt. -
No VSTest - Use
Microsoft.Testing.Platformonly. NEVER useMicrosoft.VisualStudio.TestPlatform. -
Performance First - Minimize allocations in hot paths. Cache reflection. Use
ValueTaskfor potentially-sync operations. -
AOT Compatible - All code must work with Native AOT. Annotate reflection with
[DynamicallyAccessedMembers].
See .claude/docs/mandatory-rules.md for full details.
NEVER run TUnit.TestProject without filters. Many tests are designed to fail.
cd TUnit.TestProject
dotnet test --treenode-filter "/*/*/SpecificClass/*"See .claude/docs/workflows.md for filter syntax and details.
# Review changes, then accept if intentional:
# (Run from test project directory, e.g., TUnit.Core.SourceGenerator.Tests)
# Linux/macOS:
for f in *.received.txt; do mv "$f" "${f%.received.txt}.verified.txt"; done
# Windows:
for %f in (*.received.txt) do move /Y "%f" "%~nf.verified.txt"
git add *.verified.txt- Use modern C# and .NET features.
LangVersionispreview— use latest syntax and APIs. - Prefer
[GenerateAssertion]for new assertions. See.claude/docs/patterns.md. - NEVER block on async - No
.Resultor.GetAwaiter().GetResult().
"Does this make TUnit faster, more modern, more reliable, or more enjoyable to use?"
- Default: create a feature branch, open a PR, iterate via review feedback. Don't push code changes directly to
main. - Exception — direct push to
mainis fine for trivial, low-risk changes that don't need review: doc tweaks (README, CLAUDE.md,.claude/**), agent-instruction updates, comment-only edits, typo fixes. Use judgment; if in doubt, branch + PR. - If the user says "push to main" while currently on
main, confirm intent: do they mean "push my branch and merge", or "push the current branch which happens to bemain"?
- When asked to clean up worktrees, proceed with
git worktree removefor[gone]or merged branches without asking for per-item confirmation; report what was done. - Preserve branches by default — only delete when explicitly asked.
- Verify each review finding against the code before applying a fix — don't blindly accept reviewer suggestions.
- Run tests locally before pushing.
- If you disagree with a review item, push back once with concrete reasoning. If the reviewer or user reaffirms, implement it instead of continuing to argue.
- Before commit, check that related tests, snapshots, and downstream files in the same module were updated alongside the source change.
- Keep individual responses under the 500-token output limit. For long results, split across turns or write to a file and reference it.
.claude/docs/mandatory-rules.md- Full rule details.claude/docs/workflows.md- Commands, checklists, filters.claude/docs/patterns.md- Code examples.claude/docs/project-structure.md- Project map.claude/docs/troubleshooting.md- Common issues