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

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
docs.anthropic.com
June 12, 2025
SDK for Claude Code (CLI) - Anthropic

SDK for Claude Code (CLI) - Anthropic

Programmatically integrate Claude Code into your applications using the SDK.

sdkssoftware development toolsai coding assistantspython librariestypescript packagessdk+7
LINK
claudia.asterisk.so
June 20, 2025
Claudia - The Elegant Desktop Companion for Claude Code

Claudia - The Elegant Desktop Companion for Claude Code

Transform your AI coding workflow with a beautiful GUI that makes managing Claude sessions, creating custom agents, and tracking usage effortless.

desktop applicationsproject managementai coding toolsclaude codecustom ai agentsclaudia+7
LINK

Related Projects

Brief

Brief

Terminal ChatGPT client with slash commands and tool execution

terminal uiclichat clientopenaijavaopen source+11
PRJ
ComposerAI

ComposerAI

AI email client / mailbox for agentic search and tasks

aiemail clientllmproductivitytask automationvector search+10
PRJ

Related Books

December 31, 2025
Build a Reasoning Model (From Scratch)

Build a Reasoning Model (From Scratch)

Sebastian Raschka

LLM reasoning models have the power to tackle truly challenging problems that require finding the right path through multiple steps. In this book you’...

computerssebastian raschkasimon and schustermodelbuildreasoning+5
BOOK
December 31, 2025
The RLHF Book

The RLHF Book

Nathan Lambert

Get a free eBook (PDF or ePub) from Manning as well as access to the online liveBook format (and its AI assistant that will answer your questions in a...

computersnathan lambertmanningbookrlhflearning+5
BOOK
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

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
Sudrania

Sudrania

Fund administration and accounting platform for investment managers.

financeseries aactivesudraniaplatforminvestment+4
INV