agents/claude-code.agent.md
# Claude Code Rules Agent
Set up Claude Code project instructions and rules for a repository.
## When to use
- "set up CLAUDE.md"
- "add Claude Code rules"
- "configure Claude Code for this repo"
- "create .claude/rules"
- "set up Claude instructions"
## When not to use
- GitHub Copilot instructions — use `copilot.agent.md`
- Cursor rules — use `cursor.agent.md`
- Authoring skills (`SKILL.md`) — use `fusion-skill-authoring`
## Context
This agent focuses exclusively on **Claude Code** instruction files:
- `CLAUDE.md` or `.claude/CLAUDE.md` — project instructions (loaded every session, target under 200 lines)
- `.claude/rules/*.md` — modular rule files, optionally path-scoped with `paths` frontmatter
- `@path/to/file` imports in CLAUDE.md to pull in additional context
### Activation modes
| Mode | Setup | When it activates |
|------|-------|-------------------|
| Unconditional | No `paths` frontmatter | Every session |
| Path-scoped | `paths` frontmatter with globs | When Claude reads matching files |
### CLAUDE.md locations
| Location | Scope |
|----------|-------|
| `./CLAUDE.md` or `./.claude/CLAUDE.md` | Project (shared via VCS) |
| `~/.claude/CLAUDE.md` | User (all projects) |
| Managed policy path | Organization (cannot be excluded) |
| `subdir/CLAUDE.md` | Subdirectory (on-demand) |
## Workflow
Follow `.system/fusion-rule-author` Steps 1–7, scoped to Claude Code:
1. **Skip** editor selection — target is Claude Code only
2. **Scan** repo docs and configs per Step 2 (README, CONTRIBUTING, ADRs, configs, CI workflows)
3. **Assess** `CLAUDE.md`, `.claude/CLAUDE.md`, and `.claude/rules/**/*.md`
4. **Interview** — present scan findings, fill gaps per Step 3
5. **Classify** into two buckets: always-on (`CLAUDE.md` / unconditional rules) and path-scoped rules
6. **Draft** using `.system/fusion-rule-author/assets/claude-rule-template.md`
7. **Validate** `paths` frontmatter uses correct glob patterns; `@path` imports point to existing files
8. **Quality gate** — `CLAUDE.md` under ~200 lines, one topic per rule file
## Key references
- `.system/fusion-rule-author/assets/creation-follow-up.md` — per-rule follow-up questions (purpose, exceptions, boundaries, voice)
- `.system/fusion-rule-author/assets/frontmatter-scenarios.md` — "Apply to all files", "Import external files", "Subdirectory rules" scenarios
- `.system/fusion-rule-author/references/examples.md` — Claude Code equivalent examples
- `.system/fusion-rule-author/assets/quality-checklist.md` — "Claude Code" section
## Safety & constraints
- Never embed secrets in instruction files
- Show drafts before writing
- Validate glob patterns and `@path` imports against actual repo paths
- Do not invent conventions — only document what the developer confirms
agents/copilot.agent.md
# Copilot Rules Agent
Set up GitHub Copilot custom instructions for a repository.
## When to use
- "set up Copilot instructions"
- "add custom instructions for Copilot"
- "configure Copilot for this repo"
- "create copilot-instructions.md"
- "add scoped instruction files"
## When not to use
- Cursor rules — use `cursor.agent.md`
- Claude Code rules — use `claude-code.agent.md`
- Authoring skills (`SKILL.md`) — use `fusion-skill-authoring`
## Context
This agent focuses exclusively on **GitHub Copilot** instruction files:
- `.github/copilot-instructions.md` — root instructions (always-on)
- `.github/instructions/*.instructions.md` — path-scoped instructions with `applyTo` frontmatter
## Workflow
Follow `.system/fusion-rule-author` Steps 1–7, scoped to GitHub Copilot:
1. **Skip** editor selection — target is GitHub Copilot only
2. **Scan** repo docs and configs per Step 2 (README, CONTRIBUTING, ADRs, tsconfig, linters, CI workflows)
3. **Assess** only `.github/copilot-instructions.md` and `.github/instructions/*.instructions.md`
4. **Interview** — present scan findings, fill gaps per Step 3
5. **Classify** into two buckets: always-on (root) and scoped (`applyTo`)
6. **Draft** using `.system/fusion-rule-author/assets/copilot-instructions-template.md` and `.system/fusion-rule-author/assets/scoped-rule-template.md` (GitHub Copilot section)
7. **Validate** frontmatter uses `applyTo` (required) and optionally `excludeAgent`
8. **Quality gate** — root under ~80 lines, scoped under ~50 lines
## Key references
- `.system/fusion-rule-author/assets/creation-follow-up.md` — per-rule follow-up questions (purpose, exceptions, boundaries, voice)
- `.system/fusion-rule-author/assets/frontmatter-scenarios.md` — "Apply to all files", "Apply to specific paths", "Exclude from code review" scenarios
- `.system/fusion-rule-author/references/examples.md` — root and scoped instruction examples
- `.system/fusion-rule-author/assets/quality-checklist.md` — "Root instructions" and "Scoped instructions" sections
## Safety & constraints
- Never embed secrets in instruction files
- Show drafts before writing
- Validate glob patterns against actual repo paths
- Do not invent conventions — only document what the developer confirms
agents/cursor.agent.md
# Cursor Rules Agent
Set up Cursor project rules for a repository.
## When to use
- "set up Cursor rules"
- "add Cursor rules"
- "configure Cursor for this repo"
- "create .cursor/rules"
- "add project rules for Cursor"
## When not to use
- GitHub Copilot instructions — use `copilot.agent.md`
- Claude Code rules — use `claude-code.agent.md`
- Authoring skills (`SKILL.md`) — use `fusion-skill-authoring`
## Context
This agent focuses exclusively on **Cursor** rule files:
- `.cursor/rules/*.mdc` — project rules with frontmatter controlling activation
- `.cursor/rules/**/*.mdc` — subdirectory-organized rules
### Activation modes
| Mode | Frontmatter | When it activates |
|------|-------------|-------------------|
| Always apply | `alwaysApply: true` | Every Agent session |
| Glob-scoped | `globs: "<pattern>"` | When matching files are in context |
| Agent-selected | `description: "..."` (no globs) | When Agent decides it is relevant |
| Manual | No `alwaysApply`, no `globs`, no `description` | Only when @-mentioned |
## Workflow
Follow `.system/fusion-rule-author` Steps 1–7, scoped to Cursor:
1. **Skip** editor selection — target is Cursor only
2. **Scan** repo docs and configs per Step 2 (README, CONTRIBUTING, ADRs, configs, CI workflows)
3. **Assess** only `.cursor/rules/**`
4. **Interview** — present scan findings, fill gaps per Step 3
5. **Classify** into four buckets: always-apply, glob-scoped, agent-selected, manual
6. **Draft** using `.system/fusion-rule-author/assets/cursor-rule-template.mdc`
7. **Validate** frontmatter uses correct combination of `description`, `globs`, `alwaysApply`
8. **Quality gate** — under ~500 lines per file, no `**/*` globs (use `alwaysApply` instead)
## Key references
- `.system/fusion-rule-author/assets/creation-follow-up.md` — per-rule follow-up questions (purpose, exceptions, boundaries, voice)
- `.system/fusion-rule-author/assets/frontmatter-scenarios.md` — "Apply to all files", "Let the agent decide", "Manual activation only" scenarios
- `.system/fusion-rule-author/references/examples.md` — Cursor equivalent examples
- `.system/fusion-rule-author/assets/quality-checklist.md` — "Cursor rules" section
## Safety & constraints
- Never embed secrets in rule files
- Show drafts before writing
- Validate glob patterns against actual repo paths
- Do not invent conventions — only document what the developer confirms
CHANGELOG.md
# Changelog
## 0.1.1 - 2026-05-07
### patch
- [#170](https://github.com/equinor/fusion-skills/pull/170) [`5e43223`](https://github.com/equinor/fusion-skills/commit/5e432232917b2b1642431d80cf1698bbefe80ee8) - Apply caveman-compress prose style to SKILL.md.
- Drop articles, filler, hedging from SKILL.md activation body
## 0.1.0 - 2026-03-21
### minor
- [#116](https://github.com/equinor/fusion-skills/pull/116) [`2037597`](https://github.com/equinor/fusion-skills/commit/20375978cba700b828b5c912e7159ef117ee2422) - Add fusion-rules gateway skill for AI coding assistant rule authoring
Gateway entrypoint that detects the target editor (GitHub Copilot, Cursor, Claude Code) and routes to the matching agent for guided rule scaffolding.
- `agents/copilot.agent.md` — GitHub Copilot instructions workflow
- `agents/cursor.agent.md` — Cursor project rules workflow
- `agents/claude-code.agent.md` — Claude Code rules workflow
SKILL.md
---
name: fusion-rules
description: 'Entrypoint for AI coding assistant rule authoring across GitHub Copilot, Cursor, and Claude Code. USE FOR: setting up rules, reviewing existing rules, scaffolding instruction files, or asking which editor format to use. DO NOT USE FOR: authoring skills (SKILL.md), agent definitions (.agent.md), or CI enforcement of rule files.'
license: MIT
metadata:
version: "0.1.1"
status: active
owner: "@equinor/fusion-core"
role: orchestrator
orchestrator: ".system/fusion-rule-author"
skills:
- agents/copilot.agent.md
- agents/cursor.agent.md
- agents/claude-code.agent.md
tags:
- copilot
- cursor
- claude-code
- rules
- instructions
- developer-experience
- onboarding
- entrypoint
---
# Fusion Rules
Gateway for AI coding assistant rule authoring. Detects the target editor and routes to the right agent.
## Routing
| Intent | Agent |
|--------|-------|
| Set up GitHub Copilot instructions / rules | `agents/copilot.agent.md` |
| Set up Cursor project rules | `agents/cursor.agent.md` |
| Set up Claude Code rules / CLAUDE.md | `agents/claude-code.agent.md` |
| Set up rules for all editors / mixed team | Run all three agents sequentially |
| Review or improve existing rules | Route to the agent matching the file format |
## Intent detection
Detect target editor from the request:
- **Copilot** — "copilot", "copilot-instructions", ".github/instructions", "applyTo"
- **Cursor** — "cursor", ".cursor/rules", "mdc", "alwaysApply", "globs"
- **Claude Code** — "claude", "CLAUDE.md", ".claude/rules", "paths"
- **All / unknown** — "rules", "instructions", "set up AI rules", or no editor specified
Route directly on detected intent. No editor specified → run all three agents.
## Loading behavior
Load ONLY the routed agent file. Each agent carries the full workflow and references `.system/fusion-rule-author/` assets and templates on demand. Don't preload all agents.
## Multi-editor workflow
When targeting multiple editors:
1. Run first agent's scan and interview (Steps 1–3) in full
2. Pass scan summary + interview answers as context to remaining agents — they skip Steps 1–3 and start at Step 4 (Classify)
3. Each agent drafts, reviews, and writes files for its own editor format
4. Generate parallel files with equivalent content — no duplication within a single editor
## What this skill does NOT do
- Author skills (`SKILL.md`) — use `fusion-skill-authoring`
- Author agent definitions (`.agent.md`) — separate concern
- Write CI checks for rule validation — out of scope
- Migrate entire legacy codebases — incremental adoption only
## Safety
- No secrets or credentials in rule files
- No overwrites without showing diff and getting approval
- No invented conventions — only document what the developer confirms
- Show drafts before writing any files