How to Use Agents MD with Claude Tips from Our Team

Published:

Updated:

how to use agents md with claude

Disclaimer

As an affiliate, we may earn a commission from qualifying purchases. We get commissions for purchases made through links on this website from Amazon and other third parties.

Can a local code assistant really save your team weeks of work? We asked that question when we began testing Claude Code on real projects.

In this short guide we share what we learned after months of hands-on trials. Our focus is clear: capture project context in markdown files, set firm command patterns, and treat documentation as part of your system.

Claude Code gives direct local file access, which helps developers keep memory and conversation history in the repo. That makes outputs more consistent and reduces repeated instructions.

We will show simple examples of file structure, workflow conventions, and commands that speed coding. These tips aim to help teams set rules that keep projects tidy and predictable.

Key Takeaways

  • Capture context in markdown files for persistent memory.
  • Define a clear command pattern to reduce errors.
  • Treat documentation as infrastructure in your repo.
  • Use local file access to keep outputs consistent.
  • Apply simple workflow rules to speed developer collaboration.

Understanding the Power of Claude Code

Claude Code unlocks a context window large enough for whole repositories, not just snippets.

That 200,000 token capacity lets the agent analyze complex codebases and keep project content in scope. We rely on this when we need consistent, long-term context for sustained coding work.

The system manages context automatically. When the window hits about 75% full, it compacts conversations so output quality stays steady.

Local file access is a major advantage. Every session can pull the right files so the tool has precise context. This beats stateless web interfaces for long projects.

  • Large window: supports deep analysis across many files.
  • Automatic compaction: keeps performance consistent during long sessions.
  • Local integration: ensures the agent sees the actual repo and relevant content.

We recommend focusing on core building blocks and concise instructions. That prevents irrelevant data from filling the window and causing performance drops.

How to Use Agents MD with Claude Effectively

We start by writing clear front matter in each project file. That metadata tells our system which agent should run and under what conditions. It reduces guesswork and keeps context focused.

Defining Agent Roles

Give each role a short responsibility line and trigger names. We store those lines in markdown so the main agent can pick the right sub-agent quickly. This approach keeps outputs consistent and predictable.

Setting Up Your Environment

We keep global tools in ~/.claude/agents so files are available across projects. Organizing commands into folders helps the system find the correct file when we request a task.

  • Use front matter in role files for precise command routing.
  • Store recurring procedures, like the /today command, as ready files.
  • Spawn sub-agents for focused tasks to manage the context window and speed output.
  • Test setup with a simple command and verify the agent reads your config.

These workflows take time to configure, but the gains in coding speed and reliable output are worth the effort. For a quick guide on scheduling and tooling that complements this setup, see our scheduling tips.

Managing Context with Markdown Files

We keep a slim set of global defaults that travel across every session and project.

Global vs project context matters. A global CLAUDE.md stored at ~/.claude/CLAUDE.md sets universal preferences for our claude code sessions. That file gives the agent consistent baseline instructions and memory across projects.

Project-specific CLAUDE.md files let us override defaults when a repository needs special behavior. We link reference files from the local directory so the agent can pull context on demand without loading everything at once.

Practical benefits: storing reference content in a dedicated folder keeps main context files clean. The agent can edit files directly, which makes collaboration faster and reduces back-and-forth.

  • Global file: universal defaults for every conversation.
  • Project files: tailored preferences per project.
  • Shared directory: linked references to avoid overload.
ScopeLocationPrimary Benefit
Global~/.claude/CLAUDE.mdConsistent defaults across projects
Projectrepo/CLAUDE.mdCustom instructions and architecture notes
Referencesrepo/docs/On-demand context without overload

Leveraging Slash Commands for Workflow Automation

A sleek, modern workspace illustrating a "slash command workflow" for automation. In the foreground, a computer screen displays a vibrant interface with various colorful slash commands and icons. Nearby, a professional individual in business attire attentively interacts with the screen, finger poised over the keyboard, embodying concentration and efficiency. The middle ground features a minimalistic desk with organized tools—such as a notepad, a smartphone, and a stylish pen—evoking a sense of productivity. The background shows soft-focused shelves lined with tech books and plants, enhancing the professional atmosphere. The lighting is bright and inviting, with a warm glow from a desk lamp, creating a balanced, optimistic mood that emphasizes innovation and workflow efficiency.

Slash commands give us a fast lane for routine work and complex procedures alike.

Slash commands begin with a / and live as markdown files inside .claude/commands. We store global files that are available from any session, and project files that remain scoped to their repo. This split keeps project context tidy and lowers accidental access to irrelevant instructions.

The /seo command is a prime example. It runs keyword analysis, generates semantic variants, and outputs structured content suggestions. Running it saves us time when drafting or revising pages.

We design commands for both simple prompts and multi-step flows. Each command acts as a shortcut. Invoke one and the agent carries out the exact procedure stored in the file.

  • Speed: frequent tasks finish faster, reducing repetitive work.
  • Maintainability: update markdown files as project needs evolve.
  • Context control: only the needed instructions load when we call a command.

Start by automating the most repetitive tasks and grow your library. For related automation best practices, see our automation best practices.

Optimizing Performance with Sub-Agents

We split large tasks into focused sub-agents so the main agent stays lean and productive.

Context window management is central. Each sub-agent runs in its own conversation and keeps its own context window. That prevents the main thread from filling with research notes or raw data.

Context Window Management

Keep core context small. Offload heavy reference files and long outputs to a sub-agent. That keeps the project’s primary file list and goals visible.

Parallel Task Execution

We spawn multiple sub-agents when we need parallel research or multi-file analysis. This speeds workflows but increases token use and time costs.

  • Run focused searches in parallel for faster results.
  • Monitor token usage to control expenses.
  • Collect outputs back into the main agent for final integration.

General Purpose Agents

We reserve generic agents for routine coding tasks and simple commands. Complex or project-specific work uses user-defined sub-agents saved as markdown files with front matter.

RoleScopeBenefit
Main agentHigh-level planningClear project context
Sub-agentFocused tasksIsolated conversation
General agentSimple codingFast outputs

For complementary tools and automation ideas that fit this workflow, see our best AI tools.

Bundling Logic with Skills

We package repeatable logic as skills so our team carries best practices across projects.

Skills live in a named folder and pair a SKILL.md file with scripts, prompts, and example inputs. That SKILL.md gives the agent the context it needs to recognize when a procedure applies.

These bundles travel across platforms. The same package runs in Claude Code, Claude.ai, and the desktop client, so our coding style and content rules stay consistent.

Unlike slash commands, skills can be invoked automatically when the system spots a matching need. Keeping SKILL.md concise helps the agent parse intent quickly—Anthropic suggests under 500 lines, and we aim near 150 for clarity.

  • Store skills in a project directory for easy discovery and reuse.
  • Include deterministic scripts and natural language prompts together for predictable output.
  • Audit skills regularly so they match current requirements and keep files tidy.

For further best practices on packaging skills, see agent skills best practices.

Implementing Deterministic Hooks

Deterministic hooks let us bind specific code paths to precise moments in a session. They ensure repeatable behavior for time-sensitive and rule-driven tasks.

Hooks run before or after key actions. Available triggers include PreToolUse, PermissionRequest, PostToolUse, UserPromptSubmit, Notification, and Stop.

Defining Hook Triggers

We map a trigger to a small file containing deterministic logic. That file runs automatically when the trigger fires, so the agent follows our exact instructions each time.

  • Run a date-calculation hook before a command that needs current timestamps.
  • Trigger a permission check for sensitive requests.
  • Aggregate session context at start-up to ensure the project contains relevant files and notes.
  • Send notifications after critical outputs so the team stays informed.
HookTrigger momentTypical use
PreToolUseBefore a tool callPrepare context, set variables, enforce checks
PostToolUseAfter a tool finishesValidate output, log results, notify users
UserPromptSubmitWhen a user sends a requestNormalize input, attach project context, run quick checks

We manage hooks interactively with the /hooks command in our claude code environment. Start with a simple hook and expand as the project needs grow. For guidance on building tools that fit your workflow, see create an online tool.

Adopting a Tiered Documentation Architecture

A high-tech office environment showcasing a tiered documentation architecture visualization. In the foreground, a sleek workstation with dual monitors displaying intricate flowcharts and diagrams, highlighting different layers of documentation systems. The middle ground features three transparent layers labeled 'Foundational', 'Operational', and 'Advanced', each filled with digital data streams and icons representing various documentation types. In the background, a glass wall reveals a modern cityscape with soft sunlight filtering through. The ambiance is professional and innovative, with a cool color palette of blues and greens. The lighting is bright yet soft, creating an engaging atmosphere. The scene is captured from a slightly elevated angle, emphasizing the depth of the layered architecture without any text overlays or distractions.

We separate global rules, skills, and deep guides so each request pulls minimal, relevant content. This tiered approach keeps the project clean and the system focused.

Tier 1 is a root CLAUDE.md under 100 lines. It sets universal rules and style conventions that apply across the repo.

Tier 2 houses skills in .claude/skills/name/SKILL.md. Each skill contains task-specific commands and concise examples the agent loads only when needed.

Tier 3 lives in docs/agent-guides/name.md. These guides hold deep reference material for developers and act as an authoritative coding guide for complex subsystems.

  • Progressive disclosure ensures the agent loads only the context required for the current task.
  • Directory-level CLAUDE.md files enforce stricter rules for backend, frontend, or other subsystems.
  • This reduces noise and improves output quality across long workflows.
TierLocationPrimary Benefit
Rootrepo/CLAUDE.mdUniversal rules and lightweight defaults
Skills.claude/skills/*/SKILL.mdTask-specific behavior and quick commands
Guidesdocs/agent-guides/Deep reference and coding conventions

We recommend auditing existing documentation and mapping files to these tiers. Treat documentation as infrastructure and your repo will scale more predictably.

Navigating the AGENTS.md Standard

Adopting AGENTS.md gives a single, vendor-neutral source of truth for our repo. This file aligns multiple AI coding tools and cuts duplication across files. It also encourages clearer documentation and quicker developer feedback.

We recommend renaming an existing CLAUDE.md to AGENTS.md and adding a symlink for backward compatibility. That keeps older toolchains working while modern tools read the new root file. Anthropic has seen many requests for support, so adoption is growing fast.

  • One file holds setup commands, pull request rules, and style conventions.
  • Projects gain consistent instructions across agent types and tools.
  • The standard nudges teams toward better documentation and immediate productivity gains.
ScopeLocationPrimary Benefit
Root instructionsrepo/AGENTS.mdSingle entry for project rules and conventions
Compatibilityrepo/CLAUDE.md → symlinkBackward compatibility for older tools
Cross-tool.claude/, docs/Shared context for agents and improved output consistency

For a practical config reference, see our AI coding config guide. We monitor support across tools and update our pattern as the standard evolves.

Mastering Your AI-Assisted Development Workflow

We’ve spent months refining a simple pattern: keep the root structure small and your conventions strict. Small reference files in the repo give the agent clear context and better output.

Treat documentation as living content. Update docs and markdown often so memory and rules stay accurate. This saves time and cuts repeated work for the team.

Follow root directory rules, keep commands predictable, and style guides brief. These steps help coding agents deliver consistent code and useful outputs across workflows.

For a practical walkthrough on setting up supporting tools, see our guide to setting up AI tools on. Iterate, learn from each run, and make documentation part of your development rhythm.

About the author

Latest Posts