#601

Globales Ranking · von 601 Skills

review-script-template AI Agent Skill

Quellcode ansehen: b-open-io/bsv-skills

Medium

Installation

npx skills add b-open-io/bsv-skills --skill review-script-template

20

Installationen

Review Script Template

Review and validate script template implementations in ts-templates for correctness and best practices.

When to Use

  • Review a new template before merging
  • Audit existing template implementations
  • Validate template follows ts-templates patterns
  • Check for common implementation errors

Review Checklist

Structure Validation

  • File located in src/template/ appropriate subdirectory
  • Implements ScriptTemplate interface from @bsv/sdk
  • Exports PREFIX constant
  • Exports Data interface with all protocol fields
  • Default export is the template class
  • Added to mod.ts exports (class + types)

Interface Requirements

  • data property is public readonly
  • Constructor accepts Data interface
  • bitcomIndex?: number field for protocol position
  • valid?: boolean field for verification status

Required Methods

Method Purpose Requirements
decode() Static. Parse from BitComDecoded Return array of instances
lock() Generate LockingScript Use BitCom for OP_RETURN protocols
unlock() Generate UnlockingScript Throw if not applicable
verify() Check signature validity Return boolean

Code Quality

  • Uses script.chunks directly (no toASM().split())
  • Uses @bsv/sdk Utils (no Buffer, TextEncoder)
  • Proper error handling in decode()
  • No hardcoded magic numbers
  • Consistent with other templates in repo

Chunk Parsing Review

Correct pattern:

const script = Script.fromBinary(protocol.script)
const chunks = script.chunks
const field = Utils.toUTF8(chunks[0].data ?? [])

Incorrect patterns to flag:

// BAD: String splitting
const parts = script.toASM().split(' ')

// BAD: Buffer usage
const field = Buffer.from(chunks[0].data).toString()

// BAD: TextEncoder
new TextEncoder().encode(field)

Utils Usage Review

Verify correct Utils functions:

Operation Correct Incorrect
String → bytes Utils.toArray(str, 'utf8') Buffer.from(), TextEncoder
Bytes → string Utils.toUTF8(bytes) Buffer.toString(), TextDecoder
Bytes → hex Utils.toHex(bytes) Buffer.toString('hex')
Bytes → base64 Utils.toBase64(bytes) Buffer.toString('base64')

Signature Verification Review

For protocols with signatures:

  • Uses BSM.sign() for signing
  • Tries all 4 recovery factors (0-3)
  • Uses Signature.fromCompact() for decoding
  • Verifies address matches recovered public key
  • Sets valid field after verification

BitCom Integration Review

For OP_RETURN protocols:

  • Uses BitCom class for lock()
  • Creates Protocol array with correct structure
  • Proper pipe delimiter handling
  • decode() accepts BitComDecoded parameter

Common Issues

Issue 1: Missing Null Checks

// BAD: Can throw on missing data
const field = Utils.toUTF8(chunks[0].data)

// GOOD: Handle missing data
const field = Utils.toUTF8(chunks[0].data ?? [])

Issue 2: Wrong Chunk Index

Verify chunk indices match protocol specification:

  • Check protocol documentation for field order
  • Account for protocol prefix being separate

Issue 3: Incomplete Error Handling

// BAD: Crashes on parse error
static decode(bitcom: BitComDecoded): Protocol[] {
  const script = Script.fromBinary(protocol.script) // Can throw!
}

// GOOD: Handle parse errors
static decode(bitcom: BitComDecoded): Protocol[] {
  try {
    const script = Script.fromBinary(protocol.script)
  } catch {
    continue // Skip invalid protocols
  }
}

Issue 4: Missing mod.ts Export

Check that mod.ts includes:

export { default as Protocol, PREFIX } from './src/template/...'
export type { ProtocolData, ProtocolOptions } from './src/template/...'

Review Output Format

Provide structured feedback:

## Template Review: [TemplateName]

### Structure: ✅ PASS / ❌ FAIL
- [Details]

### Methods: ✅ PASS / ❌ FAIL
- [Details]

### Code Quality: ✅ PASS / ❌ FAIL
- [Details]

### Issues Found
1. [Issue description and fix]
2. [Issue description and fix]

### Recommendations
- [Optional improvements]

Additional Resources

Reference Files

  • references/checklist-detailed.md - Extended validation criteria
  • references/common-bugs.md - Known issues and fixes

Installationen

Installationen 20
Globales Ranking #601 von 601

Sicherheitsprüfung

ath Safe
socket Safe
Warnungen: 0 Bewertung: 90
snyk Medium
EU EU-Hosted Inference API

Power your AI Agents with the best open-source models.

Drop-in OpenAI-compatible API. No data leaves Europe.

Explore Inference API

GLM

GLM 5

$1.00 / $3.20

per M tokens

Kimi

Kimi K2.5

$0.60 / $2.80

per M tokens

MiniMax

MiniMax M2.5

$0.30 / $1.20

per M tokens

Qwen

Qwen3.5 122B

$0.40 / $3.00

per M tokens

So verwenden Sie diesen Skill

1

Install review-script-template by running npx skills add b-open-io/bsv-skills --skill review-script-template in your project directory. Führen Sie den obigen Installationsbefehl in Ihrem Projektverzeichnis aus. Die Skill-Datei wird von GitHub heruntergeladen und in Ihrem Projekt platziert.

2

Keine Konfiguration erforderlich. Ihr KI-Agent (Claude Code, Cursor, Windsurf usw.) erkennt installierte Skills automatisch und nutzt sie als Kontext bei der Code-Generierung.

3

Der Skill verbessert das Verständnis Ihres Agenten für review-script-template, und hilft ihm, etablierte Muster zu befolgen, häufige Fehler zu vermeiden und produktionsreifen Code zu erzeugen.

Was Sie erhalten

Skills sind Klartext-Anweisungsdateien — kein ausführbarer Code. Sie kodieren Expertenwissen über Frameworks, Sprachen oder Tools, das Ihr KI-Agent liest, um seine Ausgabe zu verbessern. Das bedeutet null Laufzeit-Overhead, keine Abhängigkeitskonflikte und volle Transparenz: Sie können jede Anweisung vor der Installation lesen und prüfen.

Kompatibilität

Dieser Skill funktioniert mit jedem KI-Coding-Agenten, der das skills.sh-Format unterstützt, einschließlich Claude Code (Anthropic), Cursor, Windsurf, Cline, Aider und anderen Tools, die projektbezogene Kontextdateien lesen. Skills sind auf Transportebene framework-agnostisch — der Inhalt bestimmt, für welche Sprache oder welches Framework er gilt.

Data sourced from the skills.sh registry and GitHub. Install counts and security audits are updated regularly.

EU Made in Europe

Chat with 100+ AI Models in one App.

Use Claude, ChatGPT, Gemini alongside with EU-Hosted Models like Deepseek, GLM-5, Kimi K2.5 and many more.

App herunterladen:

Kundensupport