Contract analysis

From Happy-Technologies-LLC/happy-platform-skills · View interactive version

Contract analysis is an AI agent skill from the GitHub repository Happy-Technologies-LLC/happy-platform-skills. Analyze contracts for key terms, obligations, risks, renewal dates, and compliance requirements with metadata extraction and clause flagging

How to use this skill

Skill file

Contract Analysis

Overview

This skill provides a structured approach to analyzing contracts within ServiceNow Legal Service Delivery and Contract Lifecycle Management. It helps you:

When to use: When a new contract needs legal review, during contract renewal assessments, for portfolio-wide risk audits, or when business stakeholders need a plain-language summary of contractual obligations.

Plugin required: com.sn_legal_service_delivery

Prerequisites

Procedure

Step 1: Retrieve the Contract Record

Query the contract to obtain its core metadata and current status.

Using MCP (Claude Code/Desktop):

Tool: SN-Get-Record
Parameters:
  table_name: ast_contract
  sys_id: [contract_sys_id]
  fields: sys_id,number,short_description,contract_type,vendor,starts,ends,renewal_date,payment_amount,total_cost,state,terms_and_conditions,auto_renew,notice_period,assigned_to,department,contract_administrator,parent_contract

Using REST API:

GET /api/now/table/ast_contract/[contract_sys_id]?sysparm_fields=sys_id,number,short_description,contract_type,vendor,starts,ends,renewal_date,payment_amount,total_cost,state,terms_and_conditions,auto_renew,notice_period,assigned_to,department,contract_administrator,parent_contract&sysparm_display_value=true

Step 2: Retrieve the Contract Document

Fetch attachments to access the actual contract text for analysis.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: sys_attachment
  query: table_name=ast_contract^table_sys_id=[contract_sys_id]
  fields: sys_id,file_name,content_type,size_bytes,sys_created_on,sys_created_by
  limit: 20
  order_by: sys_created_on

Using REST API:

GET /api/now/table/sys_attachment?sysparm_query=table_name=ast_contract^table_sys_id=[contract_sys_id]^ORDERBYDESCsys_created_on&sysparm_fields=sys_id,file_name,content_type,size_bytes,sys_created_on,sys_created_by&sysparm_limit=20

To download the attachment content:

GET /api/now/attachment/[attachment_sys_id]/file

Step 3: Extract Key Contract Terms

Analyze the contract for the following term categories:

| Term Category | Key Fields to Extract | Risk Indicators |

|--------------|----------------------|-----------------|

| Payment Terms | Amount, frequency, net days, late fees, escalation | Net 15 or shorter; annual escalation > 5% |

| Liability | Cap amount, exclusions, consequential damages | Unlimited liability; no mutual cap |

| Indemnification | Scope, carve-outs, defense obligations | Broad indemnity without IP carve-out |

| Termination | For cause triggers, convenience period, wind-down | No termination for convenience; > 12-month lock-in |

| Renewal | Auto-renew, notice period, price adjustment | Auto-renew with < 60-day notice window |

| Confidentiality | Duration, scope, permitted disclosures | Perpetual confidentiality; no carve-outs |

| IP Rights | Ownership, license grants, work product | Broad IP assignment to vendor; no license-back |

| Data Privacy | Data handling, breach notification, DPA | No DPA; breach notification > 72 hours |

| SLA/Performance | Uptime, response times, credits, remedies | No SLA credits; no termination for chronic failure |

| Governing Law | Jurisdiction, dispute resolution, venue | Foreign jurisdiction; mandatory arbitration |

Step 4: Assess Risk Level

Score each term category and compute an overall contract risk level:

Risk scoring framework:

Overall risk calculation:

Step 5: Check for Related Legal Cases and Matters

Query for any existing legal activity related to this contract or vendor.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: sn_legal_case
  query: short_descriptionLIKE[vendor_name]^ORdescriptionLIKE[contract_number]
  fields: sys_id,number,short_description,state,case_type,priority,assigned_to,resolution_notes
  limit: 10

Using REST API:

GET /api/now/table/sn_legal_case?sysparm_query=short_descriptionLIKE[vendor_name]^ORdescriptionLIKE[contract_number]&sysparm_fields=sys_id,number,short_description,state,case_type,priority,assigned_to,resolution_notes&sysparm_limit=10&sysparm_display_value=true

Step 6: Flag Concerning Clauses

Create legal tasks for each clause that requires attention or renegotiation.

Using MCP:

Tool: SN-Create-Record
Parameters:
  table_name: sn_legal_task
  fields:
    short_description: "Review unlimited liability clause - Section 8.2"
    description: "Contract [contract_number] contains an unlimited liability provision in Section 8.2. Organization standard requires liability cap at 12 months of fees. Recommend renegotiation to add mutual liability cap."
    legal_case: [case_sys_id]
    priority: 2
    task_type: contract_review
    assigned_to: [counsel_sys_id]
    due_date: [review_deadline]
    state: 1

Using REST API:

POST /api/now/table/sn_legal_task
Content-Type: application/json

{
  "short_description": "Review unlimited liability clause - Section 8.2",
  "description": "Contract contains unlimited liability. Standard requires cap at 12 months of fees.",
  "legal_case": "[case_sys_id]",
  "priority": "2",
  "task_type": "contract_review",
  "assigned_to": "[counsel_sys_id]",
  "due_date": "[review_deadline]",
  "state": "1"
}

Step 7: Generate the Contract Analysis Report

Document the complete analysis as work notes on the legal case.

Using MCP:

Tool: SN-Add-Work-Notes
Parameters:
  table_name: sn_legal_case
  sys_id: [case_sys_id]
  work_notes: |
    === CONTRACT ANALYSIS REPORT ===
    Contract: [contract_number] - [short_description]
    Vendor: [vendor_name]
    Analyst: AI Contract Analyst
    Date: [current_date]

    CONTRACT OVERVIEW:
    - Type: [contract_type]
    - Effective: [start_date] to [end_date]
    - Total Value: $[total_cost]
    - Auto-Renewal: [Yes/No] | Notice Period: [notice_period] days
    - Governing Law: [jurisdiction]

    KEY TERMS SUMMARY:
    1. Payment: [payment_summary]
    2. Liability Cap: [liability_summary]
    3. Indemnification: [indemnity_summary]
    4. Termination: [termination_summary]
    5. Data Privacy: [privacy_summary]
    6. IP Rights: [ip_summary]
    7. SLA/Performance: [sla_summary]

    RISK ASSESSMENT:
    - Overall Risk Level: [HIGH/MEDIUM/LOW]
    - Critical Issues: [count]
    - High-Risk Items: [count]

    FLAGGED CLAUSES:
    1. [CRITICAL] Section 8.2 - Unlimited liability (standard: 12-month cap)
    2. [HIGH] Section 12.1 - Auto-renew with 30-day notice (standard: 90 days)
    3. [HIGH] Section 15.3 - No DPA attached (required for data processing)
    4. [MEDIUM] Section 6.4 - IP assignment broader than industry standard

    COMPLIANCE REQUIREMENTS:
    - GDPR: [compliant/non-compliant] - [details]
    - SOC 2: [compliant/non-compliant] - [details]
    - Industry-specific: [details]

    RECOMMENDED ACTIONS:
    1. Renegotiate liability cap to 12 months of annual fees
    2. Extend auto-renewal notice period to 90 days
    3. Execute Data Processing Agreement before contract signing
    4. Narrow IP assignment clause to deliverables only

    RENEWAL CALENDAR:
    - Contract Expires: [end_date]
    - Renewal Decision Deadline: [notice_date]
    - Days Until Notice Required: [days_remaining]

Step 8: Update Contract Metadata

Record analysis results back to the contract record for portfolio tracking.

Using MCP:

Tool: SN-Update-Record
Parameters:
  table_name: ast_contract
  sys_id: [contract_sys_id]
  data:
    risk_level: high
    review_date: [current_date]
    short_description: "[original_description] [REVIEWED]"
    work_notes: "Legal analysis completed. Risk level: HIGH. 4 flagged clauses require renegotiation. See legal case [case_number] for full analysis."

Using REST API:

PATCH /api/now/table/ast_contract/[contract_sys_id]
Content-Type: application/json

{
  "risk_level": "high",
  "review_date": "[current_date]",
  "work_notes": "Legal analysis completed. Risk level: HIGH. 4 flagged clauses."
}

Tool Usage

MCP Tools Reference

| Tool | When to Use |

|------|-------------|

| SN-Natural-Language-Search | Find contracts by vendor name, type, or description |

| SN-Query-Table | Structured queries for contracts, cases, tasks, attachments |

| SN-Get-Record | Retrieve a single contract or case by sys_id |

| SN-Create-Record | Create legal tasks for flagged clauses |

| SN-Update-Record | Update contract risk level and review metadata |

| SN-Add-Work-Notes | Post the analysis report to the legal case |

REST API Reference

| Endpoint | Method | Purpose |

|----------|--------|---------|

| /api/now/table/ast_contract | GET | Query contracts |

| /api/now/table/ast_contract/{sys_id} | GET/PATCH | Read or update a contract |

| /api/now/table/sn_legal_case | GET/POST | Query or create legal cases |

| /api/now/table/sn_legal_task | POST | Create review tasks for flagged clauses |

| /api/now/table/sys_attachment | GET | Retrieve contract document attachments |

| /api/now/attachment/{sys_id}/file | GET | Download attachment content |

Best Practices

Troubleshooting

"Contract record not found in ast_contract"

Cause: The contract may be stored in a different table depending on your CLM configuration

Solution: Check clm_contract_document, sn_sm_contract, or custom contract tables. Query sys_db_object with nameLIKEcontract to find all contract-related tables.

"Cannot access contract attachment"

Cause: Attachment ACLs restrict access, or the document is stored externally

Solution: Verify you have the itil or contract_manager role. Check if the contract references an external URL field for document storage.

"Risk level field not available on ast_contract"

Cause: The field may be a custom addition or part of an optional plugin

Solution: Query sys_dictionary with name=ast_contract^elementLIKErisk to find available risk-related fields. Create a custom field if needed.

"Renewal date calculation seems incorrect"

Cause: Auto-renewal logic may depend on custom business rules or the notice_period field format

Solution: Verify the notice_period field stores days (not months). Check business rules on ast_contract that compute renewal dates: sys_script with collection=ast_contract^scriptLIKErenewal.

Examples

Example 1: SaaS Vendor Agreement Review

Input: Contract CON0045678 - "Enterprise SaaS Platform - 3-year agreement with DataCorp"

Analysis:

Action: Create legal task to draft and execute DPA before contract signing.

Example 2: NDA Review

Input: Contract CON0045679 - "Mutual NDA with AcquiCo for M&A due diligence"

Analysis:

Action:

Tool: SN-Update-Record
Parameters:
  table_name: ast_contract
  sys_id: def456abc...
  data:
    risk_level: medium
    review_date: 2026-03-19
    work_notes: "NDA reviewed. Medium risk. Residual knowledge clause and non-solicitation rider flagged for counsel review."

Example 3: Contract Portfolio Risk Audit

Input: "Analyze all contracts expiring in the next 90 days"

Query:

Tool: SN-Query-Table
Parameters:
  table_name: ast_contract
  query: active=true^endsBETWEENjavascript:gs.beginningOfToday()@javascript:gs.daysAgoEnd(-90)
  fields: sys_id,number,short_description,vendor,ends,auto_renew,notice_period,total_cost,risk_level
  limit: 50
  order_by: ends

Result: 12 contracts expiring, 4 with auto-renew requiring notice within 30 days, 2 with no documented risk assessment. Prioritize these 6 for immediate review.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.