微算力 · API 导航与自营网关
API 接入 EN
未登录登录
📘

官方级TypeScript开发智能助手

typescript-lsp · vv1.0.0
这个包缺安装入口,装上也不会生效 缺 SKILL.md 或 frontmatter 不完整(NO_FRONTMATTER)。我们仍保留下载,方便你自行查看内容。
开发 安全 S 级 作者 bowen31337 公开目录收录
2.2k 下载 942 安装 5k 收藏 43.4k 浏览

简介

基于微软官方TypeScript语言服务器的文档型技能,为开发者提供类型检查、代码智能提示和重构支持的标准化开发指南。

原始描述

TypeScript language server providing type checking, code intelligence, and LSP diagnostics for .ts, .tsx, .js, .jsx, .mts, .cts, .mjs, .cjs files. Use when working with TypeScript or JavaScript code that needs type checking, autocomplete, error detection, refactoring support, or code navigation.

通过你的 Agent 添加

安装目录:typescript-lsp/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。

点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/typescript-lsp/
Codex CLI~/.codex/skills/typescript-lsp/
DeepSeek Harness~/.agents/skills/typescript-lsp/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

中文使用说明 来自收录源

核心用法

TypeScript LSP Skill 是一个纯文档型开发辅助工具,旨在帮助开发者在 LSP 兼容编辑器中高效使用 TypeScript 语言服务器。核心用法包括:通过 npm install -g typescript-language-server typescript 完成环境搭建;使用 tsc --noEmit 进行无输出类型检查;借助 tsc --watch --noEmit 实现开发时的实时类型监控;以及配置 tsconfig.json 定制编译器行为。该 Skill 覆盖了从安装、日常使用到高级配置的全流程,特别强调了 --strict、、--noEmit` 等关键编译选项的实践应用。

显著优点

  1. 权威工具背书:基于微软官方维护的 TypeScript 编译器和社区驱动的 typescript-language-server,技术栈成熟稳定
  2. 功能覆盖全面:集成类型检查、自动补全、跳转到定义、查找引用、符号重命名、代码重构等完整的 IDE 级功能
  3. 配置即最佳实践:提供的 tsconfig.json 模板包含 strict: true、、esModuleInterop` 等现代 TypeScript 项目推荐配置
  4. 零侵入性设计:纯文档封装,不执行任何代码,完全由用户自主控制命令执行时机和范围
  5. 多格式支持:覆盖 .ts/.tsx/.js/.jsx/.mts/.cts/.mjs/.cjs 等全量 TypeScript/JavaScript 生态文件类型

潜在缺点与局限性

  1. 环境依赖前置:要求用户预先安装 Node.js 和 npm/yarn 环境,对纯前端新手存在门槛
  2. 非自动化执行:Skill 本身不自动运行类型检查,需用户手动触发命令,无法提供实时的"开箱即用"体验
  3. 编辑器集成差异:LSP 功能的具体表现取决于编辑器对 LSP 协议的支持程度,不同 IDE 体验可能不一致
  4. 大型项目性能:tsc --watch 在超大型代码库中可能存在内存占用高、首次类型检查慢的问题
  5. 配置复杂度:tsconfig.json 的选项众多,初学者容易因配置不当导致意外的类型行为

适合的目标群体

  • TypeScript 初学者:需要系统学习 tsc 命令和 tsconfig 配置的标准参考
  • 全栈开发者:在 VS Code、Neovim 等 LSP 编辑器中寻求一致的 TypeScript 开发体验
  • 代码审查者:需要统一团队的类型检查流程和编译配置规范
  • 从 JavaScript 迁移的团队:需要渐进式引入类型系统的配置指导和最佳实践

使用风险

  1. 性能风险:持续运行 tsc --watch 可能消耗较多系统资源,建议在 CI/CD 环境中使用 --noEmit 替代
  2. 版本兼容性:全局安装的 typescript 与项目 node_modules 中的版本不一致时,可能导致类型检查结果差异
  3. 配置漂移风险:多个项目共用全局 tsc 时,需确保各项目的 tsconfig.json 独立且完整
  4. 依赖项风险:typescript-language-server 的更新可能引入与特定编辑器插件的兼容性问题

技能正文


name: typescript-lsp description: > Use the TypeScript language server (typescript-language-server) for precise code intelligence in the clickhouse-js repository: go-to-definition, find references, hover (type signatures and JSDoc, including @deprecated info), workspace-wide symbol search, completions, and per-file type diagnostics. Prefer this over grep when you need to resolve a symbol's actual definition, find all usages of an exported API, or inspect inferred types across the packages/* workspaces. The server is preinstalled as a root devDependency — run the repository setup skill (npm install) first so node_modules is populated. Do NOT use this skill for downstream projects that merely depend on @clickhouse/client; it is specific to working inside this repo.

TypeScript Language Server in clickhouse-js

typescript-language-server is declared as a root devDependency, so after npm install (see the setup skill) it is available via npx and uses the workspace-local typescript (6.x) compiler, matching CI exactly.

The server (6.x) requires Node.js >= 22.22.2, newer than the repository's Node 22.13.0 minimum; on older Node 22 releases npm install only warns, but the server isn't supported there.

Starting the server

From the repo root:

npx typescript-language-server --stdio

It speaks LSP (JSON-RPC, Content-Length-framed) over stdio. There is no extra configuration: each packages/* workspace, tests/clickhouse-test-runner, examples/node, and examples/web has its own tsconfig.json, and the server picks the nearest one per opened file automatically.

Protocol essentials

  1. Send initialize with rootUri/workspaceFolders pointing at the repo root, then the initialized notification.
  2. Send textDocument/didOpen with the full file text for every file you want to query (the server reads dependencies from disk on its own; only files you query positions in need to be opened).
  3. Positions are 0-based (line and character).

Verified capabilities (typescript-language-server 5.x, TS 6.x)

Request Notes
textDocument/hover Returns the full inferred signature + JSDoc markdown
textDocument/definition Resolves across workspace packages via source, not dist/
textDocument/references Within the opened file's project
workspace/symbol e.g. query ClickHouseClient finds class + re-exports
textDocument/completion Context-aware member completions
Diagnostics Push only (textDocument/publishDiagnostics notifications, sent ~1–3s after didOpen). The pull textDocument/diagnostic request is not supported (-32601) — wait for the push notification instead.

Tips

  • If your environment provides built-in LSP/code-intelligence tooling, point it at npx typescript-language-server --stdio with the repo root as the workspace folder.
  • For one-off scripted queries, spawn the server from Node, frame messages with Content-Length: <bytes>\r\n\r\n<json>, and match responses by id.
  • A full workspace typecheck is still npm run build && npm run typecheck (build first — some workspaces import compiled dist/ outputs); the LSP is for targeted, interactive queries, not for CI-equivalent validation.

正文来自原始仓库, 版权归作者所有,许可:Apache-2.0。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/ClickHouse/clickhouse-js

标签

development-engineeringfrontendbackendtypescriptdocsproductivity

同类 Skill