/typescript6-lsp-intelligence:ts-6-writing-and-navigationfrom TypeScript 6 LSP Intelligence
Use before writing, editing, reviewing or debugging TypeScript or JavaScript code (.ts, .tsx, .js, .mjs, .cjs, tsconfig and jsconfig) in a project on TypeScript 6, even for a small change, and when tsc and the editor disagree, a type check or build fails, a module won't resolve, or the user asks how the compiler or a library behaves at their version. Checks the behavior in official sources for the installed version, navigates symbols through the LSP before a change, and proves the result with the project's own tsc and checks. Not for TypeScript 7 projects, other languages, comment-only or formatting-only edits, or syntax questions that depend on neither the project nor a version.
Ships in TypeScript 6 LSP Intelligence. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
One contract governs three facets: research establishes the supported approach, execution makes the scoped change, and verification demonstrates that the affected code and its checks behave as intended. Read procedures on demand. Apply this to TypeScript and materially connected tools, not every installed dependency.
.ts, .tsx, .mts, .cts, .js, .jsx, .mjs and .cjs files, tsconfig.json and jsconfig.json, and the tools that consume them (frameworks, bundlers, runtimes, test runners, editors, CI) when the task crosses into them.checkJs or the file starts with // @ts-check; allowJs alone adds the file to the program without checking it. A jsconfig.json is a tsconfig with JavaScript defaults, and the same rule applies to it. This plugin's post-edit hook still checks each edited JavaScript file under its strict profile, checkJs included; that is the hook's policy, not the project's own check. Otherwise the project's own lint and tests are its gates.Set the mode at the start and state it in the report.
research: questions, reviews, audits and diagnoses without permission to edit. Read-only in the user's project: read files, use the LSP tool, and run commands that write nothing there (--version, --showConfig, --listFilesOnly, and tsc --noEmit --tsBuildInfoFile <file in a mktemp -d folder>, since an incremental or composite config otherwise writes its build-info file into the project). Temporary reproductions go in a mktemp -d folder outside the project. Run a project script (lint, test, build) only after reading it and confirming that it writes nothing in the project: no --fix, no emitted output, no snapshot update, no cache inside the project. A build always writes, so it never runs; a script that writes is listed as a proposed check instead. Language-server diagnostics arrive only after an edit, so research has none: the compiler's output is the diagnostics observer, and any claim about what the server or editor shows is inference. Deliver supported conclusions and proposed checks, never a claim that an implementation or test passed.implementation: the user asked for a change. Edit only the files the change needs. Apply the change even when no gate can run, and report it as not verified. When no tool can write the files (the Claude app's chat), deliver the change as a diff in the reply instead.research: propose the fix, and ask before switching to implementation.The skill uses four things. A session without the Bash tool has no shell, whatever the surface; the Claude app's chat and Cowork load no language servers.
tsc, the project's scripts and scripts/run-fixtures.sh.tsc (the program's node_modules/.bin/tsc, or a tsc on PATH) and the package manager that runs its lint and test scripts.LSP tool, served by this plugin's language server.curl to the official domain (typescriptlang.org, the counterpart's docs site); gh on the official repository (gh release view, gh api repos/<owner>/<repo>/contents/<path> for its docs and CHANGELOG.md), such as microsoft/TypeScript.The table has one row for each of the four, plus two rows for what follows from them: a project with no type-check layer, and a session where no gate can run. Apply every row that matches, not only the first; when two rows give different actions, follow the one that runs less. Report each matching row with its status, using three words only: not present (the project has no such layer), unavailable (it exists but this session cannot reach or run it) and not verified (a change no gate checked).
| Missing | How you know | What to do | What to report |
|---|---|---|---|
LSP tool | ToolSearch with select:LSP finds nothing, or every LSP call errors and the retries under "Establish readiness, coverage and freshness" do not fix it | Answer every LSP row of the governing contract with Grep and reading the files. Skip the references fixture and the fresh semantic check | Semantic evidence: unavailable |
| Web access | WebFetch, WebSearch, curl to the official domain and gh on the official repository all fail or are absent | Continue every decision that no official page decides. Block each decision that needs one | Each unread source: unavailable. Blocked decisions under Gaps |
| Type checking | No tsconfig.json or jsconfig.json program contains the changed files, or the changed files are JavaScript that neither checkJs nor a // @ts-check line covers | Lint and tests are the gates. The type-check fixtures do not apply | Type-check layer: not present |
tsc | No node_modules/.bin/tsc above the program and no tsc on PATH | Run lint and tests | Type check: unavailable, under Gaps |
| Shell | No Bash tool in the session | No gate, fixture or probe can run. In implementation mode, apply the change with the edit tools, or give it as a diff when there are none | Implementation: not verified |
| Every gate | No type check, lint or test can run, for any of the reasons above | In implementation mode, apply the change the user asked for and stop there: no further edit rests on an unverified one. Never run the user's scripts or entry points on synthetic data instead | Implementation: not verified |
Do these steps once per session, before you read or edit the first TypeScript or JavaScript file of the task, and again after /reload-plugins or when every LSP call starts failing:
command -v typescript-language-server. When it prints nothing, the language server is not installed: tell the user to install it as the plugin README's Prerequisites says, and go to step 4.LSP tool is not loaded, load it with ToolSearch and the query select:LSP. When that finds nothing, this session runs no language servers, as in cloud sessions and in the Claude app's chat and Cowork: go to step 4.documentSymbol on a TypeScript or JavaScript file of the task, or on another one of the project when the task creates the first one, alone in its message; Claude Code starts the server on that first call. Repeat it until the three-identical rule below holds. When every call errors, the server can't start here: go to step 4.LSP question in the table below with Grep and reading the files, apply the LSP tool row of "Requirements and fallbacks", and run the project's gates all the same.The rest of the toolchain, tsc, the project's lint and tests and web access, has its own rows in "Requirements and fallbacks".
A language server can answer before it has indexed the project, and its first answers can be partial or wrong. Repeat every LSP operation you rely on, with the same arguments, until three consecutive results are identical, at most six calls. When no three match within six, record the result as unstable and confirm it with Grep and reading.
LSP owns questions about code structure; Grep owns questions about text. Route each question to its owner, and use both before deleting, renaming or changing a signature.
| Question | Owner | Operation |
|---|---|---|
| Where is X defined? | LSP | goToDefinition |
| Who uses or imports X? | LSP | findReferences |
| Type or signature of X? | LSP | hover |
| What does this file contain? | LSP | documentSymbol, before reading the whole file |
| Where is X, file unknown? | LSP | workspaceSymbol, always with query |
| Who calls X, what does X call? | LSP | incomingCalls / outgoingCalls on the function's position |
| Implementations of an interface | LSP | goToImplementation |
| Where does a word appear as text (docs, comments, strings, config, scripts)? | Grep | — |
| Is it safe to delete, rename or change a signature? | Both | LSP for code references, then Grep to confirm them and find the blind spots below |
When Grep finds several symbols with the same name, search for the name together with the module it is imported from, and read the import lines to tell them apart. Without hover, read the type's declaration (the .d.ts under node_modules for a library) or ask tsc.
Every operation takes filePath (absolute), line (1-based) and character (1-based, UTF-16 code units: an emoji before the symbol counts 2). Raw LSP data in logs is 0-based: add 1 to both. Raw character values count in the encoding the client and server negotiated (positionEncoding); UTF-16 is LSP's default and the only one this tool uses, so convert a UTF-8 or UTF-32 offset from another client before passing it.
Send LSP calls in their own message, never in parallel with another tool; several LSP calls may share a message. The session's first LSP call goes alone: its answer can come from a server still loading the project, so pass the warm-up check below before grouping calls.
tsc reads the files: a bundler or runtime alias or resolver (resolve.alias, moduleNameMapper, import maps), a test runner's module mocks (vi.mock, jest.mock), framework files and conventions (.vue, .svelte, .astro, file-based routes, decorators read by a framework), code generators, or editor settings. A change confined to code and configuration that tsc alone checks does not cross one: a rename that also edits a mock path or an alias crosses it, one that touches only .ts call sites does not.findReferences result is never the full list. It misses callers in .svelte, .vue and .astro files when run from a .ts file, test mocks (vi.mock, jest.mock) and other string references, and files changed from the shell. Confirm it with Grep before deleting a symbol or changing a signature: compare call sites, not lines: each reference findReferences lists against each Grep hit that calls or imports the name, Grepping also the alias of every import { name as alias }, and explain each difference before acting on either.findReferences returns only a file, line and column. To see what each reference is, read its line in Grep's output instead of opening every file.LSP tool runs Claude Code's own language server, not the user's editor: its answers say nothing about what the editor shows. Label any conclusion about the editor as inference unless the user shares the editor's output. The editor's exact message and file are inputs only the user has: ask for them, and report inference until they arrive.research mode there is no edit, so no server diagnostics: use the compiler's output (tsc --noEmit as the research mode allows) and report semantic diagnostics as unavailable.findReferences and Grep agree (both list the same call sites and imports, compared as "Treat LSP results as evidence, not the whole picture" describes), or after you explain each difference. Respect authorization, formatter ownership and existing user changes.exports, main, types, typings or bin entry of its own package.json points to, and that package.json is not "private": true. Those entries name files, often built ones: map each to its source through the tsconfig rootDir and outDir, then read that source's exports. In a monorepo, judge the package that holds the symbol; an export only other workspace packages import is internal, so update those packages too. A project with no package.json, or a private one, has no public API.Verify intended behavior and relevant negative cases:
Match the defect to the observer:
implementation mode, run the project's own gates (type check, lint, tests, build) on the final state, plus a fresh semantic check: hover or findReferences on each changed symbol after the last edit. When no diagnostics arrive, the type check is the gate (lint and tests when there is no type-check layer) and semantic diagnostics are reported as unavailable.
In research mode, run only the gates the research mode allows and list the others as proposed checks.LSP operation or its fallback.implementation mode, run fixtures.md once per program the change touches, before the first time you report its checks clean. Its type-check fixtures run with bash ${CLAUDE_SKILL_DIR}/scripts/run-fixtures.sh <owning tsconfig.json>.research mode, run only bash ${CLAUDE_SKILL_DIR}/scripts/run-fixtures.sh --outside, and only when a conclusion rests on the compiler's sensitivity; otherwise skip the fixtures and say so. --outside never proves which files a program contains, which --listFilesOnly does.git diff or a hash that only the intended change remains.npm ci, pnpm install --frozen-lockfile, yarn install --immutable) run inside it, and only when the task allows network and time. Copied or symlinked node_modules do not count, because they can change module resolution (project-evidence.md, "Isolated reproduction"). When the frozen install cannot run, a copy cannot reproduce the check: use the in-project probe below in implementation mode, or report the probe as not possible in research mode. Keep its outputs and caches there.research mode, never probe inside the project.implementation mode, an in-project probe is allowed only when a copy cannot reproduce the check, for example a monorepo layout or a running editor service. It must be in a file the task already edits:
git diff or a hash that only the intended change remains.implementation mode they create and delete only lsp-fixture-* folders inside the project. The type-check fixtures need one because the fixture must extend the owning tsconfig from where it sees the project's environment; the references fixture needs one because only the session's working directory is indexed.When a result is the session's first LSP result, is empty, shows only the definition, or will justify an edit or deletion, check all five before believing it:
hover at the same spot shows the intended symbol. "No hover information" means a wrong position or no server, never "no usages".goToDefinition included (an early answer may point at the import line). This match check is separate from the readiness retries in semantic-execution.md.LSP sees static code references only. Grep the name in: strings and reflection (dynamic imports, eval, dispatch by name); test mocks and stubs (vi.mock, jest.mock and other module paths in strings); entry points and config (package scripts, YAML, JSON, TOML, and .env with Grep -l only, never quoting its values); framework injection (fixtures, decorators, registries, routes); .astro, .svelte, .vue and .mdx files; shell scripts, CI, Makefiles, Dockerfiles; docs, comments, templates.
End with this record in the reply, scaled to the task:
Mode: research | implementation
Categories: <selected source-map categories> (<count> of 10; 0 when the change needed no research)
Versions: <declared, locked, installed and invoked compiler and counterparts>
Change: <applied diff in implementation mode, or the diff given in the reply when no tool could write the files; the proposed change in research mode>
Evidence: <each claim as observation, inference, contradiction or unavailable, with its command or source>
Checks: <command, baseline result, final result>; fixtures <run | not run, why>; probes restored <yes | n/a>
Gaps: <blocked decisions, missing evidence, pre-existing failures>
assets/clean_control.ts.fixture (opens in a new tab)assets/implicit_any.ts.fixture (opens in a new tab)assets/missing_member.ts.fixture (opens in a new tab)assets/possibly_undefined.ts.fixture (opens in a new tab)assets/references.ts.fixture (opens in a new tab)assets/tsconfig.json.fixture (opens in a new tab)assets/type_mismatch.ts.fixture (opens in a new tab)references/fixtures.md (opens in a new tab)references/integration-and-releases.md (opens in a new tab)references/project-evidence.md (opens in a new tab)references/research-workflow.md (opens in a new tab)references/semantic-execution.md (opens in a new tab)references/source-map.md (opens in a new tab)references/verification.md (opens in a new tab)scripts/run-fixtures.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub nerymurillohnd/the-claude-factory --plugin typescript6-lsp-intelligence