Agent skill

Bit Shift Safety

by PlamenTSV in PlamenTSV/plamen

Trigger Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents, depth-edge-case

MITAuto-check passed

Install Bit Shift Safety

skills CLI
$ npx skills add PlamenTSV/plamen --skill bit-shift-safety -a claude-code

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

GitHub CLI
$ gh skill install PlamenTSV/plamen bit-shift-safety --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/PlamenTSV/plamen.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agents/skills/aptos/bit-shift-safety .claude/skills/bit-shift-safety && 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
bit-shift-safety
GitHub stars
303
Token cost
~2.4k tokens
SKILL.md length
1,083 words
Files
1
Skills in repo
87
Repo updated
First seen
Licence
MIT

At a glance

Trigger Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents, depth-edge-case

  • Works in 5 steps: Shift Operation Inventory → Shift Amount Bound Verification → Computed Shift Analysis → …
  • Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents
  • SKILL.md covers 1. Shift Operation Inventory, 2. Shift Amount Bound…, 3. Computed Shift Analysis and 4. DoS Impact Assessment, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Bit Shift Safety is an agent skill from PlamenTSV/plamen. Trigger Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents, depth-edge-case

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Autonomous Web3 security audit agent for Claude Code. The licence is MIT.

When your agent uses it

  • Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents
  • Depth-edge-case

Example prompts

  • “/bit-shift-safety”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Shift Operation Inventory
  2. Shift Amount Bound Verification
  3. Computed Shift Analysis
  4. DoS Impact Assessment
  5. Safe Shift Patterns

What it can do on your machine

Read from SKILL.md and the folder at commit 795962b. 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

    No scripts in the folder and no shell commands in SKILL.md (its code samples are markdown).

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

  • Network

    No URLs in SKILL.md.

    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

Bit Shift Safety loads about 2.4k tokens when it runs. Until then it costs about 34 tokens; SKILL.md has 1,083 words of instructions outside code blocks.

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

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 passed

The automated check found no risky patterns in SKILL.md.

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 PlamenTSV/plamen at commit 795962b, republished under its MIT licence (© PlamenTSV). 1,083 words, ~2,433 tokens.

Download SKILL.mdSave it as .claude/skills/bit-shift-safety/SKILL.md (or your agent's skills folder).
name
bit-shift-safety
description
Trigger Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents, depth-edge-case

BIT_SHIFT_SAFETY Skill

Trigger Pattern: Always (Aptos Move) --- Move VM aborts on shift >= bit width Inject Into: Breadth agents, depth-edge-case

The Move VM performs a runtime check on every bit shift operation: if the shift amount is greater than or equal to the bit width of the operand type, the transaction aborts. This is not a silent wraparound --- it is a hard abort that reverts the entire transaction. Any user-controllable or computed shift amount that can reach the bit width threshold is a denial-of-service vector.

1. Shift Operation Inventory

MANDATORY GREP: Search all .move files for << and >> operators.

For each shift operation found:

Location (file:line)Operand TypeBit WidthShift Amount SourceUser-Controllable?Bounded?
{file}:{line}u8/u16/u32/u64/u128/u2568/16/32/64/128/256constant / parameter / computedYES/NOYES/NO --- {how}

Classification of shift amount sources:

  • Constant: Hardcoded literal (e.g., 1 << 64). Safe if < bit width, abort if >= bit width. Check constants that equal or exceed the bit width --- this is a compile-time-detectable bug but Move does not always catch it.
  • Parameter: Passed into the function from a caller. Trace the call chain to determine if externally controllable.
  • Computed: Result of arithmetic (e.g., 1 << (decimals - offset)). Requires boundary analysis.

2. Shift Amount Bound Verification

For each shift operation where the shift amount is NOT a safe constant:

2a. Bit Width Threshold Table
TypeBit WidthMax Safe ShiftAbort Condition
u887shift >= 8
u161615shift >= 16
u323231shift >= 32
u646463shift >= 64
u128128127shift >= 128
u256256255shift >= 256
2b. Bound Verification Per Shift

For each non-constant shift:

LocationShift Amount ExpressionMinimum ValueMaximum ValueExceeds Bit Width?Guard Present?
{location}{expression}{min}{max}YES/NOYES --- {assert/min/if} / NO

Verification method: Trace the shift amount back to its origin. For each variable in the expression:

  1. What is its declared type? (constrains range)
  2. Is there an assert!() that bounds it before the shift?
  3. Is there a min() or if guard?
  4. Can the variable be set by an external caller (entry function parameter, stored value set by a public function)?

Tag: [BOUNDARY:shift_amount={val} → abort at bit_width={W}]

3. Computed Shift Analysis

For shift amounts derived from arithmetic, perform boundary value analysis:

3a. Subtraction Underflow in Shift Amount

Pattern: 1 << (a - b) where both a and b are unsigned integers.

LocationExpressionCan b > a?Underflow ResultImpact
{location}1 << (decimals - 6)YES if decimals < 6Wraps to large u8/u64 → abortDoS

Check: Move unsigned subtraction aborts on underflow (no wraparound). So a - b where b > a aborts BEFORE the shift. This is a separate DoS vector (arithmetic underflow). Document both:

  1. Underflow abort if b > a
  2. Shift abort if a - b >= bit_width
3b. Addition/Multiplication Overflow in Shift Amount

Pattern: value << (a + b) or value << (a * b)

LocationExpressionCan Sum/Product >= Bit Width?Impact
{location}{expression}YES/NO --- {boundary values}{DoS / safe}
3c. Shift Result Overflow

Even if the shift amount is safe, the RESULT of the shift may overflow the type:

LocationExpressionOperand Max ValueShift AmountResult Exceeds Type Max?Impact
{location}amount << decimals{max}{amount}YES/NO{silent truncation / abort}

Note: Move does NOT abort on shift result overflow --- the result is silently truncated (high bits discarded). This is a correctness bug, not a DoS bug, but can cause incorrect calculations (e.g., 1u64 << 63 = 9223372036854775808, but 3u64 << 63 = 9223372036854775808 due to truncation).

Tag: [BOUNDARY:shift_result=truncated at type_max]

4. DoS Impact Assessment

For each shift operation that can abort:

4a. Abort Impact Trace
LocationFunctionEntry Point?Who Calls This?Abort Blocks What?Severity
{location}{function}YES/NO{callers}{blocked operations}{H/M/L}

Trace from the aborting shift outward:

  1. Which function contains the shift?
  2. Is that function called by entry functions (user-facing)?
  3. Is it called in a critical path (deposit, withdraw, claim, liquidation)?
  4. Can an attacker provide input that triggers the abort?
  5. Does the abort affect ONLY the attacker's transaction, or does it block other users?

Severity guide:

  • Shift in view function only -> Low (informational, no state impact)
  • Shift in user's own transaction path (self-DoS only) -> Low
  • Shift in shared operation (affects all users) -> Medium to High
  • Shift in critical path (deposits/withdrawals blocked for all) triggered by attacker input -> High
  • Shift in liquidation/price computation path -> High to Critical (can block liquidations, enable insolvency)
Show full SKILL.md (375 more words)Show less
4b. Attacker-Triggerable Analysis

For shifts that can abort and are in shared/critical paths:

1. Attacker calls entry function F with parameter P
2. P flows through {trace} to shift operation at {location}
3. Shift amount becomes {expression} which equals {value} >= {bit_width}
4. Transaction aborts
5. Impact: {what is blocked for other users}
6. Cost to attacker: {gas cost only / requires tokens / requires role}
7. Persistence: {one-time / repeatable / permanent state corruption}

Tag: [TRACE:attacker input P={val} → shift abort → {blocked_operation} DoS]

5. Safe Shift Patterns

Document which shifts in the codebase follow safe patterns (for completeness and to confirm analysis coverage):

PatternExampleWhy Safe
Constant shift < bit width1u64 << 3232 < 64, always safe
Bounded by min()1 << min(amount, 63)Capped below bit width
Guarded by assertassert!(shift < 64, E_INVALID); val << shiftExplicit pre-check
Type-constrained(x as u8) << 4 where x comes from a u8 fieldu8 max = 255, but shift amount 4 is constant
Bounded by protocol invariantdecimals is always 6 or 8 (set once, immutable)Document the invariant and verify immutability

RULE: A shift is only "safe by protocol invariant" if the invariant is ENFORCED on-chain (assert, type constraint, immutable field set in constructor). Documentation-only invariants do NOT qualify.

Finding Template

When this skill identifies an issue:

markdown
**ID**: [BS-N]
**Severity**: [based on DoS scope and attacker controllability]
**Step Execution**: check1,2,3,4,5 | X(reasons) | ?(uncertain)
**Rules Applied**: [R2:Y, R4:Y, R10:Y]
**Depth Evidence**: [BOUNDARY:shift_amount={val}], [TRACE:input→abort→impact]
**Location**: module::function (source_file.move:LineN)
**Title**: Unbounded bit shift in [function] enables [DoS/incorrect calculation]
**Description**: [Trace from input to shift operation to abort/truncation to impact]
**Impact**: [What is blocked or miscalculated, who is affected, persistence]

Step Execution Checklist (MANDATORY)

CRITICAL: You MUST report completion status for ALL sections. Sections 1-2 are mechanical and must never be skipped.

SectionRequiredCompleted?Notes
1. Shift Operation InventoryYESY/X/?MANDATORY --- grep ALL .move files
2. Shift Amount Bound VerificationYESY/X/?For each non-constant shift
3. Computed Shift AnalysisIF computed shifts foundY/X(N/A)/?Subtraction underflow + result overflow
3c. Shift Result OverflowIF shifts with variable operandsY/X(N/A)/?Silent truncation check
4. DoS Impact AssessmentIF any shift can abortY/X(N/A)/?Trace to user impact
4b. Attacker-Triggerable AnalysisIF abort in shared/critical pathY/X(N/A)/?Full attack trace
5. Safe Shift PatternsYESY/X/?Confirm safe shifts for coverage
Cross-Reference Markers

After Section 1 (Shift Operation Inventory):

  • IF zero shifts found in codebase -> mark all sections X(N/A), write "No bit shift operations found in audited modules" and STOP
  • IF shifts found -> proceed to Section 2, do NOT skip

After Section 4 (DoS Impact Assessment):

  • Cross-reference with access control analysis: can the aborting function be called permissionlessly?
  • Cross-reference with oracle/price analysis: are shifts used in price computations? If yes, abort = price oracle DoS -> severity escalation
  • IF shift in liquidation path -> severity minimum HIGH

After Section 5 (Safe Shift Patterns):

  • Verify: every shift from Section 1 is accounted for in EITHER Section 2 (unsafe) or Section 5 (safe)
  • Any unaccounted shift -> reanalyze before finalizing

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

Files

Just SKILL.md in agents/skills/aptos/bit-shift-safety of PlamenTSV/plamen.

Open the folder on GitHubat commit 795962b

Compare with similar skills

Bit Shift Safety 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.

Bit Shift Safety compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bit Shift Safety this skillPlamenTSV/plamen303—~2.4kAutomated safety check: PassMIT
Python Patternsaffaan-m/ECC276k—~2.3kAutomated safety check: PassMIT
Memory Safety Patternswshobson/agents40k9 repos~646Automated safety check: PassMIT
Golang Patternsaffaan-m/ECC276k—~1.1kAutomated safety check: PassMIT
RTK Rust Design Patternsrtk-ai/rtk83k—~1.9kAutomated safety check: PassApache-2.0
Kotlin Exposed Patternsaffaan-m/ECC276k4 repos~5.5kAutomated safety check: PassMIT

Similar skills

  • Python Patterns

    affaan-m/ECC

    Python-specific design patterns and best practices including protocols, dataclasses, context managers, decorators, async/await, type hints, and package organization.

    276k GitHub stars~2.3k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Memory Safety Patterns

    wshobson/agents

    Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C.

    40k GitHub starsUsed in 9 repos~646 tokens
    Auto-check passed
  • Golang Patterns

    affaan-m/ECC

    Go-specific design patterns and best practices including functional options, small interfaces, dependency injection, concurrency patterns, error handling, and package organization.

    276k GitHub stars~1.1k tokensUpdated 4 days ago
    DevelopmentAuto-check passed
  • Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.

    83k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed
  • JetBrains Exposed ORM patterns including DSL queries, DAO pattern, transactions, HikariCP connection pooling, Flyway migrations, and repository pattern.

    276k GitHub starsUsed in 4 repos~5.5k tokens
    DatabasesAuto-check passed
  • Dotnet Patterns

    affaan-m/ECC

    Idiomatic C and .NET patterns, conventions, dependency injection, async/await, and best practices for building robust, maintainable .NET applications.

    276k GitHub starsUsed in 1 repo~2.3k tokens
    DevelopmentAuto-check passed

More from PlamenTSV/plamen

All 87 skills in this repo
  • Audit Prep

    PlamenTSV/plamen

    Prepare Solidity projects for a security audit — test coverage, test quality, NatSpec docs, code hygiene, dependency health, best-practice enforcement, deployment readiness, and project…

    303 GitHub stars~3.7k tokensUpdated 13 days ago
    Auto-check passed
  • Verification Protocol

    PlamenTSV/plamen

    Trigger Pattern Always (used by all verifier agents) - Inject Into security-verifier agents (Phase 5)

    303 GitHub stars~3.5k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.3k tokensUpdated 13 days ago
    Auto-check passed
  • Ability Analysis

    PlamenTSV/plamen

    Trigger Pattern Always (Sui Move) -- foundational security check - Inject Into Breadth agents, depth agents

    303 GitHub stars~3.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Lifecycle

    PlamenTSV/plamen

    Trigger Pattern ACCOUNTCLOSING flag detected (close/CloseAccount usage) - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.2k tokensUpdated 13 days ago
    Auto-check passed
  • Account Validation

    PlamenTSV/plamen

    Trigger Pattern Always required for Solana audits - Inject Into Breadth agents, depth agents

    303 GitHub stars~1.7k tokensUpdated 13 days ago
    Auto-check passed

Questions about Bit Shift Safety

What does Bit Shift Safety do?

Trigger Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents, depth-edge-case. Bit Shift Safety is an agent skill from PlamenTSV/plamen.

When should I use Bit Shift Safety?

Bit Shift Safety fits situations like: pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents; depth-edge-case.

How do I install Bit Shift Safety in Claude Code?

Run `npx skills add PlamenTSV/plamen --skill bit-shift-safety -a claude-code`. Or copy the skill folder (agents/skills/aptos/bit-shift-safety in PlamenTSV/plamen) into .claude/skills/bit-shift-safety in your project. Claude Code loads it when a task matches its description.

How do I install Bit Shift Safety in Codex?

Run `npx skills add PlamenTSV/plamen --skill bit-shift-safety -a codex`. Or copy the skill folder (agents/skills/aptos/bit-shift-safety in PlamenTSV/plamen) into .agents/skills/bit-shift-safety in your project. Codex loads it when a task matches its description.

Can I use Bit Shift Safety 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 PlamenTSV/plamen --skill bit-shift-safety -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bit-shift-safety, .gemini/skills/bit-shift-safety, .github/skills/bit-shift-safety and .opencode/skills/bit-shift-safety in your project.

What does Bit Shift Safety need to run?

SKILL.md names no scripts, command-line tools or credentials: Bit Shift Safety is instructions for the agent only.

Does Bit Shift Safety access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bit Shift Safety safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bit Shift Safety use?

Bit Shift Safety 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 Bit Shift Safety use?

About 2.4k tokens (SKILL.md is roughly 9.7k 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 Bit Shift Safety?

Skills that share tags, products or a category with Bit Shift Safety: Python Patterns (affaan-m/ECC, 276k stars), Memory Safety Patterns (wshobson/agents, 40k stars), Golang Patterns (affaan-m/ECC, 276k stars) and RTK Rust Design Patterns (rtk-ai/rtk, 83k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bit Shift Safety?

PlamenTSV (a GitHub user) maintains it in PlamenTSV/plamen, which has 303 GitHub stars. The repository holds 87 skills in this directory. The repository was last updated on September 26, 2026.

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