Skip to content
fold-lsp logo

Fold LSP - Scheme Code Intelligence

fold-lsp

This skill should be used when working with Scheme files in The Fold codebase. Use it to "get type information", "find definitions", "check for errors", "understand Scheme code", or when editing .ss files. Provides LSP-powered code intelligence for Scheme development.

SKILL.md

Full skill instructions

Fold LSP - Scheme Code Intelligence

Overview

The Fold includes an LSP (Language Server Protocol) server that provides rich code intelligence for Scheme files. The MCP server exposes these capabilities as tools that can be used to understand and navigate Scheme code.

Use LSP tools for:

  • Getting type information and documentation for symbols
  • Finding where functions are defined
  • Finding all usages of a function or variable
  • Checking files for syntax errors and warnings
  • Searching for symbols by name

Available Tools

ToolPurposeWhen to Use
fold_lsp_hoverGet type info at positionBefore modifying a function to understand its signature
fold_lsp_definitionGo to symbol definitionWhen needing to read or modify a function's implementation
fold_lsp_referencesFind all usagesBefore refactoring to understand impact
fold_lsp_symbolsSearch by nameWhen looking for a function but unsure of exact location
fold_lsp_diagnosticsCheck for errorsAfter editing to verify code correctness
fold_lsp_formatFormat codeWhen code needs consistent formatting
fold_lsp_lookupCombined lookupOne-stop info gathering (hover + def + refs)
fold_lsp_statusCheck LSP statusTroubleshooting LSP issues

Usage Patterns

When Editing Scheme Files

  1. Before modifying a function, use fold_lsp_hover to understand:

    • The function's type signature
    • What parameters it expects
    • What it returns
  2. After editing, use fold_lsp_diagnostics to:

    • Verify no syntax errors were introduced
    • Check for unbalanced parentheses
    • Identify any type issues

When Understanding Code

Use fold_lsp_lookup for comprehensive symbol analysis:

  • Combines type info, definition location, and all references
  • More efficient than calling each tool separately
  • Useful for understanding a symbol's role in the codebase

When Refactoring

  1. Use fold_lsp_references to find all usages of a symbol
  2. Review each usage to understand the impact
  3. Make changes incrementally
  4. Use fold_lsp_diagnostics after each change

When Searching

Use fold_lsp_symbols when:

  • Looking for a function by partial name
  • Exploring available functions in a module
  • Finding where a concept is implemented

Position Parameters

LSP tools use 0-indexed positions:

  • line: Line number starting from 0
  • character: Column position starting from 0

To find the position of a symbol in a file:

  1. Read the file content
  2. Count lines (0-indexed)
  3. Count characters from line start (0-indexed)

Examples

Get Type Information

To understand what vec3-add does:

fold_lsp_hover(file: "lattice/​linalg/​vec.ss", line: 42, character: 8)

Returns type signature and documentation if available.

Find Definition

To navigate to where matrix-multiply is defined:

fold_lsp_definition(file: "lattice/​linalg/​matrix.ss", line: 100, character: 12)

Returns file path and line number of definition.

Check for Errors

After editing a file, verify it's correct:

fold_lsp_diagnostics(file: "lattice/​linalg/​vec.ss")

Returns list of errors/​warnings or "File looks clean!"

Search for Symbols

Find all functions related to "parse":

fold_lsp_symbols(query: "parse")

Returns matching function names with their locations.

Best Practices

  1. Use proactively: Check types before modifying unfamiliar code
  2. Verify edits: Run diagnostics after any .ss file changes
  3. Understand impact: Check references before renaming or removing
  4. Combine tools: Use lookup for comprehensive understanding
  5. Trust but verify: LSP type inference is best-effort, not guaranteed

Integration with Other Tools

LSP tools complement other The Fold tools:

  • With lattice search (lf, li, le): LSP provides position-specific info, lattice provides module-level discovery
  • With REPL (fold_eval): LSP shows types, REPL executes code
  • With Read tool: LSP shows semantics, Read shows raw content

Troubleshooting

LSP not responding:

  1. Check status with fold_lsp_status
  2. The LSP starts automatically on first use
  3. If issues persist, restart the MCP server

No results:

  • Ensure file path is correct (absolute or relative to project root)
  • Position must be on a symbol, not whitespace
  • Some symbols may not have type information

Wrong results:

  • LSP uses heuristic type inference, not formal type checking
  • Built-in primitives have predefined types
  • User-defined functions get inferred types when possible

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View