Troubleshooting
6 min read
Updated Mar 2026

Fix Common AI Agent & Custom Skill Errors Fast [2026]

Is your AI stubbornly ignoring your carefully crafted rules? Here is how to diagnose and fix the most common agent breakdowns across all major IDEs.

Quick Answer

If an agent is ignoring your .cursorrules or SKILL.md file, it is almost always due to Context Dilution (the file is too long), Conflicting Global Settings, or a Malformed XML Tag breaking the parser.

Error 1: The AI Completely Ignores the Rules

This is the most frustrating error. You explicitly told the AI "Use Tailwind v4", and it continuously generates CSS Modules instead.

Diagnosis Checklist:

  • Check the file name: Ensure your OS isn't hiding file extensions. .cursorrules.txt will be ignored. It must be exactly .cursorrules.
  • Check Global Overrides: In Cursor, go to Settings > General > Rules for AI. If you have conflicting rules here, they will override the project-level dotfile.
  • Check for Positive Phrasing: LLMs are bad at "remembering to do X". Rewrite your rules using strict negative constraints: "CRITICAL: Do NOT use CSS modules. If you use a CSS module, the build will fail."

Error 2: "Context Token Limit Exceeded"

This happens when developers try to paste entire framework documentations into their SKILL.md file. While models like Claude 3.5 Sonnet have 200k context windows, stuffing the system prompt leaves no room for the actual codebase editing.

The Fix: Use MDC Architecture

Instead of one massive file, break your skills up. If using Cursor, create a .cursor/rules/ folder and split your context:

.cursor/rules/
├── react.mdc (Globs: *.tsx)
├── database.mdc (Globs: prisma/*)
└── testing.mdc (Globs: *.test.ts)

Now, the database rules are only loaded into context when the AI is explicitly asked to edit the db schema.

Error 3: The Infinite Bash Loop (Claude Code)

A common issue with CLI agents like Claude Code or Antigravity is the "Infinite Testing Loop." The agent writes code, runs npm test, it fails, it guesses a fix, runs it again, fails, and repeats until you hit your API spend limit.

The Fix: Hard Stop Constraints

Add this exact XML block to your SKILL.md:
<rules>
  <rule id="anti-loop">
    If a bash command (like a test) fails 3 times in a row, you MUST STOP and ask the user for clarification. Do not attempt a 4th fix autonomously.
  </rule>
</rules>

Error 4: Hallucinating MCP Dependencies

Sometimes your AI skill will reference an MCP server (e.g., "Use the Postgres MCP to read the schema"). But the AI will hallucinate the JSON-RPC calls instead of actually routing the request through the Model Context Protocol client.

  • Fix: Use the <mcp_servers> notation in your SKILL file.
  • Explicitly state: "You have access to the `postgres` MCP server. Use the `list_tables` tool provided by this server. Do not write your own SQL queries to check the schema."

Start Fresh with Verified Templates

The easiest way to fix agent errors is to replace your handwritten rules with community-tested templates.