agentleFS
glennawatsonglennawatson/CSharpAgentSkills/skills/csharp-lsp/SKILL.md

csharp-lsp

Skill2 starsChanged 42 days agoMITView on GitHub

Use when relying on LSP/IDE language-server data in a C#/.NET repo — go-to-definition, find-references, hover, "errors" lists. Treat LSP as a fast index that goes stale, not as ground truth. `dotnet build` is the authority on whether code compiles. Lean on LSP for navigation, renames, and trivia; verify everything else against a real build.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Quick "where is this" orientation: before you dig in with real tools.

    line 23
  2. Distinctive:

    If LSP and build disagree, trust the build and keep going — don't reload-dance unless you're actively using LSP navigation and it's clearly …

    line 37
  3. Distinctive:

    If you *are* relying on LSP and it's stale, a reload/restart of the server (or reopening the workspace) re-indexes — but only bother when …

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Using the C# language server without trusting it too much

The LSP/IDE language server is a cached index. It's fast and great for moving around code, but it lags reality — it serves stale results after edits, reports phantom errors from a half-loaded workspace, and misses errors in code it hasn't re-analyzed yet. In this repo it throws a lot of false positives. So use it for what it's good at, and never let it be the thing that decides whether the code is correct.

dotnet build is the king of truth

  • Compilation status comes from the build, not the language server. If LSP shows red squiggles / "errors" but dotnet build is clean, the build wins — the index is stale. If LSP is green but dotnet build fails, the build wins. Always reconcile against an actual build before acting on a reported error.
  • Don't "fix" an LSP-reported error you haven't reproduced in a build. Chasing a phantom diagnostic wastes effort and can introduce real breakage. Run the build, see if it's real, then fix the cause.
  • Analyzer warnings come from the build too (see csharp-verification). The IDE may surface a subset or a stale set; dotnet build / dotnet format --verify-no-changes is the gate.

What LSP is good for

Lean on it for navigation and mechanical edits where a stale answer is cheap to notice:

  • Go-to-definition / find-references to navigate and understand structure. Treat the reference list as "very likely complete," not "provably complete" — confirm with a text search for anything load-bearing, like before deleting a member.
  • Rename of a symbol — the language server's rename is syntax-aware and usually correct across the solution. Still build afterward.
  • Trivia / formatting / signature help — whitespace, usings organization, hover for a type's shape. Low-stakes, fast.
  • Quick "where is this" orientation before you dig in with real tools.

What to verify against a build instead

  • Whether the project actually compiles.
  • Whether an "unused" symbol is truly unused (LSP can miss reflection, DI, source-generated, or InternalsVisibleTo usage — cross-check with a text search).
  • Whether an error is real before you change code to satisfy it.
  • Anything you're about to delete or change broadly.

When LSP looks wrong

Stale index is the common cause. In order:

  1. Build it. dotnet build tells you the truth in seconds.
  2. If LSP and build disagree, trust the build and keep going — don't reload-dance unless you're actively using LSP navigation and it's clearly desynced.
  3. If you are relying on LSP and it's stale, a reload/restart of the server (or reopening the workspace) re-indexes — but only bother when navigation is the task. For a verdict on correctness, just build.

Anti-patterns

  • Treating the IDE's error list as authoritative and "fixing" diagnostics you never reproduced in a build.
  • Declaring a symbol unused on find-references alone, then deleting it — missing reflection/DI/codegen callers.
  • Reload-dancing the language server to chase a red squiggle instead of just running dotnet build.
  • Reporting "no errors" because LSP is green, without building.
  • Using LSP find-references as proof of completeness for a risky refactor — back it with a text search.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.