code-annotations

bearcove's avatarfrom bearcove

Code annotation requirements for pikru. Use when writing or porting Rust functions from C code. All ported functions must have cref comments.

⭐6stars🔀0forks📁View on GitHub🕐Updated Dec 30, 2025

When & Why to Use This Skill

This Claude skill enforces standardized code annotation requirements for developers porting C code to Rust. By mandating the use of 'cref' comments, it establishes a permanent, traceable link between the new Rust implementation and the original C source code, which is essential for maintaining logic consistency and simplifying long-term maintenance in complex systems.

Use Cases

  • Legacy Code Migration: Ensuring that every Rust function ported from C includes a mandatory reference to its original source for full auditability.
  • Cross-Language Debugging: Using 'cref' annotations to quickly locate and compare the original C logic when troubleshooting discrepancies in the Rust implementation.
  • Maintainability & Knowledge Transfer: Providing future maintainers with immediate context regarding the origin and rationale of ported code blocks, reducing the learning curve for new developers.
namecode-annotations
descriptionCode annotation requirements for pikru. Use when writing or porting Rust functions from C code. All ported functions must have cref comments.

Code Annotations

All Rust functions ported from C must be annotated with a cref comment:

// cref: c_function_name
fn rust_function() { ... }

Purpose

The // cref: comments create a traceable link between the Rust implementation and the original C function it was ported from. This helps:

  • Future maintainers understand the origin of the code
  • Cross-reference behavior between C and Rust implementations
  • Debug discrepancies between the two implementations