Agent skill

Per Loop Affinity

by isc-projects in isc-projects/bind9

Design pattern for per-loop (per-thread) sharded data structures in BIND 9 — isctid() affinity replaces locking, foreign mutation becomes mark + owner lazy-reap, and eviction pressure must spread…

MPL-2.0Auto-check passedDevelopment

Install Per Loop Affinity

skills CLI
$ npx skills add isc-projects/bind9 --skill per-loop-affinity -a claude-code

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

GitHub CLI
$ gh skill install isc-projects/bind9 per-loop-affinity --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/isc-projects/bind9.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/per-loop-affinity .claude/skills/per-loop-affinity && 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
per-loop-affinity
GitHub stars
780
Token cost
~757 tokens
SKILL.md length
404 words
Files
1
Skills in repo
9
Repo updated
First seen
Licence
MPL-2.0

At a glance

Design pattern for per-loop (per-thread) sharded data structures in BIND 9 — isctid() affinity replaces locking, foreign mutation becomes mark + owner lazy-reap, and eviction pressure must spread…

  • Reviewing sharded LRU/SIEVE caches
  • SKILL.md covers Ownership rules and Eviction fairness across shards
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Any structure partitioned by loop/thread id

What it does

Per Loop Affinity is an agent skill from isc-projects/bind9. Design pattern for per-loop (per-thread) sharded data structures in BIND 9 — isctid() affinity replaces locking, foreign mutation becomes mark + owner lazy-reap, and eviction pressure must spread across shards. Use when designing or reviewing sharded LRU/SIEVE caches, per-loop lists, or any structure partitioned by loop/thread id.

Its SKILL.md is about 760 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 Design patterns. The repository describes itself as: Archived mirror of https://gitlab.isc.org/isc-projects/bind9, please submit issues and PR/MRs in the GitLab. The licence is MPL-2.0.

When your agent uses it

  • Reviewing sharded LRU/SIEVE caches
  • Any structure partitioned by loop/thread id

Example prompts

  • “/per-loop-affinity”

What it can do on your machine

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

    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

Per Loop Affinity loads about 757 tokens when it runs. Until then it costs about 88 tokens; SKILL.md has 404 words of instructions outside code blocks.

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

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 isc-projects/bind9 at commit 12d28b2, republished under its MPL-2.0 licence (© isc-projects). 404 words, ~757 tokens.

Download SKILL.mdSave it as .claude/skills/per-loop-affinity/SKILL.md (or your agent's skills folder).
name
per-loop-affinity
description
Design pattern for per-loop (per-thread) sharded data structures in BIND 9 — isc_tid() affinity replaces locking, foreign mutation becomes mark + owner lazy-reap, and eviction pressure must spread across shards. Use when designing or reviewing sharded LRU/SIEVE caches, per-loop lists, or any structure partitioned by loop/thread id.

Per-loop affinity: ownership instead of locking

When a data structure is sharded per event-loop and each shard is owned exclusively by its loop (isc_tid() affinity), the owner needs no locking for insert/walk/unlink at all. The rules below preserve that exclusivity; break any of them and the design degrades back to a locked (or racy) structure.

Ownership rules

  • Owner-only mutation and traversal. Only the owning loop touches the shard's link pointers. Foreign threads never walk, unlink, or even read link pointers — peeking at them cross-thread is a data race (TSAN will find it), not an optimization.
  • Foreign deletion = mark + hand over, owner reaps lazily. A deleter on another thread marks the entry dead (an atomic attribute) and hands the exact entry to the owner — a wait-free MPSC stack per shard works well; the push takes its own reference because the hint races the owner's eviction walk. The owner unlinks during its own subsequent operations, off any hot lock.
  • Never make anyone scan for marked entries. An O(shard) sweep to find dead entries — by the owner or anyone else — degrades progressively as the shard grows and can collapse throughput under load. The handoff must carry the entry itself.
  • Gate the handoff with an atomic membership bit (owner sets it at insert, clears it at every unlink path, including teardown). A stale bit means pushing onto a never-drained stack; a missing gate means double handoff.
  • The shard holds its own reference to every linked entry, so a marked entry can outlive its parent object; store whatever the reaper needs to finish the job (e.g. a lock index) in the entry itself rather than reaching through pointers that may be gone.
  • Bound zombie lifetime. If reaping only happens during eviction, a below-limit shard never reaps; advance a small reap cursor on each insert so marked entries cannot accumulate unboundedly.
Show full SKILL.md (99 more words)Show less

Eviction fairness across shards

  • Never drain one shard to satisfy a purge before moving to the next — that degrades LRU/SIEVE to random mass-eviction of whichever shard was picked first. Spread the pressure: evict one entry per shard round-robin, or avoid sharding the eviction structure that finely in the first place.
  • Better still, colocate eviction capacity with insert pressure: each loop evicts from its own shard, so a busy loop owns a proportionally bigger shard and eviction scales with the load that created it, by construction.

Related: the rcu-mutation skill covers the reader-visible side (publish/reclaim discipline) of the same structures.

© isc-projects, MPL-2.0. 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 .agents/skills/per-loop-affinity of isc-projects/bind9.

Open the folder on GitHubat commit 12d28b2

Compare with similar skills

Per Loop Affinity 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.

Per Loop Affinity compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Per Loop Affinity this skillisc-projects/bind9780—~757Automated safety check: PassMPL-2.0
Vercel Composition Patternssupabase/supabase111k59 repos~726Automated safety check: PassMIT
Swiftui View RefactorDimillian/Skills4k5 repos~2kAutomated safety check: PassMIT
RTK Rust Design Patternsrtk-ai/rtk83k—~1.9kAutomated safety check: PassApache-2.0
Effect Client WrapperUsefulSoftwareCo/executor4.1k1 repos~1.4kAutomated safety check: PassMIT
Architecture PatternsKartikLabhshetwar/better-shot2.4k2 repos~1.4kAutomated safety check: PassCustom licence

Similar skills

  • Official

    React composition patterns that scale. An agent skill from supabase/supabase.

    111k GitHub starsUsed in 59 repos~726 tokens
    DevelopmentAuto-check passed
  • Swiftui View Refactor

    Dimillian/Skills

    Refactor and review SwiftUI view files with strong defaults for small dedicated subviews, MV-over-MVVM data flow, stable view trees, explicit dependency injection, and correct Observation usage.

    4k GitHub starsUsed in 5 repos~2k tokens
    DevelopmentAuto-check passed
  • Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.

    83k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Effect Client Wrapper

    UsefulSoftwareCo/executor

    Pattern for wrapping third-party SDK clients (Stripe, Resend, AWS, etc.) with Effect.

    4.1k GitHub starsUsed in 1 repo~1.4k tokens
    DevelopmentAuto-check passed
  • Architecture Patterns

    KartikLabhshetwar/better-shot

    Deep dive into software architecture for macOS. An agent skill from KartikLabhshetwar/better-shot.

    2.4k GitHub starsUsed in 2 repos~1.4k tokens
    DevelopmentAuto-check passed
  • GitVersion .NET Development

    GitTools/GitVersion

    Gives repository-specific .NET guidance for GitVersion: build and test commands, central package management, project layout and coding conventions.

    3.1k GitHub stars~1.7k tokensUpdated today
    DevelopmentAuto-check passed

More from isc-projects/bind9

All 9 skills in this repo
  • Isc Mem Allocator

    isc-projects/bind9

    BIND 9's memory allocator wrapper (iscmem memory contexts and iscmempool fixed-size pools).

    780 GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • Rcu Mutation

    isc-projects/bind9

    Correct discipline for mutating an RCU / lock-free pointer-based data structure (trie, tree, list, graph) that has concurrent readers — build a new node cluster invisibly, publish it, then reclaim…

    780 GitHub stars~3.8k tokensUpdated today
    Auto-check passed
  • Struct Layout Analysis

    isc-projects/bind9

    Measure and fix C struct layout in BIND 9 — pahole on the build's DWARF for sizes, padding holes, and cacheline boundaries, plus the house cacheline-padding idiom.

    780 GitHub stars~461 tokensUpdated today
    Auto-check passed
  • Tweak Release Notes

    isc-projects/bind9

    Review and refine ISC BIND 9 release notes for a new version — audit audience/action tags against the actual change substance, verify every covered issue is closed, and rewrite the auto-generated…

    780 GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Bind Mr Description

    isc-projects/bind9

    Drafting BIND 9 merge-request titles and descriptions — they feed the generated release notes, so the audience is system administrators.

    780 GitHub stars~674 tokensUpdated today
    Auto-check passed
  • Isc Async Scheduling

    isc-projects/bind9

    How BIND 9 schedules callbacks — iscjobrun (same loop), iscasyncrun (any thread → any loop), iscworkenqueue (offload to a worker thread).

    780 GitHub stars~1.8k tokensUpdated today
    Auto-check passed

Categories

Questions about Per Loop Affinity

What does Per Loop Affinity do?

Design pattern for per-loop (per-thread) sharded data structures in BIND 9 — isctid() affinity replaces locking, foreign mutation becomes mark + owner lazy-reap, and eviction pressure must spread…. Per Loop Affinity is an agent skill from isc-projects/bind9. Design pattern for per-loop (per-thread) sharded data structures in BIND 9 — isctid() affinity replaces locking, foreign mutation becomes mark + owner lazy-reap, and eviction pressure must spread across shards.

When should I use Per Loop Affinity?

Per Loop Affinity fits situations like: reviewing sharded LRU/SIEVE caches; any structure partitioned by loop/thread id.

How do I install Per Loop Affinity in Claude Code?

Run `npx skills add isc-projects/bind9 --skill per-loop-affinity -a claude-code`. Or copy the skill folder (.agents/skills/per-loop-affinity in isc-projects/bind9) into .claude/skills/per-loop-affinity in your project. Claude Code loads it when a task matches its description.

How do I install Per Loop Affinity in Codex?

Run `npx skills add isc-projects/bind9 --skill per-loop-affinity -a codex`. Or copy the skill folder (.agents/skills/per-loop-affinity in isc-projects/bind9) into .agents/skills/per-loop-affinity in your project. Codex loads it when a task matches its description.

Can I use Per Loop Affinity 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 isc-projects/bind9 --skill per-loop-affinity -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/per-loop-affinity, .gemini/skills/per-loop-affinity, .github/skills/per-loop-affinity and .opencode/skills/per-loop-affinity in your project.

What does Per Loop Affinity need to run?

SKILL.md names no scripts, command-line tools or credentials: Per Loop Affinity is instructions for the agent only.

Does Per Loop Affinity 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 Per Loop Affinity 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 Per Loop Affinity use?

Per Loop Affinity is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Per Loop Affinity use?

About 757 tokens (SKILL.md is roughly 3k 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 Per Loop Affinity?

Skills that share tags, products or a category with Per Loop Affinity: Vercel Composition Patterns (supabase/supabase, 111k stars), Swiftui View Refactor (Dimillian/Skills, 4k stars), RTK Rust Design Patterns (rtk-ai/rtk, 83k stars) and Effect Client Wrapper (UsefulSoftwareCo/executor, 4.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Per Loop Affinity?

isc-projects (a GitHub organization) maintains it in isc-projects/bind9, which has 780 GitHub stars. The repository holds 9 skills in this directory. The repository was last updated on October 7, 2026.

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