This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is an Astro-based static site generator within the Lossless Group monorepo, featuring an advanced Markdown processing pipeline with custom components and multiple deployment environments.
Core Technologies:
- Astro 5.13.2 - Static site generator with islands architecture
- Svelte 5.38 - Interactive client components
- Tailwind CSS v4 - Styling with custom Lossless theme
- Shiki - Syntax highlighting with custom singleton utility
- pnpm - Package manager (REQUIRED - do not use npm/yarn)
# Install dependencies (MUST use pnpm)
pnpm install
# One-time setup after install
pnpm approve-builds
# Development server
pnpm dev
# If dev server issues, run in background
pnpm dev > /tmp/astro-dev.log 2>&1 &
# Production build
pnpm build
# Debug build issues
pnpm build 2>&1 | tee build_output.log
# Preview production build
pnpm preview
# Export slides to PDF
pnpm export-pdf
# Git LFS (for large files)
git lfs install
git lfs pull
# Initialize content submodule
git submodule update --init --recursiveNote: No lint/typecheck commands currently configured. When requested by users, suggest adding to package.json.
The content architecture supports multiple deployment contexts through environment-based path resolution:
DEPLOY_ENV determines content location:
- LocalSiteOnly: /src/generated-content (default)
- LocalMonorepo: ../content (for monorepo development)
- Vercel: /src/generated-content
- Railway: /lossless-monorepo/content
The site uses Astro's content collections with custom loaders:
- essays, concepts, vocabulary - Knowledge base content
- tooling, vertical-toolkits - Tool documentation
- slides - Reveal.js presentations
- projects - Project showcases with JSON Canvas support
- client-content - Client-specific recommendations and portfolios
- lost-in-public/ - Public content (blueprints, prompts, explorations)
The site implements a sophisticated multi-stage processing system:
-
Remark Stage (Markdown AST)
- Custom directives (:::figma, :::projects)
- Obsidian-style backlinks [[Internal Links]]
- Callout blocks (> [!info], > [!warning])
- YouTube auto-embeds from plain URLs
-
Rehype Stage (HTML AST)
- Mermaid diagram rendering
- Auto-linked headers with IDs
- Raw HTML processing
- Syntax highlighting via Shiki singleton
-
Component Integration
- MDX support for embedding Astro/Svelte components
- Custom code block types (imageGallery, toolingGallery)
- JSON Canvas rendering for interactive diagrams
/src/components/
├── basics/ # Core UI components
├── tool-components/ # Tool-specific components
├── *.astro # Server-rendered components
└── *.svelte # Client-side interactive components
/src/layouts/
├── Layout.astro # Base layout wrapper
├── OneArticle.astro # Article with sidebar
├── MarkdownSlideDeck.astro # Reveal.js presentations
└── Section__JSONCanvasLayout.astro # Canvas visualizations
- File-based routing via
/src/pages/ - Dynamic catch-all route
[...path].astrohandles content collections - Client-specific routing through MOC (Map of Contents) system
Create .env from example.env:
NODE_ENV=development
APP_ENV=development
DEPLOY_ENV=LocalSiteOnly
# Debug flags
SHOW_DEBUG_MARKDOWN_AST=true
DEBUG_CITATIONS=true
DEBUG_BACKLINKS=true
DEBUG_TOC=true
# API Keys (optional)
PLUNK_API_KEY=your_key_here- Check existing patterns in similar components
- Use TypeScript for new components with proper interfaces
- Follow Astro conventions (no React/JSX patterns)
- Leverage existing utilities before creating new ones
- Collections defined in
content.config.ts - Content paths resolved via
envUtils.jsbased on DEPLOY_ENV - Use glob loaders with proper base paths
- Schemas are permissive (.passthrough()) to handle varied frontmatter
- Directives:
:::<name>with YAML-style attributes - Backlinks:
[[path/to/file]]Obsidian-compatible - Callouts:
> [!type]GitHub-style with custom styling - Code blocks: Support custom languages for galleries
- Use Tailwind classes inline during development
- Global styles in
/src/styles/global.css - Theme variables in
lossless-theme.css - Avoid custom CSS unless absolutely necessary
# Check DEPLOY_ENV setting
cat .env | grep DEPLOY_ENV
# Initialize submodules
git submodule update --init --recursive
# Verify content path
ls -la src/generated-content/# Run in background and check logs
pnpm dev > /tmp/astro-dev.log 2>&1 &
tail -f /tmp/astro-dev.log# Capture full output
pnpm build 2>&1 | tee build_output.log
# Common fixes:
# 1. Clear node_modules and reinstall
rm -rf node_modules && pnpm install
# 2. Check for Git LFS issues
git lfs pull
# 3. Verify environment variablesExpected warnings for custom code block types:
imageGallerytoolingGallerylitegal
These are handled by custom rendering, not Shiki.
- AI-assisted development with non-standard patterns
- Prioritize functionality over convention
- Expect creative solutions and workarounds
- Test thoroughly as no automated test suite exists
- Site lives in
/site/directory - Content managed as separate git submodule
- Path resolution adapts to deployment context
- Use relative imports within site directory
- Images served via ImageKit CDN when configured
- Static generation for all pages
- Islands architecture for selective hydration
- Lazy loading for heavy components
astro.config.mjs- Core Astro setupcontent.config.ts- Collection definitionssrc/utils/envUtils.js- Environment resolutiontailwind.config.js- Tailwind setup
src/layouts/OneArticle.astro- Main article layoutsrc/components/JSONCanvas*.svelte- Canvas renderingsrc/pages/[...path].astro- Dynamic routing
- Layout-level processing (not global)
- Custom remark/rehype plugins per layout
- Debug output in
/debug/when enabled
- Always use pnpm - npm/yarn will cause dependency issues
- Check git status - User may have uncommitted changes
- Verify DEPLOY_ENV - Affects content path resolution
- Test incrementally - No automated tests means manual verification
- Preserve functionality - Even if code seems unusual
- Ask about intent - "Vibe coded" nature means understanding goals is crucial
When users report issues, check in order:
- Environment variables (.env file)
- Git submodules (content availability)
- Dev server logs (if running in background)
- Build output (pipe to file for long outputs)
- Browser console (for client-side errors)