agentleFS
icantcodefyiicantcodefyi/sakuralang/skills/sakura/SKILL.md

sakura

Skill4 starsChanged 24 days agoApache-2.0View on GitHub

Writes, checks, repairs, and tests Sakura Lang programs. Use when working with .sak files, sakura.toml, Sakura effects, typed holes, or Sakura compiler diagnostics.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. momori777/Artemis★ 445same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 1 is distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run sakura --version, then start with sakura prompt --budget 3000 before editing.

    line 15
  2. Very specific:

    Write parameter and return types on top-level functions.

    line 24
  3. Very specific:

    Import non-prelude names explicitly, from their declaring modules: Http from std/http.

    line 28
  4. Very specific:

    Use let for a fixed binding and var for rebinding.

    line 31
  5. Very specific:

    Use fn(x) { ... } for lambdas, match for exhaustive cases, with for local handlers and try/catch for typed failures.

    line 38
  6. Very specific:

    Retrieve: Run sakura doc std::list::set for a known symbol or sakura doc --search "fn(List<A>) -> Int" for a type shape.

    line 43
  7. Very specific:

    Set the task boundary: Read the manifest, permissions and independent acceptance tests.

    line 47
  8. Very specific:

    Check: Run sakura check --json. Parse one JSON object per line by kind.

    line 51
  9. Very specific:

    Repair: Use sakura explain V3001 (substitute the actual code), then make the smallest change consistent with the task.

    line 56
  10. Very specific:

    Build and report: Run sakura build for the requested target (js by default).

    line 67
  11. Very specific:

    Use validate for recoverable external input.

    line 102
  12. Distinctive:

    Keep the effect in the production function's row and replace its handler in the test.

    line 117
  13. Very specific:

    Read the repair table on failure or to upgrade v0.1.0 code.

    line 132
  14. Very specific:

    Read the cookbook for offline projects, the APIs changed since v0.1.0, and sakura audit/sakura verify guidance.

    line 140

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Write Sakura with the compiler

Run sakura --version, then start with sakura prompt --budget 3000 before editing. Retrieve a specific symbol with sakura doc or a diagnostic with sakura explain as needed. Do not reload guides. The CLI fills the two sakura-compiler-* fields; if they do not match sakura --version, trust the installed compiler's prompt, doc and explain.

Syntax

  • Write parameter and return types on top-level functions. Pure functions omit !; effectful signatures name a row, such as ! {Console, Fail<Missing>}.
  • Calls are positional. No f<T>(x) and no f(name: value): annotate a binding to guide inference and pass a record when the API takes options.
  • Import non-prelude names explicitly, from their declaring modules: Http from std/http; Request and Payload (a body: Payload.Text(s)) from std/request. Query before guessing imports.
  • Use let for a fixed binding and var for rebinding. Collections have value semantics: List.set and Map.set return a new collection. Assign that result back to the var. Check index bounds first. Prefer List for dense integer IDs, Map for sparse keys.
  • For a zero-length case, use if n == 0 { return ... } before computing n - 1 or indexing. State the nonnegative-input requirement when needed; an empty-input guard alone does not establish it. Ranges are half-open.
  • Use fn(x) { ... } for lambdas, match for exhaustive cases, with for local handlers and try/catch for typed failures. A runtime defect is not Fail.

The edit loop

  1. Retrieve. Run sakura doc std::list::set for a known symbol or sakura doc --search "fn(List<A>) -> Int" for a type shape. With MCP, call compiler_info first, confirm workspace_root, then use symbol_query or docs_query. Without MCP, the CLI provides the same lookup/check workflow.
  2. Set the task boundary. Read the manifest, permissions and independent acceptance tests. Write signatures and contracts first; use ?body while exploring. Agree the baseline revision before repair. Do not edit tests or broaden effects, error unions or permissions merely to make a check pass.
  3. Check. Run sakura check --json. Parse one JSON object per line by kind; inspect diagnostics, holes and the final summary. For repair, add --frozen-specs all --since <baseline> with the actual agreed Git revision. A successful check may contain holes. Read their expected type, allowed effects, locals and candidates instead of treating exit 0 as completion.
  4. Repair. Use sakura explain V3001 (substitute the actual code), then make the smallest change consistent with the task. A local machine_applicable fix can help; inspect its edits. An incomplete fix still needs work. Review behavior/interface changes; never weaken contracts or widen authority to silence a diagnostic. With MCP, check interface_delta and frozen_spec_violations, pass frozen_specs: "all" to both check_patch and apply_patch, and apply against the original base snapshot; results are objects, not JSON Lines.
  5. Exercise. Fill all holes, run sakura fmt, then sakura check --json and sakura test --json. Keep independent acceptance tests unchanged. Use fake handlers or committed cassettes for external effects; do not record live requests or spend a provider budget without task authorization.
  6. Build and report. Run sakura build for the requested target (js by default). Build rejects holes with V2050. Report exact commands, results, remaining limitations and any authorized signature or permission changes.

Four complete examples

Each block is a separate file; check it with sakura check --json <file>, then run sakura test --json <file>; no test uses a live service.

Recover a typed failure

Catch only the expected tag; other failures must remain in the signature.

error Missing
fn lookup() -> Int ! {Fail<Missing>} { fail Missing }
fn fallback() -> Int { try { lookup() } catch { Missing => 0 } }
test "missing value uses the fallback" { expect_eq(fallback(), 0) }

Handle an effect locally

label stays pure because its handler supplies the operation. A local handler must implement the intended behavior, not discard the task's required effects.

effect Name { fn get() -> String }
fn label() -> String {
  with handler Name { fn get() { "Sakura" } } { Name.get() }
}
test "local name" { expect_eq(label(), "Sakura") }

Check a refinement at entry

Use validate for recoverable external input. Use from only at a boundary where violation should be a defect; do not remove the predicate to accept it.

type Percent = Int where it >= 0 && it <= 100
fn checked(n: Int) -> Percent { Percent.from(n) }
test "valid boundary" { expect_eq(checked(100), 100) }
test "invalid entry defects" { expect_defect(fn() { checked(101) }) }
test "external input can be rejected" {
  expect(Result.is_err(Percent.validate(101)))
}

Replace time with a deterministic fake

Keep the effect in the production function's row and replace its handler in the test. Query other effects' fake or replay handlers before writing a live test.

import std/instant.{Instant}
fn observed_time() -> Instant ! {Clock} { Clock.now() }
test "clock is controlled by the test" {
  let at = Instant.from_unix_millis(42)
  let seen = with Clock.fixed(at) { observed_time() }
  expect_eq(seen, at)
}

Repair by diagnostic

Read the repair table on failure or to upgrade v0.1.0 code; sakura explain CODE has the full explanation.

Completion and deeper lookup

Finish only when no holes remain, independent tests pass, the requested target builds, and contracts/tests/permissions have not been weakened. Report missing prerequisites and failing checks; never claim a skipped test passed. Read the cookbook for offline projects, the APIs changed since v0.1.0, and sakura audit/sakura verify guidance.

Load references selectively: language, API signatures, and diagnostic codes. Use only bundled templates.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.