$ recombobulate _
home / tips / add-common-commands-to-claudemd-so-claude-runs-the-right-scripts-every-time
67

Add Common Commands to CLAUDE.md So Claude Runs the Right Scripts Every Time

recombobulate @recombobulate · Mar 28, 2026 · Configuration
add-common-commands-to-claudemd-so-claude-runs-the-right-scripts-every-time

Every project has its own way of running things. Without guidance, Claude guesses — and guesses wrong when your test command isn't npm test or your linter isn't the default. A "Common Commands" section in CLAUDE.md fixes this permanently.

## Common Commands

- **Dev server**: `pnpm dev` (not npm — we use pnpm workspaces)
- **Tests**: `pnpm test:unit` for unit tests, `pnpm test:e2e` for Playwright
- **Lint**: `pnpm lint:fix` (auto-fixes), `pnpm lint:check` (CI mode)
- **Build**: `pnpm build` (outputs to dist/)
- **Database**: `pnpm db:migrate` to run migrations, `pnpm db:seed` for test data
- **Type check**: `pnpm typecheck` (runs tsc --noEmit)

Now when you say "run the tests," Claude uses pnpm test:unit — not npm test, not jest, not npx vitest. The right command, every time.

This is especially important for projects with non-obvious commands:

## Common Commands

- **Tests**: `php artisan test --compact` (always use --compact flag)
- **Lint**: `vendor/bin/pint --dirty` (only lint changed files)
- **Queue**: `php artisan queue:work --once` (process one job for testing)
- **Fresh DB**: `php artisan migrate:fresh --seed` (resets everything)
- **Cache clear**: `php artisan optimize:clear` (run after config changes)

Include commands that Claude might not discover on its own — custom make scripts, monorepo-specific tooling, or project aliases that wrap complex operations.

You can also note what not to run:

- **Never** run `npm install` — we use pnpm. Running npm creates a package-lock.json that conflicts.
- **Never** run migrations against the production database from local.

The few minutes spent writing this section saves hours of Claude running wrong commands, waiting for failures, and then trying again.

Claude can read your code, but it can't read your team's tribal knowledge — put it in CLAUDE.md and make it permanent.

via Claude Code

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Describe Your Users in CLAUDE.md So Claude Writes Appropriate Copy, Error Messages, and UX

When Claude writes error messages, button labels, validation text, or onboarding flows, it defaults to generic developer-speak. Add a "Users" section to your CLAUDE.md describing who your actual users are — their technical level, industry jargon, and what they care about — so Claude writes copy that makes sense to THEM, not to developers.

recombobulate @recombobulate · 1 day ago
1
Create Custom Agents with --agent for Scoped Sessions

Use the --agent flag with custom markdown files in .claude/agents/ to launch purpose-built Claude sessions with restricted tools and scoped system prompts.

recombobulate @recombobulate · 1 day ago
106
Add Known Gotchas and Pitfalls to Your CLAUDE.md So Claude Avoids Mistakes Your Team Already Made

Every project has traps — the billing module that silently fails if you forget to queue the job, the legacy table with column names that don't match the model, the config value that must be set before tests run. Document these gotchas in your CLAUDE.md so Claude avoids the same mistakes your team spent days debugging.

recombobulate @recombobulate · 1 day ago