style-libsrc-layout

Enforces one major function per source file when organizing z88dk libsrc assembly and C code.

1.1k|206|Updated Mar 16, 2016
One-click install
npx skills add https://github.com/z88dk/z88dk --skill style-libsrc-layout-z88dk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: style-libsrc-layout
Source: https://github.com/z88dk/z88dk/tree/main/.agents/skills/style-libsrc-layout
Command: npx skills add https://github.com/z88dk/z88dk --skill style-libsrc-layout-z88dk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When adding, splitting, or reorganizing library code under z88dk's libsrc tree, contributors often merge unrelated operations into one file or scatter a single operation across many files, breaking the project's house layout and making symbol attribution in maps and listings unreliable. ## Core Features & Use Cases - Layout Rule Enforcement: Defines the one major function (or one logical operation) per source file convention for both classic and newlib libraries. - Grouping Guidance: Clarifies what belongs together (callee and non-callee glue, f16/f24 variants of the same op, op-specific helpers) versus what must be split into separate files. - CPU-Specific Consistency: Ensures CPU-specific copies under asm/z80/, asm/8085/, and similar directories keep the same one-op-per-file mapping. - Use Case: When adding a new math routine to libsrc, check this rule to decide whether it needs its own .asm file or belongs with an existing operation, matching neighboring filenames to symbol names. ## Quick Start Ask the AI to review your new libsrc assembly file and confirm it follows the one major function per file layout before committing.

Frequently Asked Questions about style-libsrc-layout

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I organize new library functions in z88dk libsrc?

Place one major function or logical operation per source file, with the filename matching the symbol or operation name. Keep callee and non-callee glue plus same-op variants like f16 and f24 together in that file.

When should I split assembly code into separate files in libsrc?

Split when a file contains unrelated operations, such as multiply and add together. Do not split a single operation just to isolate a small helper unless the existing tree already follows that pattern.

Does the one-function-per-file rule apply to CPU-specific code?

Yes. CPU-specific copies under directories like asm/z80/ or asm/8085/ keep the same one-op-per-file mapping. Implementations may differ by instruction set, but the file taxonomy stays identical.

Can I merge small helper routines into one file to reduce file count?

Only if the helpers belong exclusively to that one operation. Helpers that constitute a second feature must get their own file, and merging unrelated ops to save files violates the house style.

Why does z88dk require one operation per source file?

List files and build products reference modules by path, so one op per file keeps nm, map, and hotspot attribution accurate. It also keeps the library layout predictable across sccz80 runtime, float cores, and target drivers.