pre-commit-workflow

A pre-commit checklist for the lightfast-mcp project, covering code formatting, linting, tests, configuration files, server startup, security, and type checking.

In plain words
What is it for?
Use it before each commit to validate Python code, YAML and JSON settings, server startup, tests, and type safety.
Why use it?
It helps catch style, configuration, startup, security, and type problems before changes are committed.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/ekakit/lightfast-mcp/pre-commit-workflow
Clone the repo
git clone --depth 1 https://github.com/ekakit/lightfast-mcp

Made for: Cursor.

Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,300 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00010 $0.01300
Opus 5 $0.00005 $0.00650
Sonnet 5 $0.00002 $0.00260
Haiku 4.5 $0.00001 $0.00130

Measured yesterday against content hash 23e12ec55594, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pre-commit-workflow 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 yesterday.

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.

.cursor/rules/pre-commit-workflow.mdc · 206 lines

How it starts

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

Pre-Commit Workflow

Before committing any changes to lightfast-mcp, execute this comprehensive validation workflow:

Mandatory Pre-Commit Steps

  1. Format and Lint: Ensure code style compliance
  2. Run Tests: Execute comprehensive test suite
  3. Validate Configs: Check all configuration files
  4. Test Server Startup: Verify servers can start
  5. Security Check: Run security validation
  6. Type Check: Ensure type safety

Automatic Pre-Commit Commands

Run this command sequence before every commit:

#!/bin/bash
echo "🚀 Running lightfast-mcp pre-commit checks..."

# Step 1: Format and Lint
echo "📝 Step 1: Formatting and linting..."
uv run task format
uv run task lint

# Step 2: Fast tests for immediate feedback
echo "⚡ Step 2: Running fast tests..."
nox -s test_fast

# Step 3: Configuration validation
echo "⚙️  Step 3: Validating configurations..."
find config -name "*.yaml" -exec python -c "import yaml; yaml.safe_load(open('{}'))" \; 2>/dev/null
find . -name "*.json" -exec python -c "import json; json.load(open('{}'))" \; 2>/dev/null
echo "✅ Configuration files validated"

# Step 4: Test server startup
echo "🏁 Step 4: Testing server startup..."
timeout 10 uv run lightfast-mock-server &
MOCK_PID=$!
sleep 3
kill $MOCK_PID 2>/dev/null || true
echo "✅ Mock server startup tested"

# Step 5: System integration test
echo "🧪 Step 5: System integration test..."
nox -s verify_system

# Step 6: Type checking
echo "🔍 Step 6: Type checking..."
nox -s typecheck

# Step 7: Security check
echo "🔒 Step 7: Security check..."
python -m py_compile $(find src -name "*.py")
echo "✅ Python compilation successful"

echo "✨ All pre-commit checks passed!"

File-Type Specific Validations

For Server File Changes

# Additional checks when server files are modified
echo "🖥️  Server-specific validations..."

# Test MCP protocol compliance
uv run pytest tests/unit/test_*server*.py -v

# Validate tool decorators and signatures
python -c "
import ast
import glob
for file in glob.glob('src/lightfast_mcp/servers/**/*.py', recursive=True):
    with open(file) as f:
        tree = ast.parse(f.read())
        # Check for @mcp.tool() decorators
        print(f'Validated: {file}')
"

Read the full file on GitHub · 206 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. yesterday First seen · 206 lines · 10 tokens per session scan A 23e12ec55594

Subscribe to this mod's changes

pre-commit-workflow is a cursor rule published in the GitHub repository ekakit/lightfast-mcp (2 stars, last pushed 1y ago), licensed MIT. It adds 10 tokens to every session and 1,300 once invoked, about $0.0001 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-31.