with one click
sac-style-guide
Enforce SaC code formatting and readability conventions.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Enforce SaC code formatting and readability conventions.
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Triage and improve sac2c diagnostic quality in editor workflows.
Add or adjust SaC overloads while preserving semantic consistency.
Compile and diagnose SaC files by calling the local sac2c MCP tools.
| name | sac-style-guide |
| description | Enforce SaC code formatting and readability conventions. |
Use this skill when editing .sac files.
Follow these rules exactly to match formatter behavior.
| ., on following lines.(), [], {}.||, &&) on same guard line when they continue a guard expression.// comments intact; never reinterpret commented code as active code.// when comment body exists.return { ... }; tensor block:
-> and | columns.return with { ... } : genarray(...); may be expanded to multiline canonical form.} : genarray(...) arm aligned with the with keyword column.* lines and closing */ relative to declaration indentation.Use this formatting for multi-line function guards and nested expression continuations.
/**
* Rank-polymorphic selection with explicit domain checks.
*
* @param iv Index vector.
* @param a Input array.
* @return Selected sub-array.
*/
int[m:ishp] mySel(int[n] iv, int[n:shp, m:ishp] a)
| all(0 <= iv)
, all(iv < shp)
, ((n > m && ishp == []) || (ishp == shp))
{
return { jv -> _sel_VxA_(++(iv, jv), a) | jv < ishp };
}
int[m, n] checkerboard(int[m, n] a)
{
return with {
(. <= [i, j] <= .) : (a[i, j] + i + j) % 2;
} : genarray([m, n], 0);
}
int[d:shp] vsum2(int[n, d:shp] a)
{
transposed_a = transpose(a);
return d > 0 ? transpose({ iv -> sum(transposed_a[iv]) | iv < reverse(shp) }) : sum(a);
}
int[m, n] edgeMask(int[m, n] a)
{
return {
[i, j] -> abs(a[i, j] - a[i, j - 1]) + abs(a[i, j] - a[i - 1, j]) | [1, 1] <= [i, j] < [m - 1, n - 1];
[i, j] -> 0 | [i, j] < [m, n]
};
}
.sac-format keysWhen present, align behavior with these keys:
IndentSizeTabWidthNormalizeGuardsExpandInlineWithLoopsExpandInlineComprehensionsSplitInlineGuardsAssertions (deprecated alias)VS Code sac.format.* settings override .sac-format values when both exist.