contract-detection

contract-detection is a skill for Claude Code from prime-radiant-inc/greenfield. It costs 50 tokens per session (3,905 once invoked), scanned C, original, Apache-2.0.

A method for finding and reading formal API definitions, such as OpenAPI, GraphQL, gRPC, and JSON Schema files. These files describe what an API accepts and returns.

In plain words
What is it for?
It helps document API endpoints, inputs, outputs, and expected behavior from machine-readable contract files.
Why use it?
It gives the analysis a clear, published description of an API instead of relying only on source code or guesses.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the greenfield plugin — 22 skills, 2 commands, 2 agents shipped together

Good fit It helps document API endpoints, inputs, outputs, and expected behavior from machine-readable contract files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/prime-radiant-inc/greenfield/contract-detection
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add prime-radiant-inc/greenfield --skill contract-detection
Clone the repo
git clone --depth 1 https://github.com/prime-radiant-inc/greenfield

Made for: Claude Code.

Or install greenfield, the plugin that ships this one along with the rest of its 22 skills, 2 commands, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for contract-detection

README.md
[![agentmods](https://agentmods.dev/badge/skills/prime-radiant-inc/greenfield/contract-detection/github.svg)](https://agentmods.dev/skills/prime-radiant-inc/greenfield/contract-detection)
Your own site
<a href="https://agentmods.dev/skills/prime-radiant-inc/greenfield/contract-detection"><img src="https://agentmods.dev/badge/skills/prime-radiant-inc/greenfield/contract-detection/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for contract-detection

Your own site · 80×15
<a href="https://agentmods.dev/skills/prime-radiant-inc/greenfield/contract-detection"><img src="https://agentmods.dev/badge/skills/prime-radiant-inc/greenfield/contract-detection.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 50 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,905 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00050 $0.03905
Opus 5 $0.00025 $0.01953
Sonnet 5 $0.00010 $0.00781
Haiku 4.5 $0.00005 $0.00391

Measured 10d ago against content hash 77a9f98064f6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade C, and why

contract-detection scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- cite: source=machine-readable-contract, ref=openapi.yaml:/paths/~1users/get/parameters/0, confidence=confirmed, agent=contract-detector -->
skills/contract-detection/SKILL.md · 443 lines

How it starts

The opening of the file, as written. The whole thing — 443 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Contract Detection Methodology

Extract behavioral intelligence from machine-readable API contracts. These are formal, published definitions of system interfaces -- the strongest possible specification source. A contract file is an explicit promise about what the system accepts and returns.

When to Use This Mode

Contract detection activates when:

  • The target repository or documentation contains API specification files
  • The discovery inventory identifies machine-readable contract files
  • Other modes discover machine-readable contracts during analysis

This mode runs independently of all other intelligence sources. All output is PUBLIC -- machine-readable contracts are published definitions intended for external consumption. Output goes to workspace/public/contracts/.

Why Contracts Are the Strongest Source

Machine-readable contracts are unique among intelligence sources because they are:

  • Formal -- they use standardized schemas with unambiguous semantics
  • Published -- they are intended for external consumers to rely on
  • Machine-verifiable -- they can be validated against implementations automatically
  • Versioned -- they explicitly track breaking changes through version fields

A single OpenAPI specification can contain more behavioral intelligence than the entire official documentation site, because every endpoint, parameter, response schema, and error code is defined with machine precision.

OpenAPI / Swagger

Detection

# Find OpenAPI/Swagger files
find . -maxdepth 5 -type f \( \
  -name "openapi.*" -o -name "swagger.*" -o \
  -name "api-spec.*" -o -name "api-docs.*" \
  \) \( -name "*.json" -o -name "*.yaml" -o -name "*.yml" \) 2>/dev/null

# Check for OpenAPI version markers in YAML/JSON files
grep -rl '"openapi":\|openapi:' --include="*.json" --include="*.yaml" --include="*.yml" . 2>/dev/null | head -20
grep -rl '"swagger":\|swagger:' --include="*.json" --include="*.yaml" --include="*.yml" . 2>/dev/null | head -20

# Check for hosted spec endpoints (common locations)
# /api-docs, /swagger.json, /openapi.json, /v2/api-docs, /v3/api-docs

Read the full file on GitHub · 443 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 443 lines · 50 tokens per session scan C 77a9f98064f6

Subscribe to this mod's changes

contract-detection is a skill published in the GitHub repository prime-radiant-inc/greenfield (275 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 50 tokens to every session and 3,905 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories