claudeskill

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claudeskill installs, checks and removes the hopsesh skill for Claude Code: a personal skill at <claude config dir>/skills/hopsesh that teaches Claude to list and move sessions with the hopsesh CLI (plan first, move only after the user says yes).

The files are rendered from templates in this binary. An install record (.hopsesh-install.json, beside SKILL.md) keeps the hash of every file hopsesh wrote, so a skill is "current" (matches this build), "stale" (written by an older hopsesh and not edited since: safe to replace), "modified" (the user edited it: never overwritten without force), "foreign" (a skill called hopsesh that hopsesh did not write), "broken" or absent.

Index

Constants

View Source
const (
	Absent   = "absent"
	Current  = "current"
	Stale    = "stale"
	Modified = "modified"
	Foreign  = "foreign"
	Broken   = "broken"
)

States of an installed skill.

View Source
const Format = "1"

Format changes when the skill's structure changes in a way older hopsesh versions would not understand.

View Source
const Name = "hopsesh"

Name is the skill's name and folder.

Variables

View Source
var ErrForeign = errors.New("a skill called hopsesh already exists and was not installed by hopsesh")

ErrForeign means a skill called hopsesh exists that hopsesh did not install.

View Source
var ErrModified = errors.New("the hopsesh skill was edited after hopsesh installed it")

ErrModified means the skill was edited by the user; Install needs force to replace it.

Functions

func AddRules

func AddRules(settingsPath, bin string) ([]string, error)

AddRules merges Rules into a Claude Code settings.json (creating it if needed), keeping everything else and a backup of the previous file. It returns the rules it added.

func Dir

func Dir(configDir string) string

Dir is the skill folder under a Claude Code config dir.

func HasRules

func HasRules(settingsPath, bin string) bool

HasRules reports whether the settings already carry every hopsesh rule.

func Remove

func Remove(configDir string, p Params, force bool) error

Remove deletes the skill when hopsesh owns it unchanged (current, stale or broken), or with force.

func Render

func Render(p Params) (map[string][]byte, error)

Render returns the skill's files (name → content) for these parameters.

func Rules

func Rules(bin string) (allow, ask []string)

Rules are the permission rules hopsesh can add to Claude Code's settings: read-only commands allowed, moves and undo always asking (even in auto mode).

Types

type Params

type Params struct {
	Bin     string // how Claude should run hopsesh: "hopsesh" or an absolute path
	Version string
	Format  string
}

Params fill the templates.

type Record

type Record struct {
	Format  string            `json:"format"`
	Version string            `json:"hopseshVersion"`
	Bin     string            `json:"bin"`
	Files   map[string]string `json:"files"` // name → sha256
}

Record is the install record.

type Status

type Status struct {
	State     string   `json:"state"`
	Dir       string   `json:"dir"`
	Version   string   `json:"installedVersion,omitempty"`
	Bin       string   `json:"bin,omitempty"`
	Changed   []string `json:"changedFiles,omitempty"` // files the user edited (modified)
	NewSkills bool     `json:"newSkillsFolder,omitempty"`
}

Status describes the skill on disk.

func Check

func Check(configDir string, want Params) (Status, error)

Check reports the state of the skill compared with what this build would write.

func Install

func Install(configDir string, p Params, force bool) (Status, error)

Install writes (or updates) the skill. A skill the user edited, or one hopsesh did not write, is only replaced with force (the old folder is kept as skills/hopsesh.bak-N).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL