SharpPad: Command for Claude Code

.claude/commands/add-assembly-reference.md

add-assembly-reference is a command for Claude Code from gaoconggit/SharpPad. It costs 0 tokens per session (1,374 once invoked), scanned A, original, MIT.

A command for adding missing .NET assembly references to a C# code-execution workspace. An assembly is a library that provides types such as HTTP clients or JSON serializers.

In plain words
What is it for?
Use it when a dynamic C# script reports that a type or namespace cannot be found, supplying the missing type and, when needed, its assembly name.
Why use it?
It fixes errors where dynamically executed C# code cannot find a type because its library is not registered. It can update the workspace and rebuild the completion provider.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is gaoconggit/SharpPad's own configuration. It tells Claude Code how to work on SharpPad itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything SharpPad configures →

Reuse

Borrowing it

Nothing to install: this file belongs to gaoconggit/SharpPad. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/gaoconggit/SharpPad/main/.claude/commands/add-assembly-reference.md
Clone the repo
git clone --depth 1 https://github.com/gaoconggit/SharpPad

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 add-assembly-reference

README.md
[![agentmods](https://agentmods.dev/badge/commands/gaoconggit/sharppad/add-assembly-reference/github.svg)](https://agentmods.dev/commands/gaoconggit/sharppad/add-assembly-reference)
Your own site
<a href="https://agentmods.dev/commands/gaoconggit/sharppad/add-assembly-reference"><img src="https://agentmods.dev/badge/commands/gaoconggit/sharppad/add-assembly-reference/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 add-assembly-reference

Your own site · 80×15
<a href="https://agentmods.dev/commands/gaoconggit/sharppad/add-assembly-reference"><img src="https://agentmods.dev/badge/commands/gaoconggit/sharppad/add-assembly-reference.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,374 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.00000 $0.01374
Opus 5.5 $0.00000 $0.00550
Sonnet 5.5 $0.00000 $0.00275
Haiku 4.5 $0.00000 $0.00137

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

Security

Grade A, and why

add-assembly-reference 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 13d 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.

.claude/commands/add-assembly-reference.md · 205 lines

How it starts

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

/add-assembly-reference - Add Missing Assembly Reference

Automatically adds missing .NET assembly references to CompletionWorkspace for dynamic code execution.

Syntax

/add-assembly-reference <type_name> [assembly_name]

Description

When users encounter errors like "未能在命名空间中找到类型名" (Type not found in namespace) during dynamic code execution in SharpPad, this command automatically:

  1. Identifies the missing assembly based on the error message
  2. Adds the appropriate TryAddType() call to CompletionWorkspace.cs
  3. Adds the assembly name to the assembly list if needed
  4. Rebuilds the MonacoRoslynCompletionProvider project

Common Assembly Issues

WebSocket Support

Error: 未能在命名空间"System.Net.WebSockets"中找到类型名"ClientWebSocket"
Solution: /add-assembly-reference System.Net.WebSockets.ClientWebSocket

Task Parallel Library

Error: 未能在命名空间"System.Threading.Tasks"中找到类型名"Parallel"
Solution: /add-assembly-reference System.Threading.Tasks.Parallel

HTTP Client

Error: 未能在命名空间"System.Net.Http"中找到类型名"HttpClient"
Solution: /add-assembly-reference System.Net.Http.HttpClient

JSON Serialization

Error: 未能在命名空间"System.Text.Json"中找到类型名"JsonSerializer"
Solution: /add-assembly-reference System.Text.Json.JsonSerializer

Error Pattern Recognition

The command recognizes common error patterns:

Type Forward Errors

未能在命名空间"X.Y.Z"中找到类型名"TypeName"。
此类型已转发到程序集"AssemblyName, Version=X.X.X.X, ..."

Action: Extracts both the type name and assembly name from error message

Missing Reference Errors

找不到类型或命名空间名"TypeName"

Action: Searches for the type in common .NET assemblies

How It Works

1. Type Reference Addition

Adds TryAddType() call in BuildDefaultAssemblyPaths():

TryAddType(typeof(System.Net.WebSockets.WebSocket));

2. Assembly Name Addition

Adds assembly name to the assembly list:

foreach (var assemblyName in new[]
{
    "System.Runtime",
    // ... existing entries
    "System.Net.WebSockets",
    "System.Net.WebSockets.Client"  // ← Added
})

Read the full file on GitHub · 205 lines

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. 13d ago First seen · 205 lines · 0 tokens per session scan A 0a3773ad99f5

Subscribe to this mod's changes

add-assembly-reference is a command published in the GitHub repository gaoconggit/SharpPad (83 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,374 tokens. 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-10-02.