kemalcr/kemal/kemal-orm
Claude Code and agent skill by kemalcr/kemal
- community
Checking that the SKILL.md file is still in the repository.
Object-Relational Mapping (ORM) with Crecto and SQLite in Kemal, following established project patterns.
Install
npx vskill@latest install kemalcr/kemal/kemal-ormSKILL.md
The same SKILL.md was published earlier as kemalcr/kemal/kemal-orm.
Kemal ORM Integration (Crecto)
This skill provides expert guidance on using Crecto ORM with Kemal applications and SQLite, strictly following patterns from `kemal-by-example/budget-management-orm`.
Core Mandates
- Dependencies: Include
kemal,crecto, andsqlite3inshard.ymlandrequirethem in the main application file. - Repository Setup: Centralize Crecto configuration in a
config/repo.crmodule:
```crystal module MyProject module Repo extend Crecto::Repo
config do |conf| conf.adapter = Crecto::Adapters::SQLite3 conf.db = ENV["DATABASE_URL"]? || "sqlite3:./db/app.db" end end end ```
- Schema Initialization: Set up database schema tables with
Repo.db_adapter.execin aSchema.setupmodule:
```crystal module MyProject module Schema extend self
def setup Repo.db_adapter.exec <<-SQL CREATE TABLE IF NOT EXISTS budget_entries ( id INTEGER PRIMARY KEY AUTOINCREMENT, title TEXT NOT NULL, kind TEXT NOT NULL, amount_cents INTEGER NOT NULL, notes TEXT NOT NULL DEFAULT '', created_at DATETIME, updated_at DATETIME ); SQL end end end ```
- Model Definition: Subclass
Crecto::Model, declare fields insideschema, and set validation rules:
```crystal module MyProject class BudgetEntry < Crecto::Model schema "budget_entries" do field :title, String field :kind, String field :amount_cents, Int64 field :notes, String end
validate_required :title validate_inclusion :kind, %w[income expense] end end ```
- Repository Operations:
- Querying all:
query = Crecto::Repo::Query.new.order_by("id DESC"); Repo.all(BudgetEntry, query) - Finding by ID:
Repo.get(BudgetEntry, id) - Creating:
entry = BudgetEntry.new; entry.title = title; Repo.insert(entry) - Updating:
entry.title = new_title; Repo.update(entry) - Deleting:
Repo.delete(entry)
Patterns from Source Code
Repo Configuration (config/repo.cr)
Schema Setup (config/schema.cr)
Model with Validations & Domain Logic (models/budget_entry.cr)
Route Integration with Crecto Models (routes/entries.cr)
Best Practices
- Centwise Currency Storage: Always store monetary values as integers (
Int64cents) to avoid floating-point rounding errors. - Repository Pattern: Delegate database access to Crecto's
Repoobject rather than executing raw SQL strings directly in route handlers. - Model Validation: Use
validate_required,validate_format, andvalidate_inclusioninside model definitions for declarative data integrity. - Initialization Order: Run
Schema.setupin your main entrypoint file before callingKemal.run.
When to Use
- When building Kemal applications that require ORM abstraction (Crecto) instead of raw SQL strings.
- When organizing complex domain models with validations and relations.
- When managing structured database queries with ordering, filtering, and transactions.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/kemal-orm/SKILL.md
Popularity
- Repository stars
- 3,918
- Repository forks
- 205
- 7-day trend score
- 41
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kemalcr/kemal/kemal-orm)