optimizing-fast-lookup

optimizing-fast-lookup is a skill for Claude Code from christian289/dotnet-with-claudecode. It costs 34 tokens per session (652 once invoked), scanned A, original, MIT.

A .NET guide for fast membership and key-value lookups using `HashSet`, `FrozenSet`, `Dictionary`, and `FrozenDictionary`. These collections are designed to find an item by key without scanning every item in the collection.

In plain words
What is it for?
Use it for allowed-value checks, membership tests, set operations, and retrieving values by key in performance-sensitive .NET code.
Why use it?
It helps replace slow repeated searches with lookup structures intended for constant-time access, including read-only options in .NET 8 and later.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: model in frontmatter.

Good fit Use it for allowed-value checks, membership tests, set operations, and retrieving values by key in performance-sensitive .NET code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add christian289/dotnet-with-claudecode --skill optimizing-fast-lookup
Clone the repo
git clone --depth 1 https://github.com/christian289/dotnet-with-claudecode

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for optimizing-fast-lookup

README.md
[![agentmods](https://agentmods.dev/badge/skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup/github.svg)](https://agentmods.dev/skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup)
Your own site
<a href="https://agentmods.dev/skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup"><img src="https://agentmods.dev/badge/skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for optimizing-fast-lookup

Your own site · 80×15
<a href="https://agentmods.dev/skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup"><img src="https://agentmods.dev/badge/skills/christian289/dotnet-with-claudecode/optimizing-fast-lookup.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 652 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00034 $0.00652
Opus 5 $0.00017 $0.00326
Sonnet 5 $0.00007 $0.00130
Haiku 4.5 $0.00003 $0.00065

Measured 10d ago against content hash d9d400bdddd9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

optimizing-fast-lookup scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

archive-skills/optimizing-fast-lookup/SKILL.md · 108 lines

How it starts

The opening of the file, as written. The whole thing — 108 lines — stays where its author put it; the contents beside it link to each section on GitHub.

.NET Fast Lookup

A guide for fast lookup APIs leveraging O(1) time complexity.

Quick Reference: See QUICKREF.md for essential patterns at a glance.

1. Core APIs

API Time Complexity Features
HashSet<T> O(1) Mutable, no duplicates
FrozenSet<T> O(1) Immutable, .NET 8+
Dictionary<K,V> O(1) Mutable, Key-Value
FrozenDictionary<K,V> O(1) Immutable, .NET 8+

2. HashSet

// O(1) time complexity for existence check
var allowedIds = new HashSet<int> { 1, 2, 3, 4, 5 };

if (allowedIds.Contains(userId))
{
    // Allowed user
}

// Set operations
setA.IntersectWith(setB); // Intersection
setA.UnionWith(setB);     // Union
setA.ExceptWith(setB);    // Difference

3. FrozenSet (.NET 8+)

using System.Collections.Frozen;

// Immutable fast lookup (read-only scenarios)
var allowedExtensions = new[] { ".jpg", ".png", ".gif" }
    .ToFrozenSet(StringComparer.OrdinalIgnoreCase);

if (allowedExtensions.Contains(fileExtension))
{
    // Allowed extension
}

4. Dictionary<K,V> Optimization

// ❌ Two lookups
if (dict.ContainsKey(key))
{
    var value = dict[key];
}

// ✅ Single lookup
if (dict.TryGetValue(key, out var value))
{
    // Use value
}

// Lookup with default value
var value = dict.GetValueOrDefault(key, defaultValue);

5. Comparer Optimization

// Case-insensitive string comparison
var set = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
set.Add("Hello");
set.Contains("HELLO"); // true

6. When to Use

Scenario Recommended Collection
Frequently modified set HashSet<T>
Read-only configuration data FrozenSet<T>
Frequent existence checks HashSet<T> / FrozenSet<T>
Key-Value cache Dictionary<K,V>
Static mapping table FrozenDictionary<K,V>

7. References

Read the full file on GitHub · 108 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 108 lines · 34 tokens per session scan A d9d400bdddd9

Subscribe to this mod's changes

optimizing-fast-lookup is a skill published in the GitHub repository christian289/dotnet-with-claudecode (41 stars, last pushed 1mo ago), licensed MIT. It adds 34 tokens to every session and 652 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

author-test

Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.

Azure/azure-sdk-for-net · 68 tokens

migrate-xunit-to-mstest

Convert .NET tests from xUnit.net v2/v3 to MSTest v4 while preserving VSTest or MTP. Use for replacing xunit packages, Fact/Theory/InlineData/MemberData, assertions, IClassFixture/ICollectionFixture, ITestOutputHelper, TestContext cancellation, traits/Owner, skips, timeouts, and xUnit parallelization. Also use when a…

managedcode/dotnet-skills · 141 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens

crap-score

Calculates CRAP (Change Risk Anti-Patterns) for a named .NET method, class, or file. USE FOR: explicit CRAP calculation or coverage-and-complexity risk within that named target, including which tests to prioritize. DO NOT USE FOR: project-wide coverage/CRAP, plateaus, or project-wide blockers/priorities…

managedcode/dotnet-skills · 99 tokens

nunit

Write, run, or repair .NET tests that use NUnit. Use when a repo uses NUnit, [Test], [TestCase], [TestFixture], or NUnit3TestAdapter for VSTest or Microsoft.Testing.Platform execution. USE FOR: writing or reviewing NUnit tests; using [Test], [TestCase], [TestFixture], [SetUp], [TearDown] attributes; configuring…

managedcode/dotnet-skills · 146 tokens

tunit

Write, run, or repair .NET tests that use TUnit. Use when a repo uses TUnit, TUnit.Playwright, [Test], [Arguments], ClassDataSource, SharedType.PerTestSession, or Microsoft.Testing.Platform-based execution. Preserve TUnit's parallel-by-default model and constrain only destructive shared-state collisions. DO NOT USE…

managedcode/dotnet-skills · 89 tokens