Token导航 LogoToken导航TokenDH.com
前端设计只读github未标认证来源可访问许可证需确认审计通过

assembly-guide组装指南

Agent Skill

assembly-guide 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

309

周安装

13

GitHub Stars

8

下载量

108
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:assembly-guide(组装指南)
来源仓库:https://github.com/ar4mirez/samuel
仓库路径:skills/assembly-guide
安装命令:
npx skills add https://github.com/ar4mirez/samuel --skill assembly-guide
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ar4mirez/samuel --skill assembly-guide

简介

assembly-guide 提供 x86-64 与 ARM64 汇编的结构化编写规范与注释标准。

  • 适用于需要精确控制指令流或分析编译器输出的开发任务。
  • 它强调 ABI 合规性与寄存器保护,避免因调用约定错误导致栈崩溃。
  • 输出包含 NASM/GAS 语法差异说明与宏定义建议,提升代码可维护性。
  • 优化阶段应优先保证正确性,再通过 profiling 定位热点进行针对性加速。

SKILL.md

Assembly Guide

Applies to: x86-64 (System V ABI), ARM64 (AAPCS), NASM, GAS syntax

Core Principles

  1. Clarity Over Cleverness: Comment every instruction's purpose; assembly lacks self-documentation
  2. ABI Compliance: Follow calling conventions precisely for interoperability with C/system code
  3. Minimal Register Pressure: Preserve callee-saved registers, minimize spills to stack
  4. Correctness First: Get it working correctly, then profile, then optimize with SIMD
  5. Structured Layout: Use consistent label naming, section organization, and macro definitions

Guardrails

Architecture Selection

  • Declare target architecture at the top of every file
  • x86-64: default for Linux/macOS server and desktop workloads
  • ARM64: default for Apple Silicon, mobile, and embedded Linux
  • Never mix architecture-specific code without %ifdef / .ifdef guards

Calling Conventions

  • x86-64 System V ABI (Linux, macOS, BSD):

- Arguments: rdi, rsi, rdx, rcx, r8, r9 (integer/pointer, in order) - Floating-point arguments: xmm0-xmm7 - Return value: rax (integer), xmm0 (float) - Caller-saved (volatile): rax, rcx, rdx, rsi, rdi, r8-r11 - Callee-saved (non-volatile): rbx, rbp, r12-r15 - Stack must be 16-byte aligned before call instruction

  • ARM64 AAPCS (Linux, macOS):

- Arguments: x0-x7 (integer/pointer), d0-d7 (float) - Return value: x0 (integer), d0 (float) - Callee-saved: x19-x28, x29 (frame pointer), x30 (link register) - Stack must be 16-byte aligned at all times

Register Usage

  • Document which registers hold which logical values at function entry
  • Never clobber callee-saved registers without saving and restoring them
  • Use rbp / x29 as frame pointer for debuggability (omit only in leaf functions)
  • Reserve scratch registers for temporaries; name them in comments
  • Zero-extend results when returning values smaller than 64 bits

Stack Management

  • Always maintain 16-byte stack alignment on x86-64 and ARM64
  • Allocate local variables by subtracting from rsp / sp in the prologue
  • Deallocate in the epilogue before ret (never leave the stack dirty)
  • Use red zone (128 bytes below rsp) only in leaf functions on System V ABI
  • Never write below the stack pointer outside the red zone

Documentation

  • File header: purpose, target architecture, assembler syntax, author
  • Function header: C-style prototype comment, argument register mapping, return value
  • Inline comments: explain the *why*, not the *what* (avoid ; increment counter)
  • Label naming: module_function_sublabel (e.g., crypto_sha256_loop)
  • Constants: use equ / .equ directives with descriptive names

Key Patterns

x86-64 Function with Frame Pointer

; long compute(long x, long y, long z)
; Args: rdi = x, rsi = y, rdx = z
; Returns: rax = x * y + z
global compute
compute:
    push    rbp                 ; save frame pointer
    mov     rbp, rsp            ; establish stack frame
    mov     rax, rdi            ; rax = x
    imul    rax, rsi            ; rax = x * y
    add     rax, rdx            ; rax = x * y + z
    pop     rbp                 ; restore frame pointer
    ret

ARM64 AAPCS Function

// int64_t multiply_add(int64_t a, int64_t b, int64_t c)
// Args: x0 = a, x1 = b, x2 = c  |  Returns: x0 = a * b + c
    .global multiply_add
multiply_add:
    stp     x29, x30, [sp, #-16]!  // save fp and lr
    mov     x29, sp                 // establish stack frame
    mul     x0, x0, x1              // x0 = a * b
    add     x0, x0, x2              // x0 = a * b + c
    ldp     x29, x30, [sp], #16     // restore fp and lr
    ret

SIMD / SSE2 (4 floats per iteration)

; void add_f32(float *dst, const float *a, const float *b, size_t n)
; Args: rdi = dst, rsi = a, rdx = b, rcx = n
global add_f32
add_f32:
    shr     rcx, 2              ; n /= 4
.loop:
    test    rcx, rcx
    jz      .done
    movups  xmm0, [rsi]        ; load 4 floats from a
    addps   xmm0, [rdx]        ; add 4 floats from b
    movups  [rdi], xmm0        ; store result
    add     rsi, 16
    add     rdx, 16
    add     rdi, 16
    dec     rcx
    jnz     .loop
.done:
    ret

Linux x86-64 Syscall Interface

; Syscall: rax = number, args in rdi/rsi/rdx/r10/r8/r9, return in rax
; Note: r10 replaces rcx (clobbered by syscall instruction)
SYS_WRITE equ 1
SYS_EXIT  equ 60

section .data
    msg db "Hello, world!", 10
    msg_len equ $ - msg

section .text
global _start
_start:
    mov     rax, SYS_WRITE      ; write(stdout, msg, msg_len)
    mov     rdi, 1               ; fd = STDOUT
    lea     rsi, [rel msg]       ; RIP-relative for PIC
    mov     rdx, msg_len
    syscall
    mov     rax, SYS_EXIT        ; exit(0)
    xor     edi, edi
    syscall

Position-Independent Code (PIC)

default rel                     ; all memory refs become RIP-relative

section .data
    counter dq 0

section .text
global get_counter
get_counter:
    mov     rax, [counter]      ; RIP-relative with default rel
    ret

global increment_counter
increment_counter:
    lock inc qword [counter]    ; atomic increment (thread-safe)
    mov     rax, [counter]
    ret

Debugging

GDB Commands

gdb ./program
(gdb) layout asm                # show disassembly window
(gdb) layout regs               # show registers window
(gdb) stepi                     # step one instruction
(gdb) nexti                     # step over call
(gdb) info registers            # print all register values
(gdb) p/x $rax                  # print rax in hex
(gdb) x/4gx $rsp               # examine 4 quad-words at stack pointer
(gdb) break *0x401000           # break at address
(gdb) display/i $pc             # show current instruction after each step
(gdb) set disassembly-flavor intel

objdump & strace

objdump -d -M intel program     # disassemble with Intel syntax
objdump -h program              # show section headers
objdump -t program              # show symbol table
objdump -r program.o            # show relocations (PIC debugging)

strace ./program                # trace all syscalls
strace -e trace=write,read ./program  # filter specific syscalls

Tooling

Assemblers & Linkers

# NASM (Intel syntax)
nasm -f elf64 -g -F dwarf program.asm -o program.o   # Linux
nasm -f macho64 program.asm -o program.o              # macOS

# GAS (AT&T syntax, supports .intel_syntax)
as --64 -g program.s -o program.o

# LLVM
clang -c program.s -o program.o

# Linking
ld -o program program.o               # bare metal (no libc)
gcc -o program program.o              # with libc (C interop)
gcc -shared -o libfoo.so foo.o        # shared library (requires PIC)

Verification

nm program.o                    # verify symbol visibility
nm -u program.o                 # check undefined references
readelf -S program.o            # verify section layout
# In GDB: p/x $rsp & 0xf       # should be 0x0 at call boundaries

References

For detailed patterns and code examples, see:

External References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.58%
按下载量换算42

Claude

28.66%
按下载量换算31

Cursor

18.7%
按下载量换算20

Gemini CLI

9.94%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills