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/exercise/main.go
View on GitHubpackage main
import (
"context"
"encoding/json"
"flag"
"fmt"
"io"
"os"
"path/filepath"
"time"
)
// This file is complete. It is the wiring you write once per tool, and the only
// file here that touches os.Args, the real streams, or the user's directories.
// Everything below it is handed what it needs.
func main() {
ctx, stop := WithInterrupt(context.Background())
defer stop()
os.Exit(run(ctx, os.Args[1:], os.Stdin, os.Stdout, os.Stderr))
}
func run(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) int {
fset := flag.NewFlagSet("runner", flag.ContinueOnError)
fset.SetOutput(stderr)
timeout := fset.Duration("timeout", 30*time.Second, "give up on the child after this long")
if err := fset.Parse(args); err != nil {
return 2
}
if fset.NArg() == 0 {
fmt.Fprintln(stderr, "usage: runner [-timeout d] <program> [args...]")
return 2
}
ctx, cancel := context.WithTimeout(ctx, *timeout)
defer cancel()
res, err := Run(ctx, Command{Name: fset.Arg(0), Args: fset.Args()[1:], Stdin: stdin})
if err != nil {
fmt.Fprintf(stderr, "runner: %v\n", err)
return ExitCodeFor(err)
}
io.WriteString(stdout, res.Stdout)
io.WriteString(stderr, res.Stderr)
if err := saveLastRun(fset.Arg(0), res); err != nil {
// A cache is a nice-to-have: say so and carry on, because failing to
// record the run does not mean the run failed.
fmt.Fprintf(stderr, "runner: could not record this run: %v\n", err)
}
return res.ExitCode
}
type lastRun struct {
Command string `json:"command"`
ExitCode int `json:"exit_code"`
}
func saveLastRun(name string, res Result) error {
dir, err := AppDir(os.UserCacheDir, "runner")
if err != nil {
return err
}
if err := os.MkdirAll(dir, 0o700); err != nil {
return err
}
data, err := json.Marshal(lastRun{Command: name, ExitCode: res.ExitCode})
if err != nil {
return err
}
return WriteFileAtomic(filepath.Join(dir, "last-run.json"), data, 0o600)
}
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 |