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/capstone/exercise/root.go
View on GitHubpackage main
import (
"context"
"errors"
"fmt"
"io"
"github.com/spf13/cobra"
)
// Execute builds the tree, runs it, and returns the process exit code. It is
// the seam between "a program" and "a function": main is a shell around this,
// and tests call it directly to assert on exit codes and stderr.
//
// Provided complete — note that it is the only place that prints an error.
func Execute(ctx context.Context, app *App, args []string, out, errw io.Writer) int {
if args == nil {
args = []string{} // SetArgs(nil) makes cobra fall back to os.Args[1:]
}
root := NewRootCmd(app)
root.SetOut(out)
root.SetErr(errw)
root.SetArgs(args)
err := root.ExecuteContext(ctx)
switch {
case err == nil:
case errors.Is(err, context.Canceled):
fmt.Fprintln(errw, "scout: interrupted")
default:
fmt.Fprintln(errw, "scout:", err)
}
return exitCode(err)
}
// NewRootCmd builds a fresh command tree bound to app. Fresh matters: a
// cobra.Command stores parsed flag values on itself, so a shared tree leaks the
// previous run's flags into the next one.
//
// The tree:
//
// scout --json --color --config --ignore --version
// ├── scan [dir] --top
// ├── authors [dir] --limit
// └── version
//
// TODO: build it.
// - Silence cobra's own error and usage printing: Execute is the one place
// that reports a failure.
// - --json, --color, --config and --ignore are persistent (the whole tree);
// --top, --limit and --version are local to one command each.
// - SetFlagErrorFunc turns every parse failure into an ErrUsage error, so
// exitCode can return 2 without any handler knowing about exit codes.
// - Handlers call app.Resolve(cmd), write to cmd.OutOrStdout(), pass
// cmd.Context() to anything that can block, and return errors instead of
// calling os.Exit.
// - `scout` with no arguments prints help and succeeds; `scout --version`
// prints the same thing `scout version` does, in whichever format the
// settings say.
func NewRootCmd(app *App) *cobra.Command {
root := &cobra.Command{
Use: "scout",
Short: "Repository statistics without leaving the terminal",
Long: "scout walks a directory and reports what is in it: files, lines and\n" +
"bytes by extension, and who has been committing.\n\n" +
"Exit codes: 0 success, 1 failure, 2 bad usage, 130 interrupted.",
Args: cobra.NoArgs,
}
return root
}
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: 470k | 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 |