self-improving-legal
Captures clause risks, compliance gaps, precedent shifts, contract deviations, regulatory changes, and litigation exposure to enable continuous legal operations improvement. Use when: (1) An unfavorable clause is accepted or slips through review, (2) A compliance deadline is missed or approaching, (3) A new regulation impacts the organization, (4) A contract remains unsigned past SLA, (5) An IP infringement notice is received, (6) New case law changes interpretation in a relevant jurisdiction, (7) A data subject access request reveals process gaps.
What this skill does
# Self-Improving Legal Skill
Log legal learnings, compliance findings, contract issues, and regulatory changes to markdown files for continuous improvement. Captures clause risks, compliance gaps, precedent shifts, contract deviations, regulatory changes, and litigation exposure. Important learnings get promoted to clause libraries, compliance checklists, regulatory trackers, contract playbooks, or risk registers.
## CRITICAL: Privilege & Confidentiality Protection
**NEVER log privileged attorney-client communications, specific case strategy, confidential settlement terms, or litigation work product in any learning or issue entry.** Always abstract findings to process-level lessons. Use generalized descriptions:
| Protected Information | Acceptable Abstraction |
|----------------------|----------------------|
| Attorney-client advice on specific matter | "Outside counsel recommended clause revision for indemnity cap" |
| Settlement amount or terms | "Settlement reached; update playbook to flag similar exposure earlier" |
| Litigation strategy details | "Discovery phase revealed need for better document retention process" |
| Privileged legal memoranda | "Internal review identified gap in force majeure clause coverage" |
| Specific opposing party positions | "Counterparty negotiation pattern: late-stage payment term changes" |
| Confidential deal terms | "Deal structure required non-standard IP assignment clause" |
When in doubt, omit the specific detail and log only the process improvement lesson. Privilege waiver through careless documentation is irreversible.
## First-Use Initialisation
Before logging anything, ensure the `.learnings/` directory and files exist in the project or workspace root. If any are missing, create them:
```bash
mkdir -p .learnings
[ -f .learnings/LEARNINGS.md ] || printf "# Legal Learnings\n\nClause risks, compliance gaps, precedent shifts, regulatory changes, and legal operations insights.\n\n**Categories**: clause_risk | compliance_gap | precedent_shift | contract_deviation | regulatory_change | litigation_exposure\n**Areas**: contracts | compliance | litigation | intellectual_property | privacy | regulatory | corporate_governance\n\n---\n" > .learnings/LEARNINGS.md
[ -f .learnings/LEGAL_ISSUES.md ] || printf "# Legal Issues Log\n\nContract disputes, compliance failures, regulatory impacts, and litigation matters.\n\n---\n" > .learnings/LEGAL_ISSUES.md
[ -f .learnings/FEATURE_REQUESTS.md ] || printf "# Legal Operations Feature Requests\n\nLegal technology, automation, and process improvement requests.\n\n---\n" > .learnings/FEATURE_REQUESTS.md
```
Never overwrite existing files. This is a no-op if `.learnings/` is already initialised.
Do not log privileged communications, specific case strategy, or confidential settlement terms. Abstract all entries to process-level lessons.
If you want automatic reminders, use the opt-in hook workflow described in [Hook Integration](#hook-integration).
## Quick Reference
| Situation | Action |
|-----------|--------|
| Unfavorable clause accepted in contract | Log to `.learnings/LEARNINGS.md` with category `clause_risk` |
| Compliance deadline missed or approaching | Log to `.learnings/LEGAL_ISSUES.md` with category `compliance_gap` |
| New regulation impacts the organization | Log to `.learnings/LEARNINGS.md` with category `regulatory_change` |
| Contract unsigned past SLA | Log to `.learnings/LEGAL_ISSUES.md` with category `contract_deviation` |
| IP infringement notice received | Log to `.learnings/LEGAL_ISSUES.md` with category `litigation_exposure` |
| New case law in relevant jurisdiction | Log to `.learnings/LEARNINGS.md` with category `precedent_shift` |
| Data subject access request reveals gaps | Log to `.learnings/LEARNINGS.md` with category `compliance_gap` |
| Vendor changed terms without flagging | Log to `.learnings/LEGAL_ISSUES.md` with category `contract_deviation` |
| Regulatory filing deadline within 30 days | Log to `.learnings/LEGAL_ISSUES.md` with priority `high` |
| Contract redline rejected 3+ times | Log to `.learnings/LEARNINGS.md` with category `clause_risk` |
| Similar to existing entry | Link with `**See Also**`, consider priority bump |
| Broadly applicable legal pattern | Promote to clause library, compliance checklist, or playbook |
| Proven compliance workflow | Promote to `AGENTS.md` (OpenClaw workspace) |
| Legal tool configuration | Promote to `TOOLS.md` (OpenClaw workspace) |
| Legal operations principles | Promote to `SOUL.md` (OpenClaw workspace) |
## OpenClaw Setup (Recommended)
OpenClaw is the primary platform for this skill. It uses workspace-based prompt injection with automatic skill loading.
### Installation
**Via ClawdHub (recommended):**
```bash
clawdhub install self-improving-legal
```
**Manual:**
```bash
git clone https://github.com/jose-compu/self-improving-legal.git ~/.openclaw/skills/self-improving-legal
```
### Workspace Structure
OpenClaw injects these files into every session:
```
~/.openclaw/workspace/
├── AGENTS.md # Legal workflows, contract review delegation
├── SOUL.md # Legal principles, privilege protection, confidentiality
├── TOOLS.md # Legal tool capabilities, CLM configs, e-discovery
├── MEMORY.md # Long-term memory (main session only)
├── memory/ # Daily memory files
│ └── YYYY-MM-DD.md
└── .learnings/ # This skill's log files
├── LEARNINGS.md
├── LEGAL_ISSUES.md
└── FEATURE_REQUESTS.md
```
### Create Learning Files
```bash
mkdir -p ~/.openclaw/workspace/.learnings
```
Then create the log files (or copy from `assets/`):
- `LEARNINGS.md` — clause risks, compliance gaps, regulatory changes, precedent shifts
- `LEGAL_ISSUES.md` — contract disputes, compliance failures, litigation matters
- `FEATURE_REQUESTS.md` — legal technology and automation requests
### Promotion Targets
When legal learnings prove broadly applicable, promote them:
| Learning Type | Promote To | Example |
|---------------|------------|---------|
| Clause patterns | Clause library | "Always cap indemnity at 2x annual contract value" |
| Compliance requirements | Compliance checklist | "CCPA deletion must cover backup systems within 90 days" |
| Regulatory tracking | Regulatory tracker | "EU AI Act model documentation deadline Q1 2026" |
| Contract negotiation patterns | Contract playbook | "Vendor payment term changes require VP approval" |
| Risk patterns | Risk register | "Unlimited liability clauses in SaaS agreements" |
| Legal operations workflows | `AGENTS.md` | "Route IP matters to patent counsel within 48 hours" |
### Optional: Enable Hook
For automatic reminders at session start:
```bash
cp -r hooks/openclaw ~/.openclaw/hooks/self-improving-legal
openclaw hooks enable self-improving-legal
```
See `references/openclaw-integration.md` for complete details.
---
## Generic Setup (Other Agents)
For Claude Code, Codex, Copilot, or other agents, create `.learnings/` in the project or workspace root:
```bash
mkdir -p .learnings
```
Create the files inline using the headers shown above. Avoid reading templates from the current repo or workspace unless you explicitly trust that path.
### Add reference to agent files
Add to AGENTS.md, CLAUDE.md, or `.github/copilot-instructions.md`:
#### Legal Self-Improvement Workflow
When legal issues or findings occur:
1. Log to `.learnings/LEGAL_ISSUES.md`, `LEARNINGS.md`, or `FEATURE_REQUESTS.md`
2. **NEVER log privileged communications, case strategy, or settlement terms**
3. Review and promote broadly applicable findings to:
- Clause libraries — reusable clause language and fallback positions
- Compliance checklists — regulatory requirement tracking
- Contract playbooks — negotiation patterns and escalation guides
- Risk registers — recurring risk categories and mitigation plans
## Logging Format
### Learning Entry [LRN-YYYYMMDD-XXX]
Append to `.learnings/LEARNINGS.md`:
```markdown
## [LRN-YYRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.