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/solution/render.go
View on GitHubpackage main
import (
"encoding/json"
"fmt"
"io"
"strings"
)
const (
Reset = "\x1b[0m"
Bold = "\x1b[1m"
)
// Column widths are shared by the header and the rows so the two cannot drift.
const (
scanHeaderFmt = "%-10s %6s %8s %10s"
scanRowFmt = "%-10s %6d %8d %10d"
)
// Renderer owns every byte the tool puts on stdout. It is handed the resolved
// Settings, so no rendering code re-decides whether colour is allowed.
type Renderer struct {
out io.Writer
color bool
json bool
}
func NewRenderer(out io.Writer, set Settings) *Renderer {
return &Renderer{out: out, color: set.Color, json: set.JSON}
}
// Paint wraps s in the codes and one Reset — or returns it untouched when
// colour is off. Callers pad *before* painting: an escape sequence has no
// width, so %-10s on a painted string pads by bytes and ruins the columns.
func (r *Renderer) Paint(s string, codes ...string) string {
if !r.color || len(codes) == 0 || s == "" {
return s
}
return strings.Join(codes, "") + s + Reset
}
func (r *Renderer) writeJSON(v any) error {
return json.NewEncoder(r.out).Encode(v)
}
// RenderScan writes the scan report: a JSON document, or a human table.
func (r *Renderer) RenderScan(res ScanResult) error {
if r.json {
return r.writeJSON(res)
}
if res.Files == 0 {
_, err := fmt.Fprintln(r.out, "no files")
return err
}
header := fmt.Sprintf(scanHeaderFmt, "ext", "files", "lines", "bytes")
if _, err := fmt.Fprintln(r.out, r.Paint(header, Bold)); err != nil {
return err
}
for _, e := range res.Exts {
row := fmt.Sprintf(scanRowFmt, e.Ext, e.Files, e.Lines, e.Bytes)
if _, err := fmt.Fprintln(r.out, row); err != nil {
return err
}
}
total := fmt.Sprintf(scanRowFmt, "total", res.Files, res.Lines, res.Bytes)
_, err := fmt.Fprintln(r.out, r.Paint(total, Bold))
return err
}
// RenderAuthors writes the author ranking.
func (r *Renderer) RenderAuthors(list []Author) error {
if r.json {
// A document, not a bare array: {"authors":[…]} can grow a field later
// without breaking every consumer.
return r.writeJSON(struct {
Authors []Author `json:"authors"`
}{Authors: list})
}
if len(list) == 0 {
_, err := fmt.Fprintln(r.out, "no commits")
return err
}
for _, a := range list {
if _, err := fmt.Fprintf(r.out, "%6d %s\n", a.Commits, a.Name); err != nil {
return err
}
}
return nil
}
// RenderVersion writes the build metadata patched in by -ldflags.
func (r *Renderer) RenderVersion(info BuildInfo) error {
if r.json {
return r.writeJSON(info)
}
_, err := fmt.Fprintf(r.out, "scout %s (commit %s, built %s, %s, %s)\n",
info.Version, info.Commit, info.Date, info.Go, info.Platform)
return err
}
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: 469k | 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: 321k | 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: 321k | 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: 321k | Updated | Claude CodeCodex | Verified | Install |