Commit 236928a
docs: add guideline to avoid Rust keywords as field names (#148)
## Summary
Added explicit rules to both `CLAUDE.md` and `CONTRIBUTING.md`
prohibiting the use of Rust keywords (`type`, `use`, `trait`, `impl`,
etc.) as struct field names, especially in public APIs.
Addresses:
https://github.com/renlabs-dev/torus-substrate/pull/140/files#r2337166593
## Problem
Rust keywords require the `r#` prefix (e.g., `r#type`), which causes
serialization inconsistencies across language bindings:
- Polkadot.js converts to `r_type` or `rType`
- Serde serializes as `type`
- Creates confusion and breaks API consistency
## Solution
Use alternative names like `kind`, `variant`, `scope`, `category`, or
`mode` instead. This guideline applies to all public structs, especially
those in `api` crates and types exposed to external clients.
## Changes
- Added "API Design - MANDATORY" section to `CLAUDE.md` with strict
rules for AI code generation
- Added bullet point to "Pallet-specific guidelines" in
`CONTRIBUTING.md` for human developers
## Test plan
- [x] Documentation changes only, no code changes
- [x] Reviewed for clarity and consistency with existing style
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- New Features
- Added a Torus command-line interface with commands for keys, balances
(check/transfer), agents (info/register/unregister), namespaces
(info/register/unregister), and staking (view/add/remove/transfer).
- Supports fee estimation, dry-run, JSON output, testnet mode, and
interactive confirmations.
- Introduced fee estimation methods in the client for transactions.
- Updated permission validation to allow zero-weight recipients when
permissions are revocable.
- Documentation
- Expanded contributor guidelines with mandatory API design rules and
Rust keyword guidance.
- Added a CLI README with command references.
- Chores
- Added CLI to the workspace and updated the Rust toolchain.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Co-authored-by: Claude <[email protected]>1 parent c66f4dd commit 236928a
2 files changed
+26
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
77 | 80 | | |
78 | 81 | | |
79 | 82 | | |
| 83 | + | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| |||
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
135 | 149 | | |
136 | 150 | | |
137 | 151 | | |
| 152 | + | |
138 | 153 | | |
139 | 154 | | |
140 | 155 | | |
| 156 | + | |
141 | 157 | | |
| 158 | + | |
142 | 159 | | |
143 | 160 | | |
144 | 161 | | |
| 162 | + | |
145 | 163 | | |
| 164 | + | |
146 | 165 | | |
147 | 166 | | |
148 | 167 | | |
| |||
169 | 188 | | |
170 | 189 | | |
171 | 190 | | |
172 | | - | |
| 191 | + | |
173 | 192 | | |
174 | 193 | | |
175 | 194 | | |
176 | 195 | | |
177 | 196 | | |
178 | | - | |
| 197 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| |||
0 commit comments