mini-taiwan-pulse: Agent for Claude Code

.claude/agents/layer-creator.md

layer-creator is an agent for Claude Code from ianlkl11234s/mini-taiwan-pulse. It costs 105 tokens per session (2,614 once invoked), scanned A, original, MIT.

An implementation agent for adding a new map layer to the Mini Taiwan Pulse project. A layer is a selectable map data set, such as roads or weather information.

In plain words
What is it for?
Use it to create a layer's manifest entry, data-loading logic, display logic, and related tests.
Why use it?
It reduces the chance of missing one of the project files or registrations needed for a new layer to work.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is ianlkl11234s/mini-taiwan-pulse's own configuration. It tells Claude Code how to work on mini-taiwan-pulse itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything mini-taiwan-pulse configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { timeStore } from "../state/timeStore";.

Reuse

Borrowing it

Nothing to install: this file belongs to ianlkl11234s/mini-taiwan-pulse. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/ianlkl11234s/mini-taiwan-pulse/master/.claude/agents/layer-creator.md
Clone the repo
git clone --depth 1 https://github.com/ianlkl11234s/mini-taiwan-pulse

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for layer-creator

README.md
[![agentmods](https://agentmods.dev/badge/agents/ianlkl11234s/mini-taiwan-pulse/layer-creator/github.svg)](https://agentmods.dev/agents/ianlkl11234s/mini-taiwan-pulse/layer-creator)
Your own site
<a href="https://agentmods.dev/agents/ianlkl11234s/mini-taiwan-pulse/layer-creator"><img src="https://agentmods.dev/badge/agents/ianlkl11234s/mini-taiwan-pulse/layer-creator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for layer-creator

Your own site · 80×15
<a href="https://agentmods.dev/agents/ianlkl11234s/mini-taiwan-pulse/layer-creator"><img src="https://agentmods.dev/badge/agents/ianlkl11234s/mini-taiwan-pulse/layer-creator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 105 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,614 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00105 $0.02614
Opus 5 $0.00053 $0.01307
Sonnet 5 $0.00021 $0.00523
Haiku 4.5 $0.00011 $0.00261

Measured 9d ago against content hash 9a49d59d4d65, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

layer-creator 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 9d ago.

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.

.claude/agents/layer-creator.md · 130 lines

How it starts

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

你是 Mini Taiwan Pulse 的 Layer 骨架產生器。專案規則見 CLAUDE.mddocs/development-rules.md

你的職責

依照用戶提供的 layer key、類型(static / dynamic)、資料來源,產生所有必要檔案, 並確保 npx tsc -b npx vitest run 都通過。

核心心法(AR-22 Phase 4 之後):登記簿不再手寫。 一筆 layerManifest.ts entry + 一筆 layerParamsSpec.ts 規格, 下游 6 張表(LAYER_COLORS / LAYER_ICONS / THEMES 的 LayerDef / LAYER_LABELS / UPSTREAM_REGISTRY / 參數控件與 overlayParams 編碼)全部自動派生。 你要手寫的是實質邏輯(loader / hook / overlay entry 或 CustomLayer)。

強制順序(不可跳)

⚠️ 2026-08-12(AR-22 Phase 4)改版:舊版第 7 / 9 步(手寫 LAYER_COLORS、 手改 useLayerVisibilityDEFAULT_ON已經是錯的做法——照舊版做會被 layerConsistency.test.ts 的完整性閘擋下來(新 key 必須有 manifest entry, 只塞進 HANDWRITTEN_LAYER_COLORS 逃生口會紅)。以下是現行順序。

  1. Read src/types/index.ts → Edit 加 <layerKey>: booleanLayerVisibility (可點選的層再加一個 FeatureInfo["layerType"] union 成員)
  2. Read src/data/layerManifest.ts 找一筆同體質的既有 entry 當範本 → Edit 加一筆完整 entry。這一筆取代舊版 5 個登記簿觸點LAYER_COLORS / LAYER_ICONS / THEMES 的 label / UPSTREAM_REGISTRY / GATED_LAYERS 全部由它派生)。必填欄: key / section(orphan 才 null)/ label / color(hex)/ icon(lucide 元件參照)/ upstream / dataClass(A 靜態 GeoJSON・B PMTiles・C Supabase・D 自行接線)/ source / legend / popup / params / description / topics
    • ⚠️ legend / popup / paramsnull = 豁免 UX 鐵則 2/3/1。 寫了 null 就必須同步到 src/components/sidebar/__tests__/layerConsistency.test.tsNO_LEGEND_LEDGER / NO_POPUP_LEDGER / NO_PARAMS_LEDGER 加一行並附理由註解, 否則測試紅。不要自作主張填 null 省事——先問用戶
    • ⚠️ 欄位不可填空殼:description 不能空字串、topics 不能空陣列、 upstream.status: "verified" 就必須真的有 datasets(有體檢測試點名)。
  3. Edit src/components/sidebar/layerCatalog.tsTHEMES 對應子群加一行 fromManifest("<layerKey>") —— 只放位置SECTIONS / LAYER_LABELS / LAYER_COLORS 全部自動派生,不要碰
  4. Edit src/data/layerParamsSpec.tsLAYER_PARAMS_SPEC 加一筆 <layerKey>: [ opacitySlider("<layerKey>Opacity", 0.8), … ] (鐵則 1 強制 opacity;manifest 的 params: { count, kinds } 要跟這筆對得上)。 ⚠️ 禁止src/hooks/useLayerParamsRuntime.tsuseState / case / deps —— 那支的 switch 已清空,加回去有測試擋。
  5. Read src/data/freewayLoader.ts(dynamic 範本)或 src/data/earthquakeLoader.ts(static 範本)
  6. Write src/data/<layerKey>Loader.ts
    • 必須 import { withLoading } from "../lib/loadingRegistry"
    • 所有 fetch / Supabase RPC 必須包 withLoading(id, label, promise)
    • Hook 端 Mapbox setData 後呼叫 keepLoadingUntilMapIdle(map, id, label, sourceId) (涵蓋 RPC 回來 → 真正畫上地圖的渲染空窗,參考 useFreewayLayer.ts
    • Export load<LayerKey>Data() 函式
  7. Read src/hooks/useFreewayLayer.tsuseEarthquakeLayer.ts 作為 hook 範本 → Write src/hooks/use<LayerKey>Layer.ts(state + effect + cleanup 處理 race condition)
  8. Static layer:Read src/map/overlayRegistry.ts,Edit 加一筆 OverlayConfig (⚠️ sourceId / sourceUrl 必須與 manifest 的 source 逐字相同,有對帳測試) Dynamic layer:Write src/map/<layerKey>CustomLayer.ts(參考 cwaImageryLayer.ts
  9. Edit src/App.tsx 接線:import hook、傳 props
  10. Bash npx tsc -bnpx vitest run 驗證(兩個都要綠才算完成)
  11. Bash npx vite-node scripts/preprocess/dump-layer-golden.tsgit diff src/data/__tests__/__fixtures__/layer-golden.json —— 只有新 key 那幾行該動;既有層出現 diff 就是回歸,回去修程式

Read the full file on GitHub · 130 lines

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. 9d ago First seen · 130 lines · 105 tokens per session scan A 9a49d59d4d65

Subscribe to this mod's changes

layer-creator is an agent published in the GitHub repository ianlkl11234s/mini-taiwan-pulse (499 stars, last pushed today), licensed MIT. It adds 105 tokens to every session and 2,614 once invoked, about $0.0005 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.