Skip to content
kalahari-coding logo

Kalahari Coding Standards

kalahari-coding

Core coding patterns and conventions for Kalahari project. MUST be used by all code-related agents.

SKILL.md

Full skill instructions

Kalahari Coding Standards

1. Icons

ALWAYS

core::ArtProvider::getInstance().getIcon("cmd_id")
core::ArtProvider::getInstance().createAction("cmd_id", parent)  // for QAction with auto-refresh

NEVER

QIcon("path/​to/​icon.svg")  // hardcoded path

Available icons

  • Location: resources/​icons/
  • Registered in: icon_registrar.cpp (gui::registerAllIcons())

2. Icon Colors

ALWAYS

QColor primary = core::ArtProvider::getInstance().getPrimaryColor();
QColor secondary = core::ArtProvider::getInstance().getSecondaryColor();
core::ArtProvider::getInstance().setPrimaryColor(QColor("#hex"));
core::ArtProvider::getInstance().setSecondaryColor(QColor("#hex"));

NEVER

QColor(255, 0, 0)  // hardcoded color
Theme::instance().getColor()  // DOES NOT EXIST!

3. Configuration

ALWAYS

auto& settings = core::SettingsManager::getInstance();
std::string value = settings.getValue("key", "default");
settings.setValue("key", "value");

NEVER

// hardcoded configuration values
const int MAX_SIZE = 100;  // should be in settings

4. UI Strings

ALWAYS

tr("User visible text")
tr("Format: %1").arg(value)

NEVER

"Hardcoded string"  // not translatable

5. Themes

ALWAYS

const core::Theme& theme = core::ThemeManager::getInstance().getCurrentTheme();
// Access theme colors:
theme.colors.primary
theme.colors.secondary
theme.palette.toQPalette()
theme.log.info  // log panel colors

Adding New Theme Colors

Use the automated script scripts/​add_theme_color.py for adding colors to the theme system.

Basic usage (5 files modified):

python scripts/​add_theme_color.py <color_name> <dark_value> <light_value> -d "description"

With Settings UI integration (9 files modified):

python scripts/​add_theme_color.py <color_name> <dark_value> <light_value> -d "description" -l "Label" -s

Parameters:

  • color_name: camelCase name (e.g., infoPrimary)
  • dark_value: hex color for Dark theme (e.g., #6B9BD2)
  • light_value: hex color for Light theme (e.g., #3D6A99)
  • -d/​--description: description for C++ comments
  • -l/​--label: display label in Settings UI
  • -s/​--add-to-settings: add to Settings dialog UI

Files modified by script:

  • resources/​themes/​Dark.json - dark theme color value
  • resources/​themes/​Light.json - light theme color value
  • include/​kalahari/​core/​theme.h - QColor member in Theme struct
  • src/​core/​theme.cpp - fromJson/​toJson serialization
  • src/​core/​theme_manager.cpp - fallback, applyColorOverrides, setColorOverride
  • (with -s): settings_data.h, settings_dialog.h, settings_dialog.cpp, main_window.cpp

Example:

python scripts/​add_theme_color.py htmlHeading "#4A90D9" "#2E5C8A" -d "HTML heading color" -l "Heading" -s

NEVER add theme colors manually - always use the script to ensure consistency across all 5-9 files.

6. Logging

ALWAYS

core::Logger::getInstance().info("Message: {}", value);
core::Logger::getInstance().debug("Debug: {}", value);
core::Logger::getInstance().warn("Warning: {}", value);
core::Logger::getInstance().error("Error: {}", value);

Levels

  • trace, debug, info, warn, error, critical

7. Layouts (Qt6)

Basic patterns

QVBoxLayout* mainLayout = new QVBoxLayout(this);
QHBoxLayout* rowLayout = new QHBoxLayout();
QGroupBox* group = new QGroupBox(tr("Title"));

Stretch factors

  • 0 = fixed size
  • 1+ = flexible, fills available space

Clearing layouts (ALWAYS use utility)

#include "kalahari/​gui/​utils/​layout_utils.h"

// ALWAYS - properly handles nested layouts
kalahari::gui::utils::clearLayout(m_contentLayout);

// NEVER - leaks nested layouts
while (QLayoutItem* item = layout->takeAt(0)) {
    delete item->widget();
    delete item;
}

8. Build

Windows

scripts/​build_windows.bat Debug

Linux

scripts/​build_linux.sh

NEVER

  • cmake directly
  • WSL for Windows builds

9. Naming Conventions

TypeConventionExample
Filessnake_casecharacter_card.cpp
ClassesPascalCaseCharacterCard
MethodscamelCasegetTitle()
Membersm_prefixm_title
ConstantsUPPER_SNAKE_CASEMAX_CHAPTERS
Namespaceslowercasekalahari::core

10. Singletons Reference

ClassAccess MethodNamespace
ArtProvidergetInstance()kalahari::core
SettingsManagergetInstance()kalahari::core
ThemeManagergetInstance()kalahari::core
IconRegistrygetInstance()kalahari::core
LoggergetInstance()kalahari::core
CommandRegistrygetInstance()kalahari::gui

11. MCP Tools for Code Intelligence

Use for understanding and navigating Kalahari codebase:

When to use:

  • Before modifying any file → understand structure
  • Before creating new class → find similar patterns
  • Before refactoring → find all usages

Context7 (External Docs)

Use for Qt6 and other library documentation:

mcp__context7__resolve-library-id("Qt6")           # get library ID (once)
mcp__context7__get-library-docs("/​qt/​qtdoc", topic="QDockWidget")

When to use:

  • Unsure about Qt6 API parameters
  • Need to know available signals/​slots
  • Checking Qt6 best practices

Tool Selection Guide

NeedTool
Qt6 API referenceContext7
Qt6 signals/​slotsContext7
External library docsContext7

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View