claude/ai-resources-plugin/skills/ai-validation-output/SKILL.md
--- name: ai-validation-output description: Configure AI-optimal validation: pre-commit hooks, CommandCenter.json, and low-noise linter/test/typecheck output for AI agents. --- # AI-Optimal Validation Output Configure validation tools (linters, type checkers, test runners) to produce output optimized for AI agent consumption. AI agents read every line of tool output, and each line consumes tokens. Default output is designed for human eyes — color codes, progress bars, per-file success messages
npx skillsauth add amhuppert/my-ai-resources claude/ai-resources-plugin/skills/ai-validation-outputInstall 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.
Configure validation tools (linters, type checkers, test runners) to produce output optimized for AI agent consumption. AI agents read every line of tool output, and each line consumes tokens. Default output is designed for human eyes — color codes, progress bars, per-file success messages — none of which helps an agent understand what's broken.
--no-color or equivalent.CLAUDECODE=1 in every spawned shell; CI systems set CI=true.All tool configurations should use automatic detection:
const isAI = process.env.CLAUDECODE === "1";
const isCI = process.env.CI === "true";
This is deterministic and preferable to relying on agent instructions or CLI flags.
| Tool | Human Command | AI Command | Key Difference |
|------|--------------|------------|----------------|
| ESLint | eslint . | eslint . --quiet --no-color --no-warn-ignored | Errors only, no colors |
| TypeScript | tsc --noEmit --pretty | tsc --noEmit --pretty false | One line per error, no source snippets |
| Vitest | vitest run (default reporter) | vitest run --no-color (dot reporter via config) | 1 char per test, full failure detail |
| Jest | jest (default reporter) | jest --silent --no-color --bail=3 (summary reporter via config) | No per-file PASS lines |
| Prettier | prettier --write . | prettier --write . > /dev/null 2>&1 | Suppress file list |
For detailed per-tool configuration including config file examples, output comparisons, and rationale, see references/tool-configurations.md.
Projects managed by CC can configure a pre-merge validation script via CommandCenter.json in the project root:
{
"preMergeCommand": "scripts/pre-merge-validate.sh"
}
CC runs this script before squash-merging a session branch into main. The path can be relative (to the project root) or absolute.
If the script exits non-zero, the merge is aborted and error output is surfaced to the user.
| Variable | Description |
|----------|-------------|
| PROJECT_ROOT | Absolute path to the project root |
| WORKTREE_PATH | Absolute path to the session worktree |
| SESSION_NAME | Session identifier |
| BRANCH_NAME | Git branch name |
Note: CLAUDECODE=1 is set by Claude Code itself in every spawned shell — it is not injected by CC. The validation script inherits it from the shell environment.
#!/usr/bin/env bash
set -euo pipefail
npx prettier --write .
npx eslint . --fix
npx tsc --noEmit --pretty
npx vitest run --project unit
The set -euo pipefail exits on first failure. The pre-merge script intentionally uses human-readable output since CC captures stderr/stdout for debugging failed merges. AI-optimal flags belong in pre-commit hooks and CI, where agents consume output in real time.
Branch on CLAUDECODE to switch between human and AI output modes:
#!/bin/sh
set -e
# Format and stage
npx prettier --write . > /dev/null 2>&1
git add -u
# Lint — AI mode suppresses warnings and colors
if [ "$CLAUDECODE" = "1" ]; then
npx eslint . --fix --quiet --no-color --no-warn-ignored
else
npx eslint . --fix
fi
git add -u
# Type check — AI mode uses one-line-per-error format
if [ "$CLAUDECODE" = "1" ]; then
tsc --noEmit --pretty false
else
tsc --noEmit --pretty
fi
# Tests — reporter switching handled in vitest/jest config
npx vitest run
Add dedicated :ai variants for tools that only accept CLI flags (ESLint, TypeScript). For test runners (Vitest/Jest), prefer automatic CLAUDECODE detection in the config file as shown in references/tool-configurations.md — the :ai script variants are a fallback for projects that cannot modify their test config.
{
"scripts": {
"lint": "eslint .",
"lint:ai": "eslint . --quiet --no-color --no-warn-ignored",
"test": "vitest run",
"test:ai": "vitest run --no-color",
"typecheck": "tsc --noEmit --pretty",
"typecheck:ai": "tsc --noEmit --pretty false",
"check:ai": "eslint . --quiet --no-color --no-warn-ignored && tsc --noEmit --pretty false && vitest run --no-color"
}
}
When a user asks to set up AI-optimal validation:
package.json for eslint, vitest, jest, typescript)CommandCenter.json, pre-commit hooks, and validation scriptsreferences/tool-configurations.mdCLAUDECODE detection:ai script variantsCommandCenter.json has preMergeCommand configuredreferences/tool-configurations.md — Detailed per-tool configuration with config file examples, output comparisons, flag explanations, and rationale for each recommendationtools
Use when picking or vetting a keyboard shortcut on macOS. Triggers include "what hotkey should I use for X", "is `<combo>` available", "does this shortcut conflict", "recommend a keybinding for…", "check `<combo>` against my setup", "pick a hotkey for…", or any mention of choosing/binding/changing a shortcut in WezTerm, tmux, Zed, Chrome, Claude Code, or macOS. Determines whether a proposed combo collides with OS-reserved bindings, app defaults, or the user's customizations, and recommends ergonomic alternatives when needed.
development
Detect and remove dead code with knip. Use when the user asks to "run knip", "find unused files", "find unused exports", "find unused dependencies", "clean up dead code", "remove dead code", "set up knip", "configure knip", "knip.json", "knip false positive", "knip CI", or mentions a `knip` config, dependency bloat, bundle bloat from unused imports, or tree-shaking unused exports. Covers the configuration-first workflow, confidence-gated deletion, framework-specific gotchas (Next.js 15+, Tailwind, Storybook, Jest, Bun's test runner and `bun build --compile`), monorepos, CI integration, and performance tuning.
tools
This skill should be used when the user asks to "set up react-scan", "install react-scan", "diagnose React re-renders", "find unnecessary renders", "find unstable props", "automate React render checks with Playwright", "react-scan + playwright", "measure component renders programmatically", "check why a React component is slow", or mentions React rendering issues, slow React interactions, render counts, or component-level perf attribution. Covers install across Next.js/Vite/Remix/script-tag/browser-extension, the lite headless API for CI, and the canonical render-attribution → fix → validate loop driven through Playwright.
documentation
This skill should be used when integrating source material into a knowledge base, including when the user asks to "integrate this document into the knowledge base", "add this transcript to the memory bank", "ingest this document", "update the knowledge base", "analyze a new source document", or "sync current-state docs with this source".