Back to skills
SKILL.md
Trealla Prolog Standards
ASecurityCoding standards and guidelines for Trealla Prolog applications and WASM targets. Use when targeting Trealla Prolog specifically.
- 4 stars
- 0 votes
- 0 copies
- 1 view
- Added October 1, 2026
Security analysis
100/100npx -y skills add dougransom/prolog-agent-toolkit --skill trealla-prolog-standards --agent claude-codeAre you the author of Trealla Prolog Standards?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/dougransom-trealla-prolog-standards)---
name: trealla-prolog-standards
description: Coding standards and guidelines for Trealla Prolog applications and WASM targets. Use when targeting Trealla Prolog specifically.
---
# Trealla Prolog Standards
Guidelines for writing idiomatic Trealla Prolog code:
## Core Rules
1. **ISO Code Target**: Trealla Prolog emphasizes fast execution, modularity, and WASM support. AI agents should attempt to produce standard ISO-compliant code subject to Trealla's capabilities and limitations.
2. **Text & Double Quotes**: Follow standard character lists (`chars`) representation.
3. **Library Cheat-Sheet Usage**: Explicitly declare imports using `:- use_module(library(...)).`. Use the Standard Library Cheat Sheet below.
4. **Safety**: Always execute code using `trealla-safe` or `prolog-safe` with `PROLOG_ENGINE=trealla`.
## Trealla Prolog Standard Library Cheat Sheet
> **Universal Coding Standards Note**: The cheat sheet table below specifies Trealla-specific module import headers (`:- use_module(library(...)).`). All underlying coding guidelines, purity rules, reification patterns (`=(X,Y,Truth)`, `cond_t`, `if_`), integer constraints (`clpz`), DCG syntax, character I/O (`chars`), and formatting follow the **universal Prolog coding standards** defined in [`prolog-conventions`](../prolog-conventions/SKILL.md) and [`prolog_guidelines.md`](../../references/prolog_guidelines.md).
| Feature / Topic | Import Header | Primary Exported Predicates | Notes / System Rules |
| :--- | :--- | :--- | :--- |
| **DCG Parsing** | `:- use_module(library(dcgs)).` | `phrase/2`, `phrase/3` | Standard ISO DCG grammars. |
| **Character I/O** | `:- use_module(library(charsio)).` | `read_from_chars/2`, `write_to_chars/2` | Double-quoted strings are `chars`. |
| **CLP(Z) Constraints**| `:- use_module(library(clpz)).` | `(#=)/2`, `label/1`, `labeling/2` | Integer constraints in Trealla (`clpz`). |
| **Reified Logic** | `:- use_module(library(reif)).` | `if_/3`, `dif/2`, `(=)/3` | Reified condition evaluation. |
| **Coroutining / Delay**| `:- use_module(library(when)).` | `when/2`, `freeze/2` | Goal suspension and coroutining. |
| **Formatted Printing**| `:- use_module(library(format)).` | `format/2`, `format/3` | C-style formatted string/stdout output. |
| **Randomization** | `:- use_module(library(random)).` | `maybe/0`, `random_integer/3` | Fast pseudorandom generation. |
## Universal Guidelines & References
- [Covington Prolog Style Guide](../../references/covington_style.md)
- [Prolog Purity Guidelines](../../references/prolog_guidelines.md)
Attribution
Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.