Converted rule
Source: legacy Claude rule general-code-change.
General Code Change Policy
This rule file summarizes the cross-language code change policy for this repository.
Design Principles
Apply these priorities in order when designing or changing code:
- Simplicity first — Prefer the simplest design that works and is readable. Avoid cleverness and deep indirection.
- Reusability — Factor out logic that is clearly reusable. Avoid copy-paste; share behavior via composition or helper methods.
- Extensibility — Design public APIs so they can be extended without breaking callers. Prefer keyword-style parameters with defaults. Prefer composition over inheritance. Use interfaces/abstract types/protocols to support multiple implementations.
- Separation of concerns — Keep pure logic (transforms, calculations, parsing) separate from I/O (disk, network, DB), UI/CLI, and framework-specific glue.
Classes, Functions, and APIs
- Create a class when: there is a clear domain concept with data + behavior, state and invariants must travel together, multiple implementations behind an interface are expected, or a multi-step workflow shares context.
- Create a standalone function when: the operation is pure, stateless, and simple; it is a small helper that does not naturally belong on a domain class; or it is a simple transformation from inputs to outputs.
- Keep methods small and focused. Avoid god objects.
- Use interfaces/abstract types/protocols when multiple implementations are likely.
Module Rigor Tiers
Module rigor tiers (T1–T4) and the uniform-versus-tier-dependent gate matrix are defined in .agents/skills/quality-tiers.md. Every project must be classified in quality-tiers.yml at repo root.
Mandatory Toolchain Loop
Run the full seven-stage toolchain in this exact order and repeat until all stages pass in a single pass:
- Formatting (e.g., Black, Prettier, CSharpier, Invoke-Formatter)
- Linting (e.g., Ruff, ESLint, PSScriptAnalyzer, .NET analyzers)
- Type checking (e.g., Pyright, TSC, nullable analysis; skip for PowerShell)
- Architecture-boundary tests (e.g., dependency-cruiser, NetArchTest.Rules)
- Unit tests (e.g., Pytest, Vitest, MSTest, Pester) including property-based tests where applicable per
quality-tiers.md
- Contract / schema compatibility checks (e.g., oasdiff, schema-snapshot diff)
- Integration tests
Restart from step 1 if any stage fails or auto-fixes any files. Do not stop the loop until all seven stages complete without errors in a single pass.
Mutation testing and golden tests run in pre-merge or nightly pipelines, not the per-commit loop.
File Size Limit
- No production code, test code, or reusable script file may exceed 500 lines.
- Exceptions: temporary throwaway scripts created and deleted within an agent session; raw text fixtures for language-processing test data; Markdown documentation files.
Error Handling and Logging
- Fail fast and explicitly: raise or return clear, specific errors when invariants are violated.
- Do not silently ignore errors. Do not use broad catch-all handlers unless you immediately re-raise or propagate with added context.
- Use the project's established logging pattern. Log at appropriate levels (
debug, info, warning, error).
- Enforce invariants at construction/initialization time.
- Use assertions only for internal sanity checks, not user-facing error handling.
Naming
- Names must be descriptive. Abbreviations are acceptable only when they are standard (
id, url, db).
- Language-specific conventions:
snake_case for Python functions/variables, PascalCase for Python classes, camelCase for TypeScript/C# locals, PascalCase for TypeScript/C# types and public members.
Public APIs and Compatibility
- Prefer keyword-style parameters with defaults.
- Prefer composition over inheritance when possible.
- Avoid breaking public APIs. If a breaking change is necessary, update all callers in-repo and call it out clearly in the change description.
Dependencies
- Use only libraries already approved in the project unless explicitly told to add more.
- If adding a dependency is unavoidable, choose a well-maintained, widely used package and document why it is required.
I/O Boundaries
- Isolate I/O (disk, network, APIs) into specific classes or modules.
- Core domain logic must be testable without touching the network or filesystem.
- Use of temporary files within tests is strictly prohibited.
1---2name: general-code-change3description: Converted rule4---56# Converted rule78Source: legacy Claude rule `general-code-change`.910# General Code Change Policy1112This rule file summarizes the cross-language code change policy for this repository.1314## Design Principles1516Apply these priorities in order when designing or changing code:17181. **Simplicity first** — Prefer the simplest design that works and is readable. Avoid cleverness and deep indirection.192. **Reusability** — Factor out logic that is clearly reusable. Avoid copy-paste; share behavior via composition or helper methods.203. **Extensibility** — Design public APIs so they can be extended without breaking callers. Prefer keyword-style parameters with defaults. Prefer composition over inheritance. Use interfaces/abstract types/protocols to support multiple implementations.214. **Separation of concerns** — Keep pure logic (transforms, calculations, parsing) separate from I/O (disk, network, DB), UI/CLI, and framework-specific glue.2223## Classes, Functions, and APIs2425- Create a class when: there is a clear domain concept with data + behavior, state and invariants must travel together, multiple implementations behind an interface are expected, or a multi-step workflow shares context.26- Create a standalone function when: the operation is pure, stateless, and simple; it is a small helper that does not naturally belong on a domain class; or it is a simple transformation from inputs to outputs.27- Keep methods small and focused. Avoid god objects.28- Use interfaces/abstract types/protocols when multiple implementations are likely.2930## Module Rigor Tiers3132Module rigor tiers (T1–T4) and the uniform-versus-tier-dependent gate matrix are defined in `.agents/skills/quality-tiers.md`. Every project must be classified in `quality-tiers.yml` at repo root.3334## Mandatory Toolchain Loop3536Run the full seven-stage toolchain in this exact order and repeat until all stages pass in a single pass:37381. **Formatting** (e.g., Black, Prettier, CSharpier, Invoke-Formatter)392. **Linting** (e.g., Ruff, ESLint, PSScriptAnalyzer, .NET analyzers)403. **Type checking** (e.g., Pyright, TSC, nullable analysis; skip for PowerShell)414. **Architecture-boundary tests** (e.g., dependency-cruiser, NetArchTest.Rules)425. **Unit tests** (e.g., Pytest, Vitest, MSTest, Pester) including property-based tests where applicable per `quality-tiers.md`436. **Contract / schema compatibility checks** (e.g., oasdiff, schema-snapshot diff)447. **Integration tests**4546**Restart from step 1** if any stage fails or auto-fixes any files. Do not stop the loop until all seven stages complete without errors in a single pass.4748Mutation testing and golden tests run in pre-merge or nightly pipelines, not the per-commit loop.4950## File Size Limit5152- No production code, test code, or reusable script file may exceed **500 lines**.53- Exceptions: temporary throwaway scripts created and deleted within an agent session; raw text fixtures for language-processing test data; Markdown documentation files.5455## Error Handling and Logging5657- **Fail fast and explicitly**: raise or return clear, specific errors when invariants are violated.58- Do not silently ignore errors. Do not use broad catch-all handlers unless you immediately re-raise or propagate with added context.59- Use the project's established logging pattern. Log at appropriate levels (`debug`, `info`, `warning`, `error`).60- Enforce invariants at construction/initialization time.61- Use assertions only for internal sanity checks, not user-facing error handling.6263## Naming6465- Names must be descriptive. Abbreviations are acceptable only when they are standard (`id`, `url`, `db`).66- Language-specific conventions: `snake_case` for Python functions/variables, `PascalCase` for Python classes, `camelCase` for TypeScript/C# locals, `PascalCase` for TypeScript/C# types and public members.6768## Public APIs and Compatibility6970- Prefer keyword-style parameters with defaults.71- Prefer composition over inheritance when possible.72- Avoid breaking public APIs. If a breaking change is necessary, update all callers in-repo and call it out clearly in the change description.7374## Dependencies7576- Use only libraries already approved in the project unless explicitly told to add more.77- If adding a dependency is unavoidable, choose a well-maintained, widely used package and document why it is required.7879## I/O Boundaries8081- Isolate I/O (disk, network, APIs) into specific classes or modules.82- Core domain logic must be testable without touching the network or filesystem.83- Use of temporary files within tests is strictly prohibited.