Agent skill

lsp-design

Language Server Protocol 서버 구현 가이드. LSP 서버, 증분 파싱, 자동완성, 진단, Go-to-Definition, 호버를 구현할 때 사용한다.

Stars 88
Forks 14

Install this agent skill to your Project

npx add-skill https://github.com/revfactory/claude-code-harness/tree/main/experiments/results/case-015/harness/.claude/skills/lsp-design

SKILL.md

LSP Design Skill

LSP 메시지 흐름

Client                          Server
  │                               │
  │── initialize ───────────────→ │
  │←── initialize result ────────│
  │── initialized ──────────────→ │
  │                               │
  │── textDocument/didOpen ─────→ │ → parse → diagnostics
  │←── publishDiagnostics ───────│
  │                               │
  │── textDocument/didChange ───→ │ → incremental parse → diagnostics
  │←── publishDiagnostics ───────│
  │                               │
  │── textDocument/completion ──→ │
  │←── completion items ─────────│
  │                               │
  │── textDocument/definition ──→ │
  │←── location ─────────────────│
  │                               │
  │── textDocument/hover ───────→ │
  │←── hover content ────────────│
  │                               │
  │── shutdown ─────────────────→ │
  │←── null ─────────────────────│
  │── exit ─────────────────────→ │

에러 복구 파싱

파서가 예상치 못한 토큰을 만났을 때:
1. 에러 진단 추가 (위치 + 메시지)
2. 동기화 토큰까지 스킵 (;, }, EOF)
3. 파싱 계속 → 추가 에러 감지
4. 결과: 부분 AST + 에러 목록

심볼 테이블 구조

GlobalScope
  ├── print (builtin function)
  ├── len (builtin function)
  ├── x (variable, line 1)
  ├── add (function, line 3)
  │   └── FunctionScope
  │       ├── a (parameter)
  │       └── b (parameter)
  └── main logic
      └── BlockScope (if/while/for)
          └── i (variable)

자동완성 전략

  1. 커서 위치의 스코프 결정
  2. 스코프 체인 순회하며 가용 심볼 수집
  3. 접두사 필터링
  4. 종류별 정렬: keywords < variables < functions

구현 순서

  1. JSON-RPC Transport (프로토콜 레이어)
  2. Lexer + Parser (에러 복구 포함)
  3. TextDocument + DocumentManager
  4. SymbolTable + Scope
  5. DiagnosticProvider (파서 에러 + 시맨틱 에러)
  6. CompletionProvider
  7. DefinitionProvider
  8. HoverProvider
  9. LSP Server (요청 라우팅)
  10. 통합 테스트

Expand your agent's capabilities with these related and highly-rated skills.

revfactory/claude-code-harness

interpreter-design

Programming language interpreter design and implementation guide. Use when the user requests building an interpreter, parser, lexer, or language implementation — including Pratt parsing, AST evaluation, scope chains, and closures.

88 14
Explore
revfactory/claude-code-harness

express-api-design

Express.js REST API design and implementation guide. Use when implementing REST API endpoints, creating Express routes, or setting up API project structure with MVC pattern.

88 14
Explore
revfactory/claude-code-harness

query-engine-design

SQL query engine design and implementation guide. Use when the user requests building a SQL engine, query parser, query planner, or query executor — including in-memory storage, SQL parsing, and query optimization.

88 14
Explore
revfactory/claude-code-harness

api-documentation

Write accurate and complete library API documentation. Use when creating API docs, README files, or function reference documentation. Ensures all signatures, parameters, return types, and examples are precise.

88 14
Explore
revfactory/claude-code-harness

async-debugging

Analyze and fix race conditions and concurrency bugs in async code. Use when debugging async bugs, fixing race conditions, resolving concurrency issues, or when shared state is accessed by multiple async operations.

88 14
Explore
revfactory/claude-code-harness

reactive-spreadsheet-design

리액티브 스프레드시트 엔진 설계 가이드. 셀 수식 파싱, 의존성 그래프(DAG), 증분 재계산, 내장 함수 구현 시 사용한다.

88 14
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results