AgentSkillsCN

cip-document-generation

为合同智能平台生成专业的合同分析报告(.docx)。报告共分为三类:(1) 合同风险评估——初步分析包括风险评级、热力图、条款解析与谈判策略;(2) 建议红线与修订意见——提出修改建议,并附带修改前后的风险矩阵、实施注意事项及谈判指南;(3) 版本对比——对比两份合同版本,进行差异分析并生成分组对比表格。当用户需要合同风险分析、红线建议或版本对比报告时,可选用此工具。

SKILL.md
--- frontmatter
name: cip-document-generation
description: Generate professional contract analysis reports (.docx) for the Contract Intelligence Platform. Three report types: (1) Contract Risk Review - initial analysis with risk ratings, heat map, clause analysis, negotiation playbook; (2) Suggested Redlines and Revisions - proposed changes with before/after risk matrix, implementation notes, negotiation guide; (3) Version Comparison - compare two contract versions with delta analysis and grouped comparison tables. Use when user requests contract risk analysis, redline suggestions, or version comparison reports.

CIP Document Generation Skill

Generate three contract analysis report types as professional .docx documents with consistent formatting, visual risk indicators, and structured data storage.

Report Types

ReportTriggerOutput
Contract Risk Review"analyze risk", "review contract", "risk assessment"Risk ratings, heat map, clause analysis, negotiation playbook
Suggested Redlines and Revisions"suggest changes", "redline", "revisions needed"Proposed changes, before/after risk, negotiation guide
Version Comparison"compare versions", "what changed", "V1 vs V2"Delta analysis, grouped comparison table

Workflow

Phase 1: Gather Requirements

Ask one at a time, wait for response:

  1. Report type? (Risk Review / Redlines / Comparison)
  2. Contract name?
  3. Your entity name (or token from document, e.g., [COMPANY_A])
  4. Counterparty name (or token, e.g., [COMPANY_B])
  5. Your position/role? (Buyer, Seller, Integrator, Vendor, etc.)
  6. For Comparison only: Version identifiers (e.g., "October Draft" → "November Final")

Phase 2: Extract Contract

Read docx skill first:

bash
cat /mnt/skills/public/docx/SKILL.md

Extract text:

bash
pandoc --track-changes=accept contract.docx -o contract.md

Phase 3: Analyze by Clause Type

Detect clauses using taxonomy keywords. Classify each by:

Three-tier clause weighting:

WeightClause Types
CriticalIndemnification, Limitation of Liability, IP/Work Ownership
HighTermination, Insurance, Vendor Displacement, Non-Solicitation
StandardConfidentiality, Payment/Fees, Warranties, Force Majeure, Governing Law

Risk levels: 🔴 CRITICAL, 🟠 HIGH, 🔵 MODERATE, 🟢 LOW

Phase 4: Generate Report

Read docx-js documentation:

bash
cat /mnt/skills/public/docx/docx-js.md

Generate .docx using report structure below.

Phase 5: Save to Database

On user finalization:

  1. Save to reports table with status: finalized
  2. Extract findings to report_findings table
  3. For comparisons, save deltas to report_deltas table

Phase 6: Deliver

code
✅ REPORT COMPLETE

[View Report](computer:///mnt/user-data/outputs/[filename].docx)

SUMMARY:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[Report-specific summary]

Report Structures

Report 1: Contract Risk Review

code
1. Title Page
2. Executive Summary
3. Risk Heat Map
4. Clause Analysis Table (grouped by clause type)
5. Negotiation Playbook
6. Disclaimers

Report 2: Suggested Redlines and Revisions

code
1. Title Page
2. Executive Summary
3. Combined Risk Matrix (Before | After | Delta)
4. Redline Table (grouped by clause type)
5. Implementation Notes
6. Negotiation Guide
7. Disclaimers

Report 3: Version Comparison

code
1. Title Page
2. Executive Summary
3. Combined Risk Matrix (V1 | V2 | Delta)
4. Detailed Comparison Table (grouped by clause type)
5. Disclaimers

Component Specifications

Title Page

code
┌─────────────────────────────────────────────────────────────┐
│                                                             │
│                    [CONTRACT NAME]                          │
│                                                             │
│              [REPORT TYPE TITLE]                            │
│                                                             │
│            [Version info - comparison only]                 │
│                                                             │
│              Date: [Date]                                   │
│                                                             │
│              Our Entity: [COMPANY_A]                        │
│              Counterparty: [COMPANY_B]                      │
│              Position: [Role]                               │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Report type titles:

  • CONTRACT RISK REVIEW
  • SUGGESTED REDLINES AND REVISIONS
  • VERSION COMPARISON REPORT

Executive Summary: Contract Risk Review

code
┌─────────────────────────────────────────────────────────────┐
│ OVERALL RISK ASSESSMENT: [CRITICAL / HIGH / MODERATE / LOW]│
├─────────────────────────────────────────────────────────────┤
│ TOP CONCERNS                                                │
│ 1. [Clause type]: [One-line concern]                       │
│ 2. [Clause type]: [One-line concern]                       │
│ 3. [Clause type]: [One-line concern]                       │
├─────────────────────────────────────────────────────────────┤
│ RISK DISTRIBUTION                                           │
│ 🔴 CRITICAL: [n]  🟠 HIGH: [n]  🔵 MODERATE: [n]  🟢 LOW: [n]│
└─────────────────────────────────────────────────────────────┘

Overall Risk Scoring (adjectival, clause-weighted):

code
IF any Critical-weight clause has CRITICAL risk → Overall: CRITICAL
ELSE IF any Critical-weight clause has HIGH risk → Overall: HIGH
ELSE IF any High-weight clause has CRITICAL risk → Overall: HIGH
ELSE IF multiple High-weight clauses have HIGH risk → Overall: HIGH
ELSE IF any clause has HIGH risk → Overall: MODERATE
ELSE → Overall: LOW

Executive Summary: Suggested Redlines and Revisions

code
┌─────────────────────────────────────────────────────────────┐
│ REVISION IMPACT                                             │
│              │ Before │ After │                             │
│ 🔴 CRITICAL  │   [n]  │  [n]  │                             │
│ 🟠 HIGH      │   [n]  │  [n]  │                             │
│ 🔵 MODERATE  │   [n]  │  [n]  │                             │
│ 🟢 LOW       │   [n]  │  [n]  │                             │
├─────────────────────────────────────────────────────────────┤
│ CHANGES PROPOSED                                            │
│ Total: [n]  Dealbreaker: [n] | Industry Standard: [n] | Nice-to-Have: [n]│
├─────────────────────────────────────────────────────────────┤
│ KEY REVISIONS                                               │
│ 1. [Clause type]: [One-line change summary]                │
│ 2. [Clause type]: [One-line change summary]                │
│ 3. [Clause type]: [One-line change summary]                │
└─────────────────────────────────────────────────────────────┘

Executive Summary: Version Comparison

code
┌─────────────────────────────────────────────────────────────┐
│ VERSION DELTA                                               │
│              │  V1  │  V2  │ Delta │                        │
│ 🔴 CRITICAL  │  [n] │  [n] │ [±n]  │                        │
│ 🟠 HIGH      │  [n] │  [n] │ [±n]  │                        │
│ 🔵 MODERATE  │  [n] │  [n] │ [±n]  │                        │
│ 🟢 LOW       │  [n] │  [n] │ [±n]  │                        │
├─────────────────────────────────────────────────────────────┤
│ CHANGES DETECTED                                            │
│ Total: [n]  Additions: [n] | Modifications: [n] | Deletions: [n]│
├─────────────────────────────────────────────────────────────┤
│ KEY THEMES (by clause priority)                             │
│                                                             │
│ Critical Weight:                                            │
│ • Indemnification: [change summary or "No changes"]        │
│ • Limitation of Liability: [change summary or "No changes"]│
│ • IP/Work Ownership: [change summary or "No changes"]      │
│                                                             │
│ High Weight:                                                │
│ • Termination: [change summary or "No changes"]            │
│ • Insurance: [change summary or "No changes"]              │
│ • Vendor Displacement: [change summary or "No changes"]    │
│ • Non-Solicitation: [change summary or "No changes"]       │
│                                                             │
│ Standard Weight: [n] changes across [n] clause types       │
└─────────────────────────────────────────────────────────────┘

Combined Risk Matrix

Used in: Reports 2 and 3

code
┌──────────────────────────────────────────────────────────────┐
│ RISK MATRIX                                                  │
├──────────────────────────┬──────────┬──────────┬────────┐   │
│ Clause Type              │ Before/V1│ After/V2 │ Delta  │   │
├──────────────────────────┼──────────┼──────────┼────────┤   │
│ [Clause with findings]   │    🔴    │    🟠    │   ▼    │   │
│ [Clause with findings]   │    🟠    │    🔵    │   ▼    │   │
└──────────────────────────┴──────────┴──────────┴────────┘   │
├──────────────────────────────────────────────────────────────┤
│ NO CHANGES REQUIRED                                          │
│ • [Section] [Title]           • [Section] [Title]           │
└──────────────────────────────────────────────────────────────┘

Delta symbols: ▲ (increased), ▼ (decreased), ● (unchanged)

Risk Heat Map

Used in: Report 1

code
┌─────────────────────────────────────────────────────────────┐
│ RISK HEAT MAP                                               │
├──────────────────────┬──────┬──────┬──────┬──────┐         │
│ Clause Type          │ CRIT │ HIGH │ MOD  │ LOW  │         │
├──────────────────────┼──────┼──────┼──────┼──────┤         │
│ [Clause type]        │  🔴  │      │      │      │         │
│ [Clause type]        │      │  🟠  │      │      │         │
└──────────────────────┴──────┴──────┴──────┴──────┘         │
├─────────────────────────────────────────────────────────────┤
│ NO FINDINGS                                                 │
│ • [Section] [Title]           • [Section] [Title]          │
└─────────────────────────────────────────────────────────────┘

Clause Analysis Table

Used in: Report 1 (grouped by clause type)

code
┌─────────────────────────────────────────────────────────────┐
│ [CLAUSE TYPE]                                           🔴  │
├─────────┬──────┬──────────────────┬─────────────────────────┤
│ Section │ Risk │ Concern          │ Recommendation          │
├─────────┼──────┼──────────────────┼─────────────────────────┤
│ [#]     │  🔴  │ [Concern text]   │ [Recommendation text]   │
└─────────┴──────┴──────────────────┴─────────────────────────┘

Redline Table

Used in: Report 2 (grouped by clause type)

code
┌─────────────────────────────────────────────────────────────────────────────┐
│ [CLAUSE TYPE]                                                           🔴  │
├─────────┬──────┬─────────────────┬─────────────────┬────────────────────────┤
│ Section │ Risk │ Original        │ Proposed Change │ Rationale              │
├─────────┼──────┼─────────────────┼─────────────────┼────────────────────────┤
│ [#]     │  🔴  │ [Original text] │ [Redlined text] │ [Rationale text]       │
└─────────┴──────┴─────────────────┴─────────────────┴────────────────────────┘

Comparison Table

Used in: Report 3 (5-column, sequential with related clauses)

code
| # | Section / Category | V1 (Original) | V2 (Final) - Redlined | Business Impact |
|---|---------------------|---------------|----------------------|-----------------|
| [n] | [#] - [Title] | [V1 text] | [V2 redlined text] | [Impact narrative] |
|   | Related: [x.x, y.y] | | | |

Negotiation Playbook

Used in: Report 1

code
┌─────────────────────────────────────────────────────────────┐
│ NEGOTIATION PLAYBOOK                                        │
├─────────────────────────────────────────────────────────────┤
│ YOUR LEVERAGE                                               │
│ • [Leverage point]                                         │
├─────────────────────────────────────────────────────────────┤
│ COUNTERPARTY LEVERAGE                                       │
│ • [Their leverage point]                                   │
├─────────────────────────────────────────────────────────────┤
│ RECOMMENDED SEQUENCE                                        │
│ 1. 🔴 [Critical clause first]                              │
│ 2. 🟠 [High clause second]                                 │
├─────────────────────────────────────────────────────────────┤
│ POTENTIAL TRADE-OFFS                                        │
│ • Give 🔵 [Moderate item] → Get 🔴 [Critical item]         │
└─────────────────────────────────────────────────────────────┘

Negotiation Guide

Used in: Report 2

code
┌─────────────────────────────────────────────────────────────┐
│ NEGOTIATION GUIDE                                           │
├─────────────────────────────────────────────────────────────┤
│ TALKING POINTS                                              │
│ 🔴 [Clause] ([Section])                                    │
│    • [Key argument]                                        │
├─────────────────────────────────────────────────────────────┤
│ CONCESSION STRATEGY                                         │
│ ┌────────────────────────┬────────────────────────┐        │
│ │ GIVE                   │ GET                    │        │
│ ├────────────────────────┼────────────────────────┤        │
│ │ 🔵 [Moderate item]     │ 🔴 [Critical item]     │        │
│ └────────────────────────┴────────────────────────┘        │
├─────────────────────────────────────────────────────────────┤
│ WALK-AWAY TRIGGERS                                          │
│ • 🔴 [Dealbreaker condition]                               │
└─────────────────────────────────────────────────────────────┘

Implementation Notes

Used in: Report 2

code
┌─────────────────────────────────────────────────────────────┐
│ IMPLEMENTATION NOTES                                        │
├─────────────────────────────────────────────────────────────┤
│ SEQUENCING                                                  │
│ 1. 🔴 [Section] - [Why first]                              │
│ 2. 🟠 [Section] - [Dependency note]                        │
├─────────────────────────────────────────────────────────────┤
│ DEPENDENCIES                                                │
│ • [Section] ← requires [Other section] first               │
├─────────────────────────────────────────────────────────────┤
│ NOTES                                                       │
│ • [Special considerations]                                 │
└─────────────────────────────────────────────────────────────┘

Disclaimers

Used in: All reports

code
┌─────────────────────────────────────────────────────────────┐
│ DISCLAIMER                                                  │
├─────────────────────────────────────────────────────────────┤
│ Risk Advisory: This report applies generally accepted       │
│ contract risk categories and contract management best       │
│ practices. Stakeholders must use this analysis to make      │
│ informed business decisions regarding risk acceptance and   │
│ mitigation. Failure to address identified risks may result  │
│ in material financial, operational, or legal exposure.      │
│                                                             │
│ Legal: This analysis is for informational purposes only and │
│ does not constitute legal advice. Consult qualified legal   │
│ counsel before making decisions based on this report.       │
│                                                             │
│ AI-Generated: This report was generated with AI assistance. │
│ All findings should be verified against source documents.   │
│                                                             │
│ Confidential: This document contains confidential analysis. │
│ Do not distribute without authorization.                    │
└─────────────────────────────────────────────────────────────┘

Redline Notation

Change TypeMarkdown.docx Format
Deletion~~text~~Red #FF0000 strikethrough
Addition**text**Green #00B050 bold
New section**[NEW]** prefixGreen bold
Deleted section~~[DELETED]~~ prefixRed strikethrough

Example: The cure period shall be ~~fifteen (15)~~ **thirty (30)** calendar days.


Visual Specifications

Risk Level Colors

Risk LevelSymbolHex Color
CRITICAL🔴#C00000
HIGH🟠#ED7D31
MODERATE🔵#2E75B6
LOW🟢#00B050

Delta Symbols

SymbolMeaning
Risk increased
Risk decreased
No change

Document Styling

ElementValue
Header backgroundNavy #1F4E79
Header textWhite #FFFFFF
Body fontArial
Margins0.75"

Clause Type Taxonomy

Detection Keywords

Clause TypeKeywords
Indemnificationindemnify, hold harmless, defend
Limitation of Liabilitylimitation, liability cap, consequential, damages
IP/Work Ownershipintellectual property, work product, ownership, license
Terminationtermination, cancel, cure period, breach
Insuranceinsurance, coverage, policy, certificate
Vendor Displacementtransition, displacement, incumbent, handover
Non-Solicitationnon-solicit, non-compete, hiring, recruit
Confidentialityconfidential, NDA, proprietary, disclose
Payment/Feespayment, fees, invoice, net, billing
Warrantieswarrant, represent, guarantee, covenant
Force Majeureforce majeure, act of god, pandemic
Governing Lawgoverning law, jurisdiction, venue, choice of law

Database Storage

Reports saved to SQLite on finalization.

See references/database-schema.md for full schema.

Tables:

  • reports - Core metadata, versioned
  • report_findings - Queryable findings per clause
  • report_deltas - Version comparison deltas

File Output

Naming convention:

code
[ContractName]_[ReportType]_[Date].docx

Examples:

  • MSA_Risk_Review_20251129.docx
  • MSA_Redlines_20251129.docx
  • MSA_V1_to_V2_Comparison_20251129.docx

Output location:

code
/mnt/user-data/outputs/

References

  • references/clause-taxonomy.md - Full keyword lists and classification rules
  • references/database-schema.md - SQLite schema with versioning
  • references/color-specs.md - Hex codes and styling details

Scripts

  • scripts/extract_clauses.py - Clause detection and classification
  • scripts/generate_risk_review.py - Report 1 generation
  • scripts/generate_redline.py - Report 2 generation
  • scripts/generate_comparison.py - Report 3 generation