Skills vs MCP Servers vs Rules Files: Which One Better?
Learn how skills, MCP servers, and rules files spend tokens and upkeep, plus the simple rule for choosing the right context for your coding agent.
Agent skills vs MCP servers vs rules files: short answer
Agent skills, MCP servers, and rules files all dey put knowledge in front of coding agent. Choose based on wetin the knowledge dey do. MCP (model context protocol) na for data wey fit change the next time you check am. Skill na for procedure wey you fit write down today and e still go correct six weeks from now. Rules file na for the few facts wey must apply for every session.
That choice get cost, and the cost na context. Every token wey you spend for instruction wey agent no need na token wey no dey available for the code wey e dey read. You still dey pay that token again for every turn, because the full context window dey resend with each request. So the useful question no be which mechanism fit do the work. Most days, all three fit. The question na which one go cost the least while e dey idle.
Cost wey each one get before you use am
The three ones load for different times, and na this timing make the main difference.
Unconditional rules file dey load when session start, for every session, whether e relevant or not, unless you exclude am. Claude Code dey read startup CLAUDE.md files when every conversation start, remove block-level HTML comments wey dey outside code blocks before e inject their content, and skip files wey pass 4 MiB; claudeMdExcludes fit also exclude files apart from the managed policy file. The documented target na make each file stay under 200 lines, because longer file dey use more context and people no dey follow am reliably. Both effects dey make the matter worse, so 900-line rules file worse pass useless.
Skill dey load for two stages. When startup happen, na only description line from each SKILL.md frontmatter dey enter context, so the model know say the skill dey exist and roughly when e apply. The body dey load when you invoke the skill. So, 400-line reference document almost no cost you until the time you need am.
MCP server used to be the expensive one, and na here most comparisons wey you go read don become outdated. Tool search dey on by default for current Claude Code. Na only tool names and the server's instructions field dey load when session start, while the full JSON (JavaScript object notation) schemas dey wait until Claude search for dem. Adding server no longer costs thousands of tokens upfront. E still costs something, and e still costs everything upfront for configurations wey tool search dey off.
Di data wey dey behind dis chart
[
{
"label": "Rules file, 200 lines",
"at_startup": "2,500",
"after_use": "2,500"
},
{
"label": "Skill, 12 KB body",
"at_startup": 40,
"after_use": "3,000"
},
{
"label": "MCP server, tool search on",
"at_startup": 500,
"after_use": "3,200"
},
{
"label": "MCP server, tool search off",
"at_startup": "4,500",
"after_use": "4,500"
}
]Those ones na estimates, no be measurements from your machine. Dem come from the size of the text wey each mechanism loads, using roughly four characters per token: 200-line rules file na about 10 KB of markdown, skill description na about 160 characters, and server wey exposes twelve tools carries about 18 KB of schema plus 2 KB instructions block. Claude Code dey cut the server instructions field, and the description of each tool wey loads upfront, at 4,096 characters by default, and tool description wey tool search load at 16,384. Before v2.1.296, the shorter limit na 2,048 characters, and CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH replaces both limits if you set am. Instructions and descriptions from some Anthropic-hosted MCP servers dey reach Claude complete even when that variable dey set, so these limits no be universal ceiling. Next section go show you how to read your own real numbers instead.
Read the first two rows together. The rules file costs 2,500 tokens for session where nobody need am. The skill costs 40 tokens for that same session, and 3,000 for the one session out of ten where e run. The last two rows na the same server twice, with tool search on and off: 500 tokens against 4,500. Na this gap make old advice about MCP context bloat still dey circulate.
As of October 2026, Claude Code dey use tool search on Claude Opus 4, Sonnet 4, Haiku 4.5 and later models, and on Opus 4.5, Sonnet 4.5, Haiku 4.5 and later for Google Cloud's Agent Platform. For earlier models, and Microsoft Foundry deployments hosted on Azure, every MCP tool dey load upfront, whatever you set. With ANTHROPIC_BASE_URL pointed at an LLM gateway, tool search dey on by default since v2.1.304; older versions dey turn am off there unless you opt in. Since v2.1.305, Claude Code fit retry gateway request without tool search after a 400 or 422, loading tools upfront when that retry succeed. Set ENABLE_TOOL_SEARCH to control am: false loads every schema upfront, true defers dem with the same model and deployment fallbacks as when you leave am unset, and auto loads dem upfront while their definitions total under 10% of the context window, then keep tool search on once dem reach that threshold even if the total later fall below am. Server wey you configure with "alwaysLoad": true loads its tools upfront regardless of ENABLE_TOOL_SEARCH.
# Load schemas up front only if they fit in 5% of the window
ENABLE_TOOL_SEARCH=auto:5 claudeDi deciding question be: data dey change between each time we call am?
Ask that one first, because e go remove one option completely. If agent need read or write something wey fit different the next time e check am, you need a server. Issue tracker, database, monitoring dashboard, your own internal API (application programming interface). Writing am down no help, because wetin you write don stale immediately somebody else edit the record. Your own codebase dey this list too, because e structure dey change with every commit. Na this reasoning make serve agent parsed map of the repository over MCP better than describing the layout for file wey go old with time.
If the answer still go correct six weeks from now without anybody maintaining am, you want a skill. Release checklist. Migration procedure. The shape of your error responses. How this repository want make dem write tests. Skill na file for git. E no get port, process, or failure mode apart from being wrong, and code review fit catch that.
If na one fact wey must apply to work wey you never think about yet, put am for rules file. Run make lint before committing. Never push to main. Handlers live in src/api/handlers/. One line each. Once entry don grow reach steps, e don stop being fact and become procedure, so e suppose move into skill.
When rules file dey enough
Rules files dey load from different places, from the broadest one to the most specific one: managed policy file, your personal ~/.claude/CLAUDE.md, the project ./CLAUDE.md or ./.claude/CLAUDE.md, and one gitignored ./CLAUDE.local.md. All the files wey e discover dey join together instead of overriding one another, and e read files wey dey closer to your working directory last.
Since v2.1.277, Claude Code dey also read AGENTS.md, but by default na only when no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md dey inside your working directory or above am. If your repository get both, Claude dey read only the CLAUDE.md files, so no maintain two copies wey fit drift apart.
ln -s AGENTS.md CLAUDE.mdThe symlink no dey print anything when e succeed. Start one session, run /context all, and confirm say CLAUDE.md dey show under Memory files. If e no dey listed there, the agent never see am, and changing the wording no go help. If you also want Claude-specific lines, use the import form instead and put dem below the import.
@AGENTS.md
## Claude Code
Use plan mode for changes under `src/billing/`.One trap dey here. @path imports no dey save context. The imported file dey expand and load when launch happen, together with the file wey reference am, up to four hops deep. Splitting one 600-line rules file into six imports go organise am for humans, but e no change the token cost at all. The conventions behind AGENTS.md and its human-facing twin worth reading before you choose layout.
Wetin fit reduce the cost na .claude/rules/ with one paths field. Rules file wey carry paths frontmatter dey load only when the agent touch file wey match one of the patterns.
---
paths:
- "src/api/**/*.ts"
---
# API rules
- Every endpoint validates its input.
- Use the standard error response shape.Rule wey no get paths field dey load when launch happen with the same priority as .claude/CLAUDE.md. So the useful pattern na short unconditional rules, plus one paths list for anything wey only matter inside one directory.
When you wan use skill
Skill na directory wey get SKILL.md inside am. Personal skills dey live for ~/.claude/skills/<name>/SKILL.md and dem apply to every project for your machine. Project skills dey live for .claude/skills/<name>/SKILL.md, dem dey follow repository, and you fit review dem for pull request like any other file.
mkdir -p ~/.claude/skills/summarize-changes---
name: summarize-changes
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
---
Run `git status` and `git diff` against the merge base.
Group the changes by intent, not by file.
Call out anything touching auth, migrations or deletions.description na the only part of that file wey dey inside context before skill run, so e dey do two jobs. E talk wetin the skill dey do, and e talk when to use am. Description wey say "Helps with deploys" no give model anything wey e fit match against request, so skill no go ever run quietly and you go conclude say skills no dey work.
Directory name become command, so the example above give you /summarize-changes. For personal or project skill, frontmatter name wey different from directory name go set the command wey / menu show instead, unless another command don already use that name, and directory name still dey invoke the skill.
Once you invoke skill, e rendered content enter conversation as one message and remain there for the rest of the session. Claude Code no dey read the file again for later turns. Write standing instructions instead of steps for one time, and keep the body tight, because from that point every line dey cost context again for each request. After auto-compaction, Claude Code attach the most recent invocation of each skill again, and e keep the first 5,000 tokens of each one inside combined budget of 25,000 tokens. If you invoke several large skills for one session, the oldest ones go drop completely. Na why skill fit seem like e stop to matter after long conversation. Invoke am again and e go come back. Skill wey get plenty procedures make this trade-off clear: the unlazy skill and e Depth Tree method dey spend real context on gates and plan file, in exchange for agent wey stop declaring say work don finish too early. When the same procedure apply to more than one codebase, share one skill across several repositories instead of copying the file around.
Wetin time you need an MCP server
To add one, na just one command, and the transport dey decide how e go work.
# Remote HTTP server
claude mcp add --transport http notion https://mcp.notion.com/mcp
# Remote HTTP server behind a bearer token
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer your-token"
# Local stdio server: everything after -- is passed through untouched
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
-- npx -y airtable-mcp-serverThe -- dey important. For stdio server, e separate Claude Code own options from the command line wey start your server. If you leave am out, any --port 8080 wey suppose go to the server go parse as option for claude mcp add, and claude mcp add go reject am.
claude mcp list
claude mcp get notionclaude mcp add confirm with an Added ... line. This one only show say configuration don write to disk. claude mcp list na the command wey show the real status, because e print health status beside each server: ✔ Connected, ! Needs authentication, or ✘ Failed to connect. Failure status mean say Claude Code no fit reach that server; e no mean say the list command fail. Inside a session, /mcp show the same view for each server, plus the tool count.
Each call to an MCP server dey stand on im own and carry anything wey e need. Na why MCP server no remember your previous request be the reason. Na design choice, but e get consequence wey you must handle: any state wey worth keeping must live behind the server, inside database or file. And na you go operate that database or file.
MCP server na process wey you gats run
Na the cost wey vendor comparisons dey leave out. Skill na file. MCP server na software wey dey run for somewhere, and when that place na your VPS (virtual private server), na you own the uptime.
Stdio server na the cheaper case. Claude Code go spawn am as child process when session start, and e go die when session end. You no get anything to monitor, and e no need patch according to im own schedule. Remote HTTP server na long-running service, and e need the same things wey any long-running service need, starting with user of im own. Create the mcp user wey the unit below go run as, and give am the server directory:
sudo useradd --system --home-dir /srv/notes-mcp --shell /usr/sbin/nologin mcp
sudo chown -R mcp:mcp /srv/notes-mcp[Unit]
Description=Notes MCP server
After=network-online.target
Wants=network-online.target
[Service]
User=mcp
WorkingDirectory=/srv/notes-mcp
ExecStart=/usr/bin/node /srv/notes-mcp/dist/server.js
Environment=PORT=8931
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now notes-mcp
systemctl is-active notes-mcp
journalctl -u notes-mcp -n 50 --no-pagersystemctl is-active suppose print active. If e print failed, the journal get the reason, and for first run na almost always missing environment variable or port wey something else don already bind. Restart=on-failure no be optional here, because crashed MCP server no dey announce itself. You go find out when the agent tell you say e no fit read your issue tracker.
Bind the process to 127.0.0.1 and put reverse proxy with TLS (transport layer security) in front of am. MCP server wey fit reach your database and answer for public port without authentication na database wey you don publish. Running MCP server for VPS cover the proxy, certificate, and firewall side properly.
Then count the recurring work honestly. The service dey take security updates according to im own schedule, separate from the agent wey dey talk to am. Im OAuth token dey expire, and claude mcp list go start print ! Needs authentication for inconvenient time. Im credentials dey inside config file or Authorization header, so dem need the same care like any other secret. This one na full subject by itself: keeping secrets away from AI agent reach. None of this work dey exist for skill.
Compare am with the alternative before you build. If the data behind the proposed server dey change about once every quarter, skill wey tell the agent where to look and wetin the fields mean cheaper pass service wey you gats keep alive.
How to measure your own context cost
Stop dey estimate and run /context all inside a session. E go print the current breakdown: system prompt, memory files, tools, and MCP servers, plus the token weight of each one.
Check two things. Under Memory files, confirm say every rules file wey you expect dey listed. If file no dey there, agent no fit see am, so na the first thing to rule out when instructions no dey follow. If the file dey listed but the rule still dey skipped, the cause dey somewhere else entirely, and the reasons agent dey ignore instruction wey e fit see dey worth checking before you rewrite the line again. Then check how much your servers dey cost. If server wey you use twice a month dey among the biggest lines for that list, toggle am off for /mcp and turn am on again for sessions wey need am. The configuration remain saved either way.
If discovery cache dey on for your account, remote server wey you don use before fit show status like cached 2h ago · connects on first use · 5 tools. This mean say Claude Code read the tool list from previous session instead of connecting when e start, and e go connect the first time you call a tool. The tools dey available from your first message, so nothing need fixing. Cache dey off by default unless gradual rollout don enable am for you: set MCP_DISCOVERY_CACHE=0 to make every server connect when startup happen, or 1 to turn cache on. For the bigger picture, how to manage the Claude Code context window explain wetin survive compaction, and wetin those tokens really cost you turn the numbers into money.
Why my skill no dey trigger?
The usual cause na the description. Na the only text wey dey for context before the skill run, so if e no name the situation, nothing go match am. Put the trigger inside the sentence: "Use when the user asks what changed, wants a commit message, or asks to review their diff." Vague descriptions fail silently, so e hard to notice.
The second cause na frontmatter typo, and for Claude Code this one silent too. Field name must match exactly, including hyphens, and Claude Code go ignore field wey e no recognize without reporting error. The loud version only show when you package the skill or upload am to claude.ai or the Skills API, wey accept fewer fields and reject the rest outright:
Unexpected key(s) in SKILL.md frontmatter: argument-hint. Allowed properties are: allowed-tools, compatibility, description, license, metadata, nameThe third one na location. Project skills dey load from .claude/skills/ for your working directory and every parent directory up to repository root. Skills for nested directories below where you start no dey load for launch. Dem go appear the first time the agent read or edit file inside that subdirectory, so before then dem no dey autocomplete and you no fit invoke dem by name.
The MCP equivalent of this silent failure na a .mcp.json entry wey get url but no type. Claude Code dey read any entry without type as a stdio server, so e skip the entry and report:
MCP server "notes" has a "url" but no "type"; add "type": "http" (or "sse" / "ws") to this entryMake all three work together
These mechanisms no dey compete for the same place. Setup wey dey work na to use each one where e cheap. Rules file dey hold small number of lines wey true everywhere. Skills dey hold procedures and dem load only when dem apply. One MCP server, sometimes two, dey connect systems wey you no fit predict their contents ahead of time. If you still dey build your understanding of the first one, wetin agent skill really be explain the format well.
One test fit settle most arguments about where something belong. Delete am, start fresh session, then give agent the task. If agent only slow down, e belong inside skill. If agent dey confidently give wrong answer, e belong inside rules file. If agent no fit get the information at all, you need the server, and now you also need plan for keeping that server running.
FAQ
I for write skill or start MCP server?
Decide based on whether the information dey change between one invocation and the next. If agent need read live state wey another person fit edit, like issue tracker, database, or dashboard, you need MCP server, because anything wey you write down go stale immediately the record change. If you fit write the answer down once and e still go correct after six weeks, write skill. Skill na file for git with no process to run, no port to expose, and no patch schedule, so na the cheaper option whenever e possible.
MCP servers still dey fill my context window?
E much less than before. Tool search dey enabled by default for current Claude Code, so na only tool names and server's instructions field dey load when session start. The full schemas dey fetch when Claude search for dem. This now include sessions behind an LLM gateway set through ANTHROPIC_BASE_URL, from v2.1.304 upward. Upfront loading still dey happen with ENABLE_TOOL_SEARCH=false, for server wey set to "alwaysLoad": true, on model wey older than Claude Opus 4 and Sonnet 4 (older than the 4.5 generation for Google Cloud's Agent Platform), and for Microsoft Foundry deployments hosted on Azure. Run /context all to see which situation apply to you, because the numbers for older comparison posts assume upfront loading.
Claude Code dey read AGENTS.md?
Yes, since v2.1.277, but by default only when no CLAUDE.md, .claude/CLAUDE.md, or CLAUDE.local.md dey inside your working directory or above am. If your repository get both, Claude dey read only the CLAUDE.md files, so make one point to the other instead of keeping two copies. Run ln -s AGENTS.md CLAUDE.md for plain symlink, or put @AGENTS.md for the first line of a CLAUDE.md and add Claude-specific instructions below am. Then start session and run /context all to confirm say CLAUDE.md dey show under Memory files.
Why my skill stop dey get any effect halfway through session?
Auto-compaction na the usual reason. When conversation get summarized, Claude Code re-attach the most recent invocation of each skill, keeping the first 5,000 tokens of each one, within combined budget of 25,000 tokens across all of dem. E dey fill that budget starting from the skill wey dem invoke most recently, so if you invoke several large skills, e go drop the older ones completely. Invoke the skill again to restore the full content.
How I fit stop long rules file from loading for every session?
Move the parts wey only matter sometimes into .claude/rules/ files with a paths field for their frontmatter, so each one load only when agent touch matching file. Splitting the file into @path imports no go help, because imported files dey expand and load at launch together with the file wey reference dem. Anything wey be multi-step procedure instead of standing fact suppose become skill, because skill body no cost anything until you invoke am.