sflow-code
Author a code-generation phase with executable tests and exactly-once publication.
SKILL.mdplugin/skills/sflow-code/SKILL.md
GitHubGoverned code
<!-- sflow-copilot-pause -->First run singularity-flow phase enter --compose --for-agent --json once in every turn, also after an interrupted one: an earlier turn's entry is context, not this turn's binding. It composes context only when admitted. Lookup from current cwd (non-Git allowed). Never search /Users, $HOME or parents for a repo. Require returned ready/workId/repositoryPath; unavailable: /sf-session or /sf-workspaces, stop. It checks pause before Git. If paused, native Copilot; only offer /sf-pause off, never resume implicitly. Otherwise follow agentGuide.readOrder once, reuse binding/recovery/clarification/references and delivered inputs from this entry; no duplicate lookups. Read clarification.checkpoint: missing answers permit questions, not drafting. Missing record is not unanswered: reuse same-binding replies; repair recording. Never ask users to supply questions or slice control instructions. Use personalization.replyName literally in replies, never artifacts or approval identity.
Output contract: Author configured artifacts from governed inputs and pinned clarification; publish only after readiness. Approved phase inputs are the earlier steps' outputs and settle what they state: never ask what they answer or search elsewhere for them. Summarize artifacts with verified Markdown-preview links; never paste document bodies, code or diffs into Copilot. For code, list touched paths and observed added/deleted/created line counts; unavailable stays unavailable. Use existing evidence, not extra calls solely for display. Summaries, links and opened previews are not human review or approval. For every next action, honor returned commandGuidance in order: Copilot, Shell, VS Code (model-free) using modelFreeCommand; if absent, say "not available for this action". Missing Copilot: "no verified equivalent". Never invent routes. On a refusal read remediationPlan: run its first read-only step once and follow context.strategy; never retry an unchanged condition or edit an earlier phase to clear it. One returned automatic plan-hash action (such as sync) may run once, then re-enter once. When a result's act.state is author, or it routes back to this skill with nothing for a person to answer, edit, review or confirm, that is this turn's own work: do it, never relay it. A file edit that does not match is not a refusal: read the file again and redo the edit. Run a check only when a returned field or command asks for it; never decide from a step's name, kind or route that it applies. A refusal saying a check does not apply to this step is not a blocker: skip it and continue. Act on a result's act first: its state, do routes and any ask. A bounded result names agentOutput.read ranges and omittedFields text files; read all in one response with your file tool. If your host saved a result to a file you cannot open, run that command again with --for-agent --json; never read the host's copy with shell tools.
Boundary: reuse entry ready/workId, valid phaseAgent; cwd=repositoryPath. Honor mutationContract. Returned workItemRoot/artifact paths only; never $HOME. Use exact CLI-returned paths. repositoryPath is command cwd, not a prefix for absolute file paths. Never rebase paths or strip .git/worktrees. Issued private/external files are exact exceptions to repository confinement, not wider read/write permission; writes still need authorization. Resolve relative paths only against their declared base. On failure, preserve the path and error; never search or recreate it.
Blocked: relay resolution.issues[].choices too. Eligible risk needs reason/expiry and authorized human confirmation. Never auto-accept risk.
- Require entry
phase,phaseAgent.valid: true,generatesCode: true,authoring.policyVerified; else relay routes, never draft sign-off. ReadmutationContract/authoringProgress: binding is not source permission; kernel-only/sf-nextcannot author. - Review
recovery,intent, test handoff and exact diffs/untracked bytes includingworkflow.json. Pending evidence: preserve files/index, repair draft; never accept evidence. Otherwise stop on protected/unrelated/unowned edits or lifecycle/authority blockers. Repair owned open-intent actions; runner repair requiresCODE_DELIVERY_TEST_COMMAND_REQUIRED(no in-scope runner: offer/sf-test-setupand keep coding). Untracked.sflow/results/**need no cleaning; review tracked/staged reports. Consumed-changed intent needs reviewed rollover; unchanged publication: relaynext, stop. Require open intent; absent:singularity-flow phase begin <phase> --jsonwith adoption/confirmation before edits/composition; never auto-adopt. Successful begin: refresh entry once. Consumed intent requires/sf-recover. - Use entry
context.text; ifnot-requestedor stale, rerun it once with<phase> --work-id <WORK-ID> --compose.not-admitted: relay blockers/next, stop. - Follow
clarification.checkpoint; off skips. Reuse same-binding human replies; ask only unanswered/changed questions withask_user(unavailable: show them and stop; stage chat replies). File-edit{"responses":[...]}atclarification.responseStagingPath; runcheckpoint.recordActionalone. On refusal preserve replies/staging; repair recording, not questions. Remove staging only on success; record before code mutation; refresh entry once. Staging is JSON only, never handwritten governed records. A new question while coding: never re-ask recorded ones. If the person here can decide it,ask_user, stage only that reply, runcheckpoint.newQuestionActionalone. Otherwise, or none is returned: keep coding on the most conservative reading, list it under## Upstream discrepancies, runsingularity-flow upstream-issue raise --from-artifact. - Verify references; refuse invalid/dirty.
generation > 0:singularity-flow revision status --for-agent --json. Source edits needcodeAuthoringReady: true, context/clarification. Preserve code/tests; prepare missing artifact viaauthoringProgress. Preparation is not authoring. - Native file-edit tool: finish behavior/tests/artifact/Agent brief and planned bindings. Keep planned test files; assert behavior, never fabricate tags. Preserve managed blocks. Doc-comment APIs; tags aren't docs. Exclude fixtures/docs/deletions/symlinks. Use the file's comment syntax (
//,#,--,/*,<!--). Product:@clause:<WORK-ID>:REQ-001 rationale(REQ|BEH|IFC|AC|CON); tests:@ac:<WORK-ID>:AC-001above the test. Honor pinned test-only opt-outs. FollowtoolProtocol.localVerificationfor tests/app start/stop and exactmutationContract.artifactsevidence. No VS Code task is required. - Follow
testExecution.handoff;argvWithheld: truemeans configured, not missing. No adoption/amendment for redaction/inference or reporter flags. Development tests are allowed during authoring; report argv/cwd/exit/failures. Publication still runs fresh governed tests; manual passes never advance. Never infer withheld argv.runnerStatus: blocked: fix that delivery finding first. No skip/list/dry-run/no-tests. Authorized dependencies only; never edit protected config, disable hooks or fabricate results. - Run
singularity-flow phase prepublish <phase> --for-agent --json --publish-if-ready(includes draft-check). Followcorrection.class/sameTurn,traceabilityRepair.actions; verify hashes, repair tags without asking. Never invent, pad, delete markers, nest models or overwrite producers.readyis not test success. Follow returnedrepairLoop.protocol; stop unchanged. - Use returned
commands.publishonce when ready unlesspublishIfReady.published; successful required tests continue publication. Advisories/requiredBefore: approvedon't hold. Absent: relaycommands.next, stop. Refusal: report command ID, argv/cwd, exit, bounded stderr/guidance. Nonzero exit fails despite passing JUnit. No test ran: relaytestRunRisk.commandto a step approver; never run it./sf-recover: proven runtime repair permits retry without source changes.ARTIFACT_AUTHORING_INCOMPLETE: recheck/retry once. Never submit/approve. publishIfReady.review: viewing only, hash-bound references. RelaypublishIfReady.nextafter publication.
TRP: singularity-flow explain test-recovery.