enterprise-infrastructure
Skill0 starsChanged 8 months agoApache-2.0View on GitHub
Enterprise infrastructure patterns including progressive infrastructure model, dialect-portable SQL, store factory, task queues, worker management, and idempotency. Use when asking about 'database portability', 'store factory', 'task queue', 'KAILASH_DATABASE_URL', 'idempotency', 'worker registry', 'SKIP LOCKED', 'Level 0/1/2', 'ConnectionManager', or 'QueryDialect'.
In this repository37 other files it gives its agents.
- .claude/rules/agents.mdAGENTS.md
- .claude/guides/claude-code/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- core-sdkSkill
- dataflowSkill
- nexusSkill
- kaizenSkill
- kailash-mcpSkill
- cheatsheetsSkill
- development-guidesSkill
- nodes-referenceSkill
- workflow-patternsSkill
- deployment-gitSkill
- frontend-integrationSkill
- testing-strategiesSkill
- architecture-decisionsSkill
- code-templatesSkill
- validation-patternsSkill
- gold-standardsSkill
- security-patternsSkill
- flutter-patternsSkill
- interactive-widgetsSkill
- enterprise-ai-uxSkill
- conversation-uxSkill
- uiux-design-principlesSkill
- value-auditSkill
- ai-interaction-patternsSkill
- eatp-referenceSkill
- coc-referenceSkill
- 29-pactSkill
- claude-code-patternsSkill
- error-troubleshootingSkill
- kailash-mlSkill
- kailash-alignSkill
- co-referenceSkill
- managementSkill
- projectSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 77
Use ? canonical placeholders in all SQL -- ConnectionManager translates automatically
- Very specific: line 79
Use dialect.upsert() instead of check-then-act (TOCTOU race)
- Very specific: line 80
Use async with conn.transaction() as tx: for multi-statement operations
- Distinctive: line 88
Use this skill when you need to:
- Distinctive: line 91
Write dialect-portable SQL that works across PostgreSQL, MySQL, and SQLite
- Distinctive: line 94
Add idempotency guarantees to workflow execution
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Enterprise Infrastructure - Skills
Comprehensive guide to Kailash's progressive infrastructure model for scaling from single-process SQLite to multi-worker PostgreSQL/MySQL deployments.
Features
The enterprise infrastructure layer provides:
- Progressive Infrastructure Model: Level 0 (SQLite, in-process) to Level 2 (multi-worker, shared database + queue)
- QueryDialect Strategy Pattern: Dialect-portable SQL across PostgreSQL, MySQL 8.0+, and SQLite
- ConnectionManager: Async connection pooling with dialect-aware placeholder translation
- StoreFactory: Singleton factory for creating store backends from
KAILASH_DATABASE_URL - SQL Task Queue: Database-backed task queue using
FOR UPDATE SKIP LOCKED - Worker Registry: Heartbeat monitoring and dead worker reaping
- IdempotentExecutor: Exactly-once workflow execution via claim-execute-store pattern
- Schema Versioning:
kailash_metatable with downgrade protection
Quick Start
# Level 0: Zero config (default)
from kailash.runtime import LocalRuntime
runtime = LocalRuntime() # SQLite stores, in-process
# Level 1: Set KAILASH_DATABASE_URL=postgresql://user:pass@localhost/kailash
# Auto-detects PG, all stores use shared ConnectionManager
# Level 2: Set KAILASH_QUEUE_URL=redis://localhost:6379/0
# OR KAILASH_QUEUE_URL=postgresql://user:pass@localhost/kailashThe user's workflow code is identical at all levels.
Reference Documentation
Core Patterns
- progressive-infrastructure - Level 0/1/2 model, StoreFactory, env vars, schema versioning
- dialect-portable-sql - QueryDialect strategy,
?placeholders,_validate_identifier() - connection-manager-patterns - ConnectionManager lifecycle, transactions, driver behavior
Operations
- task-queue-patterns - SQL task queue, SKIP LOCKED, Redis vs SQL, worker registry
- idempotency-patterns - IdempotentExecutor, claim-execute-store, TTL expiry
Key Concepts
Progressive Levels
| Level | Config | Runtime | Persistence |
| 0 | None | In-process, LocalRuntime | SQLite + in-memory |
| 1 | KAILASH_DATABASE_URL | In-process, shared DB | PostgreSQL/MySQL/SQLite |
| 2 | KAILASH_QUEUE_URL | Multi-worker + task queue | Shared DB + Redis or SQL queue |
Environment Variables
| Variable | Purpose | Default |
KAILASH_DATABASE_URL | Infrastructure stores | None (Level 0) |
DATABASE_URL | Fallback for KAILASH_DATABASE_URL | None |
KAILASH_QUEUE_URL | Task queue broker | None (no queue) |
Source Code Layout
| Package | Purpose |
Critical Rules
- Use
?canonical placeholders in all SQL -- ConnectionManager translates automatically - Validate all SQL identifiers with
_validate_identifier()before interpolation - Use
dialect.upsert()instead of check-then-act (TOCTOU race) - Use
async with conn.transaction() as tx:for multi-statement operations - Bound in-memory stores: OrderedDict with LRU eviction, max 10,000 entries
- Lazy imports for database drivers (aiosqlite, asyncpg, aiomysql)
- No
AUTOINCREMENTin shared DDL (SQLite-specific) - Share a single ConnectionManager via StoreFactory (never create separate instances per store)
When to Use This Skill
Use this skill when you need to:
- Scale from Level 0 (SQLite) to Level 1 (PostgreSQL) or Level 2 (multi-worker)
- Write dialect-portable SQL that works across PostgreSQL, MySQL, and SQLite
- Set up the StoreFactory for infrastructure store backends
- Implement task queue processing with SQL or Redis
- Add idempotency guarantees to workflow execution
- Manage worker registration and heartbeat monitoring
- Understand schema versioning and migration patterns
Related Skills
- 01-core-sdk - Core SDK workflow patterns (infrastructure backs execution)
- 02-dataflow - DataFlow for user data (infrastructure for runtime stores)
- 03-nexus - Multi-channel platform deployment
- 07-development-guides - Testing and development patterns
Support
For complex infrastructure questions, invoke:
infrastructure-specialist- Progressive infrastructure, dialect portability, store factorytesting-specialist- Infrastructure testing with real databasessecurity-reviewer- SQL injection prevention, transaction safety
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

