# AI Coding Tip 011 - Initialize Agents.md


> TL;DR: When you use the /init command, you create a context file that saves you from repeating instructions in every new session.

# Common Mistake ❌

You waste time copying and pasting the same project rules into every new chat. 

You forgot to tell the AI about your specific test commands. 

When you start a fresh session, the AI loses all previous context about your coding style or architecture.

Create your own *system prompts*, persist them and keep an eye on them regularly.

# Problems Addressed 😔

* Repetitive and manual meta-prompting
* Inconsistent [code styles](https://maxicontieri.substack.com/p/code-smell-48-code-without-standards-60c9e0905627) across sessions
* High token usage from redundant instructions
* AI hallucinations about build or test commands
* Onboarding new projects

# How to Do It 🛠️

1. Open your terminal in your project root directory.
2. Type [`/init`](https://opencode.ai/docs/rules/) if you use Claude Code or OpenCode.
3. Review the generated `CLAUDE.md` or `AGENTS.md` file.
4. Add specific "landmines" or things the AI can't see in the code.
5. Save the file, [review the commit diffs](https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line), and start your next coding task.
6. You can do it again when you have new rules.

# Benefits 🎯

When you initialize (/Init) your project, the AI reads all the repository immediately. 

You get consistent results without extra effort. 

You save tokens because you don't have to describe your stack every time.

# Context 🧠

AI assistants start every session with a blank slate. 

They don't remember what you told them yesterday. 

Tools like Claude Code look for a specific file to understand your project. 

When you provide this saved file, you close the gap between separate AI sessions.

## Prompt Reference 📝

**Bad Prompt:**

<!-- [Gist Url](https://gist.github.com/mcsee/a2542778e632751d0fc65c31999201ce) -->

```markdown
Remember to use 2 spaces for indentation 
and always run 'npm run test:unit' 
before you finish the task.
```

**Good Prompt:**

<!-- [Gist Url](https://gist.github.com/mcsee/8bbccab6c98ca48aec55ab9f433e6415) -->

```markdown
git clone https://github.com/torvalds/linux.git

/Init
```

# Considerations ⚠️

Keep the generated file short. 

When you add too much text, the AI might get confused. 

Don't include information that the AI can already find in your `package.json` or `README.md`.

# Type 📝

[X] Semi-Automatic

# Limitations ⚠️

You can only use this tip with AI tools that support persistent context files. 

If you change your build tools, you can update the Markdown file manually, run /init again, or do both.

In Windsurf, there is no literal /init terminal command that automatically generates a configuration file, as Claude Code or OpenCode does.

Windsurf uses a more agentic approach where the AI (Cascade) either discovers your rules automatically or creates them when you ask.

> Cascade, initialize a .windsurfrules file for this project. Include my tech stack, coding standards, and build commands.

# Tags 🏷️

- Standards

# Level 🔋

[X] Beginner

# Related Tips 🔗

%[https://maxicontieri.substack.com/p/ai-coding-tip-006-review-every-line]

* Use *.cursorrules* for local preferences

* Create modular *AGENTS.md* files for monorepos
 
* Keep your *README.md* updated for better AI indexing

# Conclusion 🏁

When you use `/init`, you turn your AI from a temporary contributor into a permanent team member.

# More Information ℹ️

%[https://opencode.ai/docs/rules/]
 
%[https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview%23claudemd-guide]

%[https://docs.cursor.com/context/rules-for-ai]

%[https://docs.windsurf.com/windsurf/cascade/memories]

# Also Known As 🎭

- Project-AI-Onboarding

- Context-Bootstrapping

# Tools 🧰

* Claude Code

* *OpenCode

* Cursor (via .cursorrules)

# Disclaimer 📢

The views expressed here are my own.

I am a human who writes as best as possible for other humans. 

I use AI proofreading tools to improve some texts.

I welcome constructive criticism and dialogue.

I shape these insights through 30 years in the software industry, 25 years of teaching, and writing over 500 articles and a book.

* * *

This article is part of the *AI Coding Tip* series.

%[https://maxicontieri.substack.com/p/ai-coding-tips]
