agentsclimarketplace

Assembly coding

Skill nguyenthdat/opencode-manager/registry/skills/assembly-coding

Project-scoped OpenCode TUI plugin for grouping and managing MCP servers, custom agent skills, and pinned vendor skill registries.

Install
npx -y skills add nguyenthdat/opencode-manager --skill assembly-coding

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 13 days oldThe repository was created 13 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Comprehensive assembly language guidance: 166 prioritized rules across 15 categories covering x86-64 (AT&T/GAS and Intel/NASM syntax), ARM64/AArch64 (AAPCS64), and RISC-V. Use when writing, reviewing, refactoring, or debugging `.s`/`.asm`/`.S` files, inline asm blocks, calling-convention/ABI code, SIMD (SSE/AVX/NEON/RVV) routines, or any hand-written machine-code-adjacent logic. Covers calling conventions, register discipline, memory addressing/alignment, control flow, syntax pitfalls (AT&T vs Intel operand order), C/asm interop, testing, and toolchain integration.

SKILL.md

27.8 KB, as published. Nobody here has run it

Assembly Best Practices

Comprehensive guide for writing correct, portable, and maintainable assembly language code. Contains 166 rules across 15 categories, prioritized by impact. Assembly has no compiler-enforced types, ownership, or error handling — correctness instead rests on calling-convention discipline, register and memory-addressing precision, and toolchain verification. Project constraints override generic defaults: preserve the target ISA(s), ABI, assembler, and syntax convention the project has already declared unless the user explicitly asks to change them.

When to Apply

Reference these guidelines when:

  • Writing new hand-written routines in x86-64, ARM64/AArch64, or RISC-V assembly
  • Reviewing .s/.asm/.S files or inline asm/asm volatile blocks in C/C++
  • Implementing or auditing a calling-convention boundary (SysV AMD64, AAPCS64, RISC-V, Windows x64)
  • Writing or reviewing SIMD-optimized code (SSE/AVX, NEON, RVV)
  • Debugging a crash or wrong-answer bug that traces into hand-written asm
  • Porting a routine between x86-64, ARM64, and RISC-V
  • Setting up or reviewing a build system that assembles .s/.asm files alongside C/C++
  • Auditing a binary's security-relevant properties (NX, PIE, stack canary) where hand-written asm is in the mix

Choosing an ISA and Syntax

Most projects target one or more of three ISA families, each with its own calling convention and idioms:

  • x86-64 — the dominant server/desktop ISA. Two competing syntaxes exist for the same instruction set: AT&T (GNU assembler/GAS default, used on Linux/BSD/macOS toolchains, %register/$immediate sigils) and Intel (NASM, MASM, and Intel's own documentation, no sigils, dword ptr-style size annotations). Operand order is the single biggest gotcha: AT&T orders operands src, dst; Intel orders them dst, src. The exact same two operands in the exact same registers mean opposite things depending on which syntax you're reading — see syntax-att-operand-order.
  • ARM64/AArch64 — the dominant mobile/embedded/increasingly-server ISA (Apple Silicon, AWS Graviton, most phones). Effectively one dominant syntax (GNU/Clang assembler, AAPCS64 calling convention), a load/store-only architecture (no memory-to-memory arithmetic), and NEON SIMD is part of the mandatory baseline.
  • RISC-V — an open, modular ISA gaining ground in embedded and increasingly server contexts. No flags register (branches compare two registers directly), ABI role names (a0-a7, s0-s11) layered over raw x0-x31 registers, and an optional, length-agnostic Vector ("V") extension rather than fixed-width SIMD registers.

When a target isn't specified, default to matching whatever ISA/syntax the surrounding project already uses (check existing .s/.asm files, build scripts, and doc-abi-assumption-comment-style header comments) rather than picking a favorite. When writing genuinely new, portable logic, prefer showing the x86-64 AT&T, ARM64, and (where it adds value) RISC-V forms side by side, since a reader of any one variant benefits from seeing how the same logic maps onto the others.

Rule Categories by Priority

PriorityCategoryImpactPrefixRules
1Calling Conventions & ABICRITICALabi-14
2Registers & Data MovementCRITICALreg-13
3Memory Addressing & AlignmentCRITICALmem-14
4Control FlowHIGHctrl-12
5Syntax & ToolchainHIGHsyntax-13
6Interop with C/High-Level LanguagesHIGHinterop-12
7SIMD & VectorizationHIGHsimd-10
8Naming ConventionsMEDIUMname-8
9Testing & VerificationMEDIUMtest-10
10DocumentationMEDIUMdoc-8
11Performance PatternsMEDIUMperf-10
12Safety & CorrectnessMEDIUM/HIGHsafe-10
13Project StructureLOWproj-9
14Linting/Static AnalysisLOWlint-8
15Anti-patternsREFERENCEanti-15

Quick Reference

1. Calling Conventions & ABI (CRITICAL)

2. Registers & Data Movement (CRITICAL)

3. Memory Addressing & Alignment (CRITICAL)

4. Control Flow (HIGH)

5. Syntax & Toolchain (HIGH)

6. Interop with C/High-Level Languages (HIGH)

7. SIMD & Vectorization (HIGH)

8. Naming Conventions (MEDIUM)

9. Testing & Verification (MEDIUM)

10. Documentation (MEDIUM)

11. Performance Patterns (MEDIUM)

12. Safety & Correctness (MEDIUM/HIGH)

13. Project Structure (LOW)

14. Linting/Static Analysis (LOW)

15. Anti-patterns (REFERENCE)


Recommended Tooling & Build Configuration

# GNU assembler (GAS) + linker, AT&T syntax, warnings as errors, debug symbols
as --fatal-warnings -g -o checksum.o checksum.s
ld -o app checksum.o main.o

# GCC/Clang driving the whole pipeline (preferred for most projects: handles PIC/PIE,
# links libc, and runs the C preprocessor over .S files automatically)
gcc -Wall -Wextra -Wa,--fatal-warnings -g -fPIC -pie -c checksum.s -o checksum.o
gcc -fPIC -pie checksum.o main.o -o app

# NASM (Intel syntax), warnings as errors, debug info, ELF64 object format
nasm -f elf64 -Wall -Werror -g checksum.asm -o checksum.o
gcc checksum.o main.o -o app
# Makefile snippet: assembling .s files alongside C, with debug symbols and warnings enabled
CC       := gcc
AS       := as
CFLAGS   := -Wall -Wextra -g -O2 -fPIC -pie
ASFLAGS  := -g --fatal-warnings

SRCS_C   := main.c parser.c
SRCS_S   := checksum_x86_64.s
OBJS     := $(SRCS_C:.c=.o) $(SRCS_S:.s=.o)

app: $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $@

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o: %.s
	$(AS) $(ASFLAGS) $< -o $@

test: app
	./run_tests.sh

clean:
	rm -f $(OBJS) app

.PHONY: test clean

Verify the shipped binary's security-relevant properties once the build is wired up:

checksec --file=./app   # confirms NX, PIE, RELRO, and stack-canary status

How to Use

This skill provides rule identifiers for quick reference. When generating or reviewing assembly code:

  1. Identify the target ISA(s) and syntax — check existing files, build scripts, or ask if unclear
  2. Check the relevant category based on the task type
  3. Apply rules with the matching prefix, showing multi-ISA variants where the skill covers more than one
  4. Prioritize CRITICAL > HIGH > MEDIUM > LOW
  5. Read rule files in rules/ for detailed, ISA-labeled examples

Rule Application by Task

TaskPrimary Categories
New routine, any ISAabi-, reg-, mem-
Calling-convention boundary / C interopabi-, interop-
Hot loop / branch structuringctrl-, perf-
SIMD / vectorized codesimd-, mem-, perf-
Porting between x86-64/ARM64/RISC-Vabi-, reg-, mem-, anti-copy-paste-abi-mismatch
Debugging a crash or wrong answertest-, safe-, doc-
Build system integrationproj-, syntax-
Code reviewanti-, lint-, safe-

Related Skills

  • c-coding - assembly work is very often paired with C, via inline asm/asm volatile blocks, extern "C" linkage boundaries, and shared struct layouts; see this skill's interop- category for the seams between the two.
  • design-patterns - architectural patterns for the higher-level code that calls into hand-written asm routines.
  • security-review - broader security-audit checklists; this skill's safe- category and lint-checksec-binary cover the asm-specific slice (stack canaries, NX, PIE) of that same concern.

Sources

This skill synthesizes best practices from:

  • Intel® 64 and IA-32 Architectures Software Developer's Manuals
  • AMD64 Architecture Programmer's Manual
  • System V Application Binary Interface, AMD64 Architecture Processor Supplement
  • Arm Architecture Reference Manual for A-profile architecture; Procedure Call Standard for the Arm 64-bit Architecture (AAPCS64)
  • RISC-V Instruction Set Manual; RISC-V ELF psABI specification
  • "Programming from the Ground Up" — Jonathan Bartlett
  • "Modern X86 Assembly Language Programming" — Daniel Kusswurm
  • OSDev Wiki
  • GNU Binutils (as, ld, objdump) and NASM documentation
  • Community conventions and production open-source assembly (glibc, Linux kernel, zlib, compiler-generated codegen idioms) (2024-2025)

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.