qtsone/learning / skills/tutor
tutor
FlaggedTurn this agent into a personal programming tutor with a versioned 0-to-expert curriculum (Go available; more languages coming). Use when the user wants to learn a programming language, start or resume lessons, get their exercise code graded, check learning progress, or contribute curriculum fixes — e.g. "/tutor go", "/tutor resume", "teach me Go", "continue my lessons", "grade my exercise".
curriculum/content/focus/cli-tooling/files-processes/solution/signal.go
View on GitHubpackage main
import (
"context"
"errors"
"os"
"os/signal"
"syscall"
)
// Exit codes this tool uses. 0 and 1 are universal; the other two are shell
// conventions worth following, because scripts already read them:
//
// 124 is what timeout(1) returns when it had to give up,
// 130 is 128+2, the status a shell reports for a program killed by SIGINT.
const (
ExitOK = 0
ExitFailure = 1
ExitTimeout = 124
ExitInterrupted = 130
)
// WithInterrupt returns a copy of parent that is cancelled the first time this
// process receives SIGINT (Ctrl-C) or SIGTERM (the polite "please stop" that
// init systems, Docker and Kubernetes send before they resort to SIGKILL).
//
// Nothing slow happens on the signal itself: the only effect is that a context
// becomes done, and the ordinary code already watching it — your work loop,
// os/exec, anything from S3 — unwinds and cleans up.
//
// The returned stop function releases the registration and restores the default
// behaviour, so a Ctrl-C after it kills the program the usual way. Always defer
// it.
func WithInterrupt(parent context.Context) (context.Context, context.CancelFunc) {
// os.Interrupt is SIGINT and is the one name that also means something on
// Windows; syscall.SIGTERM is declared on every platform Go supports, so
// this compiles everywhere without a build tag.
return signal.NotifyContext(parent, os.Interrupt, syscall.SIGTERM)
}
// ExitCodeFor maps the error a run finished with onto this process's exit
// status: nil is ExitOK, a cancelled context is ExitInterrupted, an expired
// deadline is ExitTimeout, and anything else is ExitFailure.
//
// It has to see through wrapping — the error it is handed will usually be a
// *StepError, or something wrapped with %w on the way up.
func ExitCodeFor(err error) int {
switch {
case err == nil:
return ExitOK
// Order matters only in that both must be checked before the default: a
// deadline that has expired is not context.Canceled.
case errors.Is(err, context.DeadlineExceeded):
return ExitTimeout
case errors.Is(err, context.Canceled):
return ExitInterrupted
default:
return ExitFailure
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |