This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is Second Life's creation-focused documentation site, built with Astro + Starlight. The site is currently a basic template that will be built out starting with the LSL (Linden Scripting Language) portal. It covers both building and scripting aspects of Second Life content creation.
All commands use pnpm:
pnpm install- Install dependenciespnpm dev- Start dev server at http://localhost:4321pnpm build- Build production site to ./dist/pnpm preview- Preview production build locallypnpm astro check- Run TypeScript type checkingpnpm generate:docs- Generate all reference pages (functions, events, and constants) for both LSL and Lua from src/definitions/lsl_definitions.yaml
Documentation lives in src/content/docs/ with two main areas:
build/ - Building and construction documentation
build/guides/- Build tutorials and guidesbuild/reference/- Build reference materials
script/ - Scripting documentation (primary focus: LSL portal)
script/guides/- Scripting guidesscript/lsl-reference/- LSL language referencescript/lua-reference/- Lua referencescript/learn-lua/- Lua learning materials
Files are .md or .mdx format. Routes auto-generate from file paths (e.g., docs/script/lsl-reference/example.md → /script/lsl-reference/example/).
Configured in astro.config.mjs with additional locales:
root(English, default)de(German),es(Spanish),fr(French),it(Italian)ja(Japanese),ko(Korean),nl(Dutch),pt(Portuguese),ru(Russian)
To add translated content, create localized directories like docs/de/, docs/ja/, etc.
Sidebar configuration in astro.config.mjs:
- Manual entries: Define with
labelandslug - Auto-generated: Use
autogenerate: { directory: 'reference' }to include all files in a directory
astro.config.mjs- Starlight integration, sidebar, localessrc/content.config.ts- Content collections using Starlight's schematsconfig.json- Extends Astro's strict TypeScript preset
Approved Tone: Balanced & Pragmatic
All documentation should use a balanced and pragmatic tone that:
- Is professional but approachable
- Maintains technical accuracy with clear explanations
- Acknowledges both benefits and challenges
- Respects the reader's existing knowledge (especially for LSL scripters and SL builders)
- Works well for both learning new concepts and later reference use
Writing Guidelines:
- Use "you" to address the reader directly
- Be clear and precise without being overly formal
- Explain the "why" behind concepts, not just the "what"
- Anticipate common confusion points (especially for LSL-to-Lua migration)
- Use code examples to illustrate concepts
- Avoid excessive enthusiasm or marketing language
- Don't oversimplify or condescend to the reader
Example of preferred tone:
"Tables are Lua's most powerful data structure. Unlike LSL's separate
listtype, tables serve two purposes: they work as both arrays (like LSL lists) and dictionaries/maps (which LSL doesn't have)."
- Create
.mdor.mdxfile in appropriatesrc/content/docs/subdirectory - Add frontmatter:
--- title: Page Title description: Brief description for SEO ---
- For
.mdx, import Starlight components as needed:import { Card, CardGrid, Tabs, TabItem } from '@astrojs/starlight/components';
- Update sidebar in
astro.config.mjsif needed (or rely on autogenerate)
src/assets/- Images embedded in Markdown with relative linkspublic/- Static assets (favicons, etc.) served directly
The repository includes reference materials in the context/ directory (gitignored):
context/lsl_definitions.yaml - Comprehensive language definitions for both LSL and Lua, including:
- Constants with types, values, and tooltips
- Functions with signatures, parameters, return types, and descriptions
- Events and their parameters
- Function IDs for LSO compilation
- Structured in YAML format for programmatic processing
context/wiki.secondlife.com/ - Exported MediaWiki markup from Second Life's current wiki:
constants/- Constant documentation pagesfunctions/- Function documentation pagesflow-control/- Control flow documentationlsl-portal/- General LSL portal pages, tutorials, protocols, examples
context/lua-guide/ - Suzanna's SLua Guide (https://suzanna-linn.github.io/slua/):
- Comprehensive educational resource for the Lua language
- Jekyll-based documentation with markdown files in
docs/directory - Content includes:
- Language fundamentals:
language1.md,language2.md - Migration guides for LSL scripters:
moving-*.mdfiles covering datatypes, events, functions, operators, lists, strings, control flow, and libraries - Practical examples:
scripts-*.mdfiles with working examples (coroutines, enums, floating texts, sets, web integration) - Reference materials:
classes.md,transpiler.md,beta.md,future.md,history.md
- Language fundamentals:
- Licensed under Creative Commons Attribution 4.0 (text) and MIT License (code examples)
- Use as reference for Lua language documentation and migration patterns
context/taxonomy.md - Proposed site architecture and content taxonomy:
- Scripting portal structure with sections for Getting Started, Features, Guides, and Recipes
- Planned organization for Lua/LSL language documentation
- Standard library/reference organization patterns
- Site-wide Lua/LSL toggle considerations
These files are reference materials for building the new documentation. They should be transformed into clean, modern Markdown/MDX format in src/content/docs/.
The LSL portal is the initial focus area. Documentation should go in:
src/content/docs/script/lsl-reference/- Language reference, functions, events, constantssrc/content/docs/script/guides/- Tutorials, examples, best practices
Consider organizing LSL content by:
- Language syntax and structure
- Built-in functions (organized by category)
- Events
- Constants and types
- Examples and common patterns
When building documentation, use context/lsl_definitions.yaml as the authoritative source for technical accuracy, and reference context/wiki.secondlife.com/ for existing documentation patterns and examples.
The project includes an automated generator for creating LSL and Lua reference pages for functions, events, and constants:
Generator Script: scripts/generate-docs.js
- Parses
src/definitions/lsl_definitions.yamlto extract definitions - Supports both LSL and Lua/Luau generation
- Creates MDX pages with appropriate components (LSLFunction/LuaFunction, LSLEvent/LuaEvent, LSLConstant/LuaConstant)
- Run with:
pnpm generate:docs - Generates pages in:
- LSL functions:
src/content/docs/script/lsl-reference/functions/ - Lua functions:
src/content/docs/script/lua-reference/functions/ - LSL events:
src/content/docs/script/lsl-reference/events/ - Lua events:
src/content/docs/script/lua-reference/events/ - LSL constants:
src/content/docs/script/lsl-reference/constants/ - Lua constants:
src/content/docs/script/lua-reference/constants/
- LSL functions:
Custom Content Preservation:
Generated pages support custom content that persists across regenerations. Any content after the component tag (e.g., <LSLFunction />, <LSLEvent />, <LSLConstant />) and before the optional attribution footer will be preserved when re-running the generator. This allows you to:
- Add usage examples
- Include additional notes and caveats
- Link to related functions, events, or constants
- Provide tutorials or best practices
Generated Page Structure:
- Frontmatter with title and description
- Component import statements
- Reference component tag (LSLFunction/LuaFunction, LSLEvent/LuaEvent, or LSLConstant/LuaConstant)
- Custom content marker comment:
{/* DO NOT EDIT ABOVE THIS LINE */} - Custom content section for examples, notes, and related links
- Optional WikiAttribution footer (for LSL pages)
Component Locations:
Functions:
src/components/FunctionReference.astro- Base function reference componentsrc/components/LSLFunction.astro- LSL function wrappersrc/components/SLuaFunction.astro- Lua function wrapper
Events:
src/components/EventReference.astro- Base event reference componentsrc/components/LSLEvent.astro- LSL event wrappersrc/components/SLuaEvent.astro- Lua event wrapper
Constants:
src/components/ConstantReference.astro- Base constant reference componentsrc/components/LSLConstant.astro- LSL constant wrappersrc/components/SLuaConstant.astro- Lua constant wrapper
These components dynamically load data from src/definitions/lsl_definitions.yaml at build time, requiring only the name as a prop. All metadata (signatures, parameters, types, values, energy costs, sleep times, badges) is loaded from the YAML file.
When importing custom components in MDX use the @component alias, ex.:
import SLuaConstant from '@components/SluaConstant.astro';