Skip to content
Development
Hook

Hooks

What litestar runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
litestar
1720 skills1 agent2 hooks

Claude Code

> /plugin marketplace add litestar-org/litestar-skills
> /plugin install litestar@litestar

Where it lives

  • hooks/session-start.ps1GitHub
    Read the script
    #!/usr/bin/env pwsh
    # Litestar SessionStart context hook — Native PowerShell 5.1+ / 7+.
    # Supports: --harness <agy|claude|cursor|opencode|json> --project <dir>
    
    $ErrorActionPreference = "Stop"
    
    if ($env:LITESTAR_SKILLS_HOOK_DISABLE -eq "1" -or $env:LITESTAR_SKILLS_HOOK_DISABLE -eq "true") {
        [Console]::Out.WriteLine("{}")
        exit 0
    }
    
    $Harness = "claude"
    $ProjectDir = ""
    
    for ($i = 0; $i -lt $args.Count; $i++) {
        $arg = [string]$args[$i]
        if ($arg -eq "--harness" -or $arg -eq "-Harness") {
            if ($i + 1 -lt $args.Count) {
                $Harness = [string]$args[$i + 1]
                $i++
            }
        } elseif ($arg -like "--harness=*") {
            $Harness = $arg.Substring(10)
        } elseif ($arg -like "-Harness=*") {
            $Harness = $arg.Substring(9)
        } elseif ($arg -eq "--project" -or $arg -eq "-Project") {
            if ($i + 1 -lt $args.Count) {
                $ProjectDir = [string]$args[$i + 1]
                $i++
            }
        } elseif ($arg -like "--project=*") {
            $ProjectDir = $arg.Substring(10)
        } elseif ($arg -like "-Project=*") {
            $ProjectDir = $arg.Substring(9)
        }
    }
    
    if ($Harness -eq "claude" -and -not [string]::IsNullOrEmpty($env:CURSOR_VERSION)) {
        [Console]::Out.WriteLine('{"continue":true}')
        exit 0
    }
    
    if (-not $ProjectDir -and [Console]::IsInputRedirected) {
        try {
            $StdinText = [Console]::In.ReadToEnd()
            if ($StdinText) {
                foreach ($pattern in @(
                    '"workspacePaths"\s*:\s*\[\s*"([^"]+)"',
                    '"workspace_roots"\s*:\s*\[\s*"([^"]+)"',
                    '"cwd"\s*:\s*"([^"]+)"',
                    '"workspaceRoot"\s*:\s*"([^"]+)"'
                )) {
                    $m = [regex]::Match($StdinText, $pattern)
                    if ($m.Success) {
                        $ProjectDir = $m.Groups[1].Value -replace '\\\\', '/'
                        break
                    }
                }
            }
        } catch {
            # Ignore malformed stdin
        }
    }
    
    if (-not $ProjectDir) {
        if ($env:CURSOR_PROJECT_DIR) {
            $ProjectDir = $env:CURSOR_PROJECT_DIR
        } elseif ($env:CLAUDE_PROJECT_DIR) {
            $ProjectDir = $env:CLAUDE_PROJECT_DIR
        } else {
            $ProjectDir = (Get-Location).Path
        }
    }
    
    $DetectedSkills = New-Object System.Collections.Generic.List[string]
    function Add-Skill([string]$Name) {
        if (-not $DetectedSkills.Contains($Name)) {
            $DetectedSkills.Add($Name)
        }
    }
    
    $PyprojectPath = Join-Path $ProjectDir "pyproject.toml"
    $OwnPackage = ""
    $IsPluginRepo = $false
    $IsUpstream = $false
    $HasCore = $false
    $UpstreamPackages = @(
        "litestar",
        "advanced-alchemy",
        "sqlspec",
        "msgspec",
        "litestar-granian",
        "litestar-saq",
        "litestar-queues",
        "litestar-security",
        "litestar-autowire",
        "litestar-vite",
        "litestar-htmx",
        "litestar-mcp",
        "litestar-email",
        "pytest-databases",
        "polyfactory"
    )
    
    if (Test-Path -LiteralPath $PyprojectPath) {
        $Content = Get-Content -LiteralPath $PyprojectPath -Raw -ErrorAction SilentlyContinue
        if ($Content -match '(?ms)^\[project\].*?^\s*name\s*=\s*"([^"]+)"') {
            $OwnPackage = $Matches[1].ToLowerInvariant().Replace("_", "-")
        }
        if ($OwnPackage -eq "litestar-skills") {
            $IsPluginRepo = $true
            Add-Skill 'litestar-styleguide'
        } else {
            if ($UpstreamPackages -contains $OwnPackage) {
                $IsUpstream = $true
                $HasCore = $true
            }
            if ($Content -match '(?i)litestar') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar') { Add-Skill 'litestar' }
            }
            if ($Content -match '(?i)advanced[-_]alchemy') {
                $HasCore = $true
                if ($OwnPackage -ne 'advanced-alchemy') { Add-Skill 'advanced-alchemy' }
            }
            if ($Content -match '(?i)sqlspec') {
                $HasCore = $true
                if ($OwnPackage -ne 'sqlspec') { Add-Skill 'sqlspec' }
            }
            if ($Content -match '(?i)msgspec') {
                $HasCore = $true
                if ($OwnPackage -ne 'msgspec') { Add-Skill 'msgspec' }
            }
            if ($Content -match '(?i)litestar[-_]granian') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-granian') { Add-Skill 'litestar-granian' }
            }
            if ($Content -match '(?i)litestar[-_]saq') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-saq') { Add-Skill 'litestar-saq' }
            }
            if ($Content -match '(?i)litestar[-_]queues') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-queues') { Add-Skill 'litestar-queues' }
            }
            if ($Content -match '(?i)litestar[-_]security') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-security') { Add-Skill 'litestar-security' }
            }
            if ($Content -match '(?i)litestar[-_]autowire') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-autowire') { Add-Skill 'litestar-autowire' }
            }
            if ($Content -match '(?i)litestar[-_]vite') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-vite') { Add-Skill 'litestar-vite' }
            }
            if ($Content -match '(?i)litestar[-_]htmx') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-htmx') { Add-Skill 'litestar-htmx' }
            }
            if ($Content -match '(?i)litestar[-_]mcp') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-mcp') { Add-Skill 'litestar-mcp' }
            }
            if ($Content -match '(?i)litestar[-_]email') {
                $HasCore = $true
                if ($OwnPackage -ne 'litestar-email') { Add-Skill 'litestar-email' }
            }
            if ($Content -match '(?i)pytest[-_]databases') {
                $HasCore = $true
                if ($OwnPackage -ne 'pytest-databases') { Add-Skill 'pytest-databases' }
            }
            if ($Content -match '(?i)polyfactory') {
                $HasCore = $true
                if ($OwnPackage -ne 'polyfactory') { Add-Skill 'polyfactory' }
            }
            i
  • hooks/session-start.shGitHub
    Read the script
    #!/bin/sh
    # Litestar SessionStart context hook — 100% POSIX sh + awk (zero Python/jq dependencies).
    # Supports: --harness <agy|claude|cursor|opencode|json> --project <dir>
    
    set -eu
    
    if [ "${LITESTAR_SKILLS_HOOK_DISABLE:-0}" = "1" ] || [ "${LITESTAR_SKILLS_HOOK_DISABLE:-}" = "true" ]; then
      printf '{}\n'
      exit 0
    fi
    
    HARNESS="claude"
    PROJECT_DIR=""
    
    while [ $# -gt 0 ]; do
      case "$1" in
        --harness)
          HARNESS="${2:-claude}"
          shift 2
          ;;
        --harness=*)
          HARNESS="${1#*=}"
          shift 1
          ;;
        --project)
          PROJECT_DIR="${2:-}"
          shift 2
          ;;
        --project=*)
          PROJECT_DIR="${1#*=}"
          shift 1
          ;;
        *)
          shift
          ;;
      esac
    done
    
    # Suppress duplicate Claude hook execution when running inside Cursor IDE.
    if [ "$HARNESS" = "claude" ] && [ -n "${CURSOR_VERSION:-}" ]; then
      printf '{"continue":true}\n'
      exit 0
    fi
    
    STDIN_JSON=""
    if [ ! -t 0 ]; then
      STDIN_JSON=$(cat || true)
    fi
    
    if [ -z "$PROJECT_DIR" ] && [ -n "$STDIN_JSON" ]; then
      PROJECT_DIR=$(printf '%s\n' "$STDIN_JSON" | awk '
        {
          buf = buf " " $0
        }
        END {
          if (match(buf, /"workspacePaths"[[:space:]]*:[[:space:]]*\[[[:space:]]*"[^"]+"/)) {
            s = substr(buf, RSTART, RLENGTH)
            sub(/^.*"workspacePaths"[[:space:]]*:[[:space:]]*\[[[:space:]]*"/, "", s)
            sub(/"$/, "", s)
            gsub(/\\\\/, "/", s)
            print s
            exit
          }
          if (match(buf, /"workspace_roots"[[:space:]]*:[[:space:]]*\[[[:space:]]*"[^"]+"/)) {
            s = substr(buf, RSTART, RLENGTH)
            sub(/^.*"workspace_roots"[[:space:]]*:[[:space:]]*\[[[:space:]]*"/, "", s)
            sub(/"$/, "", s)
            gsub(/\\\\/, "/", s)
            print s
            exit
          }
          if (match(buf, /"cwd"[[:space:]]*:[[:space:]]*"[^"]+"/)) {
            s = substr(buf, RSTART, RLENGTH)
            sub(/^.*"cwd"[[:space:]]*:[[:space:]]*"/, "", s)
            sub(/"$/, "", s)
            gsub(/\\\\/, "/", s)
            print s
            exit
          }
          if (match(buf, /"workspaceRoot"[[:space:]]*:[[:space:]]*"[^"]+"/)) {
            s = substr(buf, RSTART, RLENGTH)
            sub(/^.*"workspaceRoot"[[:space:]]*:[[:space:]]*"/, "", s)
            sub(/"$/, "", s)
            gsub(/\\\\/, "/", s)
            print s
            exit
          }
        }
      ')
    fi
    
    if [ -z "$PROJECT_DIR" ]; then
      PROJECT_DIR="${CURSOR_PROJECT_DIR:-${CLAUDE_PROJECT_DIR:-$(pwd)}}"
    fi
    
    json_escape() {
      awk '
        BEGIN { ORS = "" }
        {
          gsub(/\\/, "\\\\")
          gsub(/"/, "\\\"")
          gsub(/\r/, "")
          gsub(/\t/, "\\t")
          if (NR > 1) printf "\\n"
          printf "%s", $0
        }
      '
    }
    
    SKILLS=""
    SKILLS_JSON=""
    
    add_skill() {
      skill_name="$1"
      case " $SKILLS " in
        *" $skill_name "*) return ;;
      esac
      if [ -z "$SKILLS" ]; then
        SKILLS="$skill_name"
        SKILLS_JSON="\"$skill_name\""
      else
        SKILLS="$SKILLS $skill_name"
        SKILLS_JSON="$SKILLS_JSON, \"$skill_name\""
      fi
    }
    
    PYPROJECT="$PROJECT_DIR/pyproject.toml"
    OWN_PACKAGE=""
    IS_PLUGIN_REPO=0
    IS_UPSTREAM=0
    HAS_CORE=0
    
    if [ -f "$PYPROJECT" ]; then
      OWN_PACKAGE=$(awk '
        /^\[project\]/ { in_proj=1; next }
        /^\[/ { in_proj=0 }
        in_proj && /^[[:space:]]*name[[:space:]]*=/ {
          line = $0
          sub(/^[^=]*=[[:space:]]*"/, "", line)
          sub(/".*$/, "", line)
          gsub(/_/, "-", line)
          print tolower(line)
          exit
        }
      ' "$PYPROJECT" 2>/dev/null || true)
    
      case "$OWN_PACKAGE" in
        litestar-skills)
          IS_PLUGIN_REPO=1
          ;;
        litestar|advanced-alchemy|sqlspec|msgspec|litestar-granian|litestar-saq|litestar-queues|litestar-security|litestar-autowire|litestar-vite|litestar-htmx|litestar-mcp|litestar-email|pytest-databases|polyfactory)
          IS_UPSTREAM=1
          HAS_CORE=1
          ;;
      esac
    
      if [ "$IS_PLUGIN_REPO" -eq 1 ]; then
        add_skill "litestar-styleguide"
      else
        grep -qi "litestar" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar" ] && add_skill "litestar" || true; }
        grep -Eq "advanced[-_]alchemy" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "advanced-alchemy" ] && add_skill "advanced-alchemy" || true; }
        grep -qi "sqlspec" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "sqlspec" ] && add_skill "sqlspec" || true; }
        grep -qi "msgspec" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "msgspec" ] && add_skill "msgspec" || true; }
        grep -Eq "litestar[-_]granian" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-granian" ] && add_skill "litestar-granian" || true; }
        grep -Eq "litestar[-_]saq" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-saq" ] && add_skill "litestar-saq" || true; }
        grep -Eq "litestar[-_]queues" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-queues" ] && add_skill "litestar-queues" || true; }
        grep -Eq "litestar[-_]security" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-security" ] && add_skill "litestar-security" || true; }
        grep -Eq "litestar[-_]autowire" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-autowire" ] && add_skill "litestar-autowire" || true; }
        grep -Eq "litestar[-_]vite" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-vite" ] && add_skill "litestar-vite" || true; }
        grep -Eq "litestar[-_]htmx" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-htmx" ] && add_skill "litestar-htmx" || true; }
        grep -Eq "litestar[-_]mcp" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-mcp" ] && add_skill "litestar-mcp" || true; }
        grep -Eq "litestar[-_]email" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "litestar-email" ] && add_skill "litestar-email" || true; }
        grep -Eq "pytest[-_]databases" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "pytest-databases" ] && add_skill "pytest-databases" || true; }
        grep -qi "polyfactory" "$PYPROJECT" 2>/dev/null && { HAS_CORE=1; [ "$OWN_PACKAGE" != "polyfactory" ] && add_skill "

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

@litestar-org
Ships withlitestar

Opinionated, first-party agent skills, plugins, subagents, hooks, and rules for the Litestar framework and its ecosystem — published from a single-root repository across Google Antigravity, Claude Code, Codex CLI, Cursor, OpenCode, and VS Code / Copilot.

1720 skills1 agent
Get the whole plugin

Stars on GitHub

Momentum

stars in total
17
Star history of litestar-org/litestar-skills on GitHub, a chart by star-history.com

More plugins that ship hooks.

superpowers

superpowers

A development methodology for coding agents that makes the agent brainstorm before building, follow plans, run parallel work and finish branches in a disciplined way. You get fewer skipped steps and more consistent results from your coding assistant.

15 skills1 hook311k
@obra@obra
Install Plugin
ponytail

ponytail

A Claude Code plugin with skills for auditing a whole repo, reviewing a change, listing deferred shortcut comments, and showing measured savings and a quick command reference.

6 skills10 hooks188k
@dietrichgebert@dietrichgebert
Install Plugin
agent-skills

agent-skills

Walks a software change from a written spec through design, testing, code review, CI/CD, and release, applying the matching engineering skill at each stage. Useful for developers using Claude Code on full development workflows.

25 skills+3112k
@addyosmani@addyosmani
Install Plugin
planning-with-files

planning-with-files

Persistent file-based planning for AI coding agents on long-running, multi-step tasks. It keeps task_plan.md, findings.md and progress.md on disk, so work can resume after /clear or context compaction.

6 skills+228k
@othmanadi@othmanadi
Install Plugin
gsd-core

gsd-core

A spec-driven development workflow for Claude Code that guides a project through planning, phases, milestone audits and fixes. Includes skills to generate tests from UAT criteria and to audit completed work.

72 skills+311k
@open-gsd@open-gsd
Install Plugin
superpowers-zh

superpowers-zh

Chinese-language skill pack for Claude Code that adds workflow guidance for brainstorming, TDD, debugging, and code review, plus Chinese conventions for commits, documentation, and domestic Git platforms like Gitee and Coding.net.

21 skills1 hook8.5k
@jnmetacode@jnmetacode
Install Plugin
socraticode

socraticode

Gives Claude Code semantic search, dependency graph and architecture context over a codebase, so an AI assistant can explore and understand a project's code. Includes skills for indexing a project and managing its file watching.

2 skills+33.4k
@giancarloerra@giancarloerra
Install Plugin
cocoindex-code

cocoindex-code

A lightweight code search engine that uses AST-based semantic search with local embeddings and incremental indexing. It helps Claude Code users find code faster and more efficiently.

1 skill1 MCP+13k
@cocoindex-io@cocoindex-io
Install Plugin

Questions about the hooks in litestar.

Which coding agents can use the hooks in litestar?
The hooks in litestar install in Claude Code and Cursor: each runs Claude Code hooks from .claude/settings.json, so copy the hooks there.