From agent-system
Search and apply reusable Luau patterns before writing or modifying code. Prevents re-discovering known solutions.
npx claudepluginhub nanana291/agent-system --plugin agent-systemThis skill uses the workspace's default tool permissions.
Use this skill **before writing or modifying any Luau code** to find and apply proven patterns.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Migrates code, prompts, and API calls from Claude Sonnet 4.0/4.5 or Opus 4.1 to Opus 4.5, updating model strings on Anthropic, AWS, GCP, Azure platforms.
Automates semantic versioning and release workflow for Claude Code plugins: bumps versions in package.json, marketplace.json, plugin.json; verifies builds; creates git tags, GitHub releases, changelogs.
Use this skill before writing or modifying any Luau code to find and apply proven patterns.
Use when: A remote is called repeatedly (auto farm, auto skills, teleport).
-- Pattern: Circuit breaker remote protection
local REMOTE_FAILURES = 0
local REMOTE_MAX_FAILURES = 6
local remoteDisabled = false
local function SafeRemoteCall(remoteMethod, ...)
if remoteDisabled then return nil end
local ok, result = pcall(remoteMethod, ...)
if not ok then
REMOTE_FAILURES += 1
if REMOTE_FAILURES >= REMOTE_MAX_FAILURES then
remoteDisabled = true
warn("[CircuitBreaker] Remote disabled after " .. REMOTE_MAX_FAILURES .. " failures")
end
return nil
end
REMOTE_FAILURES = 0
return result
end
Rules:
Use when: Script stores Character, HumanoidRootPart, or Humanoid references that break on death.
-- Pattern: Character rebind via CharacterAdded
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
LocalPlayer.CharacterAdded:Connect(function(newChar)
Character = newChar
end)
-- Inside every loop, validate before use:
local Root = Character:FindFirstChild("HumanoidRootPart")
if not Root then task.wait() continue end
Rules:
CharacterAdded at script startHumanoidRootPart existenceHumanoidRootPart in a variable without re-checkingUse when: A taskSpawn loop fires remotes, yields, or does unsafe operations.
-- Pattern: pcallRef-cached loop
local pcallRef = pcall
taskSpawn(function()
while task.wait(interval) do
local Root = Character and Character:FindFirstChild("HumanoidRootPart")
if not Root then continue end
local ok, err = pcallRef(function()
-- action code here (remote calls, math, property writes)
end)
if not ok and err then
warn("[Loop] Error: " .. tostring(err))
end
end
end)
Rules:
pcall as pcallRef at the top of the filepcallRefUse when: Migrating from Obsidian toggles to LibSixtyTen UI sections.
-- Pattern: LibSixtyTen section with toggle + paragraph
local Section = Lib:BuildSection(LibWindow, {
Type = "Section",
Title = "Auto Farm",
})
Section:BuildToggle({
Title = "Enabled",
Callback = function(Value)
AutoFarmEnabled = Value
-- Start/stop loop lifecycle here, NOT inline action
end,
})
Section:BuildParagraph({
Title = "Status",
Text = function()
return AutoFarmEnabled and "Running" or "Stopped"
end,
})
Rules:
Use when: A script has >10 local declarations that could be merged.
-- Before (high pressure):
local t_insert = table.insert
local m_huge = math.huge
local str_fmt = string.format
local pcallRef = pcall
local taskWait = task.wait
-- After (consolidated):
local t_insert, m_huge, str_fmt, pcallRef, taskWait =
table.insert, math.huge, string.format, pcall, task.wait
Rules:
Use when: A feature needs visible status feedback.
-- Pattern: BuildBasicStatus for simple toggles
local function BuildBasicStatus(featureName, enabled)
return string.format("%s: %s", featureName, enabled and "✅ On" or "❌ Off")
end
-- Pattern: BuildDetailedStatus for complex features
local function BuildDetailedStatus(featureName, enabled, extra)
return string.format("%s: %s | %s",
featureName,
enabled and "✅" or "❌",
extra or "N/A"
)
end
Rules:
Use when: A toggle needs to start and stop a background loop cleanly.
-- Pattern: StartLoop / StopLoop
local activeLoop = nil
local function StopLoop()
if activeLoop then
activeLoop = nil -- signal loop to exit
end
end
local function StartLoop()
StopLoop() -- prevent duplicates
activeLoop = {}
taskSpawn(function()
local loopId = activeLoop
while task.wait(0.5) do
if activeLoop ~= loopId then return end -- stale loop
-- action
end
end)
end
Rules:
loopId) to kill stale loopscoroutine.yield for loop controlactiveLoop = nil is the kill signalbrain search <pattern-name> for workspace-specific variantsbrain add it with the pattern tagWhen recording or searching, use these tags:
remote-safety — patterns 1, 3character-lifecycle — pattern 2ui-wiring — patterns 4, 6local-pressure — pattern 5thread-management — pattern 7v2-migration — patterns 4, 5, 6circuit-breaker — pattern 1pcall-pattern — pattern 3