Agentic Coding for Beginners: Core Commands, Capability Layers, and How Billing Actually Works
This article introduces agentic coding for developers coming from traditional AI code completion. It explains the five capability layers found in mature agentic coding tools — slash commands, skills, hooks, memory, and rewind — with practical guidance on what each one does and where its boundaries lie. It also covers how the authentication path you choose (platform API keys, subscriptions, or a unified model gateway) determines the billing model you end up on, breaks down what actually consumes tokens in an autonomous task, and outlines a three-phase rollout path for engineering teams. Readers will come away with a clear mental model of context management, cost drivers, and the security boundaries that matter when an agent can write files and execute commands.
From Code Completion to Agentic Coding
Traditional AI coding assistants are essentially next-block-of-code predictors. The model receives the current file and a little surrounding context, emits a completion suggestion, and the developer decides whether to accept it. The interaction is passive, local, and stateless.
Agentic coding changes the interaction paradigm. The developer submits a goal — for example, “add unit tests for the legacy file upload path in this module and make CI pass” — and the tool is responsible for decomposing that goal into a task sequence. It actively reads the repository structure, searches for relevant code, edits files, executes commands, observes errors, corrects them, and loops until the acceptance criteria are met or the budget runs out.
This shift has three direct consequences, and they form the main thread of this article:
- The context window goes from “scarce resource” to “core design constraint.” A single autonomous loop may read a dozen files and run multiple builds, so context fills up fast. How a tool organizes and compresses context directly determines both task success rate and the cost per task.
- Execution privileges become a new risk surface. The tool must read and write files, run shell commands, and call network endpoints, so the security model of “read-only completion” no longer applies.
- Billing is tightly coupled to engineering behavior. Every question a developer asks, every command the agent runs, and every retry it performs turns into measurable token consumption.
So understanding agentic coding requires more than prompt-writing skill. It requires understanding how capabilities are layered, how context is managed, and how billing is calculated.
The Capability Layers of Agentic Coding Tools
The capabilities of a mature agentic coding tool can be grouped into roughly five layers. They solve different classes of problems, and knowing where the boundaries lie matters more than memorizing commands.
2.1 Slash Commands: Turning Repetitive Workflows into Reusable Entry Points
Slash commands (commands prefixed with /) are essentially preset instruction templates or workflow entry points. They are usually defined as text files stored in a conventional project directory or a user-level configuration directory. Their contents can be a prompt template, a context snippet to be injected, or a description of a fixed sequence of steps.
Their value lies in consistency. When a whole team faces similar tasks, the output quality will inevitably vary if everyone describes the requirement in different natural language. Once processes such as “generate unit tests that comply with our conventions,” “perform a code review according to team standards,” or “generate API documentation” are captured as commands, the task is constrained to an established track and newcomers can quickly reuse the experience the team has accumulated.
A common mistake in practice is writing a slash command as an overly long, monolithic prompt. A better approach is to put the stable process and acceptance criteria into the command and let the retrieval mechanism fetch the volatile context dynamically. Keep the command itself short and composable.
2.2 Skills: Task-Level Packaging Loaded on Demand
If slash commands answer “how do I enter the workflow,” skills answer “what knowledge and tools does this workflow need.”
A skill is typically a task-level package with metadata: it declares its name, when it applies, the inputs it needs, and the reference material, scripts, or templates it reads at execution time. The key design point is progressive disclosure — the full contents of a skill are not dumped into the context all at once. A short description is loaded first, the model decides whether the task matches, and only then does it expand into details and read the bundled reference files as needed.
This mechanism has an enormous effect on context cost. Suppose a project has accumulated twenty sets of technical specifications, build scripts, and templates. If all of them were preloaded into context, every conversation would pay for them again. With on-demand loading, only the genuinely relevant parts ever enter the context.
On the conceptual evolution of this area, one common confusion is worth clearing up: some documentation refers to this capability as “custom commands,” “built-in capability modules,” or other names, but the underlying idea is the same — a reusable task package. As tool ecosystems mature, capabilities like this tend to converge under a unified skills system, presenting a single entry point for registration, discovery, and invocation. That does not mean the old invocation styles stop working immediately; for backward compatibility, existing syntax can usually still be called manually, even though the internal implementation has been merged. The practical recommendation is to follow the unified system when creating new skills and to stop maintaining scattered legacy mechanisms.
2.3 Hooks: Moving Deterministic Logic Out of the Model’s Hands
Hooks are a mechanism for executing external logic at key points in the tool’s lifecycle. Common trigger points include session start, before the user submits input, before a tool call, after a tool returns, before and after file writes, and session end.
The value of hooks is that they separate “probabilistic judgment” from “deterministic constraints.” Models are good at understanding and generating, but not at guaranteeing that they follow a rule every single time. Requirements like the ones below produce unstable results when expressed as prompts and are only reliable when implemented as hooks:
- Format and standards checks: automatically run formatting and static analysis after every file write, and feed failures straight back to the model for another attempt.
- Blocking high-risk operations: intercept deletes, force pushes, and writes to production before the tool call, and require human confirmation.
- Command allowlists: restrict which shell command patterns may run, blocking obviously dangerous combinations.
- Sensitive data protection: scan input for credentials, keys, and personal information before submission, then redact or block on a match.
- Audit and telemetry: log every tool call and its duration to support cost and compliance analysis.
A common architectural recommendation is that hook scripts should be small, standalone, testable, and idempotent programs, rather than containers for complex business logic. Once a hook blocks or throws an unexpected error, it directly affects the flow of the session.
# Generic shape of a hook script (pseudocode)# Input: event type, tool name, and arguments passed via stdin# Output: a verdict in an agreed formatread -r event tool argscase "$event" inpre_tool_use)case "$tool" inshell) verify_whitelist "$args" || deny "Command is not on the allowlist" ;;*) ;;esac;;post_file_write)run_formatter "$args" && report_back "Formatting fixed; continue from the latest content";;pre_prompt_submit)scan_secrets "$args" && block;;esac
2.4 Memory: Persistent Context Across Sessions
Session context is temporary and disappears when the process ends. Memory addresses cross-session knowledge management and is usually organized in layers:
- Project-level memory: team conventions, architectural decisions, and build and test commands committed with the repository. Shared by all members and governed by version control and code review.
- Local or user-level memory: personal preferences, machine-specific paths, and private toolchain configuration that never enters the repository.
- Imported memory: import statements that pull other memory files or documents into the current context for reuse and layered composition.
The practical rule for writing memory is to record only what the model cannot derive on its own. Directory structure, dependency versions, and function signatures are all things the tool can retrieve by searching the code, so putting them in memory just occupies context. What is actually worth recording is tacit knowledge:
# Example project memory (illustrative)## Project constraints- The backend uses a layered architecture; the controller layer must neveraccess the data access layer directly.- Every public API must include input validation and return the shared error codes.- Static analysis and unit tests must pass before committing: `make verify`.## Known pitfalls- Modules in the config layer depend on a specific initialization order; do notchange the call sequence during refactoring.- Time fields must always be timezone-aware timestamps; local time strings arenot allowed.
Memory is not a case of “more is better.” As memory grows, the fixed overhead of every session rises and the weight of the constraints that genuinely matter gets diluted. Periodic pruning and categorization matter more than continuous appending.
2.5 Rewind: A Safety Net for Autonomous Execution
Model-driven edits will fail — that is an engineering reality. Rewind provides a safety net for edits and conversation history: restore a file that was modified by mistake to a previous version, roll back a stretch of conversation context, or retry from a checkpoint after a failure.
Its significance is that it changes a team’s risk tolerance. Without rewind, the rational choice is to restrict the tool to read-only or suggestion mode, and its autonomy stays locked away. Only with reliable rewind will a team let it refactor in bulk or make large-scale file changes. Practical guidance includes:
- Rewind should complement version control rather than replace it; significant changes are still managed as commits.
- Clearly distinguish “restoring code” from “restoring conversation.” They have different scopes, and mixing them up easily leads to inconsistent state.
- Before rolling it out team-wide, verify the completeness and idempotency of restores on real tasks.
These five layers form a chain: slash commands and skills supply reusable capability and knowledge, hooks supply deterministic boundaries and quality gates, memory supplies cross-session continuity, and rewind supplies the fallback after failure. The engineering focus is on composing these mechanisms into configuration assets the whole team can reuse.
How Your Authentication Path Determines Your Billing Model
The most overlooked point in any cost discussion is this: the authentication method you choose is itself a billing decision. Tools typically offer three paths.
3.1 Platform API Keys: Pay-as-you-go
When you connect using an API key issued by a model provider’s platform, you are on pay-as-you-go pricing, and usage is metered and billed in the provider’s console. The fit is clear:
- You want to evaluate output quality and unit cost against real tasks before committing to a long-term investment.
- Usage is volatile and you cannot predict peaks.
- You already have a unified cloud billing structure and need AI usage rolled into the same cost accounting.
Under this model, actual consumption depends on the combined effect of call frequency, context length, and the model tier you select — not simply the number of “conversation turns.” Choosing the wrong model tier can make costs differ severalfold.
3.2 Subscription Plans: Predictable Cost
Subscriptions charge a fixed amount per period in exchange for a certain usage allowance, with overage handled under defined rules. Again, the fit is clear:
- Individual developers using the tool heavily day to day who want predictable monthly spending.
- Organizations that need to route the purchase through a subscription-based approval process.
- Teams that want to avoid sudden bill spikes caused by a single runaway loop.
Subscription tiers, allowance caps, overage charges, and restriction policies all change as providers adjust their terms. This article deliberately cites no specific numbers. Any purchasing decision should be based on the provider’s currently published pricing and terms pages, and the contract should spell out how the allowance is defined, how overage is handled, and what usage visibility requirements apply.
3.3 Unified Gateways and Enterprise Adoption
Larger organizations usually do not hand individual keys to every developer. Instead, they connect through a model gateway, self-hosted or provided by a cloud vendor, to achieve: centralized key custody and rotation, usage broken down by project or team, rate limiting, model routing (simple tasks to low-cost models, complex tasks to high-performance ones), and complete call auditing.
On public cloud, commodity service categories cover most of this: a secret management service holds credentials, a logging service records call-level detail, monitoring and alerting tracks quotas and abnormal spikes, and a container platform hosts the gateway itself. No proprietary solution is required.
What Token Consumption Actually Consists Of
Before optimizing cost, you need to know where the money goes. One autonomous task’s consumption breaks down into roughly four parts:
| Component | What it means | How to optimize |
|---|---|---|
| System prompt and tool definitions | Every request carries the tool list and behavior constraints | Keep the tool count small; avoid registering many tools for low-frequency scenarios |
| Static memory and rules | Transmitted again on every turn | Trim memory and remove redundancy that retrieval can supply |
| Dynamic context | Retrieved files, command output, error logs | Retrieve precisely, truncate oversized output, process large files in segments |
| Loop iterations | Number of think–act–observe cycles | Make instructions clearer up front; configure validation hooks to cut down on blind retries |
Loop iterations are often the dominant cost factor. A vaguely specified task may be edited repeatedly a dozen times or more, while a task with crisp boundaries may finish in three or four rounds. The most effective cost optimization is therefore not “switch to a cheaper model” but improving the precision of task descriptions and the completeness of automated gates.
One caveat worth emphasizing: different tools implement context compaction, cache reuse, and retrieval strategies very differently. For concrete behavior and how usage is metered, rely on the official documentation rather than inferring costs from hearsay.
A Rollout Path for Engineering Teams
Move through three phases, and avoid jumping straight to full autonomy for everyone.
Phase 1: Validate on a single point. Pick a low-risk task domain with clear acceptance criteria — adding unit tests, generating API documentation, fixing static analysis warnings — and measure task success rate, average iterations, and cost per task to establish baseline data.
Phase 2: Turn configuration into assets. Capture what worked as skills, slash commands, project memory, and hooks, put them under version control, and have them reviewed by the team. The core deliverable of this phase is reusable configuration, not scattered prompts. At the same time, establish a confirmation checklist for high-risk operations and a least-privilege policy.
Phase 3: Scale and govern. Introduce a unified gateway and a usage dashboard, aggregate cost by team, feed tool-call audit records into compliance processes, and define model routing rules so that simple tasks are handled by low-cost models.
The security boundary deserves separate emphasis: agentic tools hold file-write and command-execution privileges, so their risk level is higher than read-only completion. Production credentials, keys, and production change permissions should be isolated — separate environments, separate credentials, and human confirmation steps to block accidental operations. This holds regardless of which tool you select.
Summary
The point of agentic coding is not any single command but a combination of mechanisms: commands and skills handle the reuse of capability and knowledge, hooks enforce deterministic constraints, memory maintains cross-session continuity, and rewind provides a fallback when things fail. Understanding how these four divide responsibility, and where their boundaries lie, does more for real-world results than memorizing a command list.
On the cost side, the authentication method determines how usage is metered: pay-as-you-go suits evaluation and volatile usage, subscriptions suit predictable spending, and a unified gateway suits organizational governance. The real cost lever, though, is context engineering and task description quality, not simply switching model tiers. Pricing and restriction terms change, so any purchasing or technical decision should be based on the provider’s current published information, and you should establish baseline data on real tasks before talking about optimization.
