Lesson 5 of 9 · 8 min read
Fitting the rules to your code
Read and edit the pipeline plugin's rules, export and import them, or ask Claude to rewrite them from your own repositories — and review every change before it is used.
What you’ll learn
- What the pipeline plugin's rules are and who changes them.
- How to edit a rule file and reload the plugin.
- Two ways to adapt the rules to your code: Claude rewrites them, or you export and import them.
- How to review a proposal file by file.
What the rules are
The pipeline plugin holds the rules Claude follows in Set up, Check, Plan, Build and Document: how your repositories are layered, how branches and merge requests work, how time is logged. Settings › Pipeline plugin shows them. Everyone can read them; owners and admins change them. Changes affect only your organisation's runs.
The bundled rules describe one company's repositories. Fitting them to yours is the single biggest improvement in plan quality you can make.
Edit one file
- Pick a file under Rules and commands.
- Click Edit, change the text, click Save draft. A draft isn't used yet; Changes shows the difference with the bundled text.
- Click Reload the plugin. The plugin's checks run first; if they fail, nothing changes and the page says why.
New runs use the reloaded plugin; running steps keep the version they started with. To undo: Discard my edit, Reset this file to default, or Reset to default for everything.
Way 1 · Ask Claude to rewrite
Example: Acme Logistics uses a gateway, three services and a shared library, and squashes merge requests into develop.
- Under Fit the rules to your code, click Ask Claude to rewrite.
- Under What should change?, describe the difference — or start from a preset such as Our architecture or Our git and merge request rules.
- List Repositories to learn from (optional when Sourcebot is set up) and tick the Files Claude may change (none ticked means any).
- Click Ask Claude and follow it live.
Claude reads your code with Sourcebot when it's set up; otherwise the listed repositories are copied read-only into a temporary folder, deleted afterwards. Claude works on a copy of the rules and can only edit rule files: no shell, no web, nothing pushed. One rewrite runs at a time per organisation, and you can cancel it.
Tip: be specific in What should change? — name your layers and branches. "Our services call each other through the gateway; never call a service directly" beats "use our architecture".
Way 2 · Export and import
- Export downloads the rules as a .zip with a guide for Claude (
REWRITE-WITH-CLAUDE.md). - Rewrite them anywhere — for example with Claude Code next to your code.
- Import the .zip back, or individual
.mdrule files with their original names. Only existing rule files are read; anything else is listed as left out.
Review the proposal
A rewrite or an import becomes a proposal under Waiting for your review. Nothing changes until you open it:
- Read the difference for each file, Claude's summary of what changed and why, and whether the plugin would pass its checks.
- Tick the files to keep and click Keep the ticked files — tick Reload the plugin now to use them at once — or Discard all.
Tip: keep only what you understand. You can run a second rewrite for the rest; nothing forces you to take a whole proposal.
Check yourself
1. You saved a draft of a rule file. Do new runs use it?
Not until you click Reload the plugin and its checks pass.
2. During a rewrite, can Claude push code or run commands?
No. It works on a copy of the rules and can only edit rule files — no shell, no web, nothing pushed.
3. A proposal changes six files and you agree with four. What do you do?
Tick those four and click Keep the ticked files; the others are left out.