.claude/skills/code-architecture/SKILL.md
Code architecture patterns for this monorepo. Use when organizing code, refactoring modules, designing service structure, or extracting/moving code to new files. Enforces clean function ordering, service functions over classes, and explicit dependency injection.
npx skillsauth add obsessiondb/chkit code-architectureInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Apply these patterns when:
// 1. Constants, types, schemas
const CONFIG = { ... } as const
type Options = { ... }
// 2. Main/entry functions
export async function runTask() {
await initialize()
await processData()
}
// 3. Supporting functions
async function initialize() { ... }
async function processData() { ... }
// 4. Utilities
function formatDate(date: Date) { ... }
// Bad
export class MyWorkflow {
async buildPlan() {
return await plannerService.buildPlan()
}
}
// Good
import { buildPlan } from './planner-service'
const plan = await buildPlan()
// Bad
export class ClickhouseService {
constructor(private client: ClickHouseClient) {}
async query(sql: string) { ... }
}
// Good
export async function queryClickhouse(
sql: string,
deps: { clickhouse: ClickHouseClient }
) {
return await deps.clickhouse.query(sql)
}
Benefits:
Extract shared functions only when logic is truly identical and should evolve together.
// Good
export async function runBackfillStep(input: StepInput, deps: RuntimeDeps) {
const plan = await buildPlan(input, deps)
const result = await executePlan(plan, deps)
await writeSummary(result, deps)
return result
}
Do not force abstraction when call sites are only similar and likely to diverge.
Use a final deps/env object parameter for external resources:
export async function myFunction(
input: string,
deps: { db: DbClient; logger: Logger }
) {
// ...
}
tools
ClickHouse schema management with chkit. Use when working with chkit CLI commands, ClickHouse table/view/materialized view definitions, migration generation, drift detection, or clickhouse.config.ts files. Trigger on chkit commands, @chkit/core imports, or schema definition tasks.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.