Skip to content
Back to skills

Nbt

ASecurity

Use the nbt! macro from mc_protocol for creating NBT (Named Binary Tag) data for Minecraft protocol encoding.

  • 61 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 6, 2026
developmentrust

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add plurigrid/asi --skill nbt --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nbt?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nbt
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/plurigrid-nbt/badge)](https://www.skillsdirectory.com/skills/plurigrid-nbt)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nbt
description: Use the nbt! macro from mc_protocol for creating NBT (Named Binary Tag) data for Minecraft protocol encoding.
---

# NBT Encoding Skill

Use the `nbt!` macro from `mc_protocol` for creating NBT data.

## When to Use

Use this skill when you need to:
- Encode NBT data for Minecraft packets
- Create text components for chat, action bar, titles
- Build compound NBT structures

## Basic Usage

```rust
use mc_protocol::nbt;

// Simple compound
let compound = nbt! {
    "text" => "Hello",
    "count" => 42i32,
    "flag" => true,
};

// Convert to network bytes
let bytes = compound.to_network_bytes();
```

## Nested Compounds

```rust
use mc_protocol::nbt;

let nested = nbt! {
    "outer" => nbt! {
        "inner" => 123i32,
    },
};
```

## Supported Types

- `i8` - Byte
- `i16` - Short
- `i32` - Int
- `i64` - Long
- `f32` - Float
- `f64` - Double
- `&str` / `String` - String
- `bool` - Byte (0 or 1)
- `NbtCompound` - Nested compound
- `NbtList` - List of same-type elements

## Text Components (Chat/Action Bar)

For Minecraft text components (used in chat, action bar, titles):

```rust
use mc_protocol::nbt;

// Simple text
let text_component = nbt! {
    "text" => "Hello World",
};

// With color
let colored = nbt! {
    "text" => "Red text",
    "color" => "red",
};
```

## Best Practices

1. **Always use the `nbt!` macro** instead of manual byte manipulation
2. Use explicit type suffixes (`42i32`, `1.0f32`) for numeric literals
3. Use `to_network_bytes()` for protocol encoding (adds type tag, no root name)

Files in this skill

  • CONCOMITANT_SKILLS.md472 B
  • SKILL.md1.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.