Skip to content

Commit 59f96b9

Browse files
authored
chore: Additional rules for agents (#193)
1 parent 8ca769e commit 59f96b9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎AGENTS.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@ This file provides repository-specific guidance for AI coding agents working on
1414
- Make the smallest coherent change. Do not include unrelated bug fixes, refactorings, dependency updates, or performance work; report those separately. For analysis-only requests, do not edit files or create patches unless asked.
1515
- Follow existing naming, formatting, file organization, error handling, and option patterns. Avoid unrelated formatting changes.
1616
- Apply SOLID pragmatically: keep responsibilities clear and abstractions justified by actual needs. Prefer readable, straightforward code (KISS before DRY); reuse existing mechanisms rather than introducing speculative interfaces or helpers.
17+
- Keep validation close to the code responsible for the corresponding behavior. Separate static from context-dependent validation, and avoid redundant checks across layers.
1718
- Preserve public API compatibility unless explicitly asked otherwise, including option behavior, error contracts, and serialized representations.
1819
- Do not edit generated mocks manually or change `go.mod` / `go.sum` just to accommodate a local environment.
1920
- Preserve the library's framework independence and its `Message` abstraction.
2021

2122
## RFC compliance and security
2223

2324
- Check protocol-related changes against the relevant RFC text, not only existing tests or behavior on `main`. Explain consequential design decisions in terms of the applicable requirement.
25+
- Distinguish RFC compliance issues from exploitable security vulnerabilities. Evaluate concrete threat scenarios, including risks introduced by stricter validation.
2426
- Validate before lossy conversion: preserve parameter presence, types, and values until the relevant checks are complete.
2527
- Respect the API contracts for Structured Fields component identifiers and any supported simplified configuration syntax.
2628
- Never relax signature, component, timestamp, nonce, algorithm, or key validation merely to satisfy tests. Assess security and compatibility implications explicitly.
2729

2830
## Test design
2931

3032
- Each unit test function should cover the meaningful positive and negative branches of its own target function or method. Higher-level tests should exercise that function's orchestration and error propagation, not duplicate detailed validation tests of its dependencies.
33+
- When refactoring responsibilities, move the corresponding tests to the appropriate target functions and remove obsolete or overlapping scenarios.
3134
- Extend existing test functions where possible. Add only cases for new behavior, regressions, or genuinely uncovered edges; avoid overlapping scenarios.
3235
- Use table-driven tests only when they improve clarity. Keep cases independently understandable without unnecessary helpers or abstraction (KISS before DRY).
3336
- Put end-to-end signing, verification, and cross-API round trips in integration tests rather than repeating entire workflows in unit tests.
3437
- Assert observable contracts, including partial results and error identity or wrapping (`errors.Is` where appropriate), rather than incidental implementation details.
35-
- Treat coverage as a diagnostic, not a target percentage. Inspect whether changed functions' meaningful branches have appropriate tests.
38+
- Treat coverage as a diagnostic, not a target percentage. Inspect whether changed functions' meaningful branches have appropriate tests. Prefer removing unreachable or redundant code over adding artificial tests solely to increase coverage.
3639
- Use `integration_test.go` for cross-API workflows and `rfc_vectors_test.go` for RFC test vectors.
3740

3841
## Performance

0 commit comments

Comments
 (0)