claude/ai-resources-plugin/skills/ai-validation-output/SKILL.md
Configure AI-optimal validation: pre-commit hooks, CommandCenter.json, and low-noise linter/test/typecheck output for AI agents.
npx skillsauth add amhuppert/my-ai-resources 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 recommendationdevelopment
Debug a running web app via the web-debugger SDK: app logs, application state, runtime snapshots, React state, query cache.
development
Thoroughly understand a software development objective before implementation: research, identify ambiguities, ask clarifying questions. Use before starting implementation of a non-trivial or ambiguously specified feature, or when requirements leave open design decisions.
development
Locate the on-disk Claude Code transcript file (.jsonl under ~/.claude/projects/) for the current or a specified conversation.
development
Reflect on codebase navigation effectiveness at end of conversation. Surfaces dead ends, inefficiencies, missing context. Does not write files — pair with /kiro:steering-custom to persist.