Agent skill

Code Review

by ProjectMagma in ProjectMagma/Magma

Review code changes in Magma for correctness, performance, and consistency with project conventions.

MITAuto-check passedDevelopment

Install Code Review

skills CLI
$ npx skills add ProjectMagma/Magma --skill code-review -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ProjectMagma/Magma code-review --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ProjectMagma/Magma.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/skills/code-review .claude/skills/code-review && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
code-review
GitHub stars
113
Token cost
~4.5k tokens
SKILL.md length
2,372 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Review code changes in Magma for correctness, performance, and consistency with project conventions.

  • Works in 4 steps: Gather Code Context (No PR Narrative Yet) → Form an Independent Assessment → Incorporate PR Narrative and Reconcile → …
  • Tasks that involve Code review
  • SKILL.md covers When to Use This Skill, Review Process, Multi-Model Review and Review Output Format, plus 5 more sections
  • Calls git

What it does

Code Review is an agent skill from ProjectMagma/Magma. Review code changes in Magma for correctness, performance, and consistency with project conventions. Use when reviewing PRs or code changes.

Its SKILL.md is about 4.5k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Code review. The licence is MIT.

When your agent uses it

  • Tasks that involve Code review

Example prompts

  • “/code-review”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Gather Code Context (No PR Narrative Yet)
  2. Form an Independent Assessment
  3. Incorporate PR Narrative and Reconcile
  4. Detailed Analysis

What it can do on your machine

Read from SKILL.md and the folder at commit cf955a9. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Code Review loads about 4.5k tokens when it runs. Until then it costs about 38 tokens; SKILL.md has 2,372 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~38
When it runs · the whole SKILL.md, loaded when a task matches
~4.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ProjectMagma/Magma at commit cf955a9, republished under its MIT licence (© ProjectMagma). 2,372 words, ~4,526 tokens.

Download SKILL.mdSave it as .claude/skills/code-review/SKILL.md (or your agent's skills folder).
name
code-review
description
Review code changes in Magma for correctness, performance, and consistency with project conventions. Use when reviewing PRs or code changes.

Magma Code Review

Review code changes against conventions and patterns established in the Magma codebase. Magma is a high-performance, low-level network stack library for .NET that provides zero-copy packet processing through kernel-bypass transports (AF_XDP, NetMap) and TUN/TAP interfaces (WinTun).

Reviewer mindset: Be polite but very skeptical. Your job is to find problems the author may have missed and to question the approach. Treat the PR description and linked issues as claims to verify, not facts to accept.

When to Use This Skill

Use this skill when:

  • Reviewing a PR or code change in Magma
  • Checking code for correctness, performance, style, or consistency issues before submitting a PR
  • Asked to review, critique, or provide feedback on code changes
  • Validating that a change follows Magma conventions

Review Process

Step 0: Gather Code Context (No PR Narrative Yet)

Before analyzing anything, collect as much relevant code context as you can. Do NOT read the PR description, linked issues, or existing review comments yet. You must form your own independent assessment before being exposed to the author's framing.

  1. Diff and file list: Fetch the full diff and the list of changed files.
  2. Full source files: For every changed file, read the entire source file (not just the diff hunks). You need surrounding code to understand invariants, packet processing chains, and memory lifetimes.
  3. Consumers and callers: If the change modifies a public/internal API, an interface method, or a packet processing delegate, search for how consumers use the functionality. Understanding how the code is consumed reveals whether the change could break existing behavior.
  4. Sibling types and related code: If the change fixes a bug or adds a pattern in one transport or protocol, check whether other transports or protocols have the same issue or need the same fix.
  5. Key utility/helper files: If the diff calls into shared utilities (e.g. Checksum, IPAddress types), read those to understand the contracts.
  6. Git history: Check recent commits to the changed files (git log --oneline -20 -- <file>). Look for related recent changes or prior attempts to fix the same problem.
Step 1: Form an Independent Assessment

Based only on the code context gathered above (without the PR description or issue), answer these questions:

  1. What does this change actually do? Describe the behavioral change in your own words.
  2. Why might this change be needed? Infer the motivation from the code itself.
  3. Is this the right approach? Would a simpler alternative be more consistent with the codebase?
  4. What problems do you see? Identify bugs, edge cases, memory safety issues, performance regressions, and anything else that concerns you.

Write down your independent assessment before proceeding. You must produce a holistic assessment (see Holistic PR Assessment) at this stage.

Step 2: Incorporate PR Narrative and Reconcile

Now read the PR description, labels, linked issues, author information, and existing review comments. Treat all of this as claims to verify, not facts to accept.

  1. PR metadata: Fetch the PR description, labels, linked issues, and author.
  2. Existing review comments: Check if there are already review comments on the PR to avoid duplicating feedback.
  3. Reconcile your assessment with the author's claims. Where your independent reading of the code disagrees with the PR description, investigate further — but do not simply defer to the author's framing.
  4. Update your holistic assessment if the additional context reveals information that genuinely changes your evaluation.
Step 3: Detailed Analysis
  1. Focus on what matters. Prioritize binary layout correctness, memory safety, endianness bugs, checksum errors, performance regressions in hot paths, and protocol correctness. Do not comment on trivial style issues unless they violate an explicit rule below.
  2. Consider collateral damage. For every changed code path, actively brainstorm: what other scenarios, callers, or inputs flow through this code? Could any of them break or behave differently after this change?
  3. Be specific and actionable. Every comment should tell the author exactly what to change and why. Reference the relevant convention. Include evidence of how you verified the issue is real.
  4. Flag severity clearly:
    • ❌ error — Must fix before merge. Bugs, safety issues, protocol violations, test gaps for behavior changes.
    • ⚠️ warning — Should fix. Performance issues, missing validation, inconsistency with established patterns.
    • 💡 suggestion — Consider changing. Style improvements, minor readability wins, optional optimizations.
  5. Don't pile on. If the same issue appears many times, flag it once with a note listing all affected locations.
  6. Respect existing style. When modifying existing files, the file's current style takes precedence over general guidelines.
  7. Don't flag what CI catches. Do not flag issues that a compiler or CI build step would catch.
  8. Avoid false positives. Before flagging any issue, verify the concern actually applies given the full context.

Multi-Model Review

When the environment supports launching sub-agents with different models (e.g., the task tool with a model parameter), run the review in parallel across multiple model families to get diverse perspectives. If the environment does not support this, proceed with a single-model review.

How to execute (when supported):

  1. Inspect the available model list and select one model from each distinct model family. Use at least 2 and at most 4 models. Pick the highest capability tier from each family. Do not select the same model that is already running the primary review.
  2. Launch a sub-agent for each selected model in parallel, giving each the same review prompt.
  3. Wait for all agents to complete, then synthesize: deduplicate findings, elevate issues flagged by multiple models, and include unique findings that meet the confidence bar. Timeout: If a sub-agent has not completed after 10 minutes, proceed with the results you have.
  4. Present a single unified review, noting when an issue was flagged by multiple models.

Review Output Format

Structure
## Code Review — PR #<number>

### Holistic Assessment

**Motivation**: <1-2 sentences on whether the PR is justified and the problem is real>

**Approach**: <1-2 sentences on whether the fix/change takes the right approach>

**Summary**: <✅ LGTM / ⚠️ Needs Human Review / ⚠️ Needs Changes / ❌ Reject>. <2-3 sentence summary of the overall verdict and key points.>

---

### Detailed Findings

#### ✅/⚠️/❌ <Category Name> — <Brief description>

<Explanation with specifics. Reference code, line numbers, etc.>

(Repeat for each finding category.)
Guidelines
  • Holistic Assessment comes first and covers Motivation, Approach, and Summary.
  • Detailed Findings uses emoji-prefixed category headers:
    • ✅ for things that are correct / look good
    • ⚠️ for warnings or impactful suggestions
    • ❌ for errors (must fix before merge)
    • 💡 for minor suggestions or observations
  • Summary gives a clear verdict: LGTM, Needs Human Review, Needs Changes, or Reject.
  • Never give a blanket LGTM when you are unsure. Use "Needs Human Review" instead.
Verdict Consistency Rules
  1. The verdict must reflect your most severe finding. If you have any ⚠️ findings, the verdict cannot be "LGTM."
  2. When uncertain, always escalate to human review.
  3. Separate code correctness from approach completeness. A change can be correct code that is an incomplete approach.
  4. Classify each ⚠️ and ❌ finding as merge-blocking or advisory.
  5. Devil's advocate check before finalizing. Re-read all your ⚠️ findings and ask: does this represent an unresolved concern?

Holistic PR Assessment

Before reviewing individual lines of code, evaluate the PR as a whole.

Motivation & Justification
  • Every PR must articulate what problem it solves and why. Don't accept vague or absent motivation.
  • Challenge every addition with "Do we need this?" New abstractions, APIs, and flags must justify their existence.
  • Require performance data for optimization PRs. Never accept performance claims at face value.
Approach & Alternatives
  • Check whether the PR solves the right problem at the right layer. Prefer fixing the actual source of an issue over adding workarounds.
  • Ask "Why not just X?" — always prefer the simplest solution.
  • Explicitly weigh whether the change is a net positive. Complexity is a first-class cost.
Scope & Focus
  • Require large or mixed PRs to be split into focused changes. Each PR should address one concern.
  • Defer tangential improvements to follow-up PRs.

Correctness & Safety

Binary Layout & Wire Format
  • All packet header structs must use [StructLayout(LayoutKind.Sequential, Pack = 1)]. Missing or incorrect attributes will cause wire-format misalignment. Verify field ordering matches the protocol specification.
  • Verify TryConsume bounds checks. Every TryConsume method must check input.Length >= Unsafe.SizeOf<T>() before performing Unsafe.As casts. Missing bounds checks are buffer overread vulnerabilities.
  • Verify Unsafe.As<byte, T>() is only used on pinned or stack-local spans. The reference must not move during the cast.
  • Header fields must be in wire order. The struct field order must exactly match the protocol's on-wire byte layout. Bit fields must use the correct shifting and masking.
Endianness
  • All multi-byte wire fields must handle network byte order. Ports, lengths, addresses, protocol numbers, and checksums are big-endian on the wire. Use IPAddress.NetworkToHostOrder() or BinaryPrimitives for conversion.
  • Verify endianness in both read and write paths. A common bug is converting correctly on read but forgetting to convert back on write (or vice versa).
  • EtherType values are already in network byte order. The EtherType enum values in Magma are defined in network byte order — do not double-convert.
Show full SKILL.md (964 more words)Show less
Checksum
  • Verify RFC-compliant Internet checksum calculations. Checksums must follow RFC 791/793/1071/1141/1624. Check for correct one's complement addition with carry.
  • TCP/UDP checksums require pseudo-header sums. Verify that the pseudo-header (source IP, destination IP, protocol, length) is included.
  • Incremental checksum updates must preserve correctness. When modifying a field in-place, the checksum must be updated incrementally or recomputed from scratch.
Memory Safety
  • Buffer lifetimes must be respected. Span<T> and ref references must not outlive the buffer they point into. Watch for captures of Span in closures or async methods (which is a compiler error, but verify related patterns).
  • IMemoryOwner<byte> must be disposed or passed along. The TryConsume pattern on IPacketReceiver returns default to indicate the packet was consumed (and the owner is now managed by the receiver). Returning the input means the caller still owns it.
  • Ring buffer index management must be correct. In AF_XDP and NetMap transports, verify that fill/completion/TX/RX ring indices are properly advanced and wrapped. Double-reservation or missed replenishment causes packet loss or hangs.
Transport-Specific Correctness
  • AF_XDP: Verify UMEM frame management (allocation, deallocation, recycling), XDP socket bind options, and that the fill ring is replenished after consuming from the RX ring.
  • NetMap: Verify ring slot management, NETMAP_BUF offset calculations, and that nm_ring_next is used correctly.
  • WinTun: Verify WinTun session packet allocation and release patterns, and correct use of async event handles.
Error Handling
  • Use Debug.Assert for internal invariants, not exceptions. For internal-only callers, assert assumptions rather than throwing.
  • Include actionable details in exception messages. Use nameof for parameter names.
  • Use ThrowIf helpers over manual checks. Use ObjectDisposedException.ThrowIf, ArgumentOutOfRangeException.ThrowIfNegative, etc.
Thread Safety
  • Packet receive loops run on dedicated threads. Verify that shared state accessed from receive threads is properly synchronized.
  • Use Volatile or Interlocked for cross-thread field access. Fields written on one thread and read on another must use appropriate synchronization.

Performance & Allocations

Hot Path Rules

Packet receive and transmit paths are the hottest code in Magma. These rules apply strictly to code in those paths:

  • Zero heap allocations. No new objects, no closures, no boxing, no LINQ, no string operations in packet processing loops.
  • Use stack-allocated structs. All packet headers are value types for a reason — do not box them or store them on the heap.
  • Use Span<T> and ref parameters. Avoid copying packet data. The zero-copy architecture is fundamental to Magma's performance.
  • Minimize branching. Prefer branchless patterns where possible in inner loops.
General Performance
  • Pre-allocate collections when size is known. Pass capacity to Dictionary, HashSet, List constructors.
  • Avoid closures and delegate allocations. When a lambda captures locals, it allocates a closure object on every invocation.
  • Cache repeated accessor calls in locals. Store results of repeated property/getter calls in local variables.
  • Place cheap checks before expensive operations. Order conditionals so cheapest/most-common checks come first.

Code Style & Formatting

All rules from .EditorConfig are enforced. Key rules:

  • Use var in all cases (enforced at error level).
  • No this. prefix (enforced at error level).
  • Prefer language keywords (string not String, int not Int32) (enforced at error level).
  • No throw expressions (enforced at error level).
  • Prefer null propagation (?.) and coalesce expressions (??) (enforced at error level).
  • Prefer out var for inline declarations (enforced at error level).
  • Prefer expression-bodied members where applicable (suggestion level).
  • Prefer pattern matching over is with cast check or as with null check (warning level).
  • Allman-style braces — newline before all opening braces.
  • Sort using directives with System first.
  • Use explicit using directives — implicit usings are disabled.
  • Nullable reference types are disabled globally. Do not enable per-project.
Additional Conventions
  • Use Unsafe.SizeOf<T>() for header size calculations (not sizeof or Marshal.SizeOf).
  • Use PascalCase for constants.
  • Prefer early return to reduce nesting.
  • Delete dead code and unnecessary wrappers. Remove obsolete fields and unused variables when encountered.
  • Do not initialize fields to default values. The CLR zero-initializes fields; explicit = false, = 0, = null is redundant.

Testing

  • Test projects use the .Facts suffix (e.g. Magma.Common.Facts), not .Tests.
  • Always add regression tests for bug fixes and behavior changes. Prefer adding test cases to existing test files rather than creating new ones.
  • Do not emit "Act", "Arrange" or "Assert" comments in test methods.
  • Do not add regression comments citing issue numbers unless explicitly asked.
  • Test assertions must be specific. Assert exact expected values, not broad conditions.
  • Test edge cases. Include empty spans, minimum-size packets, maximum-size packets, and malformed headers.
  • Packet parsing tests should use hex byte arrays. Follow the existing pattern of "00-15-5D-..." style hex string conversion.
  • Do not finish work with tests commented out or disabled that were not previously so.
  • When running tests, verify they actually ran by checking test run counts in the output.

Protocol Implementation

  • Follow the relevant RFC specification. When implementing or modifying protocol headers, cite the RFC section number in comments for non-obvious field layouts.
  • Bit field manipulation must be correct. Verify shift amounts and masks for packed fields (e.g. IPv4 version + IHL in one byte, TCP data offset + flags).
  • New protocol implementations must integrate into the packet processing chain. Verify that ConsumeInternetLayer, IPv4ConsumeTransportLayer, or equivalent delegates are updated to route to the new protocol.
  • Checksum-validated protocols must verify checksums on receive and compute them on transmit.

Kestrel Integration

Magma integrates with ASP.NET Core Kestrel as a custom transport:

  • ITransport implementations (AF_XDP, NetMap) must correctly implement BindAsync/UnbindAsync lifecycle.
  • TcpConnection<T> extends Kestrel's TransportConnection. Changes to connection state management must respect Kestrel's threading model and PipeScheduler.
  • IPacketReceiver implementations must correctly return default (consumed) or input (not consumed) to control whether packets are passed to the host OS.
  • Memory pool integration must use Kestrel's shared MemoryPool<byte> for pipeline buffers.

Documentation & Comments

  • Comments should explain why, not restate code. Delete comments that just duplicate the code in English.
  • Delete or update obsolete comments when code changes.
  • For markdown (.md) files, ensure no trailing whitespace at the end of any line.
  • Do not duplicate comments on interface implementations. Documentation belongs on the interface definition.

© ProjectMagma, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/skills/code-review of ProjectMagma/Magma.

Open the folder on GitHubat commit cf955a9

Compare with similar skills

Code Review next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Code Review compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Code Review this skillProjectMagma/Magma113—~4.5kAutomated safety check: PassMIT
PR Babysitteropeninterpreter/openinterpreter69k3 repos~4.2kAutomated safety check: PassApache-2.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
Backend Code Reviewlangflow-ai/langflow156k—~3.5kAutomated safety check: NotesMIT
Understand Diff AnalysisEgonex-AI/Understand-Anything86k1 repos~1.4kAutomated safety check: PassMIT
Mole Bug Patternstw93/Mole70k—~2kAutomated safety check: PassGPL-3.0

Similar skills

  • PR Babysitter

    openinterpreter/openinterpreter

    Watches an open GitHub pull request until it merges, handling review comments, diagnosing CI failures and retrying flaky checks along the way.

    69k GitHub starsUsed in 3 repos~4.2k tokens
    DevelopmentAuto-check passed
  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Backend Code Review

    langflow-ai/langflow

    Review backend code for quality, security, maintainability, and best practices based on established checklist rules.

    156k GitHub stars~3.5k tokensUpdated today
    DevelopmentAuto-check: notes
  • Understand Diff Analysis

    Egonex-AI/Understand-Anything

    Reads your git changes or a pull request against a prebuilt knowledge graph of the project to explain what changed, which components are affected and what is risky.

    86k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.

    70k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check passed
  • Backend Code Review

    langgenius/dify

    Reviews backend code under api/ for concrete, reproducible defects, routes to rule packs for architecture, schema, repositories and SQLAlchemy, and ranks findings from P0 to P3.

    158k GitHub stars~676 tokensUpdated today
    DevelopmentAuto-check passed

Categories

Questions about Code Review

What does Code Review do?

Review code changes in Magma for correctness, performance, and consistency with project conventions. Code Review is an agent skill from ProjectMagma/Magma. Review code changes in Magma for correctness, performance, and consistency with project conventions.

When should I use Code Review?

Code Review fits situations like: tasks that involve Code review.

How do I install Code Review in Claude Code?

Run `npx skills add ProjectMagma/Magma --skill code-review -a claude-code`. Or copy the skill folder (.github/skills/code-review in ProjectMagma/Magma) into .claude/skills/code-review in your project. Claude Code loads it when a task matches its description.

How do I install Code Review in Codex?

Run `npx skills add ProjectMagma/Magma --skill code-review -a codex`. Or copy the skill folder (.github/skills/code-review in ProjectMagma/Magma) into .agents/skills/code-review in your project. Codex loads it when a task matches its description.

Can I use Code Review in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ProjectMagma/Magma --skill code-review -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/code-review, .gemini/skills/code-review, .github/skills/code-review and .opencode/skills/code-review in your project.

What does Code Review need to run?

Going by SKILL.md and its folder, Code Review needs the command-line tools its instructions call (git).

Does Code Review access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Code Review safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Code Review use?

Code Review is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Code Review use?

About 4.5k tokens (SKILL.md is roughly 18k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Code Review?

Skills that share tags, products or a category with Code Review: PR Babysitter (openinterpreter/openinterpreter, 69k stars), Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars), Backend Code Review (langflow-ai/langflow, 156k stars) and Understand Diff Analysis (Egonex-AI/Understand-Anything, 86k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Code Review?

ProjectMagma (a GitHub organization) maintains it in ProjectMagma/Magma, which has 113 GitHub stars. The repository was last updated on February 12, 2026.

Source: ProjectMagma/Magma on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.