Skip to content

Commit 6521f08

Browse files
MalcolmnixonMalcolm NixonCopilotCopilot
authored
Agent improvement next (#84)
* Avoid adding testing infrastructure to design documentation. * Improvements around testing dependencies * Improve linting * Updating agent files and introduce common coding and testing principles. * Fix minor linting issues. * Minor formatting corrections. * Improve linting scripts * Update lint.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Clarify XmlDoc requirement covers all members including private Agent-Logs-Url: https://github.com/demaconsulting/TemplateDotNetLibrary/sessions/380f5d42-690a-4d8a-8390-f0d9d475e688 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Remove project/solution file patterns from C# language standard Agent-Logs-Url: https://github.com/demaconsulting/TemplateDotNetLibrary/sessions/124eeb64-6752-44e7-a20d-fab39ca8cf1b Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> * Update AGENTS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update documentation standard to require ALL members (not just public) Agent-Logs-Url: https://github.com/demaconsulting/TemplateDotNetLibrary/sessions/f9f1b3f3-8e05-4331-80ac-7d66dfc52a00 Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com> --------- Co-authored-by: Malcolm Nixon <Malcolm.Nixon@hiarc.inc> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
1 parent cc6d72f commit 6521f08

13 files changed

Lines changed: 302 additions & 107 deletions

.github/agents/quality.agent.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ This assessment is a quality control system of the project and MUST be performed
2626
Upon completion create a summary in `.agent-logs/{agent-name}-{subject}-{unique-id}.md`
2727
of the project consisting of:
2828

29-
The **Result** field MUST reflect the quality validation outcome for orchestrator decision-making:
30-
31-
- **Result: SUCCEEDED** - Only when Overall Grade is PASS (all compliance requirements met)
32-
- **Result: FAILED** - When Overall Grade is FAIL or NEEDS_WORK (compliance failures present)
33-
34-
This ensures orchestrators properly halt workflows when quality gates fail.
35-
3629
```markdown
3730
# Quality Assessment Report
3831

@@ -81,6 +74,8 @@ This ensures orchestrators properly halt workflows when quality gates fail.
8174
- Were tests created/updated for all functional changes? (PASS|FAIL|N/A) - {Evidence}
8275
- Is test coverage maintained for all requirements? (PASS|FAIL|N/A) - {Evidence}
8376
- Are testing standards followed (AAA pattern, etc.)? (PASS|FAIL|N/A) - {Evidence}
77+
- Do tests respect software item hierarchy boundaries (System/Subsystem/Unit scope)? (PASS|FAIL|N/A) - {Evidence}
78+
- Are cross-hierarchy test dependencies documented in design docs? (PASS|FAIL|N/A) - {Evidence}
8479
- Does test categorization align with code structure? (PASS|FAIL|N/A) - {Evidence}
8580
- Do all tests pass without failures? (PASS|FAIL|N/A) - {Evidence}
8681

@@ -132,4 +127,11 @@ This ensures orchestrators properly halt workflows when quality gates fail.
132127
- **Quality Gates**: {Status of automated quality checks with tool outputs}
133128
```
134129

130+
The **Result** field MUST reflect the quality validation outcome for orchestrator decision-making:
131+
132+
- **Result: SUCCEEDED** - Only when Overall Grade is PASS (all compliance requirements met)
133+
- **Result: FAILED** - When Overall Grade is FAIL or NEEDS_WORK (compliance failures present)
134+
135+
This ensures orchestrators properly halt workflows when quality gates fail.
136+
135137
Return this summary to the caller.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Coding Principles
3+
description: Follow these standards when developing any software code.
4+
---
5+
6+
# Coding Principles Standards
7+
8+
This document defines universal coding principles and quality standards for software development within
9+
Continuous Compliance environments.
10+
11+
# Core Principles
12+
13+
## Literate Coding
14+
15+
All code MUST follow literate programming principles:
16+
17+
- **Intent Comments**: Every function/method begins with a comment explaining WHY (not what)
18+
- **Logical Separation**: Complex functions use comments to separate logical blocks
19+
- **Public Documentation**: All public interfaces have comprehensive documentation
20+
- **Clarity Over Cleverness**: Code should be immediately understandable by team members
21+
22+
## Universal Code Architecture Principles
23+
24+
### Design Patterns
25+
26+
- **Single Responsibility**: Functions with focused, testable purposes
27+
- **Dependency Injection**: External dependencies injected for testing
28+
- **Pure Functions**: Minimize side effects and hidden state
29+
- **Clear Interfaces**: Well-defined API contracts
30+
- **Separation of Concerns**: Business logic separate from infrastructure
31+
- **Repository Structure Adherence**: Before creating any new files, analyze the repository structure to
32+
understand established directory conventions and file placement patterns. Place new files in locations
33+
consistent with existing patterns.
34+
35+
### Compliance-Ready Code Structure
36+
37+
- **Documentation Standards**: Language-appropriate documentation required on ALL members
38+
- **Error Handling**: Comprehensive error cases with appropriate exception handling and logging
39+
- **Configuration**: Externalize settings for different compliance environments
40+
- **Resource Management**: Proper resource cleanup using language-appropriate patterns
41+
42+
# Quality Gates
43+
44+
## Code Quality Standards
45+
46+
- [ ] Zero compiler warnings (use language-specific warning-as-error flags)
47+
- [ ] All code follows literate programming style
48+
- [ ] Language-appropriate documentation complete on all members
49+
- [ ] Passes static analysis (language-specific tools)
50+
51+
## Universal Anti-Patterns
52+
53+
- **Skip Literate Coding**: Don't skip literate programming comments - they are required for maintainability
54+
- **Ignore Compiler Warnings**: Don't ignore compiler warnings - they exist for quality enforcement
55+
- **Hidden Dependencies**: Don't create untestable code with hidden dependencies
56+
- **Hidden Functionality**: Don't implement functionality without requirement traceability
57+
- **Monolithic Functions**: Don't write monolithic functions with multiple responsibilities
58+
- **Overcomplicated Solutions**: Don't make solutions more complex than necessary - favor simplicity and clarity
59+
- **Premature Optimization**: Don't optimize for performance before establishing correctness
60+
- **Copy-Paste Programming**: Don't duplicate logic - extract common functionality into reusable components
61+
- **Magic Numbers**: Don't use unexplained constants - either name them or add clear comments
62+
63+
# Language-Specific Implementation
64+
65+
For each detected language:
66+
67+
- **Load Standards**: Read the appropriate `{language}-language.md` file from `.github/standards/`
68+
- **Apply Tooling**: Use language-specific formatting, linting, and build tools
69+
- **Follow Conventions**: Apply language-specific naming, patterns, and best practices
70+
- **Generate Documentation**: Use language-appropriate documentation format (XmlDoc, Doxygen, JSDoc, etc.)
Lines changed: 21 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
# C# Language Coding Standards
1+
---
2+
name: C# Language
3+
description: Follow these standards when developing C# source code.
4+
globs: ["**/*.cs"]
5+
---
26

3-
This document defines DEMA Consulting standards for C# software development
4-
within Continuous Compliance environments.
7+
# C# Language Development Standard
58

6-
## Literate Programming Style (MANDATORY)
9+
## Required Standards
710

8-
Write all C# code in literate style because regulatory environments require
9-
code that can be independently verified against requirements by reviewers.
11+
Read these standards first before applying this standard:
1012

11-
- **Intent Comments**: Start every code paragraph with a comment explaining
12-
intent (not mechanics). Enables verification that code matches requirements.
13-
- **Logical Separation**: Use blank lines to separate logical code paragraphs.
14-
Makes algorithm structure visible to reviewers.
15-
- **Purpose Over Process**: Comments describe why, code shows how. Separates
16-
business logic from implementation details.
17-
- **Standalone Clarity**: Reading comments alone should explain the algorithm
18-
approach. Supports independent code review.
13+
- **`coding-principles.md`** - Universal coding principles and quality gates
1914

20-
### Example
15+
# File Patterns
16+
17+
- **Source Files**: `**/*.cs`
18+
19+
# Literate Coding Example
2120

2221
```csharp
2322
// Validate input parameters to prevent downstream errors
@@ -36,51 +35,13 @@ var validatedResults = BusinessRuleEngine.ValidateAndProcess(processedData);
3635
return OutputFormatter.Format(validatedResults);
3736
```
3837

39-
## XML Documentation (MANDATORY)
40-
41-
Document ALL members (public, internal, private) with XML comments because
42-
compliance documentation is auto-generated from source code comments and review
43-
agents need to validate implementation against documented intent.
44-
45-
## Dependency Management
46-
47-
Structure code for testability because all functionality must be validated
48-
through automated tests linked to requirements.
49-
50-
### Rules
51-
52-
- **Inject Dependencies**: Use constructor injection for all external dependencies.
53-
Enables mocking for unit tests.
54-
- **Avoid Static Dependencies**: Use dependency injection instead of static
55-
calls. Makes code testable in isolation.
56-
- **Single Responsibility**: Each class should have one reason to change.
57-
Simplifies testing and requirements traceability.
58-
- **Pure Functions**: Minimize side effects and hidden state. Makes behavior
59-
predictable and testable.
60-
61-
## Error Handling
62-
63-
Implement comprehensive error handling because failures must be logged for
64-
audit trails and compliance reporting.
65-
66-
- **Validate Inputs**: Check all parameters and throw appropriate exceptions
67-
with clear messages
68-
- **Use Typed Exceptions**: Throw specific exception types
69-
(`ArgumentException`, `InvalidOperationException`) for different error
70-
conditions
71-
- **Include Context**: Exception messages should include enough information
72-
for troubleshooting
73-
- **Log Appropriately**: Use structured logging for audit trails in regulated
74-
environments
38+
# Code Formatting
7539

76-
## Quality Checks
40+
- **Format entire solution**: `dotnet format`
41+
- **Format specific project**: `dotnet format MyProject.csproj`
42+
- **Format specific file**: `dotnet format --include MyFile.cs`
7743

78-
Before submitting C# code, verify:
44+
# Quality Checks
7945

80-
- [ ] Code follows Literate Programming Style rules (intent comments, logical separation)
81-
- [ ] XML documentation on ALL members with required tags
82-
- [ ] Dependencies injected via constructor (no static dependencies)
83-
- [ ] Single responsibility principle followed (one reason to change)
84-
- [ ] Input validation with typed exceptions and clear messages
85-
- [ ] Zero compiler warnings with `TreatWarningsAsErrors=true`
86-
- [ ] Compatible with ReqStream requirements traceability
46+
- [ ] Zero compiler warnings (`TreatWarningsAsErrors=true`)
47+
- [ ] XmlDoc documentation complete on all members (public, internal, protected, private)

.github/standards/csharp-testing.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
---
2+
name: C# Testing
3+
description: Follow these standards when developing C# tests.
4+
globs: ["**/test/**/*.cs", "**/tests/**/*.cs", "**/*Tests.cs", "**/*Test.cs"]
5+
---
6+
17
# C# Testing Standards (MSTest)
28

39
This document defines DEMA Consulting standards for C# test development using
410
MSTest within Continuous Compliance environments.
511

6-
# AAA Pattern Implementation (MANDATORY)
12+
## Required Standards
13+
14+
Read these standards first before applying this standard:
15+
16+
- **`testing-principles.md`** - Universal testing principles and dependency boundaries
17+
- **`csharp-language.md`** - C# language development standards
718

8-
Structure all tests using Arrange-Act-Assert pattern because regulatory reviews
9-
require clear test logic that can be independently verified against
10-
requirements.
19+
# C# AAA Pattern Implementation
1120

1221
```csharp
1322
[TestMethod]
@@ -26,7 +35,7 @@ public void ServiceName_MethodName_Scenario_ExpectedBehavior()
2635
Use descriptive test names because test names appear in requirements traceability matrices and compliance reports.
2736

2837
- **System tests**: `{SystemName}_{Functionality}_{Scenario}_{ExpectedBehavior}`
29-
- **Subsystem tests**: `{SubsystemName}_{Functionality}_{Scenario}_{ExpectedBehavior}`
38+
- **Subsystem tests**: `{SubsystemName}_{Functionality}_{Scenario}_{ExpectedBehavior}`
3039
- **Unit tests**: `{ClassName}_{MethodUnderTest}_{Scenario}_{ExpectedBehavior}`
3140
- **Descriptive Scenarios**: Clearly describe the input condition being tested
3241
- **Expected Behavior**: State the expected outcome or exception
@@ -37,15 +46,6 @@ Use descriptive test names because test names appear in requirements traceabilit
3746
- `UserValidator_ValidateEmail_InvalidFormat_ThrowsArgumentException`
3847
- `PaymentProcessor_ProcessPayment_InsufficientFunds_ReturnsFailureResult`
3948

40-
# Requirements Coverage
41-
42-
Link tests to requirements because every requirement must have passing test evidence for compliance validation.
43-
44-
- **ReqStream Integration**: Tests must be linkable in requirements YAML files
45-
- **Platform Filters**: Use source filters for platform-specific requirements (`windows@TestName`)
46-
- **TRX Format**: Generate test results in TRX format for ReqStream compatibility
47-
- **Coverage Completeness**: Test both success paths and error conditions
48-
4949
# Mock Dependencies
5050

5151
Mock external dependencies using NSubstitute (preferred) because tests must run in isolation to generate

.github/standards/design-documentation.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
---
2+
name: Design Documentation
3+
description: Follow these standards when creating design documentation.
4+
globs: ["docs/design/**/*.md"]
5+
---
6+
17
# Design Documentation Standards
28

39
This document defines DEMA Consulting standards for design documentation
410
within Continuous Compliance environments, extending the general technical
511
documentation standards with specific requirements for software design
612
artifacts.
713

14+
## Required Standards
15+
16+
Read these standards first before applying this standard:
17+
18+
- **`technical-documentation.md`** - General technical documentation standards
19+
- **`software-items.md`** - Software categorization (System/Subsystem/Unit/OTS)
20+
821
# Core Principles
922

1023
Design documentation serves as the bridge between requirements and
@@ -46,7 +59,9 @@ or compliance drivers.
4659
### Scope Section
4760

4861
Define what software items are covered and what is explicitly excluded.
49-
Specify version boundaries and applicability constraints.
62+
Design documentation must NOT include test projects, test classes, or test
63+
infrastructure because design documentation documents the architecture of
64+
shipping product code, not ancillary content used to validate it.
5065

5166
### Software Structure Section (MANDATORY)
5267

.github/standards/reqstream-usage.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
1+
---
2+
name: ReqStream Usage
3+
description: Follow these standards when managing requirements with ReqStream.
4+
globs: ["requirements.yaml", "docs/reqstream/**/*.yaml"]
5+
---
6+
17
# ReqStream Requirements Management Standards
28

39
This document defines DEMA Consulting standards for requirements management
410
using ReqStream within Continuous Compliance environments.
511

12+
## Required Standards
13+
14+
Read these standards first before applying this standard:
15+
16+
- **`software-items.md`** - Software categorization (System/Subsystem/Unit/OTS)
17+
618
# Core Principles
719

820
ReqStream implements Continuous Compliance methodology for automated evidence
@@ -48,12 +60,12 @@ consistency with design documentation and enable automated tooling.
4860

4961
# Requirement Hierarchies and Links
5062

51-
When linking requirements between different software item levels, links MUST
52-
only flow downward in the hierarchy to maintain clear traceability:
63+
Requirements link downward only - higher-level requirements reference lower-level
64+
ones they decompose into:
5365

5466
- **System requirements** → may link to subsystem or unit requirements
5567
- **Subsystem requirements** → may link to unit requirements within that subsystem
56-
- **Unit requirements** → should NOT link to higher-level requirements
68+
- **Unit requirements** → should NOT link upward to parent requirements
5769

5870
This prevents circular dependencies and ensures clear hierarchical relationships
5971
for compliance auditing.
@@ -80,7 +92,7 @@ sections:
8092
justification: |
8193
Business rationale explaining why this requirement exists.
8294
Include regulatory or standard references where applicable.
83-
children: # Links to child requirements (optional)
95+
children: # Downward links to decomposed requirements (optional)
8496
- ChildSystem-Feature-Behavior
8597
tests: # Links to test methods (required)
8698
- TestMethodName

.github/standards/reviewmark-usage.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1+
---
2+
name: ReviewMark Usage
3+
description: Follow these standards when configuring file reviews with ReviewMark.
4+
---
5+
16
# ReviewMark Usage Standard
27

8+
## Required Standards
9+
10+
Read these standards first before applying this standard:
11+
12+
- **`software-items.md`** - Software categorization (System/Subsystem/Unit/OTS)
13+
314
## Purpose
415

516
ReviewMark manages file review status enforcement and formal review processes. It tracks which files need

.github/standards/software-items.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
name: Software Items
3+
description: Follow these standards when categorizing software components.
4+
---
5+
16
# Software Items Definition Standards
27

38
This document defines DEMA Consulting standards for categorizing software
@@ -35,13 +40,16 @@ Choose the appropriate category based on scope and testability:
3540
## Software Subsystem
3641

3742
- Major architectural boundary (authentication, data layer, UI, communications)
43+
- Contains multiple software units working together
44+
- Typically maps to project folders or namespaces
3845
- Tested through subsystem integration tests
3946

4047
## Software Unit
4148

4249
- Smallest independently testable component
43-
- Tested through unit tests with mocked dependencies
4450
- Typically a single class or cohesive set of functions
51+
- Methods within a class are NOT separate units
52+
- Tested through unit tests with mocked dependencies
4553

4654
## OTS Software Item
4755

0 commit comments

Comments
 (0)