スキル一覧に戻る
breverdbidder

everest-supabase-operations

by breverdbidder

ZoneWise - Florida's expert zoning intelligence platform. Wise about zoning.

0🍴 0📅 2026年1月25日
GitHubで見るManusで実行

SKILL.md


name: everest-supabase-operations description: Supabase database operations for Everest Capital projects (BidDeed.AI, ZoneWise, Life OS). Includes query building, checkpoint management, insights logging, and table schemas. Connection to mocerqjnksmhcjzxrewo.supabase.co. Handles RLS policies, migrations, and error recovery. Triggers on: Supabase query, database, checkpoint, save state, insights, table schema, RLS policy.

Everest Supabase Operations

Connection

Project: mocerqjnksmhcjzxrewo.supabase.co Region: us-east-1

from supabase import create_client

SUPABASE_URL = "https://mocerqjnksmhcjzxrewo.supabase.co"
SUPABASE_KEY = os.environ["SUPABASE_KEY"]  # Service role key

supabase = create_client(SUPABASE_URL, SUPABASE_KEY)

Key Tables

BidDeed.AI Tables

TablePurposeRows
historical_auctionsPast auction data for ML1,393+
multi_county_auctionsCurrent auction listingsDynamic
daily_metricsPipeline performanceDaily
insightsSystem logs, decisionsAppend-only
activitiesUser/system activities12+

ZoneWise Tables

TablePurpose
districts273 zoning districts
jurisdictions17 Florida jurisdictions
mcp_requestsMCP server logs

Life OS Tables

TablePurpose
tasksADHD task tracking
sprint_tasksRalph Wiggum queue
tax_recordsTax optimization data

Shared Tables

TablePurpose
claude_context_checkpointsConversation state
api_usageAPI cost tracking

Query Patterns

Safe Query Building

from scripts.query_builder import QueryBuilder

qb = QueryBuilder("historical_auctions")

# Select with filters
result = qb.select(
    columns=["case_number", "judgment_amount", "sale_price"],
    filters={"zip_code": "32937", "year": 2025},
    order_by="auction_date",
    limit=100
).execute()

Insert with Validation

from scripts.query_builder import safe_insert

# Validates against schema before insert
result = safe_insert(
    table="multi_county_auctions",
    data={
        "case_number": "05-2024-CA-012345",
        "parcel_id": "12345678",
        "judgment_amount": 150000,
        "auction_date": "2026-01-21"
    }
)

Upsert Pattern

result = supabase.table("multi_county_auctions").upsert(
    data,
    on_conflict="case_number"
).execute()

Checkpoint Management

Save Checkpoint

from scripts.checkpoint_manager import save_checkpoint

save_checkpoint(
    conversation_id="conv_123",
    state={
        "current_task": "foreclosure_analysis",
        "properties_processed": 15,
        "pending_properties": ["12345678", "87654321"],
        "context_summary": "Analyzing Dec 3 auction..."
    },
    token_count=150000
)

Load Checkpoint

from scripts.checkpoint_manager import load_checkpoint

checkpoint = load_checkpoint(conversation_id="conv_123")
if checkpoint:
    state = checkpoint["state"]
    # Resume from saved state

Auto-Checkpoint Trigger

TOKEN_THRESHOLD = 150000  # 75% of 200K limit

def check_checkpoint_needed(current_tokens: int) -> bool:
    return current_tokens >= TOKEN_THRESHOLD

Insights Logging

Log Insight

from scripts.insights_logger import log_insight

log_insight(
    category="ml_prediction",
    message="Third-party probability: 72%",
    data={
        "parcel_id": "12345678",
        "probability": 0.72,
        "confidence": "high"
    },
    level="info"
)

Log Categories

  • pipeline: Scraper/workflow events
  • ml_prediction: Model predictions
  • decision: BID/REVIEW/SKIP decisions
  • error: Errors and failures
  • performance: Timing and metrics
  • audit: Security/compliance events

Query Insights

# Get recent errors
errors = supabase.table("insights")\
    .select("*")\
    .eq("level", "error")\
    .gte("created_at", "2026-01-20")\
    .execute()

Table Schemas

historical_auctions

CREATE TABLE historical_auctions (
    id SERIAL PRIMARY KEY,
    case_number TEXT UNIQUE NOT NULL,
    parcel_id TEXT,
    address TEXT,
    zip_code TEXT,
    judgment_amount NUMERIC,
    opening_bid NUMERIC,
    sale_price NUMERIC,
    sold_to_third_party BOOLEAN,
    plaintiff TEXT,
    plaintiff_category TEXT,
    auction_date DATE,
    property_type TEXT,
    assessed_value NUMERIC,
    bedrooms INT,
    bathrooms NUMERIC,
    building_sf INT,
    lot_sf INT,
    year_built INT,
    created_at TIMESTAMPTZ DEFAULT NOW()
);

claude_context_checkpoints

CREATE TABLE claude_context_checkpoints (
    id SERIAL PRIMARY KEY,
    conversation_id TEXT NOT NULL,
    state JSONB NOT NULL,
    token_count INT,
    created_at TIMESTAMPTZ DEFAULT NOW(),
    expires_at TIMESTAMPTZ DEFAULT (NOW() + INTERVAL '7 days')
);

CREATE INDEX idx_checkpoints_conv ON claude_context_checkpoints(conversation_id);

insights

CREATE TABLE insights (
    id SERIAL PRIMARY KEY,
    category TEXT NOT NULL,
    level TEXT DEFAULT 'info',
    message TEXT NOT NULL,
    data JSONB,
    created_at TIMESTAMPTZ DEFAULT NOW()
);

CREATE INDEX idx_insights_category ON insights(category);
CREATE INDEX idx_insights_created ON insights(created_at DESC);

RLS Policies

Service Role (Full Access)

-- Used by backend/scripts
CREATE POLICY "Service role full access" ON historical_auctions
    FOR ALL USING (auth.role() = 'service_role');

Anon Role (Read Only)

-- Used by public API
CREATE POLICY "Anon read access" ON districts
    FOR SELECT USING (true);

Error Recovery

Retry Pattern

from scripts.query_builder import with_retry

@with_retry(max_attempts=3, backoff=2.0)
async def fetch_with_retry(table: str, filters: dict):
    return supabase.table(table).select("*").match(filters).execute()

Connection Recovery

from scripts.connection_manager import get_client

# Auto-reconnects on failure
client = get_client()  # Cached, reconnects if stale

Migrations

Run Migration

# Using Supabase CLI
supabase db push

# Or direct SQL
psql $DATABASE_URL -f migrations/001_add_column.sql

Migration Naming

migrations/
├── 001_initial_schema.sql
├── 002_add_ml_features.sql
├── 003_add_checkpoints.sql
└── 004_add_indexes.sql

Performance Tips

  1. Use indexes for filtered columns
  2. Limit results - never SELECT * without LIMIT
  3. Use RPC for complex queries
  4. Batch inserts - use upsert with arrays
  5. Cache lookups - districts change rarely

Integration

  • BidDeed.AI: Historical data, predictions, reports
  • ZoneWise: District data, MCP logs
  • Life OS: Task tracking, tax records
  • Claude Sessions: Context checkpoints

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です