agentleFS
jars-demojars-demo/jars-skills/skills/claude-best-practices/SKILL.md

claude-best-practices

Skill0 starsChanged 34 days agoMITView on GitHub

Work efficiently in Claude Code so usage limits last: short focused sessions, small context, lean always-on context, cheap tool use and clean hand-offs. Use at the start of every session, when a session has run for hours or the context is large, when the user mentions /usage, limits, cost or slowness, before starting a big multi-part build, and when switching to a new task.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 9 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Correctness first: Never skip a test, a check or a warning to save tokens.

    line 30
  2. Distinctive:

    Say it once: When a session should end, be cleared or be compacted, tell the user in one line with the reason.

    line 34
  3. Very specific:

    One task per session: Start a new session (or /clear) when the task changes.

    line 41
  4. Very specific:

    Compact before it is big: Run /compact with a focus when the context passes about half of the window, for example /compact keep the plan, …

    line 43
  5. Distinctive:

    Do not wait for automatic compaction at the very end.

    line 45
  6. Very specific:

    Keep always-on context lean: Run /context to see what is loaded on every request.

    line 48
  7. Very specific:

    Keep CLAUDE.md files short (rules, not essays), disable MCP servers you are not using in /mcp, and uninstall plugins and skills you never …

    line 49
  8. Very specific:

    Check /usage once a day: If one pattern dominates, fix that habit first.

    line 51
  9. Distinctive:

    Read only what the task needs: the repo's AGENTS.md or CLAUDE.md, then the files the task touches.

    line 57
  10. Very specific:

    If the request bundles several unrelated jobs, say so and suggest doing them in separate sessions, or finish one, write a hand-off, and let …

    line 59
  11. Distinctive:

    Search first, then read: use grep or glob to find the place, then read that range with an offset and limit, not the whole file.

    line 64
  12. Distinctive:

    Never re-read a file you just wrote or edited.

    line 66
  13. Very specific:

    Do not paste large outputs into the conversation.

    line 67
  14. Distinctive:

    Run long commands (test suites, builds, servers) in the background and wait for the notification.

    line 78
  15. Distinctive:

    Verify once, at the right level: run the relevant tests after a change, the full suite before a commit.

    line 80
  16. Distinctive:

    Keep replies short: what changed, what was verified, what is next.

    line 82
  17. Very specific:

    Write it to a file in the repo (for example docs/handoff.md, or the scratchpad) so the next session can read it in one call:

    line 97

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude best practices

Same work, a fraction of the usage.

Usage limits are spent per request, and every request sends the whole conversation so far plus everything that is always loaded. So the cost of a session grows with how long it has run and how much context it carries, not only with how hard the task is. A one-line question asked at 200k tokens of context costs far more than the same question in a fresh session.

/usage shows what drives your usage. The three patterns it most often reports:

What /usage saysWhat it meansThe fix
most usage came from sessions active for 8+ hoursone long session doing many unrelated tasksone task per session; /clear between tasks
most usage was at more than 150k contextevery request resends a huge history/compact mid-task, hand off and start fresh
a share went to always-on context over 40k tokensCLAUDE.md, MCP tools, skills and memory ride on every requesttrim them; turn off what you do not use

Ground rules

  • Correctness first. Never skip a test, a check or a warning to save tokens. Saving comes from not repeating work, not from doing less of it.
  • The user's and the repository's rules win. This skill changes how work is paced and carried, never what is required.
  • Say it once. When a session should end, be cleared or be compacted, tell the user in one line with the reason. Do not nag.

For the user: five habits

  1. One task per session. Start a new session (or /clear) when the task changes. A finished feature, a new repo, "now let's do X": all are new sessions.
  2. Compact before it is big. Run /compact with a focus when the context passes about half of the window, for example /compact keep the plan, the open decisions and file paths. Do not wait for automatic compaction at the very end.
  3. Hand off instead of dragging on. For multi-day work, ask for a hand-off note (below), save it in the repo, /clear, and start the next session from the note.
  4. Keep always-on context lean. Run /context to see what is loaded on every request. Keep CLAUDE.md files short (rules, not essays), disable MCP servers you are not using in /mcp, and uninstall plugins and skills you never call.
  5. Check /usage once a day. If one pattern dominates, fix that habit first.

For the agent: how to work

Start of a session

  • Read only what the task needs: the repo's AGENTS.md or CLAUDE.md, then the files the task touches. Do not tour the codebase "for context".
  • If the request bundles several unrelated jobs, say so and suggest doing them in separate sessions, or finish one, write a hand-off, and let the user /clear before the next.

Reading and searching

  • Search first, then read: use grep or glob to find the place, then read that range with an offset and limit, not the whole file.
  • Never re-read a file you just wrote or edited. The tools tell you when they fail.
  • Do not paste large outputs into the conversation. Filter command output (tail, grep, --quiet, -q) to the lines that answer the question.
  • For a broad search across many files where only the answer matters, a subagent keeps the main context small. It still uses tokens, so do not spawn one for a lookup that a single grep answers.

Doing the work

  • Batch independent tool calls in one turn. Write related files in one turn.
  • Plan big builds before writing code: list the pieces, agree on them in one exchange, then build without back-and-forth.
  • Run long commands (test suites, builds, servers) in the background and wait for the notification. Never poll with sleep loops.
  • Verify once, at the right level: run the relevant tests after a change, the full suite before a commit. Do not re-run a suite that just passed when nothing changed.
  • Keep replies short: what changed, what was verified, what is next. No narration of every step, no repeating the plan back.

When the session gets long

Watch for these signs, and when one appears, tell the user once:

  • the task the user asked for is done and a new, unrelated one starts
  • the conversation has been compacted before, or holds many large outputs
  • you are re-deriving facts that were settled earlier

Then offer a hand-off.

The hand-off note

Write it to a file in the repo (for example docs/handoff.md, or the scratchpad) so the next session can read it in one call:

# Hand-off: <task>, <date>

## Goal
One or two sentences.

## Done
- What is finished, with commit hashes.

## Next
1. The next concrete step.

## Decisions
- Choices already made, and why, so they are not reopened.

## Facts
- Paths, commands, ports, versions and gotchas the next session needs.

Then tell the user: "Saved a hand-off to <path>. Run /clear and start the next session with: read <path> and continue."


Checklist

  • One task in this session; unrelated work goes to a new one.
  • Context compacted with a focus before it got huge.
  • Files searched before read, read in ranges, never re-read after editing.
  • Independent tool calls batched; long commands in the background.
  • Tests run once at the right level; no repeated passing runs.
  • Replies short; no step-by-step narration.
  • Hand-off written before a long session ends.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.