51 core deterministic + 7 extended checks
    切换中文版

    The 58 evidence-backed AgentLint checks.

    Every rule cites primary data from Anthropic's 265 prompt versions, Claude Code internals, peer-reviewed papers, or our 4,533-repository audit. Click any rule ID for bad/good examples and fix commands.

    F1Findability · core · w=3

    Entry file exists

    Anthropic: CLAUDE.md is auto-loaded by Claude Code as the entry point. OpenAI: 88 AGENTS.md files, one per subsystem, each as a local entry point.

    anthropic-265, openai-agentsRule docs
    F2Findability · core · w=1

    Entry file describes the project

    AI-Friendly Standard: CLAUDE.md answers three questions — what is this, what can I do, what to read first. First paragraph must state what the project does.

    anthropic-265Rule docs
    F3Findability · core · w=2

    Conditional loading guidance

    Session Checklist ('if X → read Y') is the single most effective AI-friendly pattern. ETH Zurich found that generic repo overviews hurt performance — targeted loading helps.

    anthropic-265, eth-zurichRule docs
    F4Findability · core · w=1

    Large directories have index

    Directories with >10 content files need INDEX for AI navigation. Without it, AI defaults to 'read everything' which fills context with irrelevant content.

    anthropic-265Rule docs
    F5Findability · core · w=2

    All references resolve

    Real-world audit found broken references across multiple production projects. Broken links waste AI tokens on dead-end file reads. Codified Context: stale references are a primary failure mode.

    practical-audit, codified-contextRule docs
    F6Findability · core · w=1

    Predictable file naming

    Standard filenames (CLAUDE.md, AGENTS.md, README.md) are recognized by AI tools. Non-standard names require explicit documentation to be discovered.

    openai-agents, harness-engineeringRule docs
    I1Instructions · core · w=1

    Emphasis keyword usage

    Across 265 versions: IMPORTANT 12→4, MUST 7→1, NEVER 4→1, VERY IMPORTANT 2→0 (eliminated). Keyword-imperative instructions dropped from 34% to 5% of the system prompt.

    anthropic-265Rule docs
    I2Instructions · core · w=2

    Keyword density

    Anthropic density: 7.5 rules/1K words (v1.0.0) → 1.4 (v2.1.81). IFScale: at 500 instructions, best model (Gemini 2.5 Pro) scores 68.9%, Claude Sonnet 42.9%. Every instruction weakens every other instruction.

    anthropic-265, ifscaleRule docs
    I3Instructions · core · w=2

    Rule specificity

    Anthropic converged on: 'Don't [anti-pattern]. Instead [correct]. Because [reason].' — the golden formula after 265 versions. Agent READMEs study: concrete instructions (F1=0.94) understood 2x better than abstract ones (F1=0.42).

    anthropic-265, agent-readmesRule docs
    I4Instructions · core · w=1

    Action-oriented organization

    Section titles evolved: Phase 1 'Tone and style' (identity) → Phase 2 'Professional objectivity' (attitude) → Phase 3 'Executing actions with care' (action). All identity sections were deleted.

    anthropic-265Rule docs
    I5Instructions · core · w=1

    No identity language

    'Following conventions' — an entire 12-line section telling the model to mimic code style — was deleted in v2.0.0. The model already does this without being told. Identity descriptions are dead weight.

    anthropic-265Rule docs
    I6Instructions · core · w=1

    Entry file length

    Anthropic main agent: 15K-22K token baseline. Codified Context: 660-line constitution (n=1 reference point). IFScale: compliance degrades beyond ~150 instructions. No single 'right' length — measure and compare.

    anthropic-265, codified-contextRule docs
    W1Workability · core · w=3

    Build/test commands documented

    GitHub analysis of 2500+ repos: 'Build and test commands' is one of the 6 core areas of effective AGENTS.md. AI cannot run what it cannot find.

    openai-agentsRule docs
    W2Workability · core · w=1

    CI exists

    Harness Engineering: 'Put rules in CI mechanical checks, not just documentation.' CI is the enforcement mechanism.

    harness-engineeringRule docs
    W3Workability · core · w=2

    Tests exist and are non-empty

    Real-world audit found a project with 'uv run pytest' in CI but 0 test files. CI always 'passed' because there was nothing to fail. Empty-shell CI creates false confidence.

    practical-auditRule docs
    W4Workability · core · w=1

    Linter configured

    Harness Engineering: 'Configure code format enforcement in CI.' Linters catch style issues mechanically so AI doesn't need to guess conventions.

    harness-engineeringRule docs
    C1Continuity · core · w=3

    Document freshness

    Codified Context: stale content is the #1 failure mode — 'not missing rules, but rules that were once correct and no longer are.' Harness Engineering: 'CI Job checks document freshness relative to code.'

    codified-context, harness-engineeringRule docs
    C2Continuity · core · w=2

    Handoff information exists

    Anthropic: 'Structured progress files that let a new agent quickly understand the state of work.' Without handoff, every new session starts from zero.

    anthropic-265Rule docs
    C3Continuity · core · w=1

    Changelog has why

    'Updated INDEX.jsonl' tells a future session nothing. 'Fixed broken file path — entry referenced old directory structure' tells it what happened and whether it's relevant.

    anthropic-265Rule docs
    C4Continuity · core · w=1

    Plans in repo

    Harness Engineering: 'Plans in Jira, Confluence, Slack — for Agent, these don't exist.' Plans must be in the repo as first-class artifacts.

    harness-engineeringRule docs
    C5Continuity · core · w=1

    CLAUDE.local.md not tracked

    Claude Code behavior: CLAUDE.local.md is for per-user private preferences. If tracked in git, all team members share private overrides. CC's /init explicitly recommends adding it to .gitignore.

    anthropic-265Rule docs
    S1Safety · core · w=2

    Env files gitignored

    Claude Code behavior: Glob tool defaults to CLAUDE_CODE_GLOB_NO_IGNORE=true, meaning .env files are visible to AI even if gitignored at grep level. Corpus analysis: 57 of 4533 repos have .env committed to git.

    anthropic-265, corpus-4533Rule docs
    S2Safety · core · w=2

    Actions SHA pinned

    Corpus analysis: 58% of repos use floating tags for GitHub Actions. A compromised tag can steal CI secrets when AI pushes code. SHA pinning makes actions immutable.

    corpus-4533Rule docs
    S3Safety · core · w=1

    Secret scanning configured

    Corpus analysis: 98% of repos have no gitleaks config or pre-commit secret scanning. AI agents don't self-check for accidentally written secrets.

    corpus-4533Rule docs
    S4Safety · core · w=1

    Security policy exists

    Corpus analysis: 92% of repos have no SECURITY.md. Without it, AI has no reference for security-sensitive decisions and users have no vulnerability reporting channel.

    corpus-4533Rule docs
    S5Safety · core · w=1

    Workflow permissions minimized

    Workflow-level contents:write grants write access to every job. AI-triggered workflows should use job-level permissions with minimal scope.

    practical-auditRule docs
    S6Safety · core · w=3

    No hardcoded secrets

    Hardcoded API keys, tokens, and private keys in source code are the most common credential leak vector. AI agents may copy-paste patterns with embedded secrets.

    practical-auditRule docs
    S7Safety · core · w=1

    No personal paths in source

    Personal filesystem paths (/home/dev/, /home/xxx/) in source files reveal developer identity. Claude Code behavior: Glob tool defaults to ignoring .gitignore, making these paths visible to AI. AI copy-paste patterns spread leaked paths to new files.

    practical-audit, anthropic-265Rule docs
    S8Safety · core · w=1

    No pull_request_target trigger

    Workflows using pull_request_target run with write access and secrets from the base branch. AI agents push code and create PRs frequently, increasing exposure to this attack vector. A malicious PR can execute arbitrary code with elevated permissions.

    practical-auditRule docs
    I7Instructions · core · w=2

    Entry file size within limit

    Claude Code behavior: MAX_MEMORY_CHARACTER_COUNT = 40000. CC's built-in /doctor command warns when any single memory file exceeds 40,000 characters. Large files dilute instruction priority.

    anthropic-265Rule docs
    F7Findability · core · w=2

    Include directives resolve

    Claude Code behavior: @include paths that don't exist are silently ignored — no error, no warning. The user thinks the content is loaded but it isn't. CC supports @path, @./relative, @~/home syntax.

    anthropic-265Rule docs
    W5Workability · core · w=2

    No oversized source files

    Claude Code behavior: FileReadTool hard limit is 256 KB (MAX_FILE_SIZE). Files exceeding this cause a hard error — CC cannot read them at all. Common culprits: generated files, minified JS, large SQL schemas.

    anthropic-265Rule docs
    W6Workability · core · w=1

    Pre-commit hooks are fast

    Claude Code behavior: CC is instructed to NEVER skip hooks (--no-verify). If a pre-commit hook is slow (>10s) or flaky, CC's commit workflow stalls visibly. CC will retry indefinitely on hook failure.

    anthropic-265Rule docs
    W7Workability · core · w=2

    Local fast test command documented

    AI agents need a single, fast, documented command to run before pushing. Without it, agents either skip local verification or invoke the full slow CI suite. Observed pattern: gstack documents 'bun test' at top of CLAUDE.md; all 4 audited repos were missing this and had to add it manually in a single session.

    anthropic-265Rule docs
    W8Workability · core · w=1

    npm test script exists (JS/Node projects)

    For Node.js projects, the absence of 'scripts.test' in package.json means there is no canonical test entry point. AI agents attempting 'npm test' get 'missing script: test'. Observed: agent-lint shipped without this for its entire history; fixed when explicitly audited.

    anthropic-265Rule docs
    D1Deep (Opt-In AI) · extended · w=1

    Contradictory rules

    When the same rule exists at two levels with different wording, AI averages the signals instead of choosing one, producing unpredictable behavior.

    anthropic-265Rule docs
    D2Deep (Opt-In AI) · extended · w=1

    Dead-weight rules

    Deletion test: 'Follow coding conventions' deleted because model already does this. Four conditions must hold: model can't self-derive, prevents real failure, has decision boundary, doesn't create worse edge cases.

    anthropic-265Rule docs
    D3Deep (Opt-In AI) · extended · w=1

    Vague rules without decision boundary

    'Follow security best practices' was deleted — no decision boundary. Agent READMEs: abstract instructions (F1=0.42) understood at half the rate of concrete ones (F1=0.94).

    anthropic-265, agent-readmesRule docs
    SS1Session (Opt-In Logs) · extended · w=1

    Repeated instructions

    Claude Code /insights: 'PRIORITIZE instructions that appear MULTIPLE TIMES in user data. If user told Claude the same thing in 2+ sessions, that's a PRIME candidate for CLAUDE.md.'

    claude-insightsRule docs
    SS2Session (Opt-In Logs) · extended · w=1

    Ignored rules

    A rule that exists in CLAUDE.md but is repeatedly violated in sessions may be too abstract, poorly worded, or conflicting with another rule. Signal for rewriting, not deleting.

    anthropic-265, claude-insightsRule docs
    SS3Session (Opt-In Logs) · extended · w=1

    Friction hotspots

    Claude Code /insights friction_analysis: categorized friction by type (misunderstood_request, wrong_approach, buggy_code, excessive_changes). File/directory level aggregation reveals structural issues.

    claude-insightsRule docs
    SS4Session (Opt-In Logs) · extended · w=1

    Missing rule suggestions

    Claude Code /insights claude_md_additions: 'A specific line or block to add to CLAUDE.md based on workflow patterns.' Derived from user corrections and repeated instructions.

    claude-insightsRule docs
    H1Harness · core · w=2

    Hook event names valid

    Corpus analysis: 35+ unique invalid event names across ~50 repos. Common: preCommit (git hook name, not Claude hook), sessionStart (wrong casing), postEditHook (invented). Invalid hooks silently never fire — users believe they have protection but don't.

    corpus-4533Rule docs
    H2Harness · core · w=1

    PreToolUse hooks have matcher

    Corpus analysis: 248/273 (91%) PreToolUse hooks lack tool_name filtering (no matcher field). Every Read, Glob, Grep call triggers the hook — massive performance tax on routine operations.

    corpus-4533Rule docs
    H4Harness · core · w=3

    No dangerous auto-approve

    Corpus analysis: 85 repos auto-approve bare Bash (any command), 7 repos approve * (everything), 50 repos auto-approve financial MCP tools, 13 repos use mcp__* wildcard. Bare Bash auto-approve is equivalent to giving the agent root shell access.

    corpus-4533Rule docs
    H3Harness · core · w=2

    Stop hook has circuit breaker

    Corpus analysis: only 5/92 Stop hooks have loop protection. Stop hook exit non-zero → Claude continues → triggers Stop again → infinite loop. Circuit breaker pattern: guard variable (STOP_HOOK_ACTIVE) checked at script entry.

    corpus-4533Rule docs
    H5Harness · core · w=1

    Env deny coverage complete

    Corpus analysis: 88 repos deny Read(./.env), but only 78 cover .env.* variants (.env.local, .env.production). Partial deny creates false sense of security — the most sensitive env file variants remain readable.

    corpus-4533Rule docs
    H6Harness · core · w=1

    Hook scripts network access

    Corpus analysis: 5 repos have hooks that POST tool call input/output to external servers via curl/wget/fetch. This is a data exfiltration vector — tool calls may contain source code, credentials, or user data.

    corpus-4533Rule docs
    H7Harness · core · w=2

    Gate workflows are blocking (not warn-only)

    Observed in production CI audits: gate workflows configured in warn-only mode exit 0 regardless of test or lint outcome, blocking zero regressions. A gate workflow that always exits 0 provides no enforcement — it only creates false confidence. Gate workflows must have a failure path that exits non-zero.

    corpus-4533, practical-auditRule docs
    S9Safety · core · w=2

    No personal email in git history

    Observed incident: 5 commits with a personal Gmail address in a public repo's git history. Git history is permanent and publicly visible — author email in commits is a PII leak even if the current source code is clean. Pre-commit author identity hooks prevent new leaks but don't retroactively clean history.

    corpus-4533Rule docs
    F8Findability · core · w=1

    Rule file frontmatter uses globs

    Corpus analysis: 26.8% of .claude/rules/*.md files use paths: frontmatter instead of globs:. Claude Code's documented field is globs: — paths: may silently not apply the rule to intended files.

    corpus-4533Rule docs
    F9Findability · core · w=2

    No unfilled template placeholders

    Corpus analysis: 13% of CLAUDE.md files (419/3225) contain unreplaced template placeholders such as [your project name], <framework>, or TODO: markers. These waste context tokens and may confuse the agent about the project's actual identity.

    corpus-4533Rule docs
    I8Instructions · core · w=1

    Total injected content within budget

    Corpus analysis: total injected content (CLAUDE.md + AGENTS.md + rules/*.md) median is 116 non-empty lines, outliers reach 1000+. IFScale research shows instruction compliance degrades beyond ~150 instructions. The right metric is total injected content across all files, not just entry file length.

    corpus-4533, ifscaleRule docs
    W9Workability · core · w=2

    Release workflow validates version consistency

    Production multi-repo release audits show that workflows validating the git release tag against package manifests (pyproject.toml, package.json) catch version drift before publish. Workflows that only check tag regex (vX.Y.Z) silently ship mismatched packages. Triple-check: extract tag, compare against source manifest, fail with ::error:: on mismatch.

    corpus-4533, practical-auditRule docs
    W10Workability · core · w=2

    Test cost tiers defined (pytest markers)

    Production Python repository audits show that defining at least 3 pytest marker tiers (such as unit, smoke, and slow/network/live) lets AI agents run sub-5-second unit suites locally. Without cost tiers, every test invocation hits slow network or external APIs — causing agents to stall or skip verification. PR CI runs fast unit tests while nightly CI runs live integration markers.

    corpus-4533, practical-auditRule docs
    W11Workability · core · w=2

    feat/fix commits paired with test commits (test-required gate)

    Production CI audits show commit-type gating (requiring test coverage when feat/ or fix/ commits land in a PR) prevents untested features from merging silently. File-change heuristics have high false positives; commit-subject or test-diff gating with an explicit opt-out checkbox is precise and reproducible via .github/workflows/test-required.yml.

    practical-auditRule docs
    H8Harness · core · w=1

    Hook errors use structured format (what/rule/fix)

    Production git and Claude Code hook audits show that emitting structured error output (what failed, which rule triggered, and the exact fix command) lets coding agents self-correct immediately. Unstructured one-line hook failures force agents to guess or read hook source code, multiplying retry loops.

    practical-auditRule docs
    C6Continuity · core · w=1

    HANDOFF.md contains verify conditions (not just status)

    Production multi-session audits show that handoff notes containing explicit runnable verification evidence (passing test counts, command outputs, concrete completion criteria) let the next agent session resume without re-auditing the entire repo. Plain status text ('in progress', 'looks good') cannot be verified and triggers redundant full scans.

    practical-auditRule docs