Claude Code is not just a glorified autocomplete. It’s an agent runtime with full access to your filesystem, terminal, and the ability to run any command. When you understand that, the possibilities shift.
The starting point
I wanted a simple agent: monitor a src/ directory, detect changes in .ts files, run the affected tests, and report the result. No external watchers. No CI. Just Claude doing the work.
The initial prompt was this direct:
claude "Monitor the src/ directory. When you detect changes in .ts files,
run the related tests with npx jest and report the result with a summary
of what passed and what failed."Claude Code has Bash and Read tools built in. It knows how to run commands and read files. The agent worked on the first try — not because the prompt was perfect, but because the task matched the available tools.
Adding persistence with CLAUDE.md
The problem with the previous agent is it loses context between sessions. The solution is a CLAUDE.md in the project root — Claude Code reads it automatically on startup.
# Project: Users API
## Stack
- TypeScript + Node.js
- Jest for testing
- PostgreSQL with Drizzle ORM
## Test conventions
- Tests live in `src/__tests__/`
- Filename: `[feature].test.ts`
- Run only the tests for the affected module: `npx jest [filename]`
## Agent rules
- If a test fails, check the error in logs before editing code
- Do not modify files outside `src/`With this persistent context, the agent has the instructions it needs to operate correctly even across new sessions.
The result
The agent took about 3 minutes to set up and ran reliably for weeks. The key wasn’t prompt complexity — it was clarity: concrete task, known tools, explicit constraints.
What surprised me was Claude’s ability to chain actions: detect the changed file → identify which tests to run → run the tests → parse the output → report only failures with context. All of that without additional code on my end.
If you have a task that can be described in natural language and executed with terminal commands, you can probably automate it with Claude Code in less time than you think.