Skip to content

Library conventions - #689

Merged
ozgunozerk merged 6 commits into
mainfrom
library-conventions
Apr 29, 2026
Merged

Library conventions#689
ozgunozerk merged 6 commits into
mainfrom
library-conventions

Conversation

@ozgunozerk

@ozgunozerk ozgunozerk commented Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #688

PR Checklist

  • Tests
  • Documentation

Summary by CodeRabbit

  • Documentation

    • Added code quality audit guide with OpenZeppelin-style checklist for Stellar/Soroban contracts
    • Added release preparation workflow documentation
    • Added comprehensive development guide with project conventions and patterns
    • Updated contribution guidelines with code quality requirements
  • Chores

    • Cleaned up unused test imports
    • Updated build configuration

@ozgunozerk
ozgunozerk requested a review from brozorec April 29, 2026 12:38
@ozgunozerk ozgunozerk self-assigned this Apr 29, 2026
@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: da5fad7d-0f92-437b-afbd-1aea3b8ccafb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The PR introduces comprehensive machine-readable conventions, procedures, and documentation to standardize external contributions and internal release workflows for the Stellar Contracts repository, including code quality audit guidance, release preparation steps, development conventions, and contribution policies.

Changes

Cohort / File(s) Summary
AI-Compatible Skills
.claude/skills/code-quality.md, .claude/skills/release-prep.md
New user-invocable skill documents defining code audit procedures (against OpenZeppelin-style checklist for Rust code) and step-by-step release preparation workflow for dependency versioning and build verification.
Development Conventions & Contribution Policy
CLAUDE.md, CONTRIBUTING.md
New comprehensive development guide documenting repository layout, formatting, linting, testing, authorization patterns, storage semantics, and structural conventions; updated contribution policy to reference code-quality skill and reinforce enforcement of code conventions.
Configuration
.gitignore
Removed .claude/ directory from gitignore patterns to allow versioning of AI skill files.
Code Cleanup
packages/tokens/src/fungible/test.rs
Removed unused imports (AuthorizedFunction, vec) and associated allow attribute; no functional changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Readme and contribution #685: Modifies CONTRIBUTING.md for AI-assisted contribution policies and updates README visibility for published crates, overlapping in scope with contribution governance changes in this PR.

Suggested labels

audit-v0.7.0

Suggested reviewers

  • brozorec
  • bidzyyys

Poem

🐰 A rabbit bounces through the code with glee,
With skills and guides for all to see!
Conventions clear, from claude to release,
AI and humans find their peace! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description references issue #688 and includes a checklist template, but lacks substantive explanation of the changes introduced despite the PR adding significant new files and documentation. Add a brief explanation of what library conventions are being introduced (CLAUDE.md, code-quality skill, release-prep skill, etc.) and their purpose in assisting contributors.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Library conventions' is directly related to and summarizes the main objective of the PR, which is to introduce LLM-compatible library conventions.
Linked Issues check ✅ Passed The PR successfully addresses issue #688 by introducing comprehensive LLM-compatible library conventions including CLAUDE.md, code-quality and release-prep skills, and contribution guidelines.
Out of Scope Changes check ✅ Passed All changes are scope-aligned with the objective of establishing library conventions; the .gitignore and test import cleanup are minor supporting changes directly related to the convention documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch library-conventions

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (6)
CLAUDE.md (2)

8-23: Add language identifier to code block.

The code block should specify a language for proper syntax highlighting and markdown compliance. Use text for the directory tree structure.

📝 Suggested fix
-```
+```text
 packages/
 ├── access/          # access_control, ownable, role_transfer
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 8 - 23, The fenced code block containing the
directory tree should include a language identifier for proper highlighting and
markdown compliance; change the opening fence from ``` to ```text so the block
starting with "packages/" and the tree lines (e.g., "├── access/ ...", "└──
zk-email/ ...") becomes ```text ... ```; ensure you update the single opening
fence only and leave the directory contents unchanged.

27-32: Add language identifier to code block.

The code block should specify a language identifier. Use text for the directory structure.

📝 Suggested fix
-```
+```text
 <package>/src/<module>/
 ├── mod.rs       # docstring, trait (#[contracttrait]), errors, constants, events
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 27 - 32, The markdown code block in CLAUDE.md that
shows the directory tree for "<package>/src/<module>/" is missing a language
identifier; edit CLAUDE.md and change the fenced block to use a language tag
(use "text") by adding ```text before the tree and keeping the closing ```
after, so the block that contains "<package>/src/<module>/", "mod.rs",
"storage.rs", and "test.rs" is fenced as ```text ... ``` to satisfy the linter.
.claude/skills/code-quality.md (3)

297-302: Add language identifier to code block.

The code block should specify a language for proper rendering. Use markdown or text for the documentation example.

📝 Suggested fix
-  ```
+  ```markdown
   /// # Events
   ///
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/code-quality.md around lines 297 - 302, The fenced code block
containing the documentation example starting with "/// # Events" is missing a
language identifier; update the opening fence (the triple backticks before the
"/// # Events" block) to include a language such as markdown or text (e.g.,
change ``` to ```markdown) so the example renders correctly in docs and
syntax-highlighters; target the fenced block around the "/// # Events" comment
in the diff.

360-382: Spelling inconsistency: authorization vs authorisation.

The section header uses "authorization" (American spelling) while line 367 uses "authorisation" (British spelling). Use consistent spelling throughout the document.

✏️ Suggested fix
   siblings do neither — they accept a `caller: &Address` purely for event
   emission. The split must be honoured: `require_auth()` inside a
-  `_no_auth` function, or omitting it from the high-level entry point, is
+  `_no_auth` function, or omitting it from the high-level entry point, is
   a violation.
 - **Never call `require_auth()` twice on the same address inside one

Or update the section header to match:

-### Functions and authorization
+### Functions and authorisation

Choose one spelling and apply it consistently.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/code-quality.md around lines 360 - 382, The document uses
mixed spellings "authorization" and "authorisation"; pick one and make it
consistent (e.g., replace all occurrences of "authorisation" with
"authorization") across this file, including the section header "Functions and
authorization" and the sentence mentioning "borrowed `&Address` arguments" and
`require_auth()` so every instance uses the same spelling.

148-148: Add language identifier to code block.

The code block should specify a language for proper rendering. Use text for the directory structure.

📝 Suggested fix
-```
+```text
 <module>/
 ├── mod.rs       # trait, errors, constants, events, public re-exports
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/code-quality.md at line 148, Update the opening fenced code
block so it specifies the language identifier `text` (change the leading ``` to
```text) for the directory-structure snippet (the block that starts with the
triple backticks and contains "<module>/ ├── mod.rs ...") to ensure correct
rendering.
.claude/skills/release-prep.md (1)

37-37: Line number approximation is slightly off.

The comment states [workspace.package] version (line ~52), but based on the actual Cargo.toml, this section appears around line 44. While the ~ indicates an approximation, consider updating to (line ~44) for better accuracy.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/release-prep.md at line 37, Update the approximate line
number in the review comment so it matches the Cargo.toml location: change the
note that says `[workspace.package] version (line ~52)` to `[workspace.package]
version (line ~44)` (or similar ~44) so the reference to the
`[workspace.package]` section is accurate; edit the comment text that mentions
`[workspace.package]` to reflect the corrected approximate line number.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/skills/code-quality.md:
- Around line 435-441: The documentation contains a duplicated paragraph about
traits and contract types (the block starting "The methods that are closely
relevant..." which repeats the guidance about placing methods under a trait and
providing default implementations); remove the duplicate instance in the
Documentation section so only the original paragraph under "Traits and contract
types" remains, ensuring the remaining text still advises implementing trait
methods on the contract and providing default implementations that use storage
functions.

In @.claude/skills/release-prep.md:
- Line 51: The command includes a macOS-specific PATH export string
("/opt/homebrew/bin:$HOME/.cargo/bin:$PATH"); either remove the
platform-specific prefix and use the platform-agnostic "cargo build" command, or
keep the export but add a short note that the PATH modification is optional and
only needed on macOS/Apple Silicon (explain why the extra PATH entry is required
if there is a specific tool dependency). Update the line containing the PATH
export accordingly and ensure the doc clarifies the platform scope.

---

Nitpick comments:
In @.claude/skills/code-quality.md:
- Around line 297-302: The fenced code block containing the documentation
example starting with "/// # Events" is missing a language identifier; update
the opening fence (the triple backticks before the "/// # Events" block) to
include a language such as markdown or text (e.g., change ``` to ```markdown) so
the example renders correctly in docs and syntax-highlighters; target the fenced
block around the "/// # Events" comment in the diff.
- Around line 360-382: The document uses mixed spellings "authorization" and
"authorisation"; pick one and make it consistent (e.g., replace all occurrences
of "authorisation" with "authorization") across this file, including the section
header "Functions and authorization" and the sentence mentioning "borrowed
`&Address` arguments" and `require_auth()` so every instance uses the same
spelling.
- Line 148: Update the opening fenced code block so it specifies the language
identifier `text` (change the leading ``` to ```text) for the
directory-structure snippet (the block that starts with the triple backticks and
contains "<module>/ ├── mod.rs ...") to ensure correct rendering.

In @.claude/skills/release-prep.md:
- Line 37: Update the approximate line number in the review comment so it
matches the Cargo.toml location: change the note that says `[workspace.package]
version (line ~52)` to `[workspace.package] version (line ~44)` (or similar ~44)
so the reference to the `[workspace.package]` section is accurate; edit the
comment text that mentions `[workspace.package]` to reflect the corrected
approximate line number.

In `@CLAUDE.md`:
- Around line 8-23: The fenced code block containing the directory tree should
include a language identifier for proper highlighting and markdown compliance;
change the opening fence from ``` to ```text so the block starting with
"packages/" and the tree lines (e.g., "├── access/ ...", "└── zk-email/ ...")
becomes ```text ... ```; ensure you update the single opening fence only and
leave the directory contents unchanged.
- Around line 27-32: The markdown code block in CLAUDE.md that shows the
directory tree for "<package>/src/<module>/" is missing a language identifier;
edit CLAUDE.md and change the fenced block to use a language tag (use "text") by
adding ```text before the tree and keeping the closing ``` after, so the block
that contains "<package>/src/<module>/", "mod.rs", "storage.rs", and "test.rs"
is fenced as ```text ... ``` to satisfy the linter.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 32410266-9888-4e69-ae34-281e4e1346ed

📥 Commits

Reviewing files that changed from the base of the PR and between 3f81125 and 0d4eb2b.

📒 Files selected for processing (6)
  • .claude/skills/code-quality.md
  • .claude/skills/release-prep.md
  • .gitignore
  • CLAUDE.md
  • CONTRIBUTING.md
  • packages/tokens/src/fungible/test.rs

Comment thread .claude/skills/code-quality.md Outdated
Comment thread .claude/skills/release-prep.md Outdated
@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.24%. Comparing base (3f81125) to head (87ee905).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #689   +/-   ##
=======================================
  Coverage   96.24%   96.24%           
=======================================
  Files          59       59           
  Lines        6206     6206           
=======================================
  Hits         5973     5973           
  Misses        233      233           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ozgunozerk
ozgunozerk merged commit c5c86c4 into main Apr 29, 2026
7 checks passed
@ozgunozerk
ozgunozerk deleted the library-conventions branch April 29, 2026 13:17
@coderabbitai coderabbitai Bot mentioned this pull request May 4, 2026
2 tasks
@coderabbitai coderabbitai Bot mentioned this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Have LLM-compatible library conventions for helping external contributions

2 participants