Introduction
As a practicing attorney, I’m very excited to see how drafting legal documents will continue to evolve in this age of AI language models. Today, I conducted an experiment that is likely to make my own drafting workflow significantly more efficient. Currently, if I use AI to help me draft a document, I use the following workflow:
Put a prompt into the ChatGPT website such as, “Draft a letter for XYZ situation.”
Get a bunch of text back (that may include inaccurate hallucinations).
Check the substance of the text output to see if it is legally accurate.
Correct or rewrite portions of text.
Copy and paste that AI text into Microsoft Word.
Spend a significant amount of time on font, layout, or styling.
Save/Print the new Word document.
Wouldn't it be great if I could instruct AI to create the document I need and it generates the properly formatted Word document for me without my ever having to open MS Word?
I decided to put this idea to the test…
The Starting Point (A Sample Petition for Instructions)
I recently had to prepare a “Petition for Instructions” (under Cal. Prob. §17200) for the court regarding a trust administration matter for a client. I needed a starting point for my draft and a way to quickly prepare a document that met the local court’s requirements for this petition.
Submitting this particular type of petition to the probate court is new for me, and so I wanted to review an example petition to be sure my draft included all the necessary elements for the court. My more experienced mentor was unavailable to provide an example. I did, however, find such an example in my copy of The California Probate Paralegal in Appendix 10B.

Extracting the Text of the Sample Petition
My normal process here would have been manually type the text from the sample into Word and use that as a template starting point for my own draft. The sample is only four pages so the transcription would be tedious but possible. However, it occurred to me that it would probably be much faster to scan the relevant pages to a .pdf and then use OCR or an AI model that accepts PDF as an input to extract the text to a text file.

I decided to use Claude Code for this. Claude Code is a tool that allows me to interact with Anthropic’s Claude AI models from my desktop instead of going to their website. It is meant to help coders write code, but I’m finding some other interesting use cases for it. For example, on my own computer I was able to use it to organize files in a folder by their content and then rename those files automatically.
In this case, I launched Claude Code from the directory on my computer where the scanned .pdfs of the sample petition were saved. I then asked Claude to extract the text. I gave it the following instruction:
My Prompt: "Please extract the text from the pdf file SamplePetitionForInstructions.pdf that includes a non-OCRed scan of some pages from a book about California probate that is an example petition for instructions. Save the text (and if possible formatting and layout) of this to a new document."

The first text file output was pretty good; it gave me a clean text file, but it included more text than I actually wanted. To refine this, I decided I needed to be more specific in my instructions, so gave a follow-up instruction:
My Prompt: "I intend to use the extracted text as a starting point for drafting my own Petition for Instructions on a matter I am working on. Therefore, there are some text elements that I do not need. This includes things like page numbers and titles like "Appendix 10B", etc. Please provide a new file that contains only the elements that are necessary and useful for me to use as a starting template for my own petition."

This resulted in a much cleaner file. Claude also highlighted the changes it made:
Claude: “I’ve created a cleaned-up template file at PetitionForInstructionsTemplate.txt that removes:
- The initial page from the book scan.
- ‘Appendix 10B’ references.
- ‘Chapter 10’ and ‘(petition continued)’ headers.
- Other extraneous headers and references.”
Drafting the Petition using a Microsoft Word MCP
Having these text files certainly helps, but that still requires me to copy and paste all of this text into Word and format everything correctly. Then it occurred to me that there might be a way to get Claude Code to actually create a new Word file with the petition text already in the file. Fortunately, I was able to find a Word MCP tool. MCP (Model Context Protocol) is basically a universal format for creating tools that AI agents can take advantage of to expand their capabilities. Someone had created an MCP tool to enable AI agents to create and manipulate MS Word documents directly. All I had to do was figure out how to configure Claude Code with this MCP tool and it would (theoretically) be able to draft the sample petition as a Word document.
Once I had the Word document MCP setup in Claude Code. I gave Claude Code the following instruction:
My Prompt: "I'm trying to create a Petition for Instructions for a probate matter for the court. I have a pdf which contains scanned images of an example petition. I would like you to use that pdf as a starting point and use the word document tool to draft a petition for instructions based on that example. The file I've uploaded is SamplePetitionForInstructions.pdf."
Notably, I did not have Claude use the clean text files that were extracted earlier. I pointed it to the original .pdf scans that had the pages of the sample petition as images that were rotated 90 degrees (see the image below). I wanted to throw Claude the curve ball of having to deal with these rotated images.

I was quite pleased to see Claude work for a couple minutes and eventually produce a Word document. I was also happy to see that the Word document had text in it and the text appeared to be text of a Petition for Instructions. However, when I compared the text in the Word document to the text from the Appendix scans, they did not match at all. Claude had apparently hallucinated an the entire text of the petition and written the hallucination into the Word document.

Obviously, this was not acceptable at all. So I gave Claude a second chance and revised my instructions:
My Prompt:"You successfully created a petition. However, the contents and words used in this template petition do NOT match the words used in the example petition from the PDF. This therefore not an acceptable result. To the best extent possible, the words in the word document you create should match exactly the words from the sample pdf and to the extent possible you should try to match the layout and formatting of the pdf as well in the created word document. Please try again."
This time Claude did revise its process to apply OCR tools to the .pdf scan to try to extract the exact text first. However, the 90-degree rotation of the original .pdf scans prevented the OCR from working correctly. In an act of mercy, I provided Claude with a new version of the .pdf scans with the images properly oriented. This time it successfully read the text and reproduced the sample petition as a Word document accurately.

You can see that this time Claude was able to produce a useable Word document that accurately reflects the content of the original .pdf scans. I’m happy to see that it also applied bold formatting to the heading.
Conclusion
For me, this is a very exciting experiment. Legal documents have very specific formatting and layout requirements, and until now, I haven’t seen an AI that can meet those strict requirements and follow content rules without hallucinations. Going forward, I’m happy to experiment further with what I can do with these tools. Now I can see a path where, for example, I can have an AI ingest information about a client matter, add to that all the local rules and court policies, and produce a draft document that will be ready for my review.
