From terse
Improve an existing Terse SDK job. Use when the user wants to optimize, fix, refactor, or enhance an automation — better prompts, smarter filtering, type safety, error handling, or tool usage.
How this skill is triggered — by the user, by Claude, or both
Slash command
/terse:improve <job-name><job-name>The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Improve the Terse job named: **$ARGUMENTS**
Improve the Terse job named: $ARGUMENTS
The bundled sdk-reference.md is a quick offline cheat sheet, but Terse evolves fast. Always pull the live docs before making non-trivial changes:
terse command, including history, replay, and test.If anything in the bundled reference disagrees with the live docs, trust the live docs.
Do not search or read node_modules/. Everything you need is in src/terse.jobs.ts, src/terse.generated.ts, the bundled sdk-reference.md, and live Terse docs — not inside dependency install dirs.
src/terse.generated.ts is the source of truth for connected integrations, available triggers, skills, resources, and deterministic wrappers. Read it alongside the job implementation. Do not run terse integrate list — the generated file already reflects what terse integrate connected.
If src/terse.generated.ts is missing or stale for the integrations the job uses, rerun terse generate instead of guessing at missing helpers. Never edit the generated file directly.
Open src/terse.jobs.ts and src/terse.generated.ts. Find the job matching the requested name and read the full implementation — triggers, skills, filter, and handler.
The CLI can still load src/index.ts as a legacy fallback, and custom layouts can override the entry file with --entry-file.
Before guessing at improvements, look at how the job has actually behaved in production. The terse history CLI command fetches past runs from the deployed agent so you can see what went wrong.
Recommended invocations (see https://docs.useterse.ai/reference/cli for the full flag list):
# Recent runs as JSON, with the trigger event payload for each one (cheap, ideal for this skill)
terse history "<job-name>" --json --triggers --limit 20
# Narrow to failures only
terse history "<job-name>" --json --triggers --status failed,cancelled --limit 20
# Full chat history (model events + trigger event) for a single run — heavier, use when you need to see exactly what the agent decided
terse history --run-id <run-id> --json
If a JSON-mode command returns a structured { "error": ... } envelope with actionRequired: true, or exits with code 2, stop and surface the required next step or URL instead of treating it as a code bug.
What to look for:
runAndWait doing deterministic work (toolbox / agent.tools would be correct). Check chat history for wrong tool picks or hallucinated parameters.If the user has not deployed the job yet (no agent found), skip this step and rely on the source code plus sample events from terse test list.
Evaluate each area below. Not every area will need changes — focus on the ones that make the biggest difference. Start with Tool usage — moving work from the agent to toolbox is usually the highest-impact fix.
toolbox (no agent) or agent.tools.* — not runAndWait. Read available methods in src/terse.generated.ts.TerseAgent entirely and call toolbox directly.skills break model-driven tool use inside run() / runAndWait(), but they do not limit toolbox or agent.tools.*.toolbox.slack.sendMessage), then a narrow runAndWait for the part that needs reasoning (thread reply with summary).message.message_ts for threading).event.formatForAgentRunner()?event.sender.login.includes("[bot]"))src/terse.generated.ts over an agent run. Use agent.tools.* or agent.executeTool().skills break model-driven tool use inside run() / runAndWait(), but they do not automatically prevent direct deterministic calls from code.agent.tools.slack.sendMessage(), then use agent.runAndWait() to post an AI-generated summary as a thread reply.agent.tools.*, capture the return value if subsequent steps need it (e.g., message.message_ts for threading).run() / runAndWait() listed? If the prompt tells the model to post to Slack but Slack isn't in skills, that agentic step will fail.Edit src/terse.jobs.ts (or the repo's configured --entry-file). Make the changes. If you connected a new integration or need updated helpers, rerun terse generate and reopen src/terse.generated.ts — never edit the generated file by hand.
Don't hand the change back without proving it still works. Two complementary loops:
Replay the exact production run that failed. If you used terse history in step 2 to find a bad run, replay it locally with the new code:
terse replay <run-id>
terse replay fetches the original serialized trigger event from the Terse backend and runs your job's onTrigger against it locally with verbose agent output. This is the fastest way to confirm the bug you saw in production is actually fixed.
Or run against fresh sample events non-interactively. When there is no specific run to reproduce, or to make sure you didn't regress the happy path:
terse test list "<job-name>" --json
terse test show <id> "<job-name>" --json
terse test run "<job-name>" --id <id>
terse test list pulls real sample events from the backend (or generates synthetic ones for cron and webhook triggers) and assigns content-addressed ids.
terse test show lets you inspect a specific cached sample before running it.
terse test run executes the handler without requiring a TTY.
If multiple jobs exist, pass the job name explicitly because non-interactive job loading cannot prompt.
Reserve bare terse test for manual interactive sessions only.
For all of these commands, see https://docs.useterse.ai/reference/cli for the full option list.
After local execution looks healthy, run the typechecker so the change is statically valid before deploy:
pnpm exec tsc --noEmit
Use npx tsc --noEmit or pnpm run build if that matches how the project is set up. Fix any errors before reporting back.
After implementing and verifying, summarize what you changed and why. Where it helps, cite the production runs from terse history that motivated each change and note which terse replay / terse test list/show/run invocations confirmed the fix.
Do not run terse deploy automatically. After explaining the changes, ask the user whether to deploy them now.
Example prompt:
The improvements are verified locally. Deploy to production with
terse deploy? (This syncs all jobs in the project — removed jobs are deleted remotely.)
terse deploy and report the outcome.terse deploy when ready.// BEFORE: runs on every event
onTrigger: async (event, agent: TerseAgent) => { ... }
// AFTER: skip bot events
filter: async (event: GithubPRTrigger) => {
return !event.sender.login.includes("[bot]") && !event.pullRequest.merged
},
onTrigger: async (event: GithubPRTrigger, agent: TerseAgent) => { ... }
// BEFORE: vague
await agent.runAndWait(`Review this PR: ${event.formatForAgentRunner()}`)
// AFTER: specific instructions, format, edge cases
await agent.runAndWait(
`Review PR "${event.pullRequest.title}" (${event.pullRequest.url}). ` +
`Look at the diff and leave a concise review comment. ` +
`Focus on: correctness, edge cases, and naming. ` +
`Skip style nits. If the PR looks good, approve it with a short note. ` +
`Context: ${event.formatForAgentRunner()}`
)
// BEFORE: agent decides everything including the message send
await agent.runAndWait(`Send a welcome message and summarize: ${event.formatForAgentRunner()}`)
// AFTER: deterministic send, then AI analysis in thread
const message = await agent.tools.slack.sendMessage({
channelId: SlackChannel.Engineering.channelId,
message: `New PR from ${event.sender.login}: ${event.pullRequest.title}`,
thread_ts: "",
blocks: "",
})
await agent.runAndWait(
`Summarize the changes in this PR and post as a thread reply ` +
`(thread_ts: ${message.message_ts}). ` +
`Context: ${event.formatForAgentRunner()}`
)
// BEFORE: untyped event
onTrigger: async (event, agent: TerseAgent) => {
await agent.runAndWait(`Handle: ${event.formatForAgentRunner()}`)
}
// AFTER: typed event with type guard
import { GithubPRTrigger, isGithubPRTrigger } from "terse-sdk"
onTrigger: async (event: GithubPRTrigger, agent: TerseAgent) => {
if (!isGithubPRTrigger(event)) return
const { title, url } = event.pullRequest
await agent.runAndWait(
`Review PR "${title}" at ${url}. Context: ${event.formatForAgentRunner()}`
)
}
npx claudepluginhub terseai/terse --plugin terseGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.