Skip to content
Back to skills

Update Generated

ASecurity

Regenerate the checked-in artifacts (OpenAPI spec, insta snapshots, protocol schema). Use when the user asks to update generated files, refresh snapshots, bump the OpenAPI spec, or fix a protocol-schema-check failure.

  • 2,623 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 7, 2026
developmentgobashgitapi

Works with

  • api

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add near/nearcore --skill update-generated --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Update Generated?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Update Generated
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/near-update-generated/badge)](https://www.skillsdirectory.com/skills/near-update-generated)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: update-generated
description: Regenerate the checked-in artifacts (OpenAPI spec, insta snapshots, protocol schema). Use when the user asks to update generated files, refresh snapshots, bump the OpenAPI spec, or fix a protocol-schema-check failure.
allowed-tools: Bash, AskUserQuestion
---

Update the generated artifacts tracked in this repo. Run each step from the repo root, in order. Stop and report on any failure.

## 1. OpenAPI spec

Generate into a tmp file first; only overwrite the tracked file if the generator succeeded.

```
tmp=$(mktemp)
cargo run -p near-jsonrpc-openapi-spec > "$tmp"
```

- If `cargo run` exits non-zero, delete `$tmp` and stop with the error.
- On success, move `$tmp` to `chain/jsonrpc/openapi/openapi.json`.

## 2. Insta snapshots

```
cargo insta test --accept -p near-parameters -p near-primitives
```

Stop on failure.

## 3. Protocol schema

Run the check and capture the exit code without aborting:

```
set +e
cargo run -p protocol-schema-check
schema_status=$?
set -e
```

- **0** — schema is up-to-date, nothing to do.
- **1** — schema drift. The regenerated schema is at `${CARGO_TARGET_DIR:-target}/protocol_schema.toml`. Before copying:
  1. Show the user the diff against the tracked file:
     ```
     git diff --no-index tools/protocol-schema-check/res/protocol_schema.toml \
       "${CARGO_TARGET_DIR:-target}/protocol_schema.toml"
     ```
  2. Use AskUserQuestion with options "Accept and copy" / "Abort" to confirm.
  3. Only on confirmation, copy the regenerated file over `tools/protocol-schema-check/res/protocol_schema.toml`.
- **Any other code** — report the failure and stop; do not copy.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.