Skip to main content
OrchestKit v6.7.1 — 67 skills, 38 agents, 77 hooks with Opus 4.6 support
OrchestKit

Pattern Consistency Enforcer

The only skill-scoped hook --- enforces established code patterns during review

Blocks Skill-scoped

Checks written code against a project's established patterns file and blocks commits that violate architectural conventions.

When It Fires

Event: PreToolUse · Matcher: Write, Edit · Scope: Skill (code-review)

This is OrchestKit's only skill-scoped hook. It activates exclusively when the code-review skill is loaded, adding pattern enforcement on top of the standard file guard checks.

What It Does

When code is written or edited during a code review session, the hook reads the project's established patterns file at .claude/context/knowledge/patterns/established.json. If the file does not exist, the hook exits silently --- pattern enforcement is opt-in.

The hook then inspects the file content against category-specific rules based on file path and extension. Violations are classified as errors (blocking) or warnings (non-blocking, logged to stderr).

Enforced Patterns

Backend (Python)

PatternWhat It Catches
Clean Architecture layersRouter importing directly from repositories (should go through services)
Circular dependenciesService importing from routers
Async SQLAlchemyUsing sync Session/sessionmaker instead of AsyncSession
Pydantic v2Using @validator (v1) instead of @field_validator (v2)
Pydantic v2Using @root_validator (v1) instead of @model_validator (v2)

Frontend (TypeScript/JavaScript)

PatternWhat It Catches
React 19 componentsUsing React.FC<> instead of explicit props type
Zod validationAPI calls (fetch, axios) without Zod response validation
React 19 formsForm elements without useFormStatus/useActionState/useOptimistic (warning only)
Date formattingDirect toLocaleDateString instead of centralized @/lib/dates helpers

Testing

PatternWhat It Catches
AAA commentsMissing Arrange-Act-Assert comments in tests (warning only)
MSW for mockingUsing jest.mock for fetch instead of MSW
Pytest fixturesUsing unittest setUp instead of pytest fixtures

AI Integration

PatternWhat It Catches
IDs in promptsDatabase IDs passed directly into LLM prompts
Timeout protectionLLM calls without asyncio.timeout or Promise.race wrapping

Configuration

Pattern enforcement requires an established.json file at .claude/context/knowledge/patterns/established.json. Without this file, the hook is inactive.

The patterns checked are defined in source code. To customize which patterns apply to your project, maintain the established.json file with your project's conventions.

Edit on GitHub

Last updated on