07 · Instructions, Rules, Skills & Custom Agents

Without customisation, an AI assistant treats every project like a stranger's. With it, the assistant follows your stack, conventions, commands and workflows every time. This page covers each customisation type, when to use it, and working examples.

Level 150 minTrack 6 · CustomisationLast verified 2026-10

By the end of this page you can

The customisation toolbox

When does it enter the context? AlwaysProject instructionsAGENTS.md, copilot-instructions.md When files matchScoped rulesapplyTo: "**/*.scala" When relevant (AI decides)SkillsSKILL.md, progressive disclosure When you invoke itPrompt files / commands/write-tests, /release-notes When you switch to itCustom agentsreviewer.agent.md (role+tools) On lifecycle eventsHooksrun formatter after each edit Packaging & sharingPlugins bundle skills + agents + hooks + MCP servers for a team Live external dataMCP servers (page 09)
The key question for each type is when it loads. Always-on content costs tokens on every request, so keep it short. On-demand content can be detailed.
TypeWhat it isUse it for
Project instructionsA Markdown file automatically added to every request in this repo.Stack, versions, build/test commands, architecture, conventions, "never do X".
Scoped rulesInstructions attached only for matching files or tasks."In *.scala, prefer Either." "In migrations/, never edit old files."
Prompt files / slash commandsSaved prompts you trigger by name.Repeated tasks you start yourself: write tests, PR description, explain module.
SkillsA folder with SKILL.md (and optional scripts/references) that the agent loads when the task matches the description.Detailed procedures: "how we add an HTTP endpoint", "release checklist", "Spark job tuning".
Custom agentsA named persona with its own instructions, allowed tools and sometimes a model.Roles: Planner (read-only), Reviewer, Test-writer, Docs-writer.
HooksShell commands that run automatically on events (before/after a tool call, at session start, on stop).Deterministic guarantees: format code, block dangerous commands, run lint.
PluginsInstallable bundles of the above.Sharing a team's whole setup in one install.
MemoriesFacts the product saves and re-inserts.Personal preferences. Review them regularly.

Project instructions: AGENTS.md

AGENTS.md is an open, tool-neutral convention: a Markdown file at the repository root (and optionally in sub-folders) that agents read for project guidance. Many tools read it directly, including Codex, Copilot in VS Code, Xcode agents and others. Some tools prefer their own file name (CLAUDE.md, .github/copilot-instructions.md, .junie/guidelines.md). A common practice is to keep the content in AGENTS.md and make the tool-specific file point to it.

What to put in it

What NOT to put in it

# AGENTS.md

## Project
`orders-service`: HTTP service for order management. Scala 3.5, JDK 21, sbt 1.10.
Stack: http4s (Ember), Cats Effect 3, Doobie + Postgres, Circe, MUnit + munit-cats-effect.

## Layout
- `modules/domain`  pure domain model & logic (no IO, no dependencies on other modules)
- `modules/core`    services, ports (traits), business workflows in IO
- `modules/http`    http4s routes, JSON codecs
- `modules/db`      Doobie repositories implementing ports
- `modules/it`      integration tests (need Docker)

## Commands
- Compile:        `sbt compile`
- Unit tests:     `sbt test`
- One test:       `sbt "core/testOnly *OrderServiceSuite"`
- Format:         `sbt scalafmtAll`      (CI runs `scalafmtCheckAll`)
- Integration:    `sbt it/test`          (requires Docker running)

## Conventions
- Scala 3 syntax, significant indentation, `given`/`using` (no Scala 2 implicits).
- Recoverable errors: `Either[DomainError, A]` or `EitherT`; never throw in domain code.
- Prefer `opaque type` for IDs (`OrderId`, `CustomerId`).
- New public functions need scaladoc and at least one MUnit test.
- Don't add dependencies without asking.

## Done means
`sbt scalafmtCheckAll compile test` passes and new behaviour has tests.
# AGENTS.md

## Project
`pricing-lib`: Python 3.12 library for price calculations. Managed with uv.

## Commands
- Install:   `uv sync`
- Tests:     `uv run pytest -q`
- One test:  `uv run pytest tests/test_discounts.py::test_bulk -q`
- Lint/fmt:  `uv run ruff check . --fix && uv run ruff format .`
- Types:     `uv run mypy src`

## Conventions
- Full type hints; `mypy --strict` must pass.
- Money is `decimal.Decimal`, never float.
- Pure functions in `src/pricing/core/`; I/O only in `src/pricing/adapters/`.
- Tests: pytest, one test file per module, use `hypothesis` for numeric logic.
Let the AI draft it, then you edit Ask the agent: "Explore this repository and draft an AGENTS.md with overview, layout, exact commands, and conventions you can infer. Mark anything you are unsure about with TODO." Then fix the TODOs yourself. Many tools have an /init-style command that does this.

Scoped rules

Scoped rules apply only to some files or tasks, so they don't cost tokens elsewhere. In VS Code, for example, a file in .github/instructions/ with an applyTo glob:

---
description: Conventions for Scala test code
applyTo: "**/src/test/**/*.scala"
---
- Use MUnit (`munit.FunSuite`, or `munit.CatsEffectSuite` for IO).
- One suite per production class, named `<ClassName>Suite`.
- Prefer table-driven tests with a `List` of cases over copy-pasted tests.
- Never use `Thread.sleep`; use `TestControl` from cats-effect-testkit for time.

Other tools have equivalents, such as rules folders with glob metadata, or AGENTS.md files in sub-folders that apply to that sub-tree.

Prompt files (slash commands)

Prompt files are saved prompts you trigger by name, e.g. /write-tests. In VS Code they are *.prompt.md files. Other tools call them commands. Note that some tools now recommend skills instead, because a skill can be both invoked manually and discovered automatically.

---
description: Explain a module for a newcomer
---
Explain the selected module to a developer new to this codebase:
1. Purpose in 2 sentences.
2. Key types and how data flows between them (include a small ASCII diagram).
3. Where it is called from.
4. The 3 things most likely to surprise a newcomer.

Agent Skills (SKILL.md)

Agent Skills are an open format for packaging know-how. A skill is a folder containing a SKILL.md file with YAML front-matter (name, description) and Markdown instructions, plus optional scripts/, references/ and assets/.

Progressive disclosure: why skills scale

1. At start-uponly name + descriptionof every skill(~50–100 tokens each) 2. Task matchesagent loads the fullSKILL.md bodyinto context 3. As neededreads references/ files,runs scripts/one at a time you can install dozens of skills without filling the context window

Because only the description is visible up front, the description decides whether the skill is used. Write it with clear trigger words: what the skill does and when to use it.

.agents/skills/add-http-endpoint/      # cross-tool location; some tools use their own (e.g. .github/skills, .claude/skills)
├── SKILL.md
├── references/
│   └── error-mapping.md
└── scripts/
    └── check_routes.sh
---
name: add-http-endpoint
description: Add a new REST endpoint to the orders-service (http4s + Cats Effect). Use when the
  user asks to add, expose or create an API route/endpoint, or wire a service method to HTTP.
metadata:
  author: sanat
  version: "1.0"
---
# Add an HTTP endpoint

## Steps
1. Define request/response case classes in `modules/http/.../dto/` with Circe codecs
   (`derives Codec.AsObject`).
2. Add or extend the service trait in `modules/core` and return `IO[Either[DomainError, A]]`.
3. Add the route in the matching `*Routes.scala`. Map errors with `ErrorMapping.toResponse`
   (see references/error-mapping.md for the status-code table).
4. Register the route in `HttpApp.scala`.
5. Tests: one `munit.CatsEffectSuite` for the route using `org.http4s.client.Client.fromHttpApp`,
   covering 200, 400 (validation) and 404.
6. Run `sbt "http/test"` and `scripts/check_routes.sh`. Both must pass.

## Don'ts
- Don't put business logic in routes.
- Don't return 500 for domain errors.

Skills work across many tools because they follow an open specification. The same skill folder can serve VS Code, terminal agents and other compatible products. Level 2 has a full chapter on writing excellent skills.

Custom agents

A custom agent bundles a role, instructions, a set of allowed tools and sometimes a preferred model. For example, a read-only planner that cannot edit files, or a reviewer that only reads diffs and comments.

---
name: reviewer
description: Strict senior code reviewer. Reads the diff and reports issues; never edits files.
tools: ['search', 'read', 'changes']
---
You are a strict senior Scala/Python reviewer.
- Review only the current changes.
- Report findings as [BLOCKER], [SHOULD], [NIT] with file:line.
- Check correctness, error handling, concurrency, security, tests, naming.
- Never modify files. If a fix is obvious, show it as a suggested snippet.

Sub-agents are custom agents that the main agent delegates to. They run in their own context and return a summary, which keeps the main context clean (page 08).

Hooks

Instructions are requests the model usually follows. Hooks are guarantees: real commands that run on events, whatever the model decides.

Event (typical)Example use
Before a tool callBlock git push --force or edits under secrets/.
After a file editRun scalafmt / ruff format on the changed file.
Session startPrint the current branch and failing tests into context.
On stopRun the test suite and refuse to finish if it fails.

Hook configuration formats differ by tool (JSON settings files). Check your tool's docs. Rule of thumb: if it must always happen, make it a hook. If it is judgement, make it an instruction.

Where each tool looks (quick reference)

ToolAlways-onScoped / other
GitHub Copilot (VS Code).github/copilot-instructions.md, AGENTS.md.github/instructions/*.instructions.md, *.prompt.md, *.agent.md, skills
OpenAI CodexAGENTS.md (root + sub-folders)Skills, config file
Claude CodeCLAUDE.md.claude/rules, .claude/skills, .claude/agents, hooks in settings
JetBrains Junie.junie/guidelines.md (AGENTS.md support varies by version)IDE settings
Xcode agentsAGENTS.md / CLAUDE.md as used by the configured agentAgent environment settings
Cross-tool skills.agents/skills/<name>/SKILL.md (many tools also read their own skills folder)

Locations evolve. Check the docs of the tool you use, which usually have a "customisation" page.

Decision guide

If you want…Use
The AI to always know build commands and conventionsAGENTS.md
Rules only for tests / SQL / a folderScoped rules
A detailed multi-step procedure used sometimesSkill
A shortcut you trigger yourselfPrompt file / command (or a skill)
A different "personality" with limited toolsCustom agent
Something that must happen every timeHook
Access to an external system (tickets, DB, docs)MCP server
To give your team all of the abovePlugin, or commit the files to the repo

Writing instructions that work

Try it (25 min)
  1. In a real or sample repo, ask your agent to draft an AGENTS.md. Edit it until it is accurate.
  2. Create one skill for a procedure you repeat (e.g. "add a new MUnit suite" or "add a pytest fixture").
  3. New session: give a task that should trigger the skill without naming it. Did the agent load it? If not, improve the description.

Key takeaways