Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

context

БесплатноБез исполняемых скриптовНе проверен

Runtime context passed to compiled closures — the world as seen from inside

SimHackerот SimHacker★ 63 звезды на GitHub17 установок в других каталогах

Об этом скилле

Context

"The context IS the world as seen from inside the closure." — Dave Ungar, on lexical scope


What Is It?

The world object is passed to every compiled closure. It provides:

  1. Standard keys — Always present (adventure, player, room, turn)
  2. Extended keys — Contextual (object, target, npc)
  3. Skill namespaces — Skills register state under world.skills.skill_name
  4. Utility functions — API for interacting with the world

Why "world" not "ctx"?

  • More evocative — closures see the WORLD
  • Self-documenting — world.player, world.room
  • Matches the mental model

Standard Keys

Always present in every world:

world.turn           // Current simulation turn
world.timestamp      // ISO timestamp

world.adventure      // Root adventure state
  .name
  .flags             // Global boolean flags
  .world_state       // Global key/value state

world.player         // Current player
  .id
  .name
  .location          // Path to current room
  .inventory         // Array of item ids
  .buffs             // Active buffs

world.room           // Current room
  .id
  .name
  .path
  .exits
  .objects
  .lighting          // 0..10

world.party          // Party state
  .members
  .leader

Extended Keys

Present when relevant:

// When running object simulate/methods:
world.object         // The object being simulated
  .id
  .state             // Object's mutable state
  // Methods are bound: world.consume_fuel(1)

// When action targets something:
world.target         // The target
  .id
  .type              // "object", "character", "room"

// When NPC is simulating:
world.npc            // The NPC
  .id
  .goals
  .state

Skill State Namespaces

Skills register state under world.skills.<skill_name> using underscores:

// Skill "economy" → world.skills.economy
world.skills.economy.gold        // 100

// Skill "pie-menu" → world.skills.pie_menu (underscore!)
world.skills.pie_menu.last_selection  // "north"

// Skill "time" → world.skills.time
world.skills.time.hour           // 14
world.skills.time.phase          // "afternoon"

Why underscores? Dashes aren't valid JS/Python identifiers. foo-bar skill → foo_bar namespace.

This keeps skill state organized and avoids collisions.


Utility Functions

Methods bound to world for interaction:

Narrative

world.emit("The lamp dies!")              // Show message
world.narrate("Darkness falls.", "dramatic")

Events

world.trigger_event("GRUE_APPROACHES", { room: world.room.path })

Inventory

world.has("brass-key")                    // true/false
world.give("gold-coins")                  // Add to inventory
world.take("used-potion")                 // Remove from inventory

Flags

world.flag("dragon_slain")                // Get flag
world.set_flag("treasure_found", true)    // Set flag

State

world.get("object.state.fuel")            // Get by path
world.set("object.state.lit", true)       // Set by path

Navigation

world.go("../maze/room-a/")               // Move player
world.can_go("north")                     // Check exit

Buffs

world.add_buff({ name: "Caffeinated", effect: { energy: +2 }, duration: 5 })
world.remove_buff("caffeinated")
world.has_buff("grue_immunity")

Logging

world.log("Debug: fuel = " + world.object.state.fuel)

Example: Lamp Simulate

simulate_js: (world) => {
  if (world.object.state.lit) {
    world.consume_fuel(1);                  // Call object method
    
    if (world.object.state.fuel <= 0) {
      world.extinguish();                   // Call object method
      world.emit("The lamp sputters and dies!");
      
      if (world.room.lighting <= 2) {
        world.trigger_event("DARKNESS_FELL");  // the grue's guard decides whether to hunt
      }
    }
  }
}

Example: Guard Expression

guard: "player has the key AND room is not dark"
guard_js: (world) => world.has("brass-key") && world.room.lighting > 2

Example: Score Calculation

score_if: "player is tired OR room is dark"
score_if_js: (world) => world.has_buff("tired") || world.room.lighting <= 2

Example: Skill State

# Skill "economy" needs to check gold
guard: "player has at least 10 gold"
guard_js: (world) => world.skills.economy.gold >= 10

# Skill "pie-menu" checks last selection
score_if: "last pie menu selection was north"
score_if_js: (world) => world.skills.pie_menu.last_selection === "north"

Design Principles

Structured, Not Arbitrary

world is NOT just a bag of key/values. It has defined structure:

  • Standard keys are always present
  • Extended keys appear in context
  • Skills namespace their state (with underscores!)
  • Functions are bound methods

Skill

Полный SKILL.md на GitHub

Установить context в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

read_file
write_file

Вложенные файлы

CARD.ymlCONTEXT.yml.tmplGLANCE.ymlREADME.mdskill-snitch-report.md

FAQ

Что делает скилл context?

Runtime context passed to compiled closures — the world as seen from inside

Как установить скилл context?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл context запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить context с