pre-commit-workflow

pre-commit-workflow is a cursor rule for Cursor from ekakit/lightfast-mcp. It costs 10 tokens per session (1,300 once invoked), scanned A, original, MIT.

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

Written for Cursor: installed under .cursor/.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is uv run python scripts/benchmark_servers.py # If exists.

Good fit Use it before each commit to validate Python code, YAML and JSON settings, server startup, tests, and type safety.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

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

Made for: Cursor.

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

README.md
[![agentmods](https://agentmods.dev/badge/rules/ekakit/lightfast-mcp/pre-commit-workflow/github.svg)](https://agentmods.dev/rules/ekakit/lightfast-mcp/pre-commit-workflow)
Your own site
<a href="https://agentmods.dev/rules/ekakit/lightfast-mcp/pre-commit-workflow"><img src="https://agentmods.dev/badge/rules/ekakit/lightfast-mcp/pre-commit-workflow/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for pre-commit-workflow

Your own site · 80×15
<a href="https://agentmods.dev/rules/ekakit/lightfast-mcp/pre-commit-workflow"><img src="https://agentmods.dev/badge/rules/ekakit/lightfast-mcp/pre-commit-workflow.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. 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.00010 $0.01300
Opus 5.5 $0.00004 $0.00520
Sonnet 5.5 $0.00002 $0.00260
Haiku 4.5 $0.00001 $0.00130

Measured 2mo ago against content hash 23e12ec55594, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo ago.

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. 2mo ago 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.0000 per session on Opus 5.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.