Agent skill
lsp-design
Language Server Protocol 서버 구현 가이드. LSP 서버, 증분 파싱, 자동완성, 진단, Go-to-Definition, 호버를 구현할 때 사용한다.
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)
자동완성 전략
- 커서 위치의 스코프 결정
- 스코프 체인 순회하며 가용 심볼 수집
- 접두사 필터링
- 종류별 정렬: keywords < variables < functions
구현 순서
- JSON-RPC Transport (프로토콜 레이어)
- Lexer + Parser (에러 복구 포함)
- TextDocument + DocumentManager
- SymbolTable + Scope
- DiagnosticProvider (파서 에러 + 시맨틱 에러)
- CompletionProvider
- DefinitionProvider
- HoverProvider
- LSP Server (요청 라우팅)
- 통합 테스트
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
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.
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.
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.
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.
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.
reactive-spreadsheet-design
리액티브 스프레드시트 엔진 설계 가이드. 셀 수식 파싱, 의존성 그래프(DAG), 증분 재계산, 내장 함수 구현 시 사용한다.
Didn't find tool you were looking for?