Smart contract audit against YAML vulnerability patterns
Inputs you will receive
- Smart contract(s) — Solidity (or mixed) source: full files, snippets, or a single concatenated bundle. Note the compiler version and framework (Hardhat, Foundry, etc.) if stated.
- Patterns — YAML, typically a list of objects. Common fields (adapt if the file uses different keys):
id — pattern identifier
name — short title
severity — e.g. Critical / High / Medium / Low / Informational
description — what constitutes the vulnerability and what to look for in code
false_positives — mitigations or situations that should not be reported - Optional: cross_cluster_risk, tags, references, code hints
Treat the YAML as the single source of truth for what to check; do not invent extra vulnerability types unless the user asks.
What you must do
- Parse the YAML mentally: for each pattern, extract the checks implied by
description and the exclusions from false_positives.
- Walk the contract code (logic, modifiers, external calls, access control, asset flows, cross-chain / compose / paymaster / ERC quirks as relevant).
- For each pattern, decide:
- Match — the contract exhibits the risky behavior and
false_positives does not clearly apply.
- No match — behavior absent or adequately mitigated (cite mitigations when relevant).
- Uncertain — insufficient code or context; say what is missing.
- Prefer precision over volume: only report findings where the pattern text reasonably applies. When in doubt after applying
false_positives, mark uncertain rather than forcing a finding.
Output: JSON only for the findings block
Return a single JSON object (valid JSON, no markdown fences required unless the host asks). Schema:
{
"summary": {
"patterns_checked": <number>,
"findings_count": <number>,
"contracts_reviewed": ["<file or label>", "..."]
},
"findings": [
{
"pattern_id": "<from YAML id>",
"pattern_name": "<from YAML name>",
"severity": "<from YAML severity>",
"status": "match",
"title": "<short human title>",
"description": "<why this applies to the contract>",
"evidence": [
{
"location": "<contract: function or line hint>",
"snippet": "<relevant code excerpt, abbreviated if long>"
}
],
"recommendation": "<concrete fix or verification step>",
"false_positive_check": "<brief note on why false_positives do not apply, or N/A>"
}
],
"non_matches": [
{
"pattern_id": "<id>",
"pattern_name": "<name>",
"note": "<one line: absent or mitigated>"
}
],
"uncertain": [
{
"pattern_id": "<id>",
"pattern_name": "<name>",
"reason": "<what is missing or ambiguous>"
}
]
}
Rules
findings: include only entries with "status": "match". Omit the array or use [] if there are no matches.
non_matches: optional but useful when the user wants full coverage; cap length if there are hundreds of patterns (then summarize counts and list only matches + uncertain).
uncertain: use when you cannot verify without tests, deployment config, or off-chain components.
- Preserve exact
pattern_id and severity from YAML where present.
Quality bar
- Tie each finding to specific functions, state variables, or control flow in the supplied code.
- Respect
false_positives: if the contract clearly implements those mitigations, do not emit a finding for that pattern.
- Do not hallucinate file names; use
"unknown" or the label the user gave if paths are missing.
1---
2name: smart-contract-yaml-pattern-audit
3description: >-
4 Audits smart contract source against vulnerability patterns supplied as YAML.
5 Use when the user provides contract code and a YAML pattern list (e.g. id,
6 name, severity, description, false_positives) and expects a structured JSON
7 report of matches and rationale.
8metadata:
9 source: https://skillmd.com/skills/aibot88/smart-contract-yaml-pattern-audit
10---
11
12# Smart contract audit against YAML vulnerability patterns
13
14## Inputs you will receive
15
161. **Smart contract(s)** — Solidity (or mixed) source: full files, snippets, or a single concatenated bundle. Note the compiler version and framework (Hardhat, Foundry, etc.) if stated.
172. **Patterns** — YAML, typically a list of objects. Common fields (adapt if the file uses different keys):
18 - `id` — pattern identifier
19 - `name` — short title
20 - `severity` — e.g. Critical / High / Medium / Low / Informational
21 - `description` — what constitutes the vulnerability and what to look for in code
22 - `false_positives` — mitigations or situations that should **not** be reported - Optional: `cross_cluster_risk`, tags, references, code hints
23
24Treat the YAML as the **single source of truth** for what to check; do not invent extra vulnerability types unless the user asks.
25
26## What you must do
27
281. **Parse the YAML** mentally: for each pattern, extract the checks implied by `description` and the exclusions from `false_positives`.
292. **Walk the contract code** (logic, modifiers, external calls, access control, asset flows, cross-chain / compose / paymaster / ERC quirks as relevant).
303. For **each pattern**, decide:
31 - **Match** — the contract exhibits the risky behavior and `false_positives` does not clearly apply.
32 - **No match** — behavior absent or adequately mitigated (cite mitigations when relevant).
33 - **Uncertain** — insufficient code or context; say what is missing.
344. Prefer **precision over volume**: only report findings where the pattern text reasonably applies. When in doubt after applying `false_positives`, mark uncertain rather than forcing a finding.
35
36## Output: JSON only for the findings block
37
38Return a **single JSON object** (valid JSON, no markdown fences required unless the host asks). Schema:
39
40```json
41{
42 "summary": {
43 "patterns_checked": <number>,
44 "findings_count": <number>,
45 "contracts_reviewed": ["<file or label>", "..."]
46 },
47 "findings": [
48 {
49 "pattern_id": "<from YAML id>",
50 "pattern_name": "<from YAML name>",
51 "severity": "<from YAML severity>",
52 "status": "match",
53 "title": "<short human title>",
54 "description": "<why this applies to the contract>",
55 "evidence": [
56 {
57 "location": "<contract: function or line hint>",
58 "snippet": "<relevant code excerpt, abbreviated if long>"
59 }
60 ],
61 "recommendation": "<concrete fix or verification step>",
62 "false_positive_check": "<brief note on why false_positives do not apply, or N/A>"
63 }
64 ],
65 "non_matches": [
66 {
67 "pattern_id": "<id>",
68 "pattern_name": "<name>",
69 "note": "<one line: absent or mitigated>"
70 }
71 ],
72 "uncertain": [
73 {
74 "pattern_id": "<id>",
75 "pattern_name": "<name>",
76 "reason": "<what is missing or ambiguous>"
77 }
78 ]
79}
80```
81
82### Rules
83
84- **`findings`**: include only entries with `"status": "match"`. Omit the array or use `[]` if there are no matches.
85- **`non_matches`**: optional but useful when the user wants full coverage; cap length if there are hundreds of patterns (then summarize counts and list only matches + uncertain).
86- **`uncertain`**: use when you cannot verify without tests, deployment config, or off-chain components.
87- Preserve **exact** `pattern_id` and severity from YAML where present.
88
89## Quality bar
90
91- Tie each finding to **specific functions, state variables, or control flow** in the supplied code.
92- Respect **`false_positives`**: if the contract clearly implements those mitigations, do not emit a finding for that pattern.
93- Do not hallucinate file names; use `"unknown"` or the label the user gave if paths are missing.