Copilot 8 min read

How to Build a Contract Redline Agent in Copilot with One Skill

One skill, with a playbook and a few Python scripts, turns a Copilot agent into a first-pass contract reviewer that marks up the Word document the way a colleague would. Then the same zip runs in Copilot Cowork and edits the contract in place in SharePoint.

Key takeaways

  • A contract redline skill for Copilot is a zip with three parts: SKILL.md for the method, a playbook in a references folder for the rules, and Python scripts that write tracked changes and comments into the .docx.
  • In Copilot Agent Builder you upload the skill as a zip, keep the agent instructions short, and add starter prompts for a full redline, comments only and a quick risk check.
  • Agent Builder returns the redlined contract as a new Word file. It can't write back to the original in SharePoint.
  • The same zip uploaded to Copilot Cowork edited the contract in place in SharePoint after an approval prompt, and in my demo that run cost 113 Copilot Credits.
  • The redline is a first-pass markup against rules you set. It isn't legal advice, and a person accepts or rejects every change.

You can build a Copilot agent that reviews a supplier contract against your own playbook and hands back the Word document with real tracked changes and a comment on every change saying which rule it applied. The agent is built in Copilot Agent Builder, and the work is done by one skill: a SKILL.md file, a playbook in a references folder, and Python scripts that write the markup into the .docx.

The scripts are what make it reliable. Writing valid tracked changes into a Word file is fiddly, exact work, and a script does it the same way every time. The model reads the contract and decides what breaks the playbook, then a script writes those edits into the file.

The agent does a first-pass markup against rules you set. It isn’t legal advice. It marks up the contract the way a colleague would before a lawyer or contract owner looks at it, and a person reviews, accepts or rejects every change.

What’s inside a contract redline skill?

The skill I built for the video is one zip with three parts.

  • SKILL.md holds the method: front matter with the skill’s name and description, the steps, and the judgement calls. It also sets out three ways to review a contract (a full redline, comments only, or a quick risk check) so the agent doesn’t force a full markup every time.
  • references/playbook.md holds the rules. Each rule has a standard position, a fallback the business will accept without a fight, and red flags it always changes. My demo playbook has ten rules, R1 to R10, covering things like payment terms, renewal, breach notification, insurance, subcontracting and governing law.
  • scripts/ holds four Python scripts. One extracts the paragraphs from the contract, one applies the redline as tracked changes and comments, one lists the markup in the finished file, and one holds shared helpers for the Word file format.

Keeping the rules in their own file means you change your positions in one place, without touching the instructions or the code. SKILL.md is also a portable format: the same structure is read by Copilot, Claude and ChatGPT.

Before you start

  • Agent Builder with skills. You need access to Agent Builder in Microsoft 365 Copilot and the Skills section on your agent. I cover how skills in Agent Builder work, including the limit of eight skills per agent, in how to add skills to Copilot agents in Agent Builder.
  • Scripts that fit the sandbox. Agent Builder runs skill scripts with no network access or package installs, so mine use the Python standard library only. The package limits and folder layout are in how Copilot skills run Python scripts.
  • A test contract. Use a sample contract for your first runs. My demo contracts are fictional, including a four-page managed IT services agreement with four deliberate issues.

How to build the redline agent in Agent Builder

  1. In Microsoft 365 Copilot, go to Agents, then New agent. Skip the chat setup and go straight to configuring.
  2. Give the agent a name, a profile image and a description. Mine is called Kramer, described as our contract redlining agent.
  3. Paste in the agent instructions. Keep them short. The skill carries the method, so the instructions only need to say who the agent is and what it’s for.
  4. In the Skills section, upload the skill as a zip. Agent Builder unpacks it and lists playbook.md under references and the four scripts under scripts.
  5. Add three starter prompts: Full redline, Comments only and Quick risk check.
  6. Create the agent. If you add the starter prompts afterwards, use Update.

To change the skill later, use the three dots next to it and upload a replacement zip. Use the same route to roll out a new playbook or a script fix.

What does the agent do with a contract?

Quick risk check. I uploaded a contract and ran the risk check first. It doesn’t touch the document. The agent read the contract against the playbook and listed the findings on screen, including what was missing and which rules each issue hit. It’s the one to run when you want to know how much work a contract needs before anyone opens Word.

Full redline. The agent replies with a table of the rules it hit and what it changed. On the Clearpath managed services agreement, the agent returned a new Word file that opened in the side panel, with tracked changes in the text and a comment on each change. Each comment carried the author “Contract Review Agent”.

The skill also has a comments-only mode, which I didn’t run in the video.

I also ran a second full redline on a different contract in another conversation while the first was still going. Both finished with their own marked-up files.

How do you change who the comments come from?

The comment author is set in the apply redline script. In my build it’s “Contract Review Agent”, so every comment in Word shows that name. Change it to your team’s name, save the script, zip the skill again and upload the replacement in Agent Builder.

If you’d rather not build this from scratch, I give the skill away free at danielanderson.io/redlineskill. That version has the author as a setting at the top of the script, an example playbook, a test contract, a setup guide, and a prompt you paste into Copilot Chat that interviews you and writes your own playbook.

Can Copilot Cowork run the same skill?

Yes. I uploaded the same zip to Copilot Cowork. Not a line changed. In Cowork it’s Customize, then Add, then upload the zip. In a new task I pointed Cowork at the Clearpath contract in the SharePoint library and asked for a redline edited in place, with no new version.

Cowork stopped for approval before editing the file, with an option to always allow edits. Once approved, it redlined the contract in place and reported what it changed and what it checked and left alone. Back in SharePoint, the same document had the tracked changes and comments.

The file came out differently from Agent Builder. Agent Builder gives you a new redlined document and can’t write back to the original. Cowork edited the original in SharePoint, and because I ran the task, the comments came through under my name.

The Cowork run cost 113 Copilot Credits. I break down how Cowork credits add up in Copilot Cowork models: what each one actually costs, and the Copilot Cowork guide covers the rest of the product.

Three decisions to make before your team runs it

  1. Whose name the comments carry. In Agent Builder every comment says “Contract Review Agent”, so anyone opening the file can see which changes came from the first pass. In Cowork the same markup arrived under the name of the person who ran the task, which reads as though that person wrote every comment. The agent name shows anyone who opens the file, including the other side, which changes came from AI. A person’s name makes the markup read as that person’s own review.
  2. A new file or the original. A new file from Agent Builder leaves the original untouched and is easy to compare side by side. Editing in place with Cowork keeps one document in SharePoint, and with versioning on in the library (the default for SharePoint document libraries), the pre-redline version is still in version history to restore.
  3. Who owns the playbook. The playbook is the part of the skill that carries risk, so it needs an owner, and it sits in the skill’s references folder where anyone using the agent can read it. When a position changes, the owner updates playbook.md and the skill gets re-uploaded. The agent only checks the rules you give it: a contract with no insurance clause only gets flagged if the playbook says a missing insurance clause is a problem.

Frequently asked questions

How is this different from Copilot in Word? Copilot in Word tracks its own edits when Track Changes is on, but it doesn’t check them against a written playbook or name a rule in each comment. The skill does both, so every contract is checked against the same positions and each comment says which rule the change came from.

Can an Agent Builder agent edit the original contract in SharePoint? No. In my testing Agent Builder returned the redlined contract as a new file and couldn’t write back to the original. Copilot Cowork, running the same skill zip, edited the contract in place in SharePoint after an approval prompt to allow edits.

Why does some redlined text lose its bold formatting? Replacement text takes the formatting of the first character it replaces. I found this in local Word testing, so SKILL.md tells the agent to start each edit after a bold defined term.

Is an AI contract redline legal advice? No. The skill gives a first-pass markup against rules you set, and the example playbook in my demo is a sample I wrote to test the skill. A person needs to review and accept or reject every change before the contract goes anywhere.

Get these in your inbox. One email a week.

Practical thinking on organising your information and getting real work out of AI. Subscribers get the free SharePoint Skill course to start.