agent-typescript

Implements TypeScript agents with buildRequest, prompt builders, tool scopes, and DI registration.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill agent-typescript-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: agent-typescript
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/agent/typescript
Command: npx skills add https://github.com/gabriellst/codm --skill agent-typescript-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It standardizes how TypeScript agents are built in the codm codebase, preventing common architectural mistakes like overriding the run() template method, restating the input envelope, leaking policy into agents, or minting run tokens in the wrong layer. ## Core Features & Use Cases - Agent scaffolding conventions: Defines the one-directory-per-agent layout (class, prompt builder, types, barrel) and the bun cli agent <context> <Name> scaffold command. - Identity and tool scope rules: Enforces static IdentitySchema parsed before token issuance, declared tool scopes, and AgentIdentityService issue/resolve/revoke semantics. - Testing and DI guidance: Prescribes class-token transient DI in all three environments and testing against a stubbed AgentRunner that records requests. - Use Case: When adding a new ClassifyIssueAgent, follow the playbook to create the four files, declare the input schema via z.agentInput(), register it in the context registry, and verify the base stamps agentName using a capturing stub runner. ## Quick Start Ask the AI to scaffold a new TypeScript agent for a given context and name following the agent playbook, including its prompt builder, input schema, DI registration, and stubbed-runner test.

Frequently Asked Questions about agent-typescript

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a new TypeScript agent in this codebase?

Run `bun cli agent <context> <Name>` to scaffold the four files: the agent class, prompt builder, types, and barrel. Then implement only buildRequest, declare the input schema with z.agentInput(), and register the class token in the context registry.

How should agent input schemas be defined with Zod?

Always use z.agentInput({ ...ownFields }) so the run envelope (ownerId, threadId, cwd) is present by construction. Never restate envelope fields by hand, and never default cwd to process.cwd().

Can an agent override the run() method?

No. run() is a concrete template method on the base Agent that stamps identity and mints the run token. The only variation point is the protected buildRequest method; overriding run() is a critical bad practice.

How are agents tested without a real model or CLI?

Construct the agent directly with a stubbed AgentRunner that records requests and yields canned events. Assert buildRequest's output via the recorded request and verify the base stamped agentName.

When should an agent declare a tool scope?

Declare a non-empty tools array only when the agent is allowed to act via MCP tools; the base attaches the mcp invocation exactly when tools.length > 0. Never prompt the model to call a tool that is not in the declared scope.

Where does business policy like confidence thresholds belong?

Policy belongs in a sibling service that injects the agent, not inside the agent. The agent's single public method should be exactly `return this.collect(input)` with no threshold or fallback logic.