generate-spec-v2

generate-spec-v2 is a skill for Claude Code, Codex from saffron-health/libretto. It costs 73 tokens per session (1,655 once invoked), scanned A, original, MIT.

A guide for writing a code-based implementation specification in the specs/ directory. It describes the feature or fix, affected code paths, types, tests, and commit-sized work phases.

In plain words
What is it for?
Use it to research a significant feature, bug fix, or refactor and document its goals, non-goals, Mermaid flows, call paths, code changes, and validation steps.
Why use it?
It gives an engineer a concrete plan grounded in the existing code before implementation begins, reducing repeated investigation and incomplete scope.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present. Also seen: installed under .agents/ (shared by several agents).

Part of the libretto plugin — 24 skills shipped together

Good fit Use it to research a significant feature, bug fix, or refactor and document its goals, non-goals, Mermaid flows, call paths, code changes, and validation steps.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saffron-health/libretto/generate-spec-v2
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 saffron-health/libretto --skill generate-spec-v2
Clone the repo
git clone --depth 1 https://github.com/saffron-health/libretto

Made for: Claude Code, Codex.

Or install libretto, the plugin that ships this one along with the rest of its 24 skills.

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 generate-spec-v2

README.md
[![agentmods](https://agentmods.dev/badge/skills/saffron-health/libretto/generate-spec-v2/github.svg)](https://agentmods.dev/skills/saffron-health/libretto/generate-spec-v2)
Your own site
<a href="https://agentmods.dev/skills/saffron-health/libretto/generate-spec-v2"><img src="https://agentmods.dev/badge/skills/saffron-health/libretto/generate-spec-v2/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 generate-spec-v2

Your own site · 80×15
<a href="https://agentmods.dev/skills/saffron-health/libretto/generate-spec-v2"><img src="https://agentmods.dev/badge/skills/saffron-health/libretto/generate-spec-v2.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,655 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00073 $0.01655
Opus 5 $0.00036 $0.00827
Sonnet 5 $0.00015 $0.00331
Haiku 4.5 $0.00007 $0.00166

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

Security

Grade A, and why

generate-spec-v2 scanned grade A with 0 findings 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 11d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/generate-spec-v2/SKILL.md · 151 lines

How it starts

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

Generate an implementation spec

Write a spec in specs/ that an engineer can implement without repeating the research. Keep it lean, grounded in the current code, and focused on the requested result.

Research the change

  1. Read the request and repository instructions.
  2. Find the entry points, key types, state boundaries, callers, tests, and commands tied to the change. Trace each changed runtime path far enough to show an accurate diff.
  3. Read external docs only when a dependency or API affects the design. Prefer official docs and record the links used.
  4. Ask a question only when the answer would change the result and the code cannot answer it. Otherwise, make the narrowest sound assumption and record it.

Use the amount of research the task needs. Do not impose a fixed research process.

Choose the scope

  • Plan the smallest complete change that gives the requested result.
  • Do not add abstractions, config, infrastructure, migrations, or cleanup unless the result needs them.
  • State goals and non-goals from the request and code. Do not pause for confirmation when the scope is clear.
  • Make each phase fit one commit and leave the repository working.
  • Use as many phases as the work needs. Do not set a phase or line-count limit.

Write the file

Choose a short kebab-case name and create specs/<name>.md. Use this structure:

# <Feature or fix name>

## System flow

Put one or more Mermaid diagrams immediately after the title, before all prose. Show the main runtime flow and changed parts. Label current and proposed paths or use separate diagrams when that is clearer. Keep node text short and use valid Mermaid syntax.

```mermaid
flowchart TD
    A[Entry point] --> B[Service]
    B --> C[Observable result]
```

## Problem overview

Explain the current problem and why it matters in a few plain sentences.

## Solution overview

Explain the proposed change and its key design choice in a few plain sentences.

## Goals

- State the user-visible or system-level results that must hold.

## Non-goals

- State what this spec leaves out.

## Important files, docs, and websites

- [`path/to/file.ts`](../path/to/file.ts) — State what the implementer will change or learn here.

List only sources that help implement the change.

## Implementation

### Phase 1: <Commit-sized outcome>

Explain the intent and what becomes true after this phase lands in one or two sentences.

#### Important types

```ts
// path/to/types.ts
type ImportantInput = { id: string };
type ImportantResult =
  | { status: "ok"; value: Value }
  | { status: "error"; reason: FailureReason };
```

#### Call stack diff

Show how this phase changes the current call path. Keep the entry point and enough parents to make ownership clear.

```diff
 requestHandler
-└── existingService
-    └── dataStore
+└── validateInput
+    └── existingService
+        └── dataStore
```

#### Code diff preview

Show a short unified diff of the main edit. Use real file and symbol names, enough surrounding code to place the change, and `...` for parts the implementer will fill in. Do not try to write the full patch.

```diff
 // path/to/handler.ts
 async function requestHandler(input: ImportantInput) {
-  return existingService(input);
+  const valid = validateInput(input);
+  return existingService(valid);
 }
```

- [ ] Make one concrete implementation change, with file and symbol names.
- [ ] Wire the change into its nearest caller or consumer.
- [ ] Smoke the main failure case or boundary by hand. Do not commit this check until the feature is package-level end-to-end testable.
- [ ] Run the exact command that proves the phase works.

Read the full file on GitHub · 151 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago First seen · 151 lines · 73 tokens per session scan A 7cdff25d0eaf

Subscribe to this mod's changes

generate-spec-v2 is a skill published in the GitHub repository saffron-health/libretto (889 stars, last pushed 20d ago), licensed MIT. It adds 73 tokens to every session and 1,655 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. 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

robotgo-flow

Use when building YAML-driven Windows RPA workflows in Go — step-by-step desktop automation with image template matching, interactive recording mode, hotkey triggers. RobotGo-Flow: YAML-based Windows RPA framework built on RobotGo.

znlgis/opengis-skills · 50 tokens

fetch-weather-report

Fetch the current weather forecast for a specified location and return a structured summary.

prakhar1114/ai_mime · 19 tokens

robotgo

Use when automating desktop GUI operations in Go — mouse/keyboard control, screen capture, image recognition via OpenCV, global hotkeys via gohook. RobotGo: cross-platform Go desktop automation (RPA) library for macOS, Windows, and Linux.

znlgis/opengis-skills · 56 tokens

qirabot

Drive any GUI with AI vision on raw screenshots — no DOM, no CSS/XPath selectors — via the Qirabot Python SDK or the qirabot CLI. Hand it a whole goal to complete autonomously, or make single natural-language actions: click, type, extract, and verify on web browsers, Android, iOS, desktop apps, and games. Use this…

qirabot/qirabot · 228 tokens

wx4-skill

A WeChat automation tool. WeChat is a messaging platform used for one-to-one and group chats, file sharing, and community management.

claw-codes/wx4py · 74 tokens

qirabot

Drive any GUI with AI vision on raw screenshots — no DOM, no CSS/XPath selectors — via the Qirabot Python SDK or the qirabot CLI. Hand it a whole goal to complete autonomously, or make single natural-language actions: click, type, extract, and verify on web browsers, Android, iOS, desktop apps, and games. Use this…

qirabot/qirabot · 228 tokens