2.6 KiB
2.6 KiB
Agentic Coding Standards
This repository follows strict agentic coding practices to ensure high-quality, maintainable C# implementations.
Zero Defects Policy
All code changes must maintain a zero defects policy:
- Every feature or bug fix must be validated by passing tests before merge
- Code reviews focus on correctness, clarity, and adherence to style guidelines
- No known issues or technical debt should be introduced
- When defects are discovered, they are fixed immediately before proceeding with new work
Test-Driven Development (TDD)
We follow the Red-Green-Refactor cycle strictly. You must invoke dotnet test in each phase:
- Red: Write a failing test that describes the desired behavior
- Green: Write the minimum code necessary to make the test pass
- Refactor: Improve the code while keeping tests passing
All development must start with a test. The repository includes one intentional failing test as a starting point for TDD workflow.
Test Execution
Run the test suite using:
dotnet test
This command:
- Restores NuGet packages if needed
- Builds the solution (Vending library + test project)
- Executes all NUnit test cases
- Reports results with clear pass/fail status
The test suite must pass entirely before any code is merged.
Code Quality Standards
Testing Framework
- Test Framework: NUnit
- Coverage: All public API members must have test coverage
- Organization: Tests are located in
Vending.Tests/TestVendingMachine.cs
Code Style
- Language: C# (latest available)
- Target Framework: .NET 8.0
- Style Tool:
dotnet format(configured via.editorconfigif present) - Enforcement: All code should follow standard C# conventions (PascalCase for public members, camelCase for locals/parameters, etc.)
Agent Responsibilities
When assisting with code changes, agents must:
- Respect the zero defects policy — all code must be tested and passing
- Follow the Red-Green-Refactor workflow — tests first, implementation second
- Enforce code style using .NET formatting standards
- Ensure all tests pass before considering work complete
- Maintain clarity and maintainability in all refactoring activities
Getting Started
- User stories are in stories/ Use the task-breakdown skill to help the user break down each acceptance criterion individually.
- Read the failing test in
Vending.Tests/TestVendingMachine.cs - Implement the vending machine code in
Vending/(e.g.,Vending/VendingMachine.cs) - Run
dotnet testfrequently to verify progress - Refactor once tests pass to improve code quality
- Repeat for each new requirement