Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .claude/criteria-for-adding-quantities-and-units.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Criteria for adding quantities and units

Related wiki page: https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit#a-quantity-is-a-good-fit-to-add-if-it

To avoid bloating the library, we want to ensure quantities and units are widely used and well defined.
Avoid little used units that are obscure or too domain specific.
Ask for justification and use cases if this is not clear.

### A quantity is a good fit to add, if it

- [x] Is well documented and unambiguous, e.g. has a wiki page and generally easy to find on Google
- [x] Is widely used, preferably across domains
- [x] Has multiple units to convert between (e.g. `Length` has kilometer, feet, nanometer etc.)
- [x] Can convert to other quantities (e.g. `Length x Length = Area`)
- [x] Can be represented by a `double` numeric value, integer values are not well supported and may suffer from precision errors
- [x] Is not [dimensionless/unitless](https://en.wikipedia.org/wiki/Dimensionless_quantity) (consider using `Ratio`)

### A unit is a good fit to add to a quantity, if it

- [x] Is well documented and unambiguous, e.g. has a wiki page or found in online unit converters
- [x] Is widely used
- [x] Can be converted to other units of the same quantity
- [x] The conversion function is well established without ambiguous competing standards

### Avoid X-per-Y units

There are many variations of unit A over unit B, such as `LengthPerAngle` and we want to avoid adding these unless they are very common.
63 changes: 63 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Claude Code Review

on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"

jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
Please review this pull request and provide feedback on:
- Breaking changes, if any
- Style and conventions
- New quantities or units
- See `.claude/pr-review-instructions.md` for guidance and criteria, they should be widely used and well defined
- If it seems domain specific or obscure we ask for justification and use cases
- Changes to generated code
- Focus feedback on changes to code generators
- Tie feedback to specific examples from generated code to explain, try to pick 1-3 quantities of different types, e.g. `Length` (`ILinearQuantity`), `Temperature` (`IAffineQuantity`) and `Level` (`ILogarithmicQuantity`)
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Test coverage
- Security concerns, but only if medium or higher severity

Use the repository's CLAUDE.md for guidance on style and conventions.
Be constructive and helpful in your feedback, keep it concise.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

50 changes: 50 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read

# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'

# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'

8 changes: 7 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,10 @@ The project uses a sophisticated code generation system:

### Run performance benchmarks
- Execute: `dotnet run -c Release --project UnitsNet.Benchmark`
- Results saved to `Artifacts/` folder
- Results saved to `Artifacts/` folder

## Pull request reviews

### Adding new quantities or units

See `.claude/criteria-for-adding-quantities-and-units.md` for instructions on adding new quantities or units to ensure they are widely used and well defined.
Loading