sp

Generate sp.h-compliant C code with exact function declarations and memory rules.

1|Updated Apr 28, 2020
One-click install
npx skills add https://github.com/tspader/dotfiles --skill sp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sp
Source: https://github.com/tspader/dotfiles/tree/main/llm/.llm/skills/sp.h
Command: npx skills add https://github.com/tspader/dotfiles --skill sp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill acts as an expert guide for the sp.h single-header C standard library replacement. It ensures that all interactions, discussions, and code generation related to sp.h strictly adhere to its specific conventions, function annotations, and memory management rules. This prevents common errors, maintains code quality, and significantly reduces the cognitive load and review cycles for C developers.

Core Features & Use Cases

  • Strict sp.h Compliance: Guides the AI to consistently apply sp.h's unique coding style, type prefixes (sp_), function signatures (SP_API), and memory allocation (sp_alloc).
  • Accurate Code Annotation: Automatically annotates sp.h function references with their full declarations, drawing from bundled reference files (references/index.md, references/sp.h, references/spn.c).
  • Use Case: A C developer needs to implement a dynamic array using sp.h. By activating this skill, the AI can generate correct, idiomatic sp_da code, including initialization with SP_ZERO_INITIALIZE(), pushing elements with sp_dyn_array_push(), and iterating with sp_dyn_array_for(), without the developer needing to manually consult the library documentation.

Quick Start

Explain how to use sp_dyn_array for dynamic arrays in sp.h, including initialization and iteration, providing code examples.

Frequently Asked Questions about sp

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

FAQPage Schema
How do I integrate sp.h as a C standard library replacement?

sp.h is a portable single-header C library that replaces standard library functions with sp_-prefixed APIs. Integration involves including sp.h, adopting sp_alloc for memory management, and using sp.h function declarations throughout your codebase for consistent, flawless library integration.

What are the key memory management patterns in sp.h?

sp.h enforces zero-initialization via SP_ZERO_INITIALIZE() and provides disciplined memory allocation through sp_alloc. Memory practices include strict naming conventions with sp_ prefixes, proper initialization of sp_str_t strings and sp_dyn_array dynamic arrays, and adherence to sp.h's documented allocation rules.

How do I work with dynamic arrays and hash tables in sp.h?

sp.h provides sp_dyn_array and sp_ht patterns for collections. Initialize with SP_ZERO_INITIALIZE(), use sp_dyn_array_push() to add elements and sp_dyn_array_for() to iterate, and reference precise sp.h API declarations from references/index.md for exact function signatures and correct usage.

Why should I follow sp.h coding conventions during code review?

sp.h conventions—including type prefixes, SP_API annotations, and strict memory practices—reduce errors and cognitive load during review. Enforcing these standards prevents common mistakes, maintains consistent code quality, and ensures developers reference exact function declarations rather than relying on assumptions.

What documentation should I reference when using sp.h APIs?

Consult references/index.md for sp.h function lookups, references/sp.h for full declarations, and references/spn.c for usage examples. This workflow ensures strict header annotation, SP_LOG formatting adherence, and conformance to sp.h's mandated naming conventions and referencing practices.