Prompts & Rules

How to shape AI behavior without writing code

Concept

The Prompt Stack

AI doesn't just see your question -- it sees layers of context that shape its behavior.

Five Layers of Context

Each layer adds more specificity. The AI sees all of them combined:

  1. System prompt — built into the AI tool (Claude Code / Copilot CLI)
  2. CLAUDE.md — project instructions at the repo root
  3. .claude/rules/ — path-scoped conventions (auto-loaded per file type)
  4. Skill instructions — the SKILL.md being executed
  5. Your message — what you typed
CLAUDE.md

CLAUDE.md

The project's main instructions file -- like a README for the AI.

What Goes in CLAUDE.md

  • Build and deploy commands
  • Project structure overview
  • Key conventions and patterns
  • Branch strategy and CI info
  • Links to setup guides

Both Tools Read It

Claude Code reads CLAUDE.md at the repo root. Copilot CLI also reads it (since v1.0.4). One file, universal context for both tools.

Location
/repo-root/CLAUDE.md

Rules

Rules (.claude/rules/)

Path-scoped convention files that auto-load when you edit matching files.

Example: .claude/rules/fe-javascript.md
---
paths: ["**/*.js"]
applyTo: "**/*.js"
---
# JavaScript Conventions
- Use CustomComponent custom elements (extends HTMLElement)
- Lifecycle: options() -> beforeLoad() -> afterLoad()
- No ES modules -- use Gulp concat pipeline
- Externalize selectors to component config

Dual Frontmatter

Rules need both paths: (Claude Code) and applyTo: (Copilot CLI) to work in both tools. Single file, dual format.

Shared

Shared Rules (.ai/rules/)

Cross-tool rules read by both local skills and CI/CD automation agents.

pr-review.md

PR review standards — 80%+ confidence threshold, severity levels, constructive tone.

pr-answer.md

How to reply to PR comments — cite code, be concise, acknowledge valid points.

pragmatism.md

Filter for practical questions — skip theoretical debates, focus on actionable feedback.

Edit Once, Changes Everywhere

Shared rules in .ai/rules/ are read by local interactive sessions AND autonomous CI/CD agents. Update the rule once and every agent picks up the change.

AGENTS.md

AGENTS.md

Agent inventory at repo root -- Copilot CLI reads it for context about available agents.

Agent Registry

AGENTS.md at the repo root lists all available agents with their names, descriptions, and capabilities. Copilot CLI uses this to understand which agents are available for @AgentName invocation. Claude Code agents are defined in plugin agents/ directories instead.

Docs

Official Documentation

KAI by Dragan Filipovic