legal-writer
Legal document drafting -- contracts, memos, briefs, complaints, demand letters, opinions, discovery, settlements, ToS, privacy policies. Full pipeline: document structure, per-section writing, Bluebook citation, case law lookup (CourtListener API), regulation lookup (eCFR API), DOCX output, and TDD-style verification (defined terms, cross-references, placeholders, boilerplate, citation format). Triggers on: 'draft a contract', 'write a legal memo', 'create an NDA', 'write a brief', 'legal document about', 'draft a complaint', 'terms of service', 'privacy policy', 'demand letter', 'settlement agreement', 'legal opinion', 'discovery requests', any request to produce a legal or law-related document.
What this skill does
# Legal Document Writer
Draft publication-quality legal documents in DOCX (Word) format with a **test-driven workflow**: every section is verified before moving to the next. Covers contracts, memos, briefs, complaints, demand letters, and more.
## Bundled Resources
Find the skill directory via `glob("**/KORTIX-legal-writer/")`.
| Resource | Path | Purpose |
|----------|------|---------|
| **Verifier** | `scripts/verify-legal.py` | TDD verification suite (10 checks) |
| **Case law API** | `scripts/courtlistener.py` | CourtListener search/lookup for case citations |
| **Regulation API** | `scripts/ecfr_lookup.py` | eCFR + Federal Register lookup for statutes/regs |
| **Bluebook ref** | `references/bluebook.md` | Bluebook citation format quick reference |
| **Doc type ref** | `references/document-types.md` | Section templates for every document type |
## The TDD Rule
**After writing every section of the document:**
```
1. WRITE section content
2. GENERATE: build/update the DOCX via the docx skill
3. VERIFY: python3 verify-legal.py legal/{slug}/
4. If FAIL → FIX → go to 2
5. If PASS → move to next section
```
The document must pass verification at every step. Never batch errors.
## Pipeline Overview
```
Phase 1: SCAFFOLD → Create project, metadata.json, empty DOCX with structure
Verify: document exists and has correct sections ✓
Phase 2: RESEARCH → Case law, statutes, regulations (if litigation/regulatory doc)
Verify: citations are formatted correctly ✓
Phase 3: WRITE → Per-section drafting in logical order
Verify: verify-legal.py after EACH section ✓
Phase 4: POLISH → Self-reflection pass, strict verification, final DOCX
Verify: verify-legal.py --strict with zero warnings ✓
```
## Filesystem Architecture
```
legal/{document-slug}/
├── metadata.json # Document type, parties, jurisdiction, etc.
├── document.docx # The main document (generated via docx)
├── research/ # Case law, statutes, notes (optional)
│ ├── cases.json # CourtListener search results
│ ├── regulations.json # eCFR lookup results
│ └── notes.md # Research notes
└── versions/ # Prior versions (optional)
```
### metadata.json
This file drives verification. Create it during scaffold:
```json
{
"type": "contract",
"title": "Services Agreement",
"jurisdiction": "State of Delaware",
"governing_law": "Delaware",
"date": "2025-01-15",
"parties": [
{"name": "Acme Corporation", "short_name": "Company", "role": "client"},
{"name": "Jane Smith Consulting LLC", "short_name": "Contractor", "role": "contractor"}
],
"word_limit": null,
"page_limit": null
}
```
For briefs/motions, include `word_limit` or `page_limit` from court rules.
## Phase 1: Scaffold
### 1a. Identify document type
Read `references/document-types.md` for the section template matching the requested document type. The major types:
| Type | Key | Use Case |
|------|-----|----------|
| Legal memorandum | `memo` | Internal analysis, predictive |
| Motion brief | `brief` | Persuasive, court filing |
| Contract/Agreement | `contract` | Transactional, bilateral obligations |
| Complaint/Petition | `complaint` | Initiating litigation |
| Demand letter | `demand` | Pre-litigation claim |
| Legal opinion | `opinion` | Formal legal opinion for transaction |
| Discovery requests | `discovery` | Interrogatories, doc requests |
| Settlement agreement | `settlement` | Resolving dispute |
| Terms of Service | `tos` | User-facing terms |
| Privacy Policy | `privacy` | Data privacy compliance |
### 1b. Create project structure
```bash
SLUG="document-slug-here"
mkdir -p "legal/$SLUG"/{research,versions}
```
### 1c. Create metadata.json
Write the JSON file with document type, parties, jurisdiction, and any constraints.
### 1d. Generate initial DOCX
Load the `docx` skill. Use `python-docx` to create the document with:
- Proper heading styles (Heading 1, 2, 3 for section structure)
- 12pt font (Times New Roman or similar serif for court filings)
- 1-inch margins (adjust per jurisdiction — see court rules)
- Double-spacing for briefs/court filings, single for contracts
- Proper page numbering
- Section headers matching the document type template from `references/document-types.md`
- Placeholder text: `[TO BE DRAFTED]` in each section
### 1e. VERIFY: First green state
```bash
python3 verify-legal.py legal/$SLUG/
```
The scaffolded document should exist and have correct structure. Placeholders are expected at this stage (they'll be flagged as warnings, not failures, unless `--strict`).
## Phase 2: Legal Research (if applicable)
For litigation documents (memos, briefs, complaints) and regulatory documents, research case law and statutes before writing.
### Case Law Search (CourtListener)
```bash
SKILL_DIR="..." # from glob
# Search for relevant cases
python3 "$SKILL_DIR/scripts/courtlistener.py" search "search terms" --after 2015 --limit 10
# Get specific opinion details
python3 "$SKILL_DIR/scripts/courtlistener.py" opinion 12345
# Format as Bluebook citation
python3 "$SKILL_DIR/scripts/courtlistener.py" bluebook 12345
```
Save results to `research/cases.json`. Extract key holdings for use in the document.
**Note:** CourtListener requires a free API token for higher rate limits. Set `COURTLISTENER_API_TOKEN` env var. Without it, limited to 100 requests/day.
### Statute/Regulation Lookup (eCFR)
```bash
# Search regulations
python3 "$SKILL_DIR/scripts/ecfr_lookup.py" search "employment discrimination" --title 29
# Get specific CFR section
python3 "$SKILL_DIR/scripts/ecfr_lookup.py" section 16 444.1
# Search Federal Register for recent rules
python3 "$SKILL_DIR/scripts/ecfr_lookup.py" fedreg "data privacy"
```
No API key required.
### Citation Formatting
Read `references/bluebook.md` for Bluebook citation format. Key rules:
- **Cases:** *Party v. Party*, Vol Reporter Page, Pin (Court Year).
- **Statutes:** Title U.S.C. § Section (Year).
- **Regulations:** Title C.F.R. § Section (Year).
- **Pinpoint cites required** — always cite to the specific page.
- **Short forms** after first full citation: *Id.*, *supra*, or party name + reporter.
For non-litigation documents (contracts, ToS), formal citations are generally not needed — just reference applicable law by name and section.
## Phase 3: Per-Section Writing
### Writing Order by Document Type
**Contract:** Definitions → Core obligations → Reps & warranties → Indemnification → Limitation of liability → Term/termination → General provisions → Preamble/recitals (last, once scope is clear)
**Memo:** Question Presented → Brief Answer → Statement of Facts → Discussion (IRAC per issue) → Conclusion
**Brief:** Statement of Facts → Argument (strongest points first) → Introduction/Summary (last, once you know what to say) → Conclusion
**Complaint:** Parties → Jurisdiction/Venue → Statement of Facts → Causes of Action → Prayer for Relief
### The Writing Loop (for each section)
```
1. READ all previously written sections for context
2. WRITE the section following document-type conventions
3. REGENERATE the DOCX (update via python-docx)
4. VERIFY: python3 verify-legal.py legal/{slug}/
5. If errors → FIX → go to 3
6. SELF-REFLECT:
- Is every legal assertion supported by authority? (litigation docs)
- Are defined terms used consistently?
- Any ambiguous language? ("reasonable" without standard, "timely" without deadline)
- Cross-references point to correct sections?
- No placeholder text remaining in this section?
7. REVISE if needed → regenerate → verify
8. Section DONE → next
```
### Legal Writing Standards
Apply these throughout all sections:
**Clarity over formality:**
- "before" not "prior to"
- "about" not "with respect to"
- "if" not "in the event that"
- "under" not "pursuant to"
- "to" not "in order to"
**Precision:**
- "shall" = duty/obliRelated in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.