bitcoin-scripts
Bitcoin Script language: stack execution model, opcodes, all output types (P2PK, P2PKH, P2SH, P2WPKH, P2WSH, P2TR, Tapscript), witness construction, sig encoding (DER/Schnorr). Quick refs: opcode reference, output-type construction, Tapscript diff vs legacy. USE WHEN: writing/decoding scriptPubKey, building scriptSig/witness, understanding "what does this script do", reading raw txs.
What this skill does
# Bitcoin Script > **Quick refs**: [opcodes.md](quick-ref/opcodes.md), [output-types.md](quick-ref/output-types.md), [tapscript.md](quick-ref/tapscript.md) Bitcoin Script is a **stack-based**, **non-Turing-complete** (no loops), forth-like language. Each opcode pushes/pops bytes from a stack. Validity = stack contains a single non-zero element after execution. ## Execution model 1. Initialize empty stack. 2. Concatenate `scriptSig + scriptPubKey` (legacy) — execute serialized. *(Disabled post-BIP16 P2SH for the segwit/taproot path.)* 3. (For SegWit/Taproot) Witness stack pushes are pre-loaded onto the stack, then `scriptPubKey` (or witness script) executes. 4. After execution: top of stack must be non-zero / true. ## Output type catalogue | Type | scriptPubKey | Address | |------|--------------|---------| | **P2PK** | `<33 or 65-byte pubkey> OP_CHECKSIG` | none (uses P2PKH addr) | | **P2PKH** | `OP_DUP OP_HASH160 <20-byte hash> OP_EQUALVERIFY OP_CHECKSIG` | `1...` (Base58) | | **P2SH** | `OP_HASH160 <20-byte hash> OP_EQUAL` | `3...` (Base58) | | **P2WPKH** (v0) | `OP_0 <20-byte hash>` | `bc1q...` (Bech32) | | **P2WSH** (v0) | `OP_0 <32-byte hash>` | `bc1q...` (Bech32) | | **P2TR** (v1) | `OP_1 <32-byte tweaked x-only pubkey>` | `bc1p...` (Bech32m) | P2PK, P2PKH = pre-2012 patterns, still consensus-valid. Mainnet wallets should use SegWit v0 (P2WPKH/P2WSH) as default and Taproot (P2TR) where feasible. ## Sig encoding - **ECDSA** (legacy/segwit v0): DER-encoded signature + 1-byte sighash flag suffix (`<r,s>` low-s only since BIP146). - **Schnorr** (Taproot): 64-byte raw signature. Optional 1-byte sighash if not `SIGHASH_DEFAULT` (0x00) → 65 bytes. ## Witness construction (SegWit v0) For P2WPKH spending: ``` witness: <signature DER + sighash byte> <pubkey 33 bytes> ``` For P2WSH spending: ``` witness: <stack items consumed by witnessScript> ... <witnessScript bytes> ← last element, hashed for verification ``` ## Witness construction (Taproot) Two paths: - **Key path** (default, cheapest, indistinguishable from single-sig): ``` witness: [<schnorr sig>] ``` - **Script path**: ``` witness: [<args for leaf script> ... <leaf script> <control block>] ``` Control block: `0xc0 | parity` + internal pubkey (32) + merkle path. ## Standardness Mempool policy enforces: - No `OP_RETURN` outputs > 80 bytes data (configurable, default). - No multi-sig with > 3 keys via "bare" multisig (post-P2SH only). - No non-canonical signatures (low-s, DER strict). - Tapscript opcodes: `OP_CHECKSIGADD` is consensus-active; new opcodes added per leaf-version policy. ## See also - [taproot/SKILL.md](../taproot/SKILL.md) - [miniscript/SKILL.md](../miniscript/SKILL.md) — script policy compiler - [descriptors/SKILL.md](../descriptors/SKILL.md)
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.