Agent skill

Generate Spec V2

by cashew-labs in cashew-labs/libretto

Create a code-based implementation spec in the specs/ directory for a significant feature, fix, or refactor.

MITAuto-check: warningsDevelopment

Install Generate Spec V2

The automated check flagged lines worth reading first. See the safety section below.

skills CLI
$ npx skills add cashew-labs/libretto --skill generate-spec-v2 -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cashew-labs/libretto generate-spec-v2 --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cashew-labs/libretto.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/generate-spec-v2 .claude/skills/generate-spec-v2 && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
generate-spec-v2
GitHub stars
904
Token cost
~1.9k tokens
SKILL.md length
784 words
Files
2
Skills in repo
21
Repo updated
First seen
Licence
MIT

At a glance

Create a code-based implementation spec in the specs/ directory for a significant feature, fix, or refactor.

  • Works in 4 steps: Read the request and repository… → Find the entry points, key types, state… → Read external docs only when a… → …
  • The user asks to plan
  • SKILL.md covers Research the change, Choose the scope, Write the file and Phase rules, plus 2 more sections
  • Calls pnpm

What it does

Generate Spec V2 is an agent skill from cashew-labs/libretto. Create a code-based implementation spec in the specs/ directory for a significant feature, fix, or refactor. Use when the user asks to plan, spec, scope, or phase work before implementation and the plan should cover top-level Mermaid flows, important types, per-phase call-stack and code diffs, commit-sized phases, and checks.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `agents/openai.yaml`).

It sits in Development, covering Diagrams. It works with Mermaid. The repository describes itself as: The AI toolkit for building reliable browser automations. The licence is MIT.

When your agent uses it

  • The user asks to plan
  • Phase work before implementation and the plan should cover top-level Mermaid flows
  • Important types
  • Per-phase call-stack and code diffs

Example prompts

  • “/generate-spec-v2”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  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…
  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…

What it can do on your machine

Read from SKILL.md and the folder at commit 41ab782. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • vitest.dev

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Generate Spec V2 loads about 1.9k tokens when it runs. Until then it costs about 86 tokens; SKILL.md has 784 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~86
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: warnings

The automated check found patterns that need a careful read before installing.

  • WarningTells the agent its actions are pre-authorized / not to stop for confirmationSKILL.md:23
    nd non-goals from the request and code. Do not pause for confirmation when the scope is clear.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from cashew-labs/libretto at commit 41ab782, republished under its MIT licence (© cashew-labs). 784 words, ~1,895 tokens.

Download SKILL.mdSave it as .claude/skills/generate-spec-v2/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
generate-spec-v2
description
Create a code-based implementation spec in the specs/ directory for a significant feature, fix, or refactor. Use when the user asks to plan, spec, scope, or phase work before implementation and the plan should cover top-level Mermaid flows, important types, per-phase call-stack and code diffs, commit-sized phases, and checks.

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:

markdown
# <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.

Phase rules

  • Give every phase four or five checklist steps, including checks.
  • Keep every phase small enough for one clear commit and leave the codebase working.
  • Make each phase produce visible or testable progress.
  • Name exact files, symbols, behavior, and commands when the codebase provides them.
  • Include Important types, Call stack diff, and Code diff preview in every code phase. Keep them inside that phase; do not collect call stacks or code diffs in a global section.
  • Show inputs, outputs, state, events, errors, or unions that set the phase contract under Important types. Use the project language.
  • Make the call-stack diff start from the current path and mark the proposed path with unified diff signs. For UI work, a component render or event-handler path counts as the call stack.
  • Make the code diff a short preview of the main edit, not a full patch. Include a file path comment and preserve useful surrounding control flow.
  • Use Not applicable — no code path changes only for a true docs, data, or config phase. Do not invent types or call paths.
  • Follow Testing for what to check and when to commit tests.
  • Avoid setup-only or refactor-only phases unless later work cannot land safely without them. Fixture setup for package-level tests is allowed once the feature is end-to-end testable.
Show full SKILL.md (348 more words)Show less

Testing

Specs commit only package-level end-to-end tests. Act and observe the way a user of that package would:

  • Electron / web UI: start the app separately when needed, drive the live renderer with Playwright through pnpm halo-web, and assert visible elements, roles, labels, and text.
  • Services and other APIs: call the public methods, then read results through the same public API or another real collaborator a user of that package would use.

Do not use mocks such as vi.fn, vi.mock, or hand-rolled fake collaborators. Do not spec internal unit tests, or assert implementation details such as internal file layouts or exact formatting of private outputs. If a package-level end-to-end test is hard to build and none already exist for the area, do not add a lower-level test instead.

Committed tests must read like end-user code or interactions: short, easy to follow, and free of setup noise. Put shared setup and teardown in Vitest fixtures (test.extend), not ad-hoc helpers or manual cleanup. See the Vitest fixtures documentation.

Until the feature is end-to-end testable at the package, each phase still includes a check. Write that check as a smoke step the implementer runs by hand and does not commit:

  • Smoke the main failure case or boundary by hand. Do not commit this check.

Once the feature is end-to-end testable, add the fixtures needed for those high-level tests, then commit the tests. Make fixture setup its own phase when it is more than a small add-on; fold it into the phase that first makes the feature testable when it is small:

  • Add Vitest fixtures that set up the package the way a user would.
  • Commit a short high-level test that acts and observes through the public API or live UI.

Final check

Confirm that Mermaid diagrams appear only at the top and match the plan; each code phase has key types, an accurate call-stack diff, a code-diff preview, and four or five steps; links and commands are real; committed tests are package-level end-to-end and earlier phases use uncommitted smoke checks; and the full plan covers every goal without pulling in a non-goal.

© cashew-labs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .agents/skills/generate-spec-v2 of cashew-labs/libretto.

  • SKILL.md
  • agents/openai.yaml

Open the folder on GitHubat commit 41ab782

Compare with similar skills

Generate Spec V2 next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Generate Spec V2 compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Generate Spec V2 this skillcashew-labs/libretto904—~1.9kAutomated safety check: WarnMIT
Archify Diagramstt-a1i/archify81k—~2.9kAutomated safety check: PassMIT
Diagram Designcathrynlavery/diagram-design48k1 repos~7.6kAutomated safety check: PassMIT
Draw.io Diagram StudioAgents365-ai/drawio-skill10k—~2.4kAutomated safety check: NotesMIT
Pretty Mermaid Rendererimxv/Pretty-mermaid-skills1.5k—~2kAutomated safety check: PassMIT
Archify Diagram BuilderUnclecheng-li/AI_Animation1.5k2 repos~4.1kAutomated safety check: PassMIT

Similar skills

  • Archify Diagrams

    tt-a1i/archify

    Creates interactive architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone HTML with inline SVG, themes and image or video export.

    81k GitHub stars~2.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Diagram Design

    cathrynlavery/diagram-design

    Creates branded diagrams, from architecture, flowchart and sequence to charts and maps, as self-contained HTML with inline SVG, with import from draw.io, Mermaid and Excalidraw.

    48k GitHub starsUsed in 1 repo~7.6k tokens
    DevelopmentAuto-check passed
  • Draw.io Diagram Studio

    Agents365-ai/drawio-skill

    Creates and edits editable draw.io diagrams from descriptions, code, infrastructure files, SQL and API schemas, with sync, review, test and export tools.

    10k GitHub stars~2.4k tokensUpdated 8 days ago
    DevelopmentAuto-check: notes
  • Pretty Mermaid Renderer

    imxv/Pretty-mermaid-skills

    Writes and renders Mermaid diagrams as themed SVG, PNG or terminal ASCII and Unicode art with a bundled Node.js CLI that needs no browser.

    1.5k GitHub stars~2k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Archify Diagram Builder

    Unclecheng-li/AI_Animation

    Builds validated architecture, workflow, sequence, data-flow and lifecycle diagrams as standalone interactive HTML from a small JSON spec, with optional motion and image export.

    1.5k GitHub starsUsed in 2 repos~4.1k tokens
    DevelopmentAuto-check passed
  • Mermaid

    WH-2099/mermaid-skill

    Generate Mermaid diagrams from user requirements. An agent skill from WH-2099/mermaid-skill.

    288 GitHub starsUsed in 4 repos~958 tokens
    DevelopmentAuto-check passed

More from cashew-labs/libretto

All 21 skills in this repo
  • System Prompt Writing Guide

    cashew-labs/libretto

    Lays out a minimal, iteration-first approach to writing system prompts for LLM agents, with model-specific notes for Claude, GPT, Gemini, and Codex.

    904 GitHub stars~570 tokensUpdated 1 mo ago
    Auto-check passed
  • Address PR Review Comments

    cashew-labs/libretto

    Works through the review comments on a pull request one by one: fetches the threads, makes the fixes, runs type-check, build and lint, pushes, and resolves the threads.

    904 GitHub stars~532 tokensUpdated 1 mo ago
    Auto-check passed
  • CLI Development

    cashew-labs/libretto

    Design rules for command-line tools: subcommand-scoped help, actionable success output, debuggable failures, stable output, meaningful exit codes and a --json mode.

    904 GitHub stars~781 tokensUpdated 1 mo ago
    Auto-check passed
  • Drives desktop Electron apps already installed on your machine, such as Slack, Discord or VS Code, by relaunching them with a debugging port and using the Libretto CLI.

    904 GitHub stars~967 tokensUpdated 1 mo ago
    Auto-check passed
  • Merge Conflict Resolver

    cashew-labs/libretto

    Resolves Git merge, rebase and cherry-pick conflicts by reading the PRs behind each side, keeping both intents and asking you when they truly clash.

    904 GitHub stars~1.1k tokensUpdated 1 mo ago
    Auto-check passed
  • Feature Spec Generator

    cashew-labs/libretto

    Researches the codebase and relevant docs, asks clarifying questions, then writes a spec sheet in specs/ for a significant feature or complex fix.

    904 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Generate Spec V2

What does Generate Spec V2 do?

Create a code-based implementation spec in the specs/ directory for a significant feature, fix, or refactor. Generate Spec V2 is an agent skill from cashew-labs/libretto. Create a code-based implementation spec in the specs/ directory for a significant feature, fix, or refactor.

When should I use Generate Spec V2?

Generate Spec V2 fits situations like: the user asks to plan; phase work before implementation and the plan should cover top-level Mermaid flows; important types; per-phase call-stack and code diffs.

How do I install Generate Spec V2 in Claude Code?

Run `npx skills add cashew-labs/libretto --skill generate-spec-v2 -a claude-code`. Or copy the skill folder (.agents/skills/generate-spec-v2 in cashew-labs/libretto) into .claude/skills/generate-spec-v2 in your project. Claude Code loads it when a task matches its description.

How do I install Generate Spec V2 in Codex?

Run `npx skills add cashew-labs/libretto --skill generate-spec-v2 -a codex`. Or copy the skill folder (.agents/skills/generate-spec-v2 in cashew-labs/libretto) into .agents/skills/generate-spec-v2 in your project. Codex loads it when a task matches its description.

Can I use Generate Spec V2 in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cashew-labs/libretto --skill generate-spec-v2 -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/generate-spec-v2, .gemini/skills/generate-spec-v2, .github/skills/generate-spec-v2 and .opencode/skills/generate-spec-v2 in your project.

What does Generate Spec V2 need to run?

Going by SKILL.md and its folder, Generate Spec V2 needs the command-line tools its instructions call (pnpm).

Does Generate Spec V2 access the network?

SKILL.md names 1 domain. As links in the text: vitest.dev. This is read from the text; nothing was executed.

Is Generate Spec V2 safe to install?

Our automated static check of SKILL.md flagged 1 warning(s): tells the agent its actions are pre-authorized / not to stop for confirmation. Read the flagged lines before installing; the check is not a guarantee either way.

What licence does Generate Spec V2 use?

Generate Spec V2 is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Generate Spec V2 use?

About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Generate Spec V2?

Skills that share tags, products or a category with Generate Spec V2: Archify Diagrams (tt-a1i/archify, 81k stars), Diagram Design (cathrynlavery/diagram-design, 48k stars), Draw.io Diagram Studio (Agents365-ai/drawio-skill, 10k stars) and Pretty Mermaid Renderer (imxv/Pretty-mermaid-skills, 1.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Generate Spec V2?

cashew-labs (a GitHub organization) maintains it in cashew-labs/libretto, which has 904 GitHub stars. The repository holds 21 skills in this directory. The repository was last updated on August 21, 2026.

Source: cashew-labs/libretto on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.