setup-agent-config

Configure Claude Code session hooks to minimize prompt length and context bloat.

3|1|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/malinskibeniamin/skills --skill setup-agent-config
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-agent-config
Source: https://github.com/malinskibeniamin/skills/tree/main/setup-agent-config
Command: npx skills add https://github.com/malinskibeniamin/skills --skill setup-agent-config

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Claude-based agent workflows often bloat prompts and context with verbose tooling traces, tests, and environment noise. This Skill provides a compact, repeatable setup to minimize token usage and ensure stable performance by configuring session-wide hooks and lean test flags.

Core Features & Use Cases

  • Session optimization: automatically enables AI_AGENT=1, CLAUDECODE=1, and NODE_OPTIONS=--max-old-space-size=8192 to reduce token waste and improve tooling traces.
  • Prompt-context injection: injects project state (git branch, dirty state, scripts, violations, and config) into prompts to inform Claude without extra tool calls.
  • Tooling efficiency: reduces verbose test outputs and truncates long results for compact context in PreToolUse and PostToolUse.

Quick Start

Copy scripts/llm-env.sh, scripts/llm-test-flags.sh, and scripts/llm-truncate.sh into .claude/hooks/ and chmod +x, then configure in .claude/settings.json: SessionStart -> llm-env.sh, PreToolUse (Bash) -> llm-test-flags.sh, PostToolUse (Bash) -> llm-truncate.sh.

Frequently Asked Questions about setup-agent-config

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

FAQPage Schema
How do I reduce token usage in Claude Code agent workflows?

You reduce token usage in Claude Code by configuring lean session hooks that truncate verbose tool outputs, inject project state directly into prompts, and set environment variables like AI_AGENT=1 to optimize context and minimize bloat.

How do I set up Claude Code hooks for prompt optimization?

To set up Claude Code hooks for prompt optimization, copy the provided shell scripts into the .claude/hooks/ directory, make them executable, and map them in .claude/settings.json to SessionStart, PreToolUse, and PostToolUse events for automated context management.

What environment variables are needed for Claude Code agent configuration?

Claude Code agent configuration requires exposing the environment variables AI_AGENT=1, CLAUDECODE=1, and NODE_OPTIONS=--max-old-space-size=8192 to reduce token waste, identify the agent runtime, and allocate sufficient memory for stable performance.

Does this Claude Code token optimization require jq?

Yes, this Claude Code token optimization requires jq as a dependency to parse and process JSON data within the hook scripts, enabling efficient injection of project state and truncation of tooling traces during active sessions.

Why does my Claude Code agent session bloat context with verbose tooling traces?

Claude Code sessions bloat context with verbose traces because test outputs and environment noise accumulate without truncation. Applying PostToolUse hooks truncates long results, while PreToolUse hooks reduce verbose test outputs for compact context.

Can I inject git branch and dirty state into Claude Code prompts without tool calls?

Yes, you can inject git branch, dirty state, scripts, violations, and config into Claude Code prompts without extra tool calls by using a SessionStart hook that automatically populates the prompt context with current project state.