Welcome! Type "help" for available commands.
$
Loading terminal interface...
Back to Blog

Claude Code: Automatic Linting, Error Analysis, & Custom Commands

June 16, 2025
William Callahan

Software engineer and founder with a background in finance and tech. Currently building aVenture.vc, a platform for researching private companies. Based in San Francisco.

aiclaude codelintingerror analysisslash commandspromptscli
Claude Code: Automatic Linting, Error Analysis, & Custom Commands

Claude Code ships with a CLI that can run slash commands without opening the desktop client. This document records the small set of commands that keep a terminal workflow fast: run lint checks, hand stack traces to /analyze, and trigger project-specific helpers.

And while Claude Code has many tools and agentic behaviors of its own built in behind the scenes, commands are a good way to start with agentic behavior for coding.

Below I show how I've been customizing Claude Code.

Intro to Claude Code in Your CLI

Claude Code's built-in /analyze plus custom slash commands like /project:lint can do things like static analysis, error tracing, and other project-specific helpers directly in an agentic environment.

Installation

npm install -g @anthropic-ai/claude-code
claude --version

The CLI stores repo-scoped data in .claude/. Global settings live in ~/.claude/. Both folders are plain JSON/Markdown and can be committed (for project scope) or ignored (for personal scope).

Using /analyze for failing tests

Pipe build output into the CLI and ask for /analyze:

bun run test 2>&1 | claude -p "/analyze"

Claude returns a ranked list of suspected causes plus the files involved. Because the command runs in print mode, the response appears once and exits—useful for CI transcripts or terminal history.

Creating a project lint command

  1. Create .claude/commands/lint.md in the repository.
  2. Add a concise instruction:
    Run `bun run lint`. Show the first command that fails and summarize the error.
    
  3. Reload commands with /reload inside an interactive claude session or restart the CLI.
  4. Invoke with /lint.

When the command executes, Claude prints the command it ran, surfaces stdout/stderr, and explains the next step. Keep the instruction short—Claude already has repository context.

Pattern for preseeding arguments

Commands accept arguments appended after the name. Example: /lint apps/web. Inside the Markdown prompt, reference $ARGUMENTS to forward them:

Run `bun run lint $ARGUMENTS`. If the command fails, print the exit code and the relevant lines from the log.

Use this to target sub-packages or language-specific linters without creating multiple command files.

Custom macros for triage

A few small commands cover most incidents:

CommandPurpose
/logs failingSearch structured logs under var/log/ and return the newest matches.
/tests changedRun tests for paths changed in the last commit: bun run test -- $ARGUMENTS.
/fmtExecute formatters (bun run biome:format in this repo).

Keep commands deterministic. Avoid instructions that ask Claude to guess or invent fixes; treat the CLI as a wrapper around the tooling you already trust.

Configuration files worth tracking

  • .claude/settings.local.json – per-repo defaults (selected model, chosen output style).
  • .claude/commands/*.md – project commands (commit these when they codify workflow).
  • ~/.claude/commands/*.md – personal commands (do not commit).

Check these files into source control only when everyone on the team needs them. Otherwise add .claude/commands to .gitignore and keep your local automation private.

Command templates to keep handy

Stash the minimal prompt for each frequent task alongside the command so you can regenerate it quickly:

<!-- .claude/commands/status.md -->
Run `git status --short`. Explain staged vs unstaged files. Do not run `git add`.
<!-- ~/.claude/commands/prune-branches.md -->
Delete all local branches merged into `main`. Show `git branch` output before removing anything.

When a command needs arguments, reference $ARGUMENTS directly instead of repeating separate Markdown files.

Automation workflow helpers

Common sequences benefit from a thin wrapper:

  • /commit → run git status, show staged diffs, prompt for a summary, then call git commit -m "..." using the supplied message. Keep the Markdown file focused on the order of operations and the allowed commit categories.
  • /push → ensure git status --short is clean, then push the current branch. Abort if the working tree is dirty.
  • /create-issue → run git diff and git status, summarise the change, then call @mcp**GitHub**create_issue with owner/repo preset.

Claude follows the exact shell commands in the prompt, so list them in the order you expect. Avoid phrases like “do whatever is necessary.”

Commit checklist snippet

Drop this into .claude/commands/commit.md (adapt category names to your workflow):

Show `git status --short`. If nothing is staged, stop.
Run `git diff --cached`.
Ask the user for context, then generate a message in `type: subject` form (types: feat, fix, docs, refactor, test, chore, style).
Confirm the message before running `git commit -m`.
Display `git log -1 --stat` after committing.

This keeps every commit interactive but consistent.

Pitfalls to avoid

  • Commands that call external services (@mcp…) should include rate-limit handling and always echo the command they attempted.
  • Keep long-running scripts (tests, builds) opt-in. Add a --watch variant if the project uses one.
  • Never embed secrets in Markdown prompts. Use .claude/settings.local.json or the host application’s environment variable injection instead.

Brief documentation inside the repository helps new contributors understand why the commands exist and where to extend them. Whenever the workflow changes, update the Markdown first so the CLI remains trustworthy.

Similar Content

Home
CV
ExperienceEducation
ProjectsBookmarksInvestmentsContactBlog
Welcome! Type "help" for available commands.
$
Loading terminal interface...

Similar Content

Related Articles

August 22, 2025
Claude Code Output Styles: Explanatory, Learning, and Custom Options

Claude Code Output Styles: Explanatory, Learning, and Custom Options

An implementation guide to Claude Code's /output-style, the built‑in Explanatory and Learning modes (with to-do prompts), and creating reusable custom...

aiclaude codeoutput styleslearningcustom stylesexplanatory+7
BLOG
December 31, 2024
How to automatically use Warp Terminal's Subshells with "Warpify"

How to automatically use Warp Terminal's Subshells with "Warpify"

Set up automatic subshells in Warp Terminal with a custom Warpify configuration

terminalclitechnologysubshellswarpwarpify+5
BLOG

Related Bookmarks

claudecodeagents.com
July 30, 2025
Claude Code Agents

Claude Code Agents

Directory of Claude Code agents and tools

developer toolsai agentsworkflow automationproductivity platformscode optimizationclaude+1
LINK
github.com
July 22, 2025
GitHub - mcp-use/mcp-use: mcp-use is the easiest way to interact with mcp servers with custom agents

GitHub - mcp-use/mcp-use: mcp-use is the easiest way to interact with mcp servers with custom agents

mcp-use is the easiest way to interact with mcp servers with custom agents - mcp-use/mcp-use

githubopen source projectsai agentsmcp serverslangchain integrationsmcp-use+4
LINK
vibekit.sh
July 2, 2025
VibeKit - Run Coding Agents in a Secure Sandbox

VibeKit - Run Coding Agents in a Secure Sandbox

Run Claude Code and other coding agents in a secure sandbox. Embed Claude Code, Codex, Gemini CLI, or OpenCode in your app with E2B, Daytona support.

developer toolscoding agentsautomated code generationllm integrationssandbox securityrun+7
LINK

Related Projects

ComposerAI

ComposerAI

AI email client / mailbox for agentic search and tasks

aiemail clientllmproductivitytask automationvector search+10
PRJ
williamcallahan.com

williamcallahan.com

Interactive personal site with beautiful terminal/code components & other dynamic content

graph indexs3 object storageinteractive appterminal uimdx blogsearch+8
PRJ

Related Books

AI Agents in Action

AI Agents in Action

Micheal Lanham

In AI Agents in Action, you'll learn how to build production-ready assistants, multi-agent systems, and behavioral agents. You'll master the essential...

computersmicheal lanhamsimon and schusteragentsactionlearn+5
BOOK
React in Depth

React in Depth

Morten Barklund

React in Depthteaches the React libraries, tools and techniques that are vital to build amazing apps. You'll put each skill you learn into practice wi...

computersmorten barklundsimon and schusterreactdepthdepthteaches+5
BOOK

Related Investments

AngelList

AngelList

aVenture

Platform connecting startups with investors, talent, and resources for fundraising and growth.

investment platformsotheractiveangellistplatformgrowth+5
INV
NorthOne Business Banking

NorthOne Business Banking

Digital banking platform designed specifically for small businesses and startups.

financeseries cactivebankingnorthonebusiness+5
INV
Upstock

Upstock

Equity management platform helping companies create and manage employee equity plans.

investment platformsseedactiveupstockequityplatform+5
INV