# `mix usage_rules.sync`
[🔗](https://github.com/ash-project/usage_rules/blob/v1.2.6/lib/mix/tasks/usage_rules.sync.ex#L92)

Sync AGENTS.md and agent skills from project config

Reads the `:usage_rules` key from your project config in `mix.exs` and generates
an AGENTS.md file with usage rules from your dependencies, optionally generating
agent skills as well.

## Configuration

Add to your `mix.exs` project config:

```elixir
def project do
  [
    ...
    usage_rules: usage_rules()
  ]
end

defp usage_rules do
  # Example for those using claude.
  [
    file: "CLAUDE.md",
    # rules to include directly in CLAUDE.md
    # use a regex to match multiple deps, or atoms/strings for specific ones
    usage_rules: [:usage_rules, :ash, ~r/^ash_/],
    # If your CLAUDE.md is getting too big, link instead of inlining:
    usage_rules: [:usage_rules, :ash, {~r/^ash_/, link: :markdown}],
    # or use skills
    skills: [
      location: ".claude/skills",
      # Pull in pre-built skills shipped directly by packages
      package_skills: [:ash, ~r/^ash_/],
      # build skills that combine multiple usage rules
      build: [
        "ash-framework": [
          # The description tells people how to use this skill.
          description: "Use this skill working with Ash Framework or any of its extensions. Always consult this when making any domain changes, features or fixes.",
          # Include all Ash dependencies
          usage_rules: [:ash, ~r/^ash_/]
        ],
        "phoenix-framework": [
          description: "Use this skill working with Phoenix Framework. Consult this when working with the web layer, controllers, views, liveviews etc.",
          # Include all Phoenix dependencies
          usage_rules: [:phoenix, ~r/^phoenix_/]
        ]
      ]
    ]
  ]
end

```

Then run:
```sh
mix usage_rules.sync
```

The config is the source of truth — packages present in the file but absent
from config are automatically removed on each sync.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
