## Scope: formatting only
This skill places text the user has already written into a blank California pleading paper template.
- Do not write, draft, complete, rewrite, summarize, or suggest any legal content. That includes captions,
parties, claims, causes of action, defenses, facts, prayers, citations, and signatures.
- Use the user's words exactly as given. Do not correct, reword, or add to them. If a required caption field is
missing, ask the user to supply it, or leave it blank. Never invent it.
- If the user asks for legal advice, drafting, a review of their document, deadlines, or which form or court to
use, say that this skill only formats documents and that they should talk with a lawyer licensed in California.
Then stop using this skill for that request.
- This skill covers paper format only. It does not check content, deadlines, service, filing fees, Judicial
Council form requirements, or e-filing requirements (see rule 2.256(b)). It does not cover appellate briefs.
The user should check the filing court's instructions before filing.
- This skill is general information and a formatting aid. It is not legal advice, and using it does not create an
attorney-client relationship. It was published by SentryHall, a legal-information site run by a law student who
is not a lawyer.
Copy the code below exactly, with no changes, into a file named chat_pleading.py, and run it with Python 3. Check its sha256 against the value listed under the code. For a blank template, run python3 chat_pleading.py blank.docx and check that file's sha256 too. If a value does not match, tell the user the file may differ, and copy the code again. If it still does not match, stop.
```python
# California pleading paper (.docx) for chat AI assistants. Python 3, standard library only, no network.
# Blank template: python3 chat_pleading.py out.docx Filled: python3 chat_pleading.py out.docx caption.json body.txt
# It puts the user's caption fields (JSON) and body text (paragraphs split by blank lines) where the labels are.
import sys,json,zipfile
from xml.sax.saxutils import escape
a=sys.argv;C=a[2:]!=[];D=json.load(open(a[2]))if C else{}
W='http://schemas.openxmlformats.org/';N=f'xmlns:w="{W}wordprocessingml/2006/main" xmlns:r="{W}officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"'
def s(l,r='auto',b=''):return f''
A,X=s(240),s(480,'exact')
def p(q='',x='',f=''):return f'{q}{f}{x}'
def m(q,k,l,f=''):return''.join(p(q,escape(x),f)for x in D.get(k,'').split('\n'))if C else p(q,f'[{l}]',f)
def c(w,b,x):return f'{b}{x}'
def g(*e):return''.join(f''for k in e)
F,K,J='','',''
L=D.get('attorney_block','').split('\n')if C else['[Attorney or party name, address, phone, fax, email,','State Bar number if any]']
L=[escape(x)for x in L]
if len(L)>12:sys.exit('attorney_block: 12 lines at most')
L+=['']*12
o=''.join(p(F+A*(i!=9),L[i])for i in range(12))+p(K+'')+m(K,'court_title','Name of court','')+p(K)*2
q=m(A+J,'case_title','Case title')+p(A+J)*2+p(''+J)*2+p(A+J)*3+p(K)
R=[('case_number','Case number'),('document_title','Nature of the paper; on a complaint or petition, character of the action'),('judge_dept','Judge and department, if assigned'),('referee','Referee, if one was appointed'),('amount_demanded','Amount demanded statement, if rule 2.111(9) applies'),('limited_civil','Limited Civil Case statement, if rule 2.111(10) applies'),('reclassification','Reclassification statement, if rule 2.111(11) applies'),('hearing','Hearing date, time, and department, if any'),('trial_date','Trial date, if set'),('date_filed','Date action filed, if needed')]
r=''.join(m(A+'',*R[i],''*(i==1))for i in range(10))+p(K+'')
o+=f'{c(5037,g("bottom","right"),q)}{c(5038,g("left"),r)}'
B=[x.strip().replace('\n',' ')for x in(open(a[3]).read()if a[3:]else'').split('\n\n')if x.strip()]or['']
o+=p(s(480,'exact',' w:before="0"'))+''.join(p(X+'',escape(x))for x in B)+p(A)
o+=f'{c(4990,"",m(X,"signature_date","Date"))}{c(4990,"",p(A)*3+p(A,"_"*39,"")+m(A,"signer_name","Signer name")+p(A)+m(A,"signer_role","Signer's role",""))}'
o+=p(A)+p(''+A)
o=f'{o}'
P='position:absolute;mso-position-horizontal-relative:margin;mso-position-vertical-relative:'
def v(x,y):return f''
G=X+'';n=''.join(p(G,str(i))for i in range(1,29))+p(G)
h=f'{X}{v("505.7pt","margin;mso-position-vertical:center")}{n}{v("-5.9pt","page")}{v("-3.6pt","page")}'
Z='';Q=A+''+Z+'';E=''
u=''.join(f'{Z}{x}'for x in('',' PAGE ','','1',''))
f=f'{Q}{u}{m(E+Q,"document_title","Title of the paper",Z)}'
y=f'{s(240,"exact")}'
T='application/vnd.openxmlformats-officedocument.wordprocessingml.';O=W+'officeDocument/2006/relationships/'
z={'[Content_Types].xml':f''+''.join(f''for k,m in(('document','document.main'),('styles','styles'),('settings','settings'),('h','header'),('f','footer')))+'','_rels/.rels':f'','word/_rels/document.xml.rels':f''+''.join(f''for k,m in(('header','h'),('footer','f'),('styles','styles'),('settings','settings')))+'','word/document.xml':o,'word/h.xml':h,'word/f.xml':f,'word/styles.xml':y,'word/settings.xml':f''}
with zipfile.ZipFile(a[1],'w')as Y:
for k in z:
i=zipfile.ZipInfo(k,(2026,1,1,0,0,0));i.create_system=3;Y.writestr(i,''+z[k])
```
chat_pleading.py sha256: a938960835a1db5179832443b30abc028432d4b2262a295f6bef6515a319ca99
blank.docx (python3 chat_pleading.py blank.docx) sha256: 04da8c872d5aacbf83a1e04a54fb0ab64ea133e597debd94f9d42d9d5420509d
To fill the template, write the user's first-page details to caption.json and the user's text to body.txt, exactly as the user gave them. Then run python3 chat_pleading.py out.docx caption.json body.txt and give the user out.docx.
caption.json keys: attorney_block (up to 12 lines), court_title, case_title, case_number, document_title, judge_dept, referee, amount_demanded, limited_civil, reclassification, hearing, trial_date, date_filed, signature_date, signer_name, signer_role. Use only these keys; any other key is ignored. In a value, \n starts a new line.
In body.txt, put a blank line between paragraphs. Single line breaks are joined with a space. The body comes out as plain paragraphs, with no bold, italics, or headings; marks such as ** and # print as typed. A key left out shows as a blank line. If a detail is missing, ask the user for it or leave the key out. Never invent it.
> SentryHall publishes general legal information for educational purposes. It is not legal advice,
> and reading it does not create an attorney-client relationship. The author is a law student, not
> a lawyer. Laws change and apply differently to different facts. For advice about your situation,
> talk with a lawyer licensed in California. You can look up a lawyer's license status at
> [calbar.ca.gov](https://www.calbar.ca.gov).
[Full disclaimer](/disclaimer)