# Customize agent behavior
Use repository instructions for standing rules, skills for reusable specialist guidance, and agent profiles for a selectable persona.
## Add repository instructions
Create `AGENTS.md` in the directory where you launch magi-code:
```md
# Repository instructions
- Run `cargo fmt --check` after Rust edits.
- Preserve public behavior unless the task requires a breaking change.
- Never edit generated files under `dist/`.
```
Magi-code also reads `~/.magi-code/AGENTS.md` for rules shared across repositories. Repository instructions apply after user-level instructions, and your current prompt remains the most specific request.
Do not put credentials or private authentication output in instruction files. Their content is sent to providers.
Optional subdirectory discovery can load more specific `AGENTS.md` files when tools access those paths:
```json
{
"knowledge": {
"instructions": { "subdir_discovery": true }
}
}
```
## Install and use skills
A skill contains instructions loaded only when relevant. Put repository skills in `.agents/skills/<skill-name>/SKILL.md` under the launch directory, or user skills in `~/.magi-code/skills/<skill-name>/SKILL.md`. A simple skill starts with metadata:
```md
---
name: release-check
description: Use when preparing a release candidate.
---
Check version consistency, release notes, and locked builds before publishing.
```
Use `/skills` to enable or disable discovered skills. Type `$` to insert a skill name into your prompt; this signals which guidance applies, while the agent still loads the skill when needed.
Keep descriptions concrete: they determine when the agent knows a skill applies.
## Create a primary-agent profile
Save Markdown profiles under `~/.magi-code/agents/` or `$MC_HOME/agents/`:
```md
---
name: Careful Maintainer
description: Conservative maintenance work with focused verification.
reasoning: high
---
Prefer small changes. Preserve public behavior. Run the narrowest useful checks.
```
Select a profile from Mission Control's agent control. Profiles can choose a model, reasoning level, disabled tools, and structured output rules.
Profiles shape behavior; they do not grant extra tool permissions or bypass safety settings.
## Override built-in prompt fragments
Advanced users can replace bundled prompt fragments under `$MC_HOME/prompts/`. This changes base agent behavior globally and can make future documentation assumptions inaccurate. Prefer `AGENTS.md`, a skill, or a profile unless you need to replace product defaults.
## Advanced reference
See [Instructions, prompts, skills, and primary agents](../features/instructions-prompts-skills-and-agents.md) for discovery roots, frontmatter, precedence, limits, and prompt overrides.