slayer: Instructions file for Claude Code

CLAUDE.md

slayer CLAUDE.md is an instructions file for Claude Code from MotleyAI/slayer. It costs 1,627 tokens per session, scanned A, original, MIT.

A project guide for SLayer, a semantic layer that lets AI agents request data in plain terms and generates database queries instead of requiring raw SQL.

In plain words
What is it for?
Use it when developing or operating SLayer, its APIs and protocols, query engine, storage, memory, search, or MCP server.
Why use it?
It explains the system’s parts, commands, and where to find the authoritative documentation for query behavior.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is MotleyAI/slayer's own configuration. It tells Claude Code how to work on slayer itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything slayer configures →

Reuse

Borrowing it

Nothing to install: this file belongs to MotleyAI/slayer. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/MotleyAI/slayer/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/MotleyAI/slayer

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for slayer CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/motleyai/slayer/claude-md.svg)](https://agentmods.dev/instructions/motleyai/slayer/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/motleyai/slayer/claude-md"><img src="https://agentmods.dev/badge/instructions/motleyai/slayer/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,627 This file is loaded in full into every session.
When invoked 1,627 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01627 $0.01627
Opus 5 $0.00813 $0.00813
Sonnet 5 $0.00325 $0.00325
Haiku 4.5 $0.00163 $0.00163

Measured today against content hash 96386fa54553, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

slayer CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

Guidance for Claude Code when working in this repository.

What is SLayer?

SLayer (Semantic Layer) is a lightweight, open-source (MIT) semantic layer for AI agents, built by MotleyAI. Instead of writing raw SQL, agents describe what data they want — measures, dimensions, filters — and SLayer generates and executes the query.

Server ports: REST API 5143, Flight SQL 5144, Postgres facade 5145.

When writing SLayer query examples or answering questions about syntax and capabilities, read docs/ first — especially docs/concepts/queries.md, docs/concepts/formulas.md, docs/concepts/models.md, and docs/examples/.

Layout

slayer/core domain models & errors; slayer/engine query engine; slayer/sql SQL generation + dialects; slayer/storage YAML/SQLite backends + migrations; slayer/api REST; slayer/mcp MCP server; slayer/flight / slayer/pg_facade / slayer/facade BI wire protocols; slayer/memories + slayer/search agent memory & semantic search; slayer/cli.py CLI.

Cross-cutting structure and principles live in architecture/ (LikeC4 model + arc42 + index.yaml); enforcement bundle: poetry run lint-imports, poetry run python tools/arch_check.py, npx -y [email protected] validate architecture, poetry run basedpyright.

Common Commands

poetry install -E all                                # install with all extras
poetry run pytest -m "not integration"               # unit tests (excludes integration)
poetry run pytest tests/integration/ -m integration  # all integration tests
poetry run pytest tests/test_sql_generator.py -v     # one file
poetry run slayer serve                              # REST API server
poetry run slayer mcp                                # MCP server
poetry run ruff check slayer/ tests/                 # lint

All CLI commands accept --storage (YAML dir or .db file); defaults to the platform data dir, override with $SLAYER_STORAGE.

Key Conventions

  • Python 3.11+, Pydantic v2 for all models
  • NEVER use dataclasses — use Pydantic classes instead
  • Use poetry run for all Python commands
  • Use keyword arguments for functions with more than 1 parameter
  • Imports at the top of files
  • SQL generation uses sqlglot AST building, not string concatenation
  • Async-first: engine and storage methods are async; execute_sync() / run_sync() bridge for CLI/scripts
  • Core principle: adding a measure/field must never change result cardinality or other fields' values
  • Two expression layers — Mode A: free SQL in Column.sql / model filters (dotted join paths); Mode B: Python-AST DSL in formulas and query fields (dotted paths, colon aggregations, scalar-allowlist functions only). Rules: docs/concepts/references.md
  • Aggregations are query-time, colon syntax: revenue:sum, *:count for COUNT(*), price:percentile(p=0.9)
  • Result column keys are model.column: revenue:sumorders.revenue_sum, *:countorders._count; joined dimensions keep the full path (orders.customers.regions.name)
  • Dots denote join paths in BOTH queries and model SQL (customers.regions.name, dotted-canonical); the legacy __ split-alias input form is a hard error. __ stays only as an internal generated-SQL join alias, and is a legal (exact-match) character in model/query/column names (__slayer_ prefix reserved)
  • Models are keyed by (data_source, name); joins resolve within the parent model's datasource
  • Models/queries/datasource configs carry a version field; storage migrations run automatically on load (slayer/storage/migrations.py)
  • Filters support {variable} placeholders from query.variables (scalars, plus lists → auto-quoted IN-list body: region IN ({regions})). Values are trusted input; string escaping IS dialect-aware (DEV-1727) but only applies to quoted literals. Datasource configs support ${ENV_VAR}
  • Mode-A raw-SQL surfaces also support optional blocks {? pred ?} — render parenthesised when every inner {var} is supplied, else collapse to (1=1) (Cube FILTER_PARAMS optional-pushdown form, DEV-1730). extract_model_variables(model) classifies placeholders required vs optional; surfaced in the inspect skeleton
  • slayer import-cube reads Cube .yml/.yaml and .js (cube()/view() via esprima); FILTER_PARAMS → {var}/{? ?}, requiredness from member meta.required (--ignore-required-meta to force optional). See docs/cube/cube_import.md
  • A model may declare a variable list_valued in meta.cube_variables (importers do this for generated col IN ({var}) templates); the engine then wraps a bare scalar into a one-element list. Hand-written model SQL keeps the author-writes-the-quotes convention — a scalar string substitutes unquoted

Read the full file on GitHub · 105 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · +4 lines · +74 tokens per session 96386fa54553
  2. 8d ago First seen · 101 lines · 1,553 tokens per session scan A 35d750945f7a

Subscribe to this mod's changes

slayer CLAUDE.md is an instructions file published in the GitHub repository MotleyAI/slayer (167 stars, last pushed today), licensed MIT. It adds 1,627 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories