fileflow-pathologize

A guide to two Go libraries for moving files safely and making filenames valid across operating systems. It covers moves, copies, renames, downloads, extraction, imports, and generated paths.

In plain words
What is it for?
Use it when moving or copying files, handling name conflicts, processing user-provided filenames, or building download and upload workflows in Go.
Why use it?
Basic file operations can fail when source and destination are on different filesystems, overwrite existing data, or create names that work on one operating system but not another. These libraries address those cases.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/pascalebeier/hitkeep/fileflow-pathologize
Any agent
npx skills add PascaleBeier/hitkeep --skill fileflow-pathologize
Clone the repo
git clone --depth 1 https://github.com/PascaleBeier/hitkeep

Made for: Claude Code, Codex.

Per session 151 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,226 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00151 $0.03226
Opus 5 $0.00076 $0.01613
Sonnet 5 $0.00030 $0.00645
Haiku 4.5 $0.00015 $0.00323

Measured yesterday against content hash 46737a2f2bd1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fileflow-pathologize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/fileflow-pathologize/SKILL.md · 306 lines

How it starts

The opening of the file, as written. The whole thing — 306 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Safe File Operations: fileflow & pathologize

Two small, composable spf13 libraries that handle the two things naive file code gets wrong: moving files safely (fileflow) and making names safe (pathologize).

When to Activate

  • Moving, copying, or renaming files — especially across drives/volumes
  • Handling the "destination already exists" case without clobbering data
  • Seeing invalid cross-device link / EXDEV from os.Rename
  • Building a destination path from a filename, user input, or a regex capture
  • Downloaders, extractors, importers, file organizers, upload handlers
  • Anywhere you were about to write os.Rename + io.Copy + filepath.Clean by hand

Why These Over the Standard Library

os.Rename fails across filesystems (EXDEV) and silently overwrites the destination. filepath.Clean normalizes .. but does not remove characters that are illegal on other operating systems, and does nothing about reserved names (CON, NUL). And path/filepath validates against the host OS only — a name that is fine on Linux can break the moment the file syncs to a Windows client. These libraries close all of these gaps and compose cleanly.

The Core Pattern: Join a trusted root with untrusted parts, then move

The single most important pattern. Use pathologize.Join to combine a trusted root with untrusted path parts (regex captures, user input, scraped titles), then move with fileflow. Join sanitizes each part and guarantees it stays lexically under the root — a part can't inject an absolute path or ../ its way out.

import (
    "path/filepath"

    "github.com/spf13/fileflow"
    "github.com/spf13/pathologize"
)

// destRoot is trusted (a configured directory); id/name are untrusted.
dstDir := pathologize.Join(destRoot, "ig", id)   // parts sanitized + contained
dst := filepath.Join(dstDir, filepath.Base(src))

final, err := fileflow.Move(src, dst)            // cross-fs safe, conflict safe
if err != nil {
    return err
}
// final is where the file actually landed (may be suffixed on conflict).

Read the full file on GitHub · 306 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 306 lines · 151 tokens per session scan A 46737a2f2bd1

Subscribe to this mod's changes

fileflow-pathologize is a skill published in the GitHub repository PascaleBeier/hitkeep (85 stars, last pushed 2d ago), licensed MIT. It adds 151 tokens to every session and 3,226 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

dd-code-generation

Use pup CLI for immediate Datadog operations or generate code for integration into applications.

DataDog/pup · 16 tokens

authoring-ci-workflows

Use when adding or editing a GitHub Actions workflow, composite action, or reusable workflow under .github/ — new CI jobs, triggers, matrices, checkout/clone tuning, action pinning, GitHub App token auth, concurrency groups, timeout-minutes, paths filters, caching, or runner choice. Covers PostHog's workflow-authoring…

PostHog/posthog · 193 tokens

monitoring-capture-service

Guide for using the Grafana MCP to monitor and diagnose the capture service (rust/capture) in production. Use when investigating latency, event loss, Kafka backpressure, Redis issues, rate limiting, Envoy proxy issues, or any capture health question. Covers prod-us and prod-eu environments.

PostHog/posthog · 66 tokens

qa-frontend

Internal PostHog developer frontend/browser QA skill. Use only when a PostHog developer explicitly asks to run frontend QA, browser-test a PR, verify a UI flow against the local PostHog stack, use qa-frontend, or QA current frontend changes with browser/runtime evidence. Do not use for generic code review, PR review…

PostHog/posthog · 142 tokens

building-product-empty-states

Guide for adding a product setup empty state — the skippable first-run screen a product scene shows until real data arrives, built on the shared ProductEmptyState component. Use when adding an empty state or first-run/setup screen to a product scene, declaring emptyState on a SceneExport, writing a product…

PostHog/posthog · 124 tokens

django-migrations

Django migration patterns and safety workflow for PostHog. Use when creating, adjusting, or reviewing Django/Postgres migrations, including non-blocking index/constraint changes, multi-phase schema changes, data backfills, migration conflict rebasing, and product model moves that require SeparateDatabaseAndState. Also…

PostHog/posthog · 99 tokens