UNPKG

@felixgeelhaar/cclint

Version:

Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.

51 lines 2.29 kB
import type { Rule } from '../domain/Rule.js'; import { ContextFile } from '../domain/ContextFile.js'; import { Violation } from '../domain/Violation.js'; /** * KarpathyRule — opinionated CLAUDE.md quality advisories. * * Heuristics inspired by Andrej Karpathy's public commentary on writing for * LLMs and "context engineering": you program the model in English, so the * context window should be minimal, high signal-to-noise, literal, and * example-driven. This is a curated, opinionated ruleset — not an official * standard — and every finding is INFO severity (a recommendation, not a * failure). * * Checks: * 1. Hedging language ("try to", "where appropriate") that makes an * instruction non-literal — the model follows instructions literally, so * ambiguity invites drift. * 2. Filler / politeness ("please", "thank you", "you are a helpful * assistant") that spends context tokens without adding signal. * 3. Show, don't tell — guideline sections that list many rules but include * no concrete example (few-shot beats zero-shot). * 4. Signal-to-noise — overly long prose paragraphs; prefer tight, * skimmable lines or bullets. * * Scope: CLAUDE.md files only. Code fences are excluded from prose checks. */ export declare class KarpathyRule implements Rule { readonly id = "karpathy"; readonly description: string; private static readonly HEDGING_PHRASES; private static readonly FILLER_PHRASES; private static readonly GUIDELINE_WORDS; private static readonly MAX_PARAGRAPH_WORDS; private static readonly MAX_PARAGRAPH_CHARS; appliesTo(file: ContextFile): boolean; lint(file: ContextFile): Violation[]; private static isClaudeMd; /** Returns a boolean per line: true when the line sits inside a ``` fence. */ private static markCodeFences; private checkPhrases; private static containsPhrase; /** * Flag guideline-style sections (Conventions, Guidelines, Rules, …) that * enumerate several rules but show no concrete example — show, don't tell. */ private checkExamples; private static collectSections; /** Flag prose paragraphs that are too long to skim. */ private checkParagraphs; } //# sourceMappingURL=KarpathyRule.d.ts.map