Coding Standards
GitAuto injects an XML document into every model session. This document codifies test design principles, code quality rules, and anti-pattern definitions. It acts as a universal baseline that applies to every repository, regardless of language or framework.
Why This Exists
Without codified standards, the model produces tests with common anti-patterns: testing implementation details instead of behavior, over-mocking dependencies so tests pass even when code is broken, and writing tautological assertions like expect(mock).toHaveBeenCalled() right after calling the mock directly. The coding standards document explicitly names these anti-patterns and provides correct alternatives. It is the product of hundreds of real code reviews - every time a pattern was consistently rejected by reviewers, it was added to the standards to prevent recurrence.
Why Models Produce Anti-Patterns
Models learn from training data that includes both good and bad code. They replicate patterns they have seen most frequently, not patterns that are correct. Testing anti-patterns like over-mocking and tautological assertions are extremely common in real-world codebases, so models reproduce them confidently. Without explicit rules saying "don't do X, do Y instead," models default to the most statistically common pattern - which for tests is often the wrong one. The model has no inherent sense of test quality; it only knows what patterns appeared most often in its training data. Code generation benchmarks like HumanEval and SWE-bench reinforce this - they measure whether code passes tests, not whether the tests themselves follow best practices. Models are never penalized during training or evaluation for writing over-mocked tests or tautological assertions.
How It Works
The standards document is structured in XML with distinct sections:
- Test design principles - behavioral testing over implementation testing, meaningful assertion messages, test isolation requirements
- Mock management - when to mock, when not to mock, how to avoid over-mocking that makes tests meaningless
- Anti-pattern catalog - specific patterns to avoid with examples of what to do instead
- Code quality rules - naming conventions, file organization, import hygiene
- Dead code handling - rules for identifying and removing unreachable code rather than writing impossible tests for it. This is key to achieving 100% coverage. See Dead Code Removal for the full implementation.
- GITAUTO.md guidance- instructions for when and how to update the repo's GITAUTO.md file with new learnings
The document is injected into the system message alongside trigger-specific prompts and repository rules. It has lower priority than GITAUTO.md but higher priority than the model's default training, ensuring these standards are followed unless explicitly overridden by repo-specific configuration.
Related Features
- GITAUTO.md - repo-specific overrides that take priority over universal standards
- Repository Rules - user-configured rules that supplement the built-in standards
- Trigger-Specific Prompts - scenario-specific instructions injected alongside standards
Need Help?
Have questions or suggestions? We're here to help you get the most out of GitAuto.
Contact us with your questions or feedback!