> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsa.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Rule Spec Drafting Skill

> AI skill for turning a compliance policy into a precise, buildable Corsa rule description — scoped strictly to what the rule engine can express.

## Overview

The **corsa-rule-spec-drafting** skill turns a **compliance policy** (a clause, obligation, or AML/CFT requirement) into a **1–2 paragraph rule description** that a developer — or the **corsa-rule-engine-authoring** skill — can implement directly.

It knows exactly what Corsa's transaction-monitoring rule engine can and cannot express, so it never asks for features that don't exist and always flags capability gaps explicitly.

### What It Helps With

* Converting a compliance policy clause into an implementation-ready rule spec
* Scoping AML/CFT requirements for the Corsa rule engine
* Identifying which policy requirements fall outside the rule engine's capability envelope
* Producing grounded descriptions that hand off cleanly to rule authoring

***

## Quick Start

After installing the skill, ask your coding tool questions like:

* *"Write a rule spec for: 'flag senders who make 3+ deposits below \$10K in 24 hours'"*
* *"Translate AML Policy §4.3 on structuring into a Corsa rule description"*
* *"Can the rule engine do a live OFAC lookup? If not, what's the alternative?"*
* *"Scope this EDD requirement for the Corsa rule engine: clients risk-rated HIGH must be re-screened"*

***

## What the Skill Knows

### The Two-Step Workflow

```
corsa-rule-spec-drafting      →  grounded rule description
corsa-rule-engine-authoring   →  valid rule JSON + deployment
```

Use this skill first to produce the spec, then hand it to **corsa-rule-engine-authoring** for implementation.

### What Rules Can Express

* **Simple comparisons** on transaction, client, wallet, and bank account fields — amount, type, status, risk tier, sanctions/PEP flags, country, KYC tier, and more
* **Rolling time-window aggregations** — cumulative sum, count, distinct count, velocity change, standard deviation, baseline comparison
* **Nested AND/OR logic** with conditions scoped to sender, receiver, or both
* **Dynamic thresholds** comparing against a client's configured daily or monthly limit
* **Actions**: create an alert (with category, priority, and assignment) and/or freeze the transaction

### What Rules Cannot Express (Capability Gaps)

The skill explicitly flags these so specs stay buildable:

| Policy requirement                      | Corsa equivalent / gap                                            |
| --------------------------------------- | ----------------------------------------------------------------- |
| Live OFAC/PEP lookup at evaluation time | Pre-computed sanctions/PEP flags on the client entity             |
| Regex or fuzzy text matching            | Exact, set, and range comparisons only                            |
| ML models or custom anomaly scoring     | Built-in statistical operators (`stddev`, `deviationFromAverage`) |
| Multi-hop graph / fund tracing          | Only direct transaction participants are visible                  |
| Scheduled or periodic rule runs         | Use Workflows for periodic checks                                 |
| Actions beyond alert + freeze           | Emails, webhooks, case creation require Workflows                 |

### Output Format

A 1–2 paragraph plain-English description containing: the compliance basis (policy citation), the specific signals and thresholds, participant scope (sender/receiver/both), boolean logic, the action, and any explicit gaps with nearest approximations. No JSON, no field names — just intent, ready for a developer to implement.

***

## Source

<Card title="GitHub Repository" icon="github" href="https://github.com/corsa-labs/corsa-skills/tree/main/corsa-rule-spec-drafting">
  View the full skill source with policy-to-capability mappings and worked examples.
</Card>
