跳到正文
Skillpedia
数据库48k · #6144

weather-data-lifecycle-management

它能做什么

管理已下载的天气数据文件的生命周期和归属关系。这样可以确保文件在不再需要时被删除,避免它们不必要地占用存储空间。

适用场景

  • ✓当某个任务结束后留下了临时文件时。
  • ✓当程序因所用数据被过早删除而崩溃时。
  • ✓当程序被取消运行,并留下未完成的文件时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/weather-data-lifecycle-management/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/weather-data-lifecycle-management/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“在我的任务完成后,删除不再需要的临时数据。”

每周 5 个新技能,1 分钟读完。

工作原理

它会定义每个文件的“归属方”以及应保留多长时间。这样,程序就能准确知道何时可以安全地删除某个文件,而不会造成任何故障。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Weather Data Lifecycle Management

Overview

Keep downloaded and derived weather data for exactly as long as its consumer needs it. Make ownership explicit so one-shot jobs clean promptly, interactive views retain their inputs until close, and shared caches are never deleted as request cleanup.

This skill governs lifetime and ownership. It does not choose a provider, decode scientific data, or define a cache eviction policy by itself.

When to Use This Skill

  • A completed render leaves large temporary files behind.
  • An interactive view fails because its backing data was deleted too early.
  • Cancellation or exceptions leak partial downloads and derived files.
  • Request-owned files and a shared user cache are mixed together.
  • Background workers transfer ownership of data to a UI or later processing stage.

Classify Every Path

Assign each file or directory one owner and one lifetime:

Class Owner Delete when
Request workspace One operation Operation finishes or fails after durable outputs are saved
Interactive-session data Viewer or session Final consumer closes or display creation fails
Shared cache Cache manager Explicit eviction policy permits it
User export User Never as automatic request cleanup
Partial file Active writer Failure, cancellation, or successful atomic promotion

If ownership cannot be stated, do not delete the path. Resolve ownership first.

One-Shot Workflow

Use a request-specific temporary directory, keep all transient downloads and intermediate products inside it, and copy or atomically move only the requested artifact to its durable destination.

from pathlib import Path
from tempfile import TemporaryDirectory


def render_once(destination):
    destination = Path(destination)
    destination.parent.mkdir(parents=True, exist_ok=True)

    with TemporaryDirectory(prefix="weather-job-") as workspace:
        workspace = Path(workspace)
        source = fetch_into(workspace)
        temporary_output = render(source, workspace / "result.png")
        temporary_output.replace(destination)

    return destination

The final artifact must live outside the temporary directory. If replacement across filesystems is not atomic, copy to a temporary file beside the final destination, verify it, then replace locally.

Interactive Workflow

An interactive consumer outlives the worker that created its data. Transfer ownership only after the viewer or session is successfully created:

  1. The worker owns the request workspace during acquisition.
  2. If acquisition or display creation fails, the worker cleans it immediately.
  3. On successful display, attach one idempotent cleanup callback to the real consumer close or destroyed event.
  4. The consumer becomes the owner; the worker must not also delete the data in its ordinary finally path.
  5. If multiple consumers share the same data, release it only after the final lease closes.

Do not tie cleanup to a temporary dialog, local variable, or signal that can fire before the actual consumer is finished.

Failure and Cancellation Rules

  • Keep incomplete downloads under a distinct suffix or directory so they cannot be mistaken for valid data.
  • Close datasets, file handles, and memory maps before removing their paths.
  • Put request-owned cleanup in finally, but exclude resources whose ownership was successfully transferred.
  • Make cleanup idempotent; a cancellation signal and a close event may race.
  • Preserve a durable partial-result manifest when the user can retry remaining work.
  • On cleanup failure, report the exact owned path without deleting broader parent directories.

Shared Cache Boundary

  • A request may read or populate a shared cache but does not own the cache root.
  • Promote validated entries atomically; never expose a partial file as a hit.
  • Use cache identity and eviction metadata rather than deleting files by age or filename guesswork inside request code.
  • Do not place user exports inside a directory that normal cache cleanup owns.
  • Test that two concurrent consumers do not remove data still leased by the other.

Verification Checklist

  • Every created path has a named owner and deletion event.
  • One-shot operations retain only requested durable outputs.
  • Interactive data remains available until the final consumer closes.
  • Display-creation failure cleans immediately.

…

常见问题

为什么要管理数据的生命周期?

这样可以避免不必要的文件占用电脑空间,同时确保需要的文件不会被提前删除。

如果不使用这个工具,会怎样?

你可能会积累大量临时文件;更糟糕的是,程序可能因所需数据被删除而无法正常运行。

这个工具会删除我的个人文件吗?

不会。它专门用于管理特定任务的临时数据和缓存。个人文件或用户导出的文件不会被自动删除。

详情

作者的原始描述

Manage ownership, retention, and cleanup of downloaded weather data across one-shot jobs, interactive viewers, caches, failures, and cancellation.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#6144
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能