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/paths.go
View on GitHubpackage main
import (
"errors"
"fmt"
"path/filepath"
)
// ErrUnsafePath reports a path that would escape the directory it was supposed
// to stay inside, or a name that is not a single plain path element.
var ErrUnsafePath = errors.New("unsafe path")
// AppDir returns the per-user directory for app inside the directory base
// reports. Pass os.UserConfigDir for settings the user edits and keeps, and
// os.UserCacheDir for anything you could regenerate:
//
// dir, err := AppDir(os.UserConfigDir, "runner")
//
// base is a parameter rather than a call to os.UserConfigDir inside this
// function for the reason the whole pack keeps repeating: the seam is what lets
// a test answer the question without owning a home directory.
//
// AppDir does not create the directory — that is the caller's job, with
// os.MkdirAll and a mode of 0o700.
//
// An app name that is not a single plain path element — "", ".", "..", "a/b",
// "/etc" — is an error wrapping ErrUnsafePath. An error from base is wrapped,
// not swallowed, so the caller learns which directory could not be found.
func AppDir(base func() (string, error), app string) (string, error) {
// IsLocal rules out empty, absolute, rooted and escaping names, and Windows
// device names such as NUL. It accepts ".", which is a fine path and a
// terrible application name.
if !filepath.IsLocal(app) || app == "." || app != filepath.Base(app) {
return "", fmt.Errorf("%w: %q is not an application name", ErrUnsafePath, app)
}
dir, err := base()
if err != nil {
return "", fmt.Errorf("locating the directory for %q: %w", app, err)
}
return filepath.Join(dir, app), nil
}
// SafeJoin joins rel onto root and guarantees the result stays under root, so
// that a path arriving from a config file, an archive entry or a command line
// cannot reach /etc/passwd. rel is cleaned on the way: "a/../b" is "b".
//
// A rel that is absolute, rooted, empty, or escapes with ".." is an error
// wrapping ErrUnsafePath whose message names the offending path.
func SafeJoin(root, rel string) (string, error) {
if !filepath.IsLocal(rel) {
return "", fmt.Errorf("%w: %q must stay inside %q", ErrUnsafePath, rel, root)
}
return filepath.Join(root, rel), nil
}
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 |