
for specialized tasks, and strict ignore and permission boundaries give GitHub Copilot, Cursor, Claude Code and Gemini CLI the same architectural rules without exposing private code or breaking production builds. Keep rules in one file, point every tool-specific file at it, and never rely on a text instruction alone for zero-leakage security.
Modern engineering teams rarely rely on one AI coding tool. One developer writes components in Cursor, another reviews pull requests with GitHub Copilot, and a third runs terminal deployments through Claude Code or Gemini CLI. Without shared, repository-level instructions, each agent guesses build commands, duplicates boilerplate, or leaks sensitive configuration.
This guide covers the universal instruction-file standards, a side-by-side platform map, a safe root-directory blueprint built around an example portal repository, and a three-layer defense against data leakage. If you want to see a SKILL.md workflow in action for frontend work, read our companion guide, Deterministic AI UI Generation with SKILL.md, GitHub Copilot and @seosiri/developer-ui-kit.
1. What are AI agent instruction and skill files?
AI agent instruction files are version-controlled Markdown and YAML files, stored inside a repository, that define coding standards, build commands, permission boundaries and reusable workflows for autonomous coding assistants. Unlike a chat prompt that disappears when the session closes, they act as persistent project memory that travels with the code.
They serve two distinct functions:
- Repository-wide guardrails (
AGENTS.md,CLAUDE.md,GEMINI.md): loaded automatically when an agent opens the workspace, to enforce architecture, tech-stack rules and security boundaries. - Task-specific workflows (
SKILL.md): modular playbooks stored in folders such as.agents/skills/or.github/skills/that an agent loads on demand for specialized work, such as scaffolding UI components, syncing JSON-RPC endpoints or auditing edge workers.
The AGENTS.md open format describes itself as a README for agents, and InfoQ reported in August 2025 that more than 20,000 GitHub repositories had already adopted it. The companion Agent Skills specification defines the SKILL.md format.
2. Side-by-side comparison: instruction files by platform
Different editors and command-line agents look for specific filenames at the project root. Use this matrix to map each file to the tool that reads it.
| File or folder | Supported agent / IDE | Primary purpose |
|---|---|---|
AGENTS.md | Cross-platform standard. Cursor and GitHub Copilot (in supported features) read it directly; OpenAI Codex, Roo Code and others also use it. Claude Code and Gemini CLI reach it through an import or setting (see section 3). | Shared build commands and architecture rules at the project root. |
SKILL.md (inside a skill folder) | Agent Skills-compatible tools: GitHub Copilot, Claude, Claude Code, Cursor. | Reusable multi-step workflows and verification checks, loaded on demand. |
CLAUDE.md / CLAUDE.local.md | Claude Code (Cursor and Copilot also recognize CLAUDE.md). | Project memory, terminal commands, testing protocols and private local overrides. |
.cursor/rules/*.mdc (older: .cursorrules) | Cursor IDE | Project rules with file-glob scoping such as *.tsx. Cursor's docs treat .cursorrules as the older format. |
.github/copilot-instructions.md | GitHub Copilot | Repository-wide instructions for chat, the coding agent and pull request review. Path-specific rules go in .github/instructions/. |
GEMINI.md | Gemini CLI | Default context file; supports @file.md imports and a configurable context.fileName. |
.clinerules | Cline / Roo Code | Project instructions and tool-use guardrails for VS Code agents. |
.windsurfrules | Windsurf | Project guidelines for the Cascade agent workflow. |
CONVENTIONS.md / .aider.conf.yml | Aider | Coding conventions and flags for terminal pair-programming sessions. |
File support changes quickly, so confirm details in each vendor's documentation before standardizing a team workflow: Claude Code memory, GitHub Copilot custom instructions, Cursor rules and Gemini CLI GEMINI.md.
3. How to structure multi-agent files without breaking core builds
Store every core rule in one AGENTS.md at the repository root and make each tool-specific file a lightweight pointer or import. This avoids maintaining ten duplicate rulebooks that drift apart.
Take a full-stack example portal built with Vite, TypeScript, Python administration scripts and a Cloudflare Worker (worker.js and wrangler.toml). Markdown files at the root do not interfere with production builds, because Vite only compiles assets reachable from index.html or copied from public/.
Safe root-directory blueprint (D:\example-portal\)
D:\example-portal\
├── AGENTS.md # master rules (committed)
├── CLAUDE.md # @AGENTS.md import for Claude Code
├── GEMINI.md # @AGENTS.md import for Gemini CLI
├── .windsurfrules # pointer for Windsurf
├── .clinerules # pointer for Cline / Roo Code
├── .aiignore # AI context exclusions
├── .cursorignore # Cursor context exclusions
├── .gitignore # excludes *.local.md and private-* files
├── .github/
│ └── copilot-instructions.md # pointer for Copilot chat and review
├── .agents/
│ └── skills/
│ └── ui-kit-builder/
│ └── SKILL.md
├── src/ # Vite + TypeScript app
├── public/ # static assets only: never put agent files here
├── admin_issuer.py # sensitive admin script (AI-excluded)
├── worker.js
├── wrangler.toml
└── index.html
Cursor needs no extra file here because it reads AGENTS.md and CLAUDE.md natively. Add a .cursorrules pointer only if your team still runs older Cursor versions.
Do not place instruction files inside public/. Vite copies that folder into dist/, which would publish your internal rules to the open web.
How the pieces connect
Figure: one master file, thin adapters per tool, and skills loaded only when needed.
Copy-paste universal pointer file
Place this snippet in .windsurfrules, .clinerules and .github/copilot-instructions.md. The Copilot pointer still matters: GitHub's docs say agent instruction files such as AGENTS.md are not yet supported by every Copilot feature, while copilot-instructions.md is.
# Agent Instructions
Read and strictly follow all project architecture rules, build commands, and security guardrails defined in `AGENTS.md` at the repository root.
For specialized multi-step workflows (such as scaffolding UI components, syncing JSON-RPC endpoints, or modifying edge routing), check `.agents/skills/` for task-specific `SKILL.md` instructions before editing code.
The Claude Code and Gemini CLI imports
Per the Claude Code documentation, Claude Code reads CLAUDE.md rather than AGENTS.md. The documented fix is an import, so your CLAUDE.md can be just this:
@AGENTS.md
## Claude Code
Use plan mode for changes under `src/billing/`.
Gemini CLI uses GEMINI.md by default and supports the same @file.md import syntax, so a one-line GEMINI.md containing @AGENTS.md works. Alternatively, set context.fileName in settings.json to a list such as ["AGENTS.md", "GEMINI.md"], as the Gemini CLI docs describe. An explicit import is more deterministic than a plain-language pointer.
4. A starter AGENTS.md you can copy
Start small. Include the facts an agent is most likely to get wrong: commands, runtime constraints and security rules. The Claude Code docs note that more specific, concise instructions are followed more consistently, and Cursor's docs recommend keeping rules focused and under 500 lines, so resist the urge to paste your whole wiki.
# AGENTS.md
## Mandatory Security & Privacy Guardrails
- NEVER read, print, log, or commit `.env`, API keys, HMAC-SHA256 signing secrets, or local credentials.
- NEVER hardcode private authentication strings, internal staging URLs, or unreleased client configurations into `src/`, `worker.js`, `AGENTS.md`, or `SKILL.md`.
- Always run `npx tsc --noEmit` and `npx vite build` locally and wait for explicit human approval before deploying changes.
## Project overview
Vite + React + TypeScript frontend, Cloudflare Worker edge API (`worker.js`), Python admin scripts.
## Commands
- Install: `npm ci`
- Type-check: `npx tsc --noEmit`
- Build: `npx vite build`
- Edge dev server: `npx wrangler dev`
## Conventions
- Strict TypeScript. No `any`.
- Edge code uses Web APIs only. Do not import Node-only modules such as `fs` into the Worker.
## Skills
For specialized workflows, check `.agents/skills/` for a matching `SKILL.md` before editing code.
Putting the security block first matters: it is the section you least want an agent to skip when context gets long.
5. SKILL.md: task playbooks loaded on demand
AGENTS.md is always on; SKILL.md is loaded only when the task matches. According to GitHub's skills documentation, a skill is a folder containing a SKILL.md file with YAML front matter (a lowercase, hyphenated name and a description saying what it does and when to use it) followed by Markdown instructions. Project skills can live in .github/skills, .claude/skills or .agents/skills. The VS Code agent skills guide covers the editor side.
GitHub recommends custom instructions for simple rules relevant to almost every task and skills for detailed instructions that should load only when relevant. That split keeps context lean.
The six-block SKILL.md pattern
| Block | Purpose | Enforced behavior |
|---|---|---|
| 1. Goal | Scope, trigger phrases, ordered workflow | Restricts generation to the approved stack and packages |
| 2. Context | Prevents blind code generation | Agent asks for target component, stack details and layout constraints first |
| 3. Tools & Permissions | Least-privilege boundaries | Allows local drafts; blocks direct production edits |
| 4. Output Format | Standard handoff artifacts | Install command, code block and package attribution |
| 5. Human Approval | Stops autonomous deployment mistakes | Named approver plus Never / Always rules |
| 6. Checks | Pre-response linter | Verifies imports, type-safe props and zero confidential values |
---
name: ui-kit-builder
description: Scaffolds React and Tailwind CSS components with an approved UI kit. Use when asked to build a UI view, endpoint tester or documentation layout.
---
# UI Kit Builder
## Goal
## Context
## Tools and Permissions
## Output Format
## Human Approval
## Checks
For the complete, tested template, including the real GitHub Copilot output it produced, see the SEOSiri UI Kit Builder specification. The skill is published alongside the @seosiri/developer-ui-kit npm package.
6. Five benefits of an AI-native repository
- Zero-friction tool switching. Developers move between Cursor, Copilot, Claude Code and Gemini CLI with identical TypeScript, linting and architecture behavior.
- Protection against runtime breakage. Explicit rules stop agents from importing Node-only libraries (such as
fs) into edge runtimes like Cloudflare Workers. - Deterministic multi-file synchronization. Pairing
AGENTS.mdwith a six-blockSKILL.md, as demonstrated in the SEOSiri UI Kit Builder specification, forces agents to gather context, import verified components and runnpx tsc --noEmitbefore asking for human sign-off. - Turnkey onboarding and handover. New engineers, open-source contributors or white-label SaaS buyers can clone the repository and use their own AI assistant without reverse-engineering the build pipeline.
- Reduced token waste. Short pointer files plus on-demand skills keep context windows lean, which lowers latency and inference cost.
7. Security and zero-leakage prevention on private projects
Instruction files are passive text and do not create vulnerabilities by themselves, but committing private roadmaps to a public repository, or letting AI tools index .env files, creates immediate leakage risk. If you develop private client features in a repository that is, or may become, public, apply this three-layer protocol.
Layer 1: isolate private rules with .gitignore
Never write confidential client names, internal staging URLs or unreleased endpoints into tracked files. Keep private instructions in local-only override files and exclude them:
# Private AI Agent Instructions & Local Overrides (Never Commit)
CLAUDE.local.md
AGENTS.local.md
.cursor/rules/private-*.mdc
.agents/skills/private-*
Layer 2: block AI context indexing
Add ignore files so AI editors skip secrets, signing keys and administrative scripts:
.env
.env.*
*.key
*.pem
secrets/
admin_issuer.py
Save this as .aiignore and .cursorignore. Support is tool-specific, so check the mechanism each of your tools actually honors:
| Tool | Typical exclusion mechanism |
|---|---|
| JetBrains AI Assistant | .aiignore |
| Cursor | .cursorignore |
| Gemini CLI | .geminiignore (also respects .gitignore) |
| Claude Code | Permission deny rules in .claude/settings.json |
| GitHub Copilot | Content exclusion in repository or organization settings |
Layer 3: write mandatory guardrails at the top of AGENTS.md
Add non-negotiable rules to defend against accidental leaks and indirect prompt injection from external pull requests. Use the security block from the starter file in section 4.
Reality check: instruction files and ignore lists are guidance, not enforcement. The Claude Code docs state that Claude treats CLAUDE.md content as context rather than enforced configuration, and GitHub notes that Copilot may not follow custom instructions the same way every time. The reliable protection is keeping secrets out of the repository entirely: use a secrets manager or Cloudflare Worker secrets, rotate any key an agent may have seen, back critical rules with CI checks, and review every AI-generated diff before it merges.
For a related edge-security example, see how we deploy an RFC 9116 file in Deploy RFC 9116 security.txt on Cloudflare Workers.
8. Implementation checklist
- Create
AGENTS.mdat the repository root with the security block first. - Add
CLAUDE.mdandGEMINI.mdfiles containing@AGENTS.md, plus pointer files for Copilot, Windsurf and Cline. - Move specialized workflows into
.agents/skills/<name>/SKILL.md. - Add
*.local.mdandprivate-*patterns to.gitignore. - Add the ignore files or deny rules your tools support.
- Confirm no instruction file sits inside
public/. - Run
npx tsc --noEmitandnpx vite build, and confirmdist/contains no Markdown rule files. - Require human approval before any deployment.
9. Key takeaways
- One source of truth: write rules once in
AGENTS.mdand connect every other tool with an import or pointer. - Skills for depth: keep always-on context short and move task-specific procedures into on-demand
SKILL.mdfiles. - Defense in depth: combine
.gitignoreoverrides, tool-specific ignore or deny rules, and a secrets manager. Text rules alone do not enforce anything. - Human in the loop: run type-checks and builds locally and require sign-off before deployment.
10. Related SEOSiri resources
- Deterministic AI UI Generation with SKILL.md and GitHub Copilot: the full six-block skill with tested output.
- SEOSiri MCP Hub: the open-source Model Context Protocol server directory.
- LLMs.txt AI Gateway: how we expose machine-readable site guidance to AI crawlers.
- AI SEO Linter: technical audit tooling for AI-search readiness.
- API Validator: API security and governance checks.
- SEOSiri-Official on GitHub: open-source repositories.
11. Frequently asked questions
What is the difference between AGENTS.md and SKILL.md?
AGENTS.md provides always-on, repository-wide rules such as build commands and coding conventions, while SKILL.md packages specialized step-by-step workflows that an AI agent loads only when performing a matching task.
Which file works across GitHub Copilot, Cursor, Claude Code and Gemini CLI?
AGENTS.md is the shared cross-platform standard. Cursor and GitHub Copilot read it directly in supported features, Claude Code reads it through a CLAUDE.md containing @AGENTS.md, and Gemini CLI reads it through a GEMINI.md import or the context.fileName setting, so every agent follows the same rules.
Do AI agent instruction files slow down or break Vite and Cloudflare Worker builds?
No. Root-level Markdown files and hidden folders such as .agents/ are ignored by Vite, TypeScript and Wrangler bundlers, as long as you do not place them in public/, which Vite copies into the production dist folder.
How do I stop AI coding agents from leaking private secrets on GitHub?
Keep credentials out of tracked files, exclude .env and key files with the ignore mechanism each tool supports, store private instructions in AGENTS.local.md or CLAUDE.local.md listed in .gitignore, and review every AI-generated diff before merging.
Is .aiignore enough to protect secrets from AI tools?
No. Ignore-file support varies by tool and is best-effort, so treat it as one layer. Combine it with tool-specific deny rules, a secrets manager, key rotation and human code review.
Will AI agents always follow instruction files?
No. Instruction files are context, not enforced configuration. Both Anthropic and GitHub document that agents may not follow them identically every time, so back critical rules with tests, CI checks, deny rules and human review.
How long should an AGENTS.md file be?
Keep it short and specific: commands, runtime constraints and security rules. Move detailed, task-specific procedures into on-demand SKILL.md files so the always-loaded context stays small and instructions are followed more consistently.
Want an AI-native repository audit?
SEOSiri builds secure, agent-ready codebases: AGENTS.md architecture, SKILL.md workflows, edge-safe Cloudflare Workers and technical SEO for AI search.
Order a Service WhatsApp Us