Skip to content

Commit be4f860

Browse files
luigi-iojaime-iobermudezthemariofranciaMiguelLZPFCopilot
authored
feat: v8.0.0 (#1298)
Signed-off-by: jaime-iobermudez <jaime.bermudez@io.builders> Signed-off-by: Mario Francia <mariofranciarius@gmail.com> Signed-off-by: Miguel_LZPF <miguel.carpena@io.builders> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Alberto Molina <alberto@io.builders> Signed-off-by: Miguel Carpena <miguel.carpena@io.builders> Signed-off-by: Luigi Navarro <luigi@io.builders> Signed-off-by: Marcos Serradilla Diez <marcos@io.builders> Signed-off-by: rbermejo <ruben@io.builders> Signed-off-by: Ruben Martinez <ruben.martinez@io.builders> Signed-off-by: adrian <adrian@io.builders> Signed-off-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com> Signed-off-by: Ruben <ruben@io.builders> Signed-off-by: mamoralesiob <miguelangel@io.builders> Co-authored-by: jaime-iobermudez <jaime.bermudez@io.builders> Co-authored-by: Mario Francia <mariofranciarius@gmail.com> Co-authored-by: Miguel_LZPF <miguel.carpena@io.builders> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alberto Molina <alberto@io.builders> Co-authored-by: Marcos Serradilla Diez <marcos@io.builders> Co-authored-by: Ruben Martinez <ruben.martinez@io.builders> Co-authored-by: adrian <adrian@io.builders> Co-authored-by: Axel-IoBuilders <108282711+Axel-IoBuilders@users.noreply.github.com> Co-authored-by: Ruben <ruben@io.builders> Co-authored-by: mamoralesiob <miguelangel@io.builders> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 1539fd1 commit be4f860

2,039 files changed

Lines changed: 123310 additions & 84303 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/commands/docs/update-docs.md

Lines changed: 562 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
name: solidity-natspec
3+
description: Produce and validate comprehensive NatSpec documentation on Solidity files. Use whenever a `.sol` file is created or modified — contracts, interfaces, libraries, facets under `packages/ats/contracts/**`. Ensures every contract element (contract/interface/library, enums, structs, events, custom errors, state variables, modifiers, functions) carries audit-ready NatSpec in the project's house style (British English, ≤100-char lines, intent-focused). Also use on explicit request (`/solidity-natspec`) to document or re-document an existing `.sol` file.
4+
---
5+
6+
# Solidity NatSpec Documentation
7+
8+
Produce audit-ready NatSpec on every element the edit touches. Document **intent, behaviour,
9+
constraints, and structure** — never restate what the code already says. Audience: auditors,
10+
maintainers, analysis tools.
11+
12+
When editing an existing file, document new or modified elements only. On `/solidity-natspec [path]`,
13+
do a full pass on the file.
14+
15+
## Templates
16+
17+
Place each block immediately above the element. Declaration order inside a contract:
18+
enums → structs → events → custom errors → state vars → modifiers → functions
19+
(`external`/`public` first, then `internal`/`private`).
20+
21+
For contract / interface / library headers, `@title`, `@author` and `@notice` are **mandatory**
22+
solhint's `use-natspec` rule flags each missing tag. Use
23+
`@author Asset Tokenization Studio Team` unless the file is clearly a fork of upstream code
24+
(OpenZeppelin, ERC references).
25+
26+
```solidity
27+
/**
28+
* @title <name>
29+
* @author Asset Tokenization Studio Team
30+
* @notice <high-level purpose>
31+
* @dev <design notes, patterns, assumptions, invariants>
32+
*/
33+
```
34+
35+
For every other element, include `@notice` (what and why), `@dev` when non-obvious, and one
36+
`@param`/`@return` per named parameter/return with matching names. Functions, events, and errors
37+
that omit `@notice` or mismatch `@param`/`@return` names fail solhint.
38+
39+
For interface implementations, use `@inheritdoc IFoo` on the concrete function (plus a `@dev` only
40+
if the implementation introduces behaviour the interface doesn't describe — e.g. a pause gate, a
41+
facet-specific guard, a snapshot side-effect). Don't duplicate the interface block; it drifts.
42+
43+
## Storage structs (ERC-7201)
44+
45+
`@custom:storage-location erc7201:<namespace>` is a NatSpec **custom tag**, not a free-floating
46+
comment. Place it **inside** the struct's NatSpec block as the last tag — never as a `///` line
47+
above the block. Solc's NatSpec parser, `forge inspect storage-layout`, Slither, and the
48+
OpenZeppelin upgrades plugin all read the tag from the doc-comment block regardless of
49+
placement; keeping it inside the block keeps the annotation visually adjacent to the struct
50+
identifier and the whole doc unit contiguous.
51+
52+
```solidity
53+
/**
54+
* @notice Persistent storage layout for ERC-20 metadata and balances.
55+
* @dev Holds the initialisation flag, decimals, total supply, balances, and allowances.
56+
* New fields must be appended below the marker to preserve ERC-7201 slot offsets.
57+
* @custom:storage-location erc7201:security.token.standard.storage.Erc20
58+
*/
59+
struct ERC20Storage { ... }
60+
```
61+
62+
When a single struct backs multiple ERC-7201 namespaces (e.g. `ScheduledTasksDataStorage`,
63+
`ExternalListDataStorage`), list every binding in a `@dev` block — no single
64+
`@custom:storage-location` line captures the multi-binding.
65+
66+
## Style
67+
68+
- **British English**: _decentralised_, _behaviour_, _initialised_, _optimise_, _authorised_,
69+
_organisation_, _serialise_, _analyse_, _licence_ (noun). Never American spelling.
70+
- **≤100 chars per line** in comment bodies.
71+
- **Present tense** for descriptions ("Transfers tokens…", not "Will transfer…").
72+
- **Precise smart-contract terminology**: reentrancy, invariant, storage slot, delegatecall,
73+
selector, EIP-xxx, diamond facet.
74+
75+
## What to cover when relevant
76+
77+
Access control (roles, modifiers) · state mutations · invariants · gas hazards (unbounded loops,
78+
cold SLOADs, storage packing) · initialisation / upgrade order · events emitted · errors raised
79+
· side effects (external calls, transfers, mint/burn) · cross-contract interactions · pre/post
80+
conditions · reentrancy posture.
81+
82+
## What to avoid
83+
84+
Explaining Solidity itself ("this is a mapping…"). Narrating self-explanatory code ("getter that
85+
returns the value"). Inventing behaviour not in the code — read the implementation first.
86+
Referencing the current task/PR/commit — NatSpec lives with the code. Duplicating interface
87+
NatSpec on the implementation.
88+
89+
## Validate before finishing
90+
91+
For each touched file:
92+
93+
1. **Coverage script** (heuristic, enforces the tags solhint's `use-natspec` rule flags):
94+
95+
```bash
96+
node .claude/skills/solidity-natspec/scripts/check_natspec.mjs <path/to/file.sol>
97+
```
98+
99+
Contract/interface/library need `@title` + `@author` + `@notice`. Functions/events/errors need
100+
`@notice` and one `@param`/`@return` per named parameter/return with matching names. Elements
101+
carrying `@inheritdoc X` pass without further tag checks. State variables are intentionally
102+
not scanned — verify those by eye against "what to cover". Exit 0 means the required tags
103+
exist; content quality still needs review.
104+
105+
2. **Solhint** on the touched file(s):
106+
107+
```bash
108+
cd packages/ats/contracts && npx solhint <relative/path/to/file.sol>
109+
```
110+
111+
Any `use-natspec` warning must be resolved before reporting done. `ordering`, `gas-*`,
112+
`no-unused-import` warnings are outside this skill's scope — flag them to the user instead of
113+
silently editing.
114+
115+
Insert the NatSpec directly with Edit/Write. Only emit a separate report if the user asks for a
116+
review-only pass.

0 commit comments

Comments
 (0)