← Back

Skills: Chaining Skills (Contract Lifecycle)

This post continues my exploration of skills, focusing on the ability to "chain" skills together to automate larger workflows.

As with my previous posts, I'll use vendor contracts as my test subject for building out a sample workflow. In this example, we'll focus on the contract management lifeycle, from a contract being signed to monitoring and renewal and/or termination. Each of those steps maps cleanly onto a set of composable skill files that we can chain together to automate the contract management process from start to finish.

Intake

To begin, when a contract is executed (via DocuSign, PandaDoc, or email), we need an "intake" agent to classify and file the document in our internal system. The agent should review the document, classify it by type (e.g., NDA, MSA, subscription agreement), check for companion documents (a DPA attached to an MSA, an Order Form attached to a subscription agreement), assign a contract ID, apply a consistent naming convention, file the document, and trigger the next steps in the process.

This step is entirely procedural. A clean trigger (e.g., a webhook firing on execution, or a Gmail filter routing to a watched folder) and a consistent filing convention are the only requirements to have an agent complete the intake step.

The following is an example of an intake SKILL.md file:

---
name: contract-intake
description: >
  Classifies, names, and files newly executed vendor contracts, then
  hands off to the extraction skill. Runs on a trigger from DocuSign,
  PandaDoc, or a Gmail filter routing signed agreements to a watched
  folder. Use when a new contract has been executed or when
  backfilling historical contracts into the system.
---

# Contract Intake

## Input
A single executed document (PDF) plus any companion attachments
received in the same envelope or email thread.

## Step 1: Classify
Read the document and assign one of the following types:
- MSA (Master Services Agreement)
- SaaS (Subscription / software agreement)
- Order Form (references a parent MSA or SaaS agreement)
- DPA (Data Processing Addendum)
- SOW (Statement of Work)
- NDA (Mutual or one-way)
- Other (flag for human review)

If classification confidence is low, file under `_review/` and stop.
Do not guess.

## Step 2: Identify companion documents
Some contracts arrive with related documents that belong together:
- An Order Form usually references a parent MSA or SaaS agreement
- A DPA is usually attached to an MSA or SaaS agreement
- An SOW is usually attached to an MSA

If a companion document is present, link it to the parent in Step 4.
If a companion document references a parent that is not in the system,
flag it and file under `_orphaned/` for human review.

## Step 3: Assign a contract ID
Format: `YYYY_Vendor_Type`
- YYYY is the effective year (from the contract, not today's date)
- Vendor is the counterparty name, stripped of legal suffixes
  (Inc., LLC, Ltd., GmbH) and normalized to TitleCase
- Type is the classification from Step 1

Examples:
- 2026_Datadog_SaaS
- 2026_Datadog_DPA
- 2026_Acme_MSA

## Step 4: File and link
Write the document to `drive://contracts/{contract_id}.pdf`. If a
companion document is present, write it to the same path with a
suffix (`_DPA`, `_OrderForm_01`) and record the parent_id in the
documents table.

## Step 5: Hand off
Emit an `intake.complete` event with the contract_id and file_path.
The extraction skill listens on this event.

## Do not
- Extract commercial terms. That is the extraction skill's job.
- Flag legal risks. That is the review skill's job.
- Guess at classification. When in doubt, file under `_review/`.

## Output
A filed document, a row in the documents table, and an
`intake.complete` event with the contract_id.

Extraction

Following intake, we can create an "extraction" agent that processes the contract data (e.g., vendor name, contract date, term) and inputs that information into our database of choice. This step transforms the contract documents from files into queryable data that we can leverage.

The following is an example of an extraction SKILL.md file:

---
name: contract-extraction
description: >
  Extracts structured data from executed vendor contracts and writes
  records to the contracts database. Runs after intake has classified
  and filed the document. Use when a new contract has been ingested
  or when reprocessing existing contracts after schema changes.
---

# Contract data extraction

## Input
A classified, filed vendor contract (PDF or DocuSign export).

## Fields to extract

| Field               | Source                          | Notes                                    |
|---------------------|---------------------------------|------------------------------------------|
| vendor              | Counterparty name               |                                          |
| type                | SaaS / PSA / DPA / Other        | Classified at intake                     |
| effective_date      | Contract text                   |                                          |
| expiration_date     | Contract text                   |                                          |
| auto_renews         | Boolean                         |                                          |
| notice_period_days  | Contract text                   | Days before expiration to give notice    |
| notice_deadline     | Calculated                      | expiration_date minus notice_period_days |
| annual_value        | Contract text                   | Annualize if monthly or multi-year       |
| payment_terms       | Net 30 / Net 60 / other         |                                          |
| governing_law       | Contract text                   |                                          |
| termination_notice  | Days required for termination   |                                          |

## Handling ambiguity
- If a field is not stated explicitly, mark as NULL rather than inferring.
- If the contract contains conflicting terms (e.g., different dates in
  the MSA and Order Form), flag the conflict and extract both values.
- A NULL expiration_date is a risk signal, not a neutral state.

## The notice deadline
The notice_deadline is the most operationally important field. Most
tracking tools store the expiration date. The date that actually
matters is the last day the company can act to avoid unwanted
auto-renewal. Calculate and store this explicitly.

## Output
Write one row to the contracts table per agreement. If companion
documents exist (DPA, Order Form), link them in the documents table
with the same contract_id.

Sample output

Running the extaction skill against a standard SaaS agreement will product a database record like this:

FieldValue
contract_id2025_Datadog_SaaS
vendorDatadog, Inc.
typeSaaS
statusactive
effective_date2025-03-01
expiration_date2026-02-28
auto_renewstrue
notice_period_days30
notice_deadline2026-01-29
annual_value$18,000
payment_termsNet 30
governing_lawDelaware
termination_notice30 days
file_pathdrive://contracts/2025_Datadog_SaaS.pdf

From here, we can create additional agents that leverage the contract data to manage different aspects of the contract's lifecycle.

Monitoring

For example, a "monitoring" agent, run weekly via cron, can query the database and flag upcoming notice deadlines to ensure our contracts don't auto-renew without internal review and approval. Renewal alerts can be tiered: 90 days is informational, 45 days is action required, 30 days is escalate. The agent could also flag obligations with approaching due dates, contracts with missing critical fields, and vendors where actual spend deviates from contracted amounts.

A sample Monday morning Slack alert could look like this:

šŸ“‹ Weekly Contract Health — Jan 6, 2026

šŸ”“ ESCALATE (30 days)
  Datadog SaaS — notice deadline Jan 29, 2026
  Annual value: $18,000 | Auto-renews if no action
  Action: renew, renegotiate, or terminate

🟔 ACTION REQUIRED (45 days)
  AWS Enterprise Support — notice deadline Feb 18, 2026
  Annual value: $42,000 | Uncapped fee escalation (Priority 1 flag open)
  Action: review flag before renewal decision

🟢 INFORMATIONAL (90 days)
  Slack Business+ — notice deadline Apr 2, 2026
  Annual value: $8,400 | No open flags

āš ļø MISSING DATA
  Figma Enterprise — NULL expiration date
  Action: source document needs manual review

šŸ“Š Summary: 3 renewals approaching, 1 open P1 flag, 1 data gap

The output is a prioritized list of what requires a decision this week, not a raw data dump.

The following is an example of a monitoring SKILL.md file:

---
name: contract-monitoring
description: >
  Queries the contracts database on a schedule and produces a
  prioritized weekly action list for the ops owner. Runs every
  Monday at 8am via cron. Use when generating the weekly contract
  health report or when on-demand review of upcoming renewals and
  open obligations is needed.
---

# Contract monitoring

## Input
Read-only access to the contracts, obligations, flags, and
documents tables. The current date.

## What to check
Run the following queries against the database:

1. **Upcoming renewals.** Any contract where
   `notice_deadline` falls within the next 90 days and
   `status = 'active'`.
2. **Open obligations.** Any row in the obligations table where
   `due_date` falls within the next 30 days and
   `status != 'complete'`.
3. **Data gaps.** Any active contract with a NULL
   `expiration_date`, NULL `notice_deadline`, or NULL
   `annual_value`.
4. **Spend variance.** Any vendor where trailing 90-day actual
   spend deviates from the contracted annual run rate by more
   than 15%.
5. **Open flags.** Any row in the flags table where
   `priority = 1` and `status = 'open'`.

## How to tier renewals
Renewal alerts are tiered by days until `notice_deadline`:
- **90 days: informational.** Surface but do not escalate.
- **45 days: action required.** Review open flags and decide
  whether to renew, renegotiate, or terminate.
- **30 days or fewer: escalate.** The decision window is closing.
- **Past deadline: critical.** The contract has auto-renewed or
  is about to. Log and notify immediately.

## How to prioritize the output
The output is a prioritized list, not a data dump. Order:
1. Past-deadline items (critical)
2. 30-day escalations
3. Open P1 flags on contracts in any renewal tier
4. 45-day action-required items
5. Data gaps on contracts with upcoming renewals
6. Spend variance over 15%
7. 90-day informational items
8. Obligations due in the next 30 days

Suppress any category with zero items. Do not pad the report.

## Output format
Post a single Slack message to #contracts-ops with the format:

- Emoji-tagged sections by tier
- Each entry: vendor name, notice deadline or due date, annual
  value, one-line context (open flags, reason for escalation)
- Explicit action for each escalation tier
- A one-line summary at the bottom

## Do not
- Make renewal decisions. Surface, don't decide.
- Extract new data from contracts. The extraction skill owns that.
- Silently skip items that don't fit the format. Flag and include.

Negotiation preparation

As a further example, when a contract approaches renewal, we can create a skill that pulls the current terms, compares them against category benchmarks, and produces a negotiation brief for our internal team. For the Datadog renewal, that brief would contain:

Datadog SaaS — Renewal Brief

Current terms:  $18,000/yr, Net 30, auto-renews, 30-day notice window
Open flags:     None from initial review
Benchmark:      Datadog SaaS contracts at this tier average $14,000–16,000/yr
Leverage:       Short notice window is below market standard (60 days typical)
Recommended asks:
  1. Extend notice window to 60 days
  2. Cap annual fee escalation at CPI
  3. Negotiate annual value toward $15,000 benchmark

The following is an example of a negotiation preparation SKILL.md file:

---
name: contract-negotiation-prep
description: >
  Produces a renewal brief for an upcoming contract renegotiation.
  Pulls current terms from the database, compares them against
  category benchmarks, and turns open review flags into a concrete
  ask list. Use when a contract hits the 45-day action-required
  tier and the decision is to renegotiate rather than renew as-is
  or terminate.
---

# Contract Negotiation Preparation

## Input
- A contract_id
- Read access to the contracts, flags, and documents tables
- The benchmarks file at `drive://contracts/_reference/benchmarks.md`
  (category-level norms for annual value, notice windows, payment
  terms, and escalation caps)

## Step 1: Pull current terms
From the contracts table, retrieve: vendor, type, annual_value,
payment_terms, auto_renews, notice_period_days, notice_deadline,
and governing_law.

## Step 2: Pull open flags
From the flags table, retrieve all rows where contract_id matches
and status = 'open'. These become the negotiation agenda. If there
are no open flags from the initial review, note "None from initial
review" explicitly — absence is information.

## Step 3: Compare to benchmarks
Look up the benchmark entry for this vendor category and contract
type. Compare the current terms against the benchmark on four
dimensions:
- Annual value (current vs. benchmark range)
- Notice window (current vs. typical)
- Payment terms (current vs. typical)
- Escalation / price-increase caps (current vs. typical)

Note any dimension where the current terms are worse than the
benchmark. These are leverage points.

## Step 4: Build the ask list
Turn open flags and leverage points into a ranked ask list. Rank
by a combination of dollar impact and likelihood of acceptance:
1. High-impact, high-likelihood asks first
2. Open P1 flags from the original review next
3. Benchmark-alignment asks last

Keep the list to three to five asks. A longer list dilutes the
negotiation.

## Step 5: Produce the brief
Output the brief as plain text in the format below. Do not embed
it in a document or format for email — the ops owner will adapt
it to the channel they're using.

## Output format

    {vendor} {type} — Renewal Brief

    Current terms:  {annual_value}, {payment_terms}, {auto_renews},
                    {notice_period_days}-day notice window
    Open flags:     {summary of open flags, or "None from initial review"}
    Benchmark:      {one-line benchmark summary}
    Leverage:       {one-line leverage summary}
    Recommended asks:
      1. {ask}
      2. {ask}
      3. {ask}

## Example output

    Datadog SaaS — Renewal Brief

    Current terms:  $18,000/yr, Net 30, auto-renews, 30-day notice window
    Open flags:     None from initial review
    Benchmark:      Datadog SaaS contracts at this tier average $14,000–16,000/yr
    Leverage:       Short notice window is below market standard (60 days typical)
    Recommended asks:
      1. Extend notice window to 60 days
      2. Cap annual fee escalation at CPI
      3. Negotiate annual value toward $15,000 benchmark

## Do not
- Send the brief anywhere. Output only. The ops owner decides who sees it.
- Make the counter-offer. The brief is preparation, not execution.
- Invent benchmarks. If the benchmarks file has no entry for this
  category, say so and stop at Step 2.

Offboarding

If a contract is being terminated, a skill file could generate the notice letter in the format and delivery method specified by the contract, produce a checklist of obligations that survive termination, and trigger a data export request with the vendor. If renewing, the skill could compare the new document against the prior version and produces a redline summary of what changed.

The following is an example of an offboarding SKILL.md file, when a contract has been terminated:

---
name: contract-offboarding
description: >
  Generates the termination notice, surviving-obligations
  checklist, and data export request for a contract that is
  being terminated. Use when the decision has been made to
  terminate a vendor relationship and the notice deadline is
  approaching, or when a contract needs to be wound down
  outside a normal renewal cycle.
---

# Contract Offboarding

## Input
- A contract_id with `status = 'active'` and a termination decision
  recorded in the contracts table
- Read access to the contracts, obligations, flags, and documents
  tables
- The source contract document (PDF) at the file_path recorded in
  the documents table

## Step 1: Read the termination clause
Open the source document and locate the termination and notice
provisions. Extract:
- Required notice period (days)
- Required delivery method (email to a specific address, certified
  mail, in-app notice, portal submission)
- Required notice format (letter on company letterhead, specific
  language, countersigned document)
- Whether notice must reference specific contract sections

If any of these cannot be located in the document, stop and flag
for human review. Do not guess at delivery requirements.

## Step 2: Verify timing
Compare today's date against the `notice_deadline` in the contracts
table. If the notice deadline has already passed, the contract has
auto-renewed or is about to — stop and escalate to the ops owner.
Do not proceed with offboarding against a renewed term.

## Step 3: Generate the notice letter
Produce a notice letter in the format required by the contract:
- Addressed to the notice recipient named in the contract (not the
  vendor's general contact)
- Referencing the contract by its legal title, effective date, and
  any contract number used by the counterparty
- Stating the effective termination date
- Citing the specific section of the contract that authorizes
  termination
- Signed by the person identified in the contracts table as the
  signing authority

Output the letter as a draft for human review and signature. Do
not send it.

## Step 4: Build the surviving obligations checklist
Query the obligations table for all rows where contract_id matches
and `survives_termination = true`. For each, list:
- The obligation (e.g., confidentiality of exchanged information,
  payment for services rendered through termination date, return
  or destruction of materials)
- The party responsible (us or the vendor)
- The duration (e.g., "perpetual," "2 years post-termination")
- Any action required from us to discharge or enforce it

## Step 5: Generate the data export request
If the vendor holds company data (almost always the case for SaaS
and PSA relationships), produce a separate data export request:
- Reference the DPA if one exists in the documents table
- Specify the data categories to be exported
- Specify the format required (CSV, JSON, database dump)
- Specify the deadline, based on the DPA or 30 days if none
- Request written confirmation of deletion after export

## Step 6: Produce the offboarding packet
Write a single markdown file to
`drive://contracts/_offboarding/{contract_id}_offboarding.md`
containing:
- The draft termination notice
- The surviving obligations checklist
- The data export request
- A timeline of required actions with dates

Post a link to the packet in #contracts-ops and assign it to the
ops owner.

## Do not
- Send the termination notice. Draft only.
- Decide the termination date. That decision is already in the
  contracts table; use it as-is.
- Cancel the vendor relationship in any other system (billing,
  provisioning, access management). Those are separate skills.
- Proceed if the notice deadline has already passed. Escalate.

The pattern

As evident from the above, there are countless opportunities to leverage skill files to automate workflows. Each stage in a process can be documented in a separate skill file, with users being able to trigger stages individually or chain them together to run in sequence. Each stage then feeds the next, with the skills producing a queryable, monitored, auditable record of what happened when, what was flagged, and what needs attention now. That creates enormous value for companies in managing their internal processes.