Agent skill

Snowbank Slices And Buffers

by SnowBankSDK in SnowBankSDK/foundationdb-dotnet-client

How to correctly use the Slice type and its companions (SliceReader, SliceWriter, SliceOwner) for binary data in the FoundationDB .NET client / SnowBank.Core codebase.

BSD-3-ClauseAuto-check passedDatabases

Install Snowbank Slices And Buffers

skills CLI
$ npx skills add SnowBankSDK/foundationdb-dotnet-client --skill snowbank-slices-and-buffers -a claude-code

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

GitHub CLI
$ gh skill install SnowBankSDK/foundationdb-dotnet-client snowbank-slices-and-buffers --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/SnowBankSDK/foundationdb-dotnet-client.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/snowbank-slices-and-buffers .claude/skills/snowbank-slices-and-buffers && 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
snowbank-slices-and-buffers
GitHub stars
158
Token cost
~2.8k tokens
SKILL.md length
862 words
Files
3 (incl. references)
Skills in repo
3
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

How to correctly use the Slice type and its companions (SliceReader, SliceWriter, SliceOwner) for binary data in the FoundationDB .NET client / SnowBank.Core codebase.

  • Works in 11 steps: Nil vs Empty — the #1 gotcha → Slice is a view — copy when you must own… → Constructing a Slice → …
  • Code constructs
  • SKILL.md covers 1. Nil vs Empty — the #1 gotcha, 2. Slice is a view — copy when…, 3. Constructing a Slice and 4. Reading values back, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Snowbank Slices And Buffers is an agent skill from SnowBankSDK/foundationdb-dotnet-client. How to correctly use the Slice type and its companions (SliceReader, SliceWriter, SliceOwner) for binary data in the FoundationDB .NET client / SnowBank.Core codebase. Slice is a readonly struct (namespace System) — the logical equivalent of a ReadOnlyMemory of bytes with many helpers. Use whenever code constructs or reads a Slice, converts between bytes and other types (Slice.FromBytes/FromStringUtf8/FromInt32/FromFixed64/ToInt64/ToStringUtf8/AsSlice/ToArray), builds or parses a binary buffer…

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/buffers-and-pooling.md` and `references/span-readers-writers.md`).

It sits in Databases, covering NoSQL databases. It works with .NET and C#. The repository describes itself as: C/.NET Binding for FoundationDB Client API. The licence is BSD-3-Clause.

When your agent uses it

  • Code constructs
  • Converts between bytes and other types (Slice.FromBytes/FromStringUtf8/FromInt32/FromFixed64/ToInt64/ToStringUtf8/AsSlice/ToArray)
  • Parses a binary buffer (SliceWriter/SliceReader)
  • Rents pooled buffers (SliceOwner/ArrayPool)

Example prompts

  • “/snowbank-slices-and-buffers”

Workflow steps

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

  1. Nil vs Empty — the #1 gotcha
  2. Slice is a view — copy when you must own it
  3. Constructing a Slice
  4. Reading values back
  5. Comparison & equality
  6. SliceWriter — build a buffer
  7. SliceReader — parse a buffer
  8. SliceOwner — pooled, disposable Slices
  9. Span / Memory interop & ISpanEncodable
  10. Round-trip example
  11. Self-check

What it can do on your machine

Read from SKILL.md and the folder at commit fdd65b1. 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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are csharp).

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

  • Network

    No URLs in SKILL.md.

    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

Snowbank Slices And Buffers loads about 2.8k tokens when it runs, and up to ~5k if it reads all its reference files. Until then it costs about 199 tokens; SKILL.md has 862 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~199
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~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 SnowBankSDK/foundationdb-dotnet-client at commit fdd65b1, republished under its BSD-3-Clause licence (© SnowBankSDK). 862 words, ~2,768 tokens.

Download SKILL.mdSave it as .claude/skills/snowbank-slices-and-buffers/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
snowbank-slices-and-buffers
description
How to correctly use the Slice type and its companions (SliceReader, SliceWriter, SliceOwner) for binary data in the FoundationDB .NET client / SnowBank.Core codebase. Slice is a readonly struct (namespace System) — the logical equivalent of a ReadOnlyMemory of bytes with many helpers. Use whenever code constructs or reads a Slice, converts between bytes and other types (Slice.FromBytes/FromStringUtf8/FromInt32/FromFixed64/ToInt64/ToStringUtf8/AsSlice/ToArray), builds or parses a binary buffer (SliceWriter/SliceReader), rents pooled buffers (SliceOwner/ArrayPool), or worries about Nil-vs-Empty, endianness, or which integer encoding to use. For the Span-of-byte (Span-first) equivalents and the low-level buffer/pool machinery, see the bundled reference files.

Slice, SliceReader, SliceWriter & friends

Slice is the workhorse for binary data in this codebase. It is a readonly struct (in namespace System) that wraps a segment of a byte[] — its three fields are Array (the backing array, possibly null), Offset, and Count. It predates Span<T> and is the logical equivalent of ReadOnlyMemory<byte>, but with a large library of helpers for turning bytes into and out of real-world types. Keys and values in the FoundationDB binding are Slices.

Two things to internalize first: (1) a Slice is a view, not a copy — it shares the backing array. (2) Slice.Nil (no array) and Slice.Empty (zero-length array) are different and the distinction is load-bearing. Both are covered below.

For the Span-first equivalents (SpanReader/SpanWriter, ISpanEncodable) read references/span-readers-writers.md; for pooled buffer-building (ISliceBufferWriter, SlicePool, ValueBuffer<T>, allocators) read references/buffers-and-pooling.md.

1. Nil vs Empty — the #1 gotcha

Slice.NilSlice.Empty
backing arraynone (null-like)a zero-length array
IsNulltruefalse
IsEmptyfalsetrue
IsNullOrEmptytruetrue
IsPresentfalsetrue
GetBytes()returns nullreturns an empty array
ToStringUtf8()returns nullreturns ""
==Nil != Emptydistinct
CompareToNil and Empty compare equal (both sort first)

tr.GetAsync(key) returns Slice.Nil for a missing key, so the canonical "does it exist?" check is value.IsNull (or IsNullOrEmpty if an empty value also counts as absent). Use Nil to mean absent and Empty to mean present but zero-length.

csharp
var v = await tr.GetAsync(key);
if (v.IsNull) { /* key does not exist */ }

2. Slice is a view — copy when you must own it

Constructing a Slice from a byte[] does not copy; the Slice references the array, so mutations to the array are visible through the slice (and its .Span). When you need an independent owner, copy:

csharp
byte[] buf = ...;
var view = buf.AsSlice();        // shares buf — buf[i] = x is visible through view
byte[] mine = view.ToArray();    // defensive copy
buf[0] = 0xFF;                   // changes `view`, not `mine`

3. Constructing a Slice

csharp
// from arrays / spans
byte[] b = ...;
b.AsSlice();                 b.AsSlice(offset, count);
new ArraySegment<byte>(b, o, n).AsSlice();
Slice.FromBytes("abc"u8);    // copies a ReadOnlySpan<byte>

// from text
Slice.FromStringUtf8("héllo");   Slice.FromString("héllo");   // UTF-8
Slice.FromStringAscii("ABC");    // ASCII only — lossy/throws on chars > 0x7F

// well-known
Slice.Empty;   Slice.Nil;   Slice.Zero(16);   // 16 zero bytes

// guids / uuids / hex
Slice.FromGuid(g);   Slice.FromUuid128(u);   Slice.FromHexString("00ff1234");
Three integer encodings — pick deliberately

This is a classic source of bugs. They are not interchangeable:

FactoryEncodingSize (int32)Read back with
Slice.FromInt32(v)minimal little-endian (leading zero bytes dropped)1–4 bytesslice.ToInt32()
Slice.FromFixed32(v)fixed little-endianalways 4 bytesslice.ToInt32()
Slice.FromVarint32(v)7-bit LEB128 varint1–5 bytes(via SliceReader.ReadVarInt32)

Every variant has a big-endian twin (FromInt32BE, FromFixed32BE, …) and 16/24/64/128-bit widths, plus floats (FromSingle/FromDouble) and FromDecimal. Big-endian fixed encodings are what you want when a number must sort correctly as a key. The minimal FromInt32 is for standalone values you read whole with ToInt32() — it is not self-delimiting, so don't use it mid-stream (in a SliceWriter, use the fixed-width WriteInt32/WriteInt64 or WriteVarInt* there; see §6).

⚠️ Naming differs between Slice and the writer/reader. On Slice (standalone), FromFixed32 = 4 bytes and FromInt32 = minimal. On SliceWriter/SliceReader (streams), the fixed-width method is plain WriteInt32/ReadInt32 (4 bytes LE; *BE for big-endian), and the varint is WriteVarInt32/ReadVarInt32. (WriteFixed32/ReadFixed32 exist but are [Obsolete] — use WriteInt32/ReadInt32.)

4. Reading values back

csharp
slice.ToInt64();   slice.ToInt32BE();   slice.ToGuid();   slice.ToUuid128();
slice.ToStringUtf8();    // Nil -> null, Empty -> ""
slice.ToArray();         // defensive copy to byte[]
slice.ToHexString();

// zero-copy access to the bytes
ReadOnlySpan<byte> span = slice.Span;
ReadOnlyMemory<byte> mem = slice.Memory;

// slicing (negative indices count from the end)
slice.Substring(7, 6);   slice[2..5];   slice[^1..];

5. Comparison & equality

Slice compares lexicographically by raw bytes (the same order FoundationDB sorts keys), is offset/array-independent (equal content compares equal regardless of backing array or offset), and supports ==, <, >, CompareTo, StartsWith, EndsWith, IndexOf. For dictionaries/sorted sets, use Slice.Comparer.Default (an IComparer<Slice> + IEqualityComparer<Slice>).

csharp
a.CompareTo(b) < 0;            // a sorts before b
key.StartsWith(prefix);        // prefix match
var set = new SortedSet<Slice>(Slice.Comparer.Default);
Show full SKILL.md (391 more words)Show less

6. SliceWriter — build a buffer

SliceWriter is a mutable, growable builder (struct, IBufferWriter<byte>, IDisposable). Start from default(SliceWriter) (heap-backed, grows as needed) or new SliceWriter(pool) (rents from an ArrayPool<byte>):

csharp
var w = new SliceWriter();
w.WriteInt32(42);                    // fixed 4 bytes LE  (self-delimiting)
w.WriteVarInt32(1000);               // LEB128            (self-delimiting)
w.WriteVarString("hello");           // length-prefixed UTF-8
w.WriteStringUtf8("raw");            // raw UTF-8, NO length prefix
w.WriteBytes(payload);               // append bytes
Slice result = w.ToSlice();          // the written region (a view into the writer's buffer)
  • Use self-delimiting writes (fixed-width WriteInt32/WriteInt64/…, WriteVarInt*, WriteVarString) for anything you'll parse back sequentially. A raw WriteStringUtf8/WriteBytes has no length, so the reader must already know the length.
  • Position, Reset(), Rewind(), Skip(n), Allocate(n)/AllocateSpan(n) (reserve space to fill in place).
  • Pooling caveat: if you pass an ArrayPool<byte>, you must either Dispose() the writer or hand the buffer off with ToSliceOwner() — otherwise the rented array is never returned. ToSlice() returns a view into the writer's buffer; if the writer (or its pooled buffer) is disposed/reused, that view becomes invalid — ToArray() or ToSliceOwner() it to keep it.

7. SliceReader — parse a buffer

SliceReader is a forward cursor over a Slice. Pair each read with the matching write:

csharp
var r = result.ToSliceReader();
int n     = r.ReadInt32();           // <-> WriteInt32  (fixed 4 bytes)
uint k    = r.ReadVarInt32();        // <-> WriteVarInt32
string s  = r.ReadVarString();       // <-> WriteVarString
// raw / fixed-length string written without a prefix: read the known number of bytes
string raw = r.ReadBytes(3).ToStringUtf8();
Slice rest = r.ReadToEnd();

Remaining, HasMore, Head (bytes already read), Tail (bytes not yet read), and non-advancing PeekByte()/PeekBytes(n) round out the API. There is no ReadStringUtf8(n) — use ReadBytes(n).ToStringUtf8().

8. SliceOwner — pooled, disposable Slices

SliceOwner is a rented Slice that returns its buffer to an ArrayPool<byte> on Dispose — the allocation-free analogue of IMemoryOwner<byte>. The contract: you MUST Dispose it, and MUST NOT use its data afterward.

csharp
using (var owner = Slice.FromBytes(payload, ArrayPool<byte>.Shared))
{
    Slice data = owner.Data;     // valid only inside the using
    Use(data.Span);
}   // buffer returned to the pool here

owner.IsValid, owner.Count, owner.Span, owner.Pool; SliceOwner.Wrap/Create/Copy and writer.ToSliceOwner() produce them. Don't let an owner's Data escape the using.

9. Span / Memory interop & ISpanEncodable

Slice interops freely with the modern primitives: slice.Span (ReadOnlySpan<byte>), slice.Memory (ReadOnlyMemory<byte>), byte[].AsSlice(). Many hot types (keys, values, the writers) implement ISpanEncodable so they can be rendered into a caller's buffer with no intermediate Slice allocation — TryGetSpan(out span) / TryGetSizeHint(out size) / TryEncode(dest, out written). That interface is how subspace.Key(...)/FdbValue.* write themselves into pooled buffers at the last moment.

For working directly over Span<byte> (a caller-owned, fixed buffer) instead of Slice, use SpanReader/SpanWriter — see references/span-readers-writers.md.

10. Round-trip example

csharp
// build
var w = new SliceWriter();
w.WriteInt32(order.Id);
w.WriteVarString(order.Customer);
w.WriteVarInt64(order.Total);
Slice packed = w.ToSlice();

// parse
var r = packed.ToSliceReader();
int id        = r.ReadInt32();
string cust   = r.ReadVarString();
long total    = (long) r.ReadVarInt64();

11. Self-check

  • Did I use IsNull/IsNullOrEmpty (not == Slice.Empty) to test for a missing value?
  • Am I treating Slice as a view — copying with ToArray()/ToSliceOwner() before mutating shared arrays or outliving a pooled buffer?
  • Did I pick the right integer encoding (Fixed*/*BE for sortable keys; VarInt*/Fixed* for self-delimiting stream fields; FromInt32 only for standalone whole-slice values)?
  • Do my SliceWriter writes and SliceReader reads pair up (WriteInt32↔ReadInt32, VarInt↔VarInt, VarString↔VarString)?
  • If I rented from an ArrayPool (SliceWriter(pool) / SliceOwner), did I Dispose/ToSliceOwner() so the buffer returns to the pool — and not use the data after disposal?

© SnowBankSDK, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in .claude/skills/snowbank-slices-and-buffers of SnowBankSDK/foundationdb-dotnet-client.

  • SKILL.md
  • references/buffers-and-pooling.md
  • references/span-readers-writers.md

Open the folder on GitHubat commit fdd65b1

Compare with similar skills

Snowbank Slices And Buffers 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.

Snowbank Slices And Buffers compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Snowbank Slices And Buffers this skillSnowBankSDK/foundationdb-dotnet-client158—~2.8kAutomated safety check: PassBSD-3-Clause
Scaffoldingdotnet/efcore15k—~321Automated safety check: PassMIT
Blockchain IndexingNethereum/Nethereum2.3k—~4.8kAutomated safety check: PassMIT
Migrating Oracle To Postgres Data Access Codegithub/awesome-copilot40k—~2kAutomated safety check: PassMIT
Dotnet Architectaiskillstore/marketplace4337 repos~1.9kAutomated safety check: PassNone
Minimax DOCXpoco-ai/poco-claw1.4k7 repos~3.9kAutomated safety check: PassMIT

Similar skills

  • Scaffolding

    dotnet/efcore

    Official

    Implementation details for EF Core scaffolding (reverse engineering).

    15k GitHub stars~321 tokensUpdated yesterday
    DatabasesAuto-check passed
  • Blockchain Indexing

    Nethereum/Nethereum

    Index blockchain data (blocks, transactions, logs, tokens) to PostgreSQL/SqlServer/SQLite with progress tracking, reorg handling, and hosted services (.NET/C).

    2.3k GitHub stars~4.8k tokensUpdated 6 days ago
    DatabasesAuto-check passed
  • Dotnet Architect

    aiskillstore/marketplace

    Expert .NET backend architect specializing in C, ASP.NET Core, Entity Framework, Dapper, and enterprise application patterns.

    433 GitHub starsUsed in 7 repos~1.9k tokens
    Backend & APIsAuto-check passed
  • Minimax DOCX

    poco-ai/poco-claw

    Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET).

    1.4k GitHub starsUsed in 7 repos~3.9k tokens
    Documents & OfficeAuto-check passed
  • Speckit Constitution

    WeihanLi/WeihanLi.Common

    Create or update the project constitution from interactive or provided principle inputs, ensuring all dependent templates stay in sync.

    242 GitHub starsUsed in 12 repos~2.1k tokens
    DevelopmentAuto-check passed

More from SnowBankSDK/foundationdb-dotnet-client

  • Foundationdb Advanced Layers

    SnowBankSDK/foundationdb-dotnet-client

    Advanced engineering for sophisticated FoundationDB layers with the .NET client (FoundationDB.Client / SnowBank) — the cluster model and transaction lifecycle (proxies, resolvers, tlogs, storage…

    158 GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed
  • Foundationdb Aspire

    SnowBankSDK/foundationdb-dotnet-client

    How to run a FoundationDB cluster and connect to it from .NET — getting the IFdbDatabaseProvider that the keys/transactions/layers skills assume you already have.

    158 GitHub stars~3.4k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Snowbank Slices And Buffers

What does Snowbank Slices And Buffers do?

How to correctly use the Slice type and its companions (SliceReader, SliceWriter, SliceOwner) for binary data in the FoundationDB .NET client / SnowBank.Core codebase. Snowbank Slices And Buffers is an agent skill from SnowBankSDK/foundationdb-dotnet-client.Core codebase.

When should I use Snowbank Slices And Buffers?

Snowbank Slices And Buffers fits situations like: code constructs; converts between bytes and other types (Slice.FromBytes/FromStringUtf8/FromInt32/FromFixed64/ToInt64/ToStringUtf8/AsSlice/ToArray); parses a binary buffer (SliceWriter/SliceReader); rents pooled buffers (SliceOwner/ArrayPool).

How do I install Snowbank Slices And Buffers in Claude Code?

Run `npx skills add SnowBankSDK/foundationdb-dotnet-client --skill snowbank-slices-and-buffers -a claude-code`. Or copy the skill folder (.claude/skills/snowbank-slices-and-buffers in SnowBankSDK/foundationdb-dotnet-client) into .claude/skills/snowbank-slices-and-buffers in your project. Claude Code loads it when a task matches its description.

How do I install Snowbank Slices And Buffers in Codex?

Run `npx skills add SnowBankSDK/foundationdb-dotnet-client --skill snowbank-slices-and-buffers -a codex`. Or copy the skill folder (.claude/skills/snowbank-slices-and-buffers in SnowBankSDK/foundationdb-dotnet-client) into .agents/skills/snowbank-slices-and-buffers in your project. Codex loads it when a task matches its description.

Can I use Snowbank Slices And Buffers 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 SnowBankSDK/foundationdb-dotnet-client --skill snowbank-slices-and-buffers -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/snowbank-slices-and-buffers, .gemini/skills/snowbank-slices-and-buffers, .github/skills/snowbank-slices-and-buffers and .opencode/skills/snowbank-slices-and-buffers in your project.

What does Snowbank Slices And Buffers need to run?

SKILL.md names no scripts, command-line tools or credentials: Snowbank Slices And Buffers is instructions for the agent only.

Does Snowbank Slices And Buffers access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Snowbank Slices And Buffers 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 Snowbank Slices And Buffers use?

Snowbank Slices And Buffers is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Snowbank Slices And Buffers use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.2k tokens, read only when the agent opens those files.

What are the alternatives to Snowbank Slices And Buffers?

Skills that share tags, products or a category with Snowbank Slices And Buffers: Scaffolding (dotnet/efcore, 15k stars), Blockchain Indexing (Nethereum/Nethereum, 2.3k stars), Migrating Oracle To Postgres Data Access Code (github/awesome-copilot, 40k stars) and Dotnet Architect (aiskillstore/marketplace, 433 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Snowbank Slices And Buffers?

SnowBankSDK (a GitHub organization) maintains it in SnowBankSDK/foundationdb-dotnet-client, which has 158 GitHub stars. The repository holds 3 skills in this directory. The repository was last updated on October 9, 2026.

Source: SnowBankSDK/foundationdb-dotnet-client on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.