Research it yourself · Chapter 4
Skills, agents, and memory
Last checked October 16, 2026 · 7 min read · LeaveRights contributors
What CLAUDE.md, skills, subagents, memory notes, and hooks are, and when to use each one. Includes a research agent, a drafting checklist, and a new-matter setup list.
On this page
Claude Code has several ways to store your rules. They differ in when they load and how strictly they apply. Picking the right one means your rules show up at the moment they matter, and not buried in a long file the tool skims past. This chapter explains each one and when to use it.
There is no official guide for a legal research workflow. What follows is one approach. Adjust it to fit your case.
The file locations, field names, and limits below come from the Claude Code docs as of October 2026. They change, so check the linked pages if something does not work.
In the paths below, ~ means your home folder, and a path starting with .claude/ means a folder named .claude inside your case folder. You can ask Claude Code to create any of these files for you. Read what it proposes before you approve it.
The five pieces
CLAUDE.md
This is the instruction file for your project. It loads at the start of every session. The user file at ~/.claude/CLAUDE.md applies to all projects. The project file is ./CLAUDE.md or ./.claude/CLAUDE.md. A personal project file can be ./CLAUDE.local.md.
Use it for the short rules every session needs. These include the read order, the governing law, and the citation rule. Keep it brief. It is context, not enforcement, so the tool can still miss a line.
Skills
A skill is a SKILL.md file with YAML frontmatter. The key fields are name and description. Claude uses a skill when it is relevant, or you can run one directly with /skill-name.
A personal skill lives at ~/.claude/skills/<name>/SKILL.md. A project skill lives at .claude/skills/<name>/SKILL.md. If you set disable-model-invocation: true, only you can run the skill.
Use a skill for a procedure you want loaded at one specific moment. A pre-filing checklist is the best example.
Subagents
A subagent is a Markdown file with frontmatter and a system prompt. It lives in .claude/agents/ for one project or ~/.claude/agents/ for all projects. The required fields are name and description. Optional fields include tools, model, permissionMode, skills, and background.
The model field takes sonnet, opus, haiku, fable, a full model ID, or inherit. Subagents can run in parallel and in the background, up to 20 at once by default.
Use a subagent for a task you hand off, such as researching one question. It does the work in its own space and reports back. That keeps long search results out of your main session.
Memory notes
Auto memory saves notes per repository under ~/.claude/projects/<project>/memory/. A MEMORY.md index loads at the start of each session, up to the first 200 lines or 25KB. You can turn it off with autoMemoryEnabled: false.
Auto memory is on by default in sessions on your own computer. You can turn it on or off with the toggle in /memory.
Use memory notes for lessons. When you correct the tool, ask it to save the correction as a short note. Each note should say what the lesson is, why it matters, and how to apply it. Keep the index to one line per note.
Hooks
Hooks are shell commands that run at set points, such as before or after a tool call or when Claude finishes responding. They always run, unlike an instruction the model might skip. You set them under hooks in settings.json. An exit code of 2 from a PreToolUse hook blocks the action.
Use a hook only when a rule must never be broken. The docs say that to block an action outright, use a hook and not CLAUDE.md. Hooks are the most technical option here. Most readers can skip them at first.
Which one to use
| You want | Use |
|---|---|
| Rules every session needs | CLAUDE.md |
| A procedure at one moment, like before filing | A skill |
| A task handed off with its own caps and output format | A subagent |
| A lesson learned from a correction | A memory note |
| A rule that can never be skipped | A hook |
When in doubt, start with CLAUDE.md. Move a rule into a skill when CLAUDE.md gets long. Add a subagent when you find yourself pasting the same research instructions again and again.
The research agent
A research agent is a subagent that searches, reads, and reports. It does not write your analysis. It acts like a careful research assistant.
The version in the template works like this.
- It has two modes. Quick verify checks a list of known cites, with small caps on searches and reads. Sweep finds the law on a question, with larger caps.
- For a sweep, it lists every way the issue could be phrased, searches the controlling rule number first, checks newer cases that cite each key case, and checks the official court site for recent decisions.
- It treats names from the web or from another AI as leads only. Every such cite is marked unverified until someone reads the opinion.
- For each case it keeps a short clip, with the case name, cite, court, date, a short holding, and one exact quote.
- It saves each verified opinion and adds a row to the manifest and the citation log.
- It ends with a list of what it did not search.
The model setting in its header is where you control cost. A smaller model works well for searching and reading. Chapter 7 explains the tiers.
Two rules protect you from quiet failure. First, it may not write "no case exists." It writes "not found using these framings and these sweeps," and lists what it skipped. Chapter 5 explains why. Second, it stops and reports when it hits a cap, and says what it did not get to. Chapter 7 covers caps.
The full file is in the research agent template. Save it as .claude/agents/legal-researcher.md in your case folder and change the model line to suit your plan. To use it, ask in your main session, for example "Use the legal-researcher agent to answer this question," followed by a prompt from Chapter 8.
The drafting checklist
A checklist loaded at the right moment works better than a long document you read once. Make it a skill that loads when you are about to write or revise something you will send.
The template has four parts.
- A few tripwires. These are the mistakes that could hurt your case, such as a made-up cite, a vague record cite, a cleaned transcript, or a statement that gives away something you meant to protect.
- A pre-drafting list. Read the relevant facts sections. If the draft needs a fact that is missing, add it to the facts file first. Check the status of every source file. Check your notes for decisions you already made.
- Drafting rules. Cite the facts file by paragraph in working drafts and the record itself in final papers. Keep how you describe people consistent. Write plain language for your reader.
- A final gate. Check for language that breaks a protection. Run the citation check. Check the draft against the facts file. Check that nothing undoes a decision you made earlier. List which other files need the same change.
Keep case facts out of the skill. Point it to the facts file instead. If the skill ever conflicts with your master documents, the master documents win, and you fix the skill.
Dates go stale fast, so keep them out of skills where you can. If you must include one, tag it "verify against the latest order."
The drafting checklist template gives you a starting version. Save it as .claude/skills/drafting-checklist/SKILL.md in your case folder. You can also run it directly by typing /drafting-checklist.
A persistence rule
Put one more rule in your user-level CLAUDE.md. If a step fails once or twice, the tool must stop and say what failed, what it tried, and the likely cause. It must not quietly switch to a different approach. After two failed tries, it should reassess.
Without this rule, an AI that hits a blocked website may move on and hand back a result that looks complete and is not. In legal work, a missing source should show up as a stated gap.
New-matter scaffolding checklist
Do this once for each new dispute, before the first real research question.
- Create the citation log with the sections from Chapter 3.
- Create the
Case Law/verified/folder and its manifest. - Set up case alerts for your controlling topics on a free case-law database. Chapter 9 explains how.
- Confirm which courts and reporters apply to your state. If your state is new to you, work out its official court site once and write down the recipe.
- Remember that state statutes need to be checked on the legislature's official site.
- Write
CLAUDE.mdand the facts file.
Next: Chapter 5 covers the order in which to search, and what to do when a database does not have a case.
Sources
LeaveRights is a free educational tool and does not provide legal advice. No account needed, and the letters you write stay on your device. Information provided is for general guidance only. Consult a qualified employment attorney for advice specific to your situation.
