My first agent

Intro

I've been learning to use Claude Code for data science projects, and my first real test was building a simple agent from scratch — starting with a CLAUDE.md file that defines how the agent should behave. Along the way I hit a classic gotcha (files quietly saving to a temp folder instead of my project directory), fixed it, and then put the whole setup through a real research task. Here's what I learned.


Building a Simple Agent with Claude Code (VS Code)

The prompt is saved in a CLAUDE.md file, with the following content:

# try to build an agent
## Project Context
This is an AI agent playground.

## About me
I'm a DS, I'm learning to use Claude Code for DS projects.

## Rules
- Always ask clarifying questions before starting a complex task
- Show your plan and steps before execution
- Keep reports and summaries concise — bullet points over paragraphs
- Save all reports to the output folder
- Cite sources when doing research
## Project Structure
- `resources/` -- reference docs and templates
- `workflows/` -- workflow instruction files (plain English recipes the agent follows)

## Output Rules
- All deliverables MUST be saved under the absolute path: `C:\claudecoderepo\my_first_agent\output`
- Never write files to system temp directories or any path outside this project folder
- Before saving, confirm the current working directory matches the project root

Testing the Agent: A Real Research Task

Next, I opened Claude Code's planning mode with Shift + Tab and gave it a real task:

  • Web search data scientist position requirements in 2026 and compare them to 2025 — are there signs of increasing demand for AI knowledge?

  • Is the trend in job openings increasing or decreasing?

  • Also, web search efficient strategies for landing a DS job in 2026.

  • Save the results — for the data scientist position research only — to the specified output folder.

Claude Code executed the task step by step, pausing to ask for confirmation at each stage, exactly as defined in the CLAUDE.md rules. It then saved the final report, Data Scientist Job Market Research (2026).md, to the target output folder — which worked flawlessly.

I've included the full report in another post.

Takeaways

A few things stood out from this first pass:

  • Relative paths are a trap. "Save to output/" sounds unambiguous to a human, but Claude Code resolves it against whatever directory it thinks it's in. Spelling out an absolute path in CLAUDE.md fixed the issue for good.

  • A CLAUDE.md file is a contract, not a suggestion. Once I made the rules explicit and specific (confirm working directory, ask before complex tasks, cite sources), the agent actually followed them — down to pausing for confirmation at each step.

  • Planning mode (Shift + Tab) is worth using for anything multi-step. Watching the agent lay out its plan before executing made it much easier to trust the output, especially for a research task with several sub-parts.

This is a real shift from how I worked before. For my CFPB project (see previous post), my workflow with Claude was entirely conversation-based: I'd chat with Claude, copy the code it generated into my notebook, run it, copy the output/errors back into the chat, ask Claude to revise, and repeat. It worked, but every iteration meant manually shuttling code and results back and forth between two windows.

With Claude Code as an agent, that loop collapses — it reads and writes files directly in my project, runs its own steps, and only surfaces results when there's something for me to review or approve. Less copy-pasting, more actual delegation.

Next up, I want to try defining a proper workflows/ recipe for recurring research tasks like this one, so I don't have to write the full prompt out each time. Will report back.

Comments

Popular posts from this blog

How To Implement Dense_Rank() In Excel Sheet

Schema and Security Control in SQL server

My Georgia Tech OMSA Year 2 Fall term Takeaway (Fall25)