AI Coding Agents and Skills: From Getting Started to Mastery

    This article explains how AI coding agents have evolved from chat-based assistants to repository-aware task executors, where their practical boundaries lie, and how engineering teams can adopt them safely and effectively. It covers environment setup, troubleshooting, interaction patterns, context and prompt engineering, reusable Skills, common development workflows, and risk controls for measuring and governing AI-assisted development.

    1. Paradigm Shift: From Completing a Line to Completing a Task

    AI-assisted coding has evolved through roughly three generations. Understanding the differences between them is the starting point for judging whether a tool is useful in a real development workflow.

    First generation: Q&A-style chat.
    Developers paste code snippets into a chat window and receive explanations, suggested fixes, or interpretations of errors. This form is valuable for knowledge retrieval, but it has a major limitation: the model cannot see the full repository. All context must be copied in manually by the developer.

    Second generation: inline completion and IDE plugins.
    The tool is embedded directly in the IDE and generates suggestions based on the current file and a small number of nearby files. It responds quickly and feels smooth, but the unit of work is still a single function or a short completion. Tasks that require multiple steps—cross-file refactoring, batch renaming, or running commands to verify changes—cannot be completed end to end.

    Third generation: terminal-based coding agents.
    A terminal coding agent runs on the developer’s machine as a command-line program and adds three capabilities that the first two generations lack:

    1. Repository-level reading. It can traverse directories, search for symbols, and trace call chains.
    2. Tool invocation. It can run shell commands, read and write files, and interact with version control.
    3. Closed-loop verification. After changing code, it can run builds, static checks, and tests, then revise its changes based on the results.

    The essential difference can be summarized in one sentence: the first two generations produce suggestions while humans execute and verify them; the third generation proposes a plan, executes the changes, and runs verification while humans define the goal and perform the final review. The developer’s role shifts from “typist” to “requirements definer and reviewer.” This shift is also the starting point for every later discussion of productivity.

    2. Capability Boundaries: Clarify What It Cannot Do First

    Treating an AI coding assistant as an omnipotent tool is one of the main reasons adoption fails inside teams. Before discussing capabilities, it is more important to clarify the limits.

    Work that is suitable for AI agents

    • Structural refactoring: extracting duplicated logic, splitting overly long functions, unifying exception-handling styles, or converting synchronous calls to asynchronous ones.
    • Bug localization: combining stack traces, logs, and call chains to enumerate hypotheses and perform bisection-based diagnosis. This is often faster than manually reading an unfamiliar codebase.
    • Test scaffolding: generating unit test skeletons and boundary cases for existing functions, adding mocks and exception branches.
    • Repository navigation: answering questions such as “Where is the entry point for this feature?”, “Who calls this method?”, or “Where is this configuration loaded?”
    • Scripts and automation: one-off data-processing scripts, batch code migrations, or boilerplate file generation.

    Limitations that must be treated seriously

    1. Misjudging business semantics.
      The model can understand syntax and call relationships, but it may not understand why a field is allowed to be null, or whether a missing state in a state machine is a defect or historical baggage. Without sufficient domain context, it can produce changes that are syntactically correct but business-wise wrong.

    2. Misjudging dependencies and versions.
      It may cite APIs that do not exist, use features from a newer version in an older runtime, or confuse multiple packages with similar names. It must be required to read package.json, dependency lockfiles, or build scripts before making assumptions.

    3. Context-window limitations.
      A large repository cannot fit entirely into the context window. The tool depends on retrieval and on-demand reading, and retrieval quality directly affects the quality of its conclusions. A file that cannot be retrieved is effectively invisible to the model.

    4. Missing verification environments.
      Without runnable builds and tests, statements such as “the change should work now” are only guesses. CI pipelines and locally reproducible tests are prerequisites for an agent to close the loop.

    5. Irreversible operation risk.
      Deleting branches, force-pushing, rewriting history, or touching production configuration must be protected by human confirmation gates.

    The conclusion is straightforward: AI is responsible for reducing the cost of understanding and the cost of mechanical labor; humans are responsible for the accuracy of intent and the safety of changes.

    3. Environment Setup and Troubleshooting: Making the Tool Stable and Usable

    For teams adopting terminal-based coding agents, the real barrier is often not learning how to use the tool. It is getting the tool installed, connected, and running reliably.

    Three layers of dependency preparation

    • Runtime layer. Most terminal tools are built around the Node.js ecosystem. The runtime version must match the range required by the tool, and long-term support versions should be preferred over the latest preview release.
    • Version-control layer. Git is the safety rope for coding agents. Letting an AI agent modify code without version control is like pressing the accelerator in a car without a seatbelt. Before starting work, create a branch and keep the working tree clean.
    • Credential layer. Inject access tokens through environment variables or a local credential file. Do not write tokens into code, scripts, or commit history.
    1. # Make environment variables persistent on macOS/Linux with zsh
    2. echo 'export AI_AGENT_TOKEN="your-token"' >> ~/.zshrc
    3. echo 'export AI_AGENT_BASE_URL="https://your-gateway.example"' >> ~/.zshrc
    4. source ~/.zshrc

    On Windows, use the system Environment Variables panel or setx to write user-level variables, then reopen the terminal. Do not set a variable temporarily with set and then wonder why a new terminal window cannot read it.

    Diagnosing three common failure modes

    Symptom Common root cause How to handle it
    401 / Unauthorized Expired token, misspelled variable name, or another configuration overriding the current value Check the token variable with `env \ grep -i token` and confirm that the current shell and the process launching the agent read the same configuration
    Connection refused Proxy not effective, incorrect gateway address, or corporate network filtering Check HTTPS_PROXY and NO_PROXY, then verify connectivity with common network tools
    Request timeout Network path instability, long-running tasks without retries, or excessive concurrency Reduce concurrency, enable retry and backoff, split large tasks into smaller ones, and use a cloud gateway as a unified egress if necessary

    Basic command categories after first launch

    Most similar tools provide the same basic groups of commands: help and configuration viewing, session clearing, context-status inspection, permission-mode switching, and exit. Three habits are especially useful:

    1. Clear the context when switching tasks.
    2. Check occupied context before starting a long task.
    3. Switch to a confirmation-required permission mode before performing risky operations.

    4. Core Operations: Interaction, Project Management, Version Control, Debugging, and Testing

    Three execution modes

    1. # 1) One-off task: suitable for small, clearly scoped tasks that can be accepted independently
    2. ai-agent --once "Add unit tests for timezone conversion in utils/date.ts, covering daylight-saving boundaries"
    3. # 2) Continue the most recent session: suitable for iterating on the same task across multiple turns
    4. ai-agent --continue
    5. # 3) Resume a historical session: suitable for returning to an unfinished task after a break
    6. ai-agent --resume

    The one-off mode has low overhead and clean context, making it suitable for tasks that can be parallelized and processed in batches. Session mode is better suited to complex changes that need to converge gradually. Resume mode is valuable because the agent does not need to be briefed on the background again.

    Four key interaction techniques

    1. Provide both the goal and the constraints.
      “Optimize performance” is a weak instruction. A stronger instruction is: “Without changing the public interface, reduce this loop from O(n²) to O(n log n), and explain the complexity change.”

    2. Require reading before writing.
      Ask the model to first explain which files it plans to read and why. This significantly reduces the chance that it continues building on incorrect assumptions.

    3. Commit in small steps.
      Solve one thing at a time and run verification at each step. This is far more efficient than generating three hundred lines of code at once and then debugging the whole result.

    4. Reject vague success.
      Ask the agent to show the actual commands it ran and their outputs, rather than accepting “tests passed” without evidence.

    Collaboration boundaries with version control

    AI agents can genuinely save time in Git by reading diffs and writing well-structured commit messages, turning a set of changes into a readable review description, and running a checklist-style review before submission. However, the following decisions must remain with humans:

    • Whether to commit.
    • Whether to push.
    • Whether to merge.
    • Whether to rewrite history.

    A practical rule is to make “no automatic commits and no automatic force pushes” a hard requirement, and to record that rule in project convention files.

    Closing the loop for debugging and testing

    The most effective debugging approach is not to throw an error message at the AI and ask it to guess. Instead, provide three things:

    1. The complete stack trace.
    2. A minimal reproducible input.
    3. The scope of the most recent change.

    When all three are available, the model can usually converge on the root cause within a few turns. The same principle applies to testing: first ask it to list branches that currently lack coverage, then add tests branch by branch, rather than asking vaguely to “complete the tests.”

    5. Efficiency Levers: Context Engineering and Prompt Engineering

    Manage context in layers

    Long-term background information that rarely changes should be written into a project convention file at the repository root, such as PROJECT_CONTEXT.md, so the tool loads it automatically on every startup. The file should contain only four types of information:

    • Technology stack and versions.
    • Directory responsibilities.
    • Coding and commit conventions.
    • Prohibited actions.
    1. # Project Context
    2. - Runtime: Node.js 20 LTS; package manager: pnpm; run `pnpm lint && pnpm test` before committing
    3. - Directories: `src/api` routing layer | `src/service` business layer | `src/repo` data access layer
    4. - Prohibited: modifying SQL in `src/repo` without updating migration scripts; committing files containing plaintext secrets
    5. - Generated code must: use explicit types, handle error branches, and avoid adding third-party dependencies

    Control the context budget

    Three techniques work well together:

    • Use ignore rules to exclude build artifacts, dependency directories, and large data files.
    • Use a directory allowlist to keep the agent focused on relevant modules.
    • For very large files, provide only the relevant snippets instead of the full file.

    More context is not always better. Noise dilutes attention.

    Use a structured prompt template

    Stable prompts are often composed of five parts:

    1. [Context] This is the refund module of the order service. Three unit tests are currently failing.
    2. [Goal] Locate the root cause of the failures and fix them without changing the refund amount calculation rules.
    3. [Constraints] Modify only the service layer; do not add dependencies; preserve the existing log format.
    4. [Validation] After the fix, run `pnpm test refund` and show the output.
    5. [Output] First list root-cause hypotheses in priority order, then provide a diff, and finally list risks.

    Automate deterministic actions with commands and hooks

    Deterministic actions such as formatting, static checking, and testing should be handed to automation scripts rather than being performed ad hoc by the model. One of the most worthwhile configurations is automatic formatting and checking after edits:

    1. {
    2. "hooks": {
    3. "post_edit": ["formatter --write", "linter --fix --quiet"]
    4. }
    5. }

    The principle is: deterministic work should be handled by scripts; judgment should be handled by the model.

    6. Skills: Turning One-Off Operations into Reusable Capabilities

    This is the key step from “knowing how to use a tool” to “building a tool system.”

    What is a Skill?

    A Skill is a structured capability package. It includes metadata that declares when the Skill should be used, instructions explaining how to execute it, and optional scripts or reference materials. Its core value is not making the model smarter. Its core value is moving accumulated best practices from human memory into version-controlled assets.

    Directory structure and metadata example

    1. .code-review/
    2. ├── SKILL.md # Metadata and execution steps
    3. ├── scripts/check_diff.py # Deterministic check logic
    4. ├── references/rule-backend.md
    5. └── templates/report.md
    1. ---
    2. name: prereview
    3. description: Run a pre-commit self-check on the current branch against the main branch. Covers null and boundary conditions, transaction consistency, concurrent writes, log redaction, and migration script completeness. Suitable for pre-commit checks and preparation for human review.
    4. ---
    5. ## Execution Steps
    6. 1. Inspect the change scope: `git diff main...HEAD --stat`
    7. 2. Check each file against the hard rules in `references/rule-backend.md`
    8. 3. Run `scripts/check_diff.py` and collect deterministic warnings
    9. 4. Output: a risk-tiered list, required changes, and recommended but non-blocking items

    Progressive disclosure is a key design point

    When an agent starts, it usually loads only the names and descriptions of all Skills, which typically consumes tens to hundreds of tokens. It reads the full instructions only after deciding that a Skill is relevant, and opens attached scripts or documents only when needed.

    Therefore, descriptions must be written to be decidable. They should clearly state when the Skill applies and when it does not, rather than using vague phrases such as “used for code quality.”

    Two triggering paths

    There are two ways a Skill can be triggered:

    1. Automatic matching. The model selects a Skill based on the semantics of the task. This is suitable for general capabilities such as code review or commit-message generation.
    2. Explicit invocation. A human explicitly specifies the Skill. This is suitable for strong process actions such as pre-release checklists or migration workflows for a specific framework.

    In production environments, high-risk processes should rely only on explicit invocation.

    Four team governance rules

    1. Put Skills under version control and review them.
      A Skill can amplify existing biases. One incorrect rule can be executed repeatedly.

    2. Prefer scripts over prose.
      Rules that can be expressed as deterministic checks—such as checking naming conventions or verifying that a migration file exists—should not be written only as natural-language guidance.

    3. Build a small evaluation set.
      Select 10 to 20 historical tasks and verify whether the Skill actually improves the first-pass success rate instead of relying on intuition.

    4. Set an expiration and recycling process.
      Skills tied to a specific runtime version or framework version must be reviewed periodically to avoid spreading outdated practices at scale.

    A practical maturity path looks like this:

    individual ad hoc use → a personal Skill library → team-shared Skills with review → integration with CI, code review workflows, and internal knowledge bases → an organization-level capability asset.

    7. Four Practical Workflows

    Legacy code refactoring

    First ask the agent to output a call-relationship map and a risk list, then confirm the “movable boundary.” Next, proceed with small-step changes while running tests at each step. Finally, produce a change description for review. Avoid starting with a vague instruction such as “refactor this module.”

    Difficult bug investigation

    Follow a six-step process:

    1. Phenomenon.
    2. Reproduction.
    3. Hypothesis enumeration.
    4. Bisection-based validation.
    5. Root cause.
    6. Regression test.

    Require evidence at each step. The value of the model is to eliminate hypotheses quickly, not to replace human judgment.

    Completing test coverage

    First generate a list of uncovered branches, then add tests branch by branch. Require normal, boundary, and exception cases. Do not use mocks in a way that removes the logic under test itself.

    Building a feature from scratch

    First ask the agent to restate the requirements and list unclear points. Clarify them before generating a skeleton, then fill in the implementation layer by layer. The clarification step cannot be skipped, because it determines whether all subsequent work proceeds in the right direction.

    8. Adoption Advice and Risk Control

    For measurement, four indicators are worth tracking:

    • First-pass success rate of tasks.
    • Human rework rate.
    • Average time per task.
    • Number of substantive defects raised during review.

    Tracking only the number of generated code lines encourages the wrong behavior.

    Risk control rests on three bottom lines:

    1. Do not put secrets or credentials into repositories or model context.
      Tokens, keys, and sensitive configuration should never be committed or passed into prompts.

    2. Review generated code with the same standard as human-written code.
      The fact that code was generated by AI should not lower the review threshold.

    3. Keep data boundaries clear.
      When unpublished business data, customer information, or restricted source code is involved, first confirm the data-handling and retention policies of any service used.

    If an organization already has a unified cloud governance pipeline, model-call audit logs, quota management, and monitoring alerts can be connected to existing logging and observability systems so that AI coding usage itself is observable.

    Using AI coding agents well depends less on how powerful the model is and more on three things: whether context is provided accurately, whether the verification loop is solid, and whether experience is accumulated effectively. The third point is precisely the problem that the Skills system is designed to solve. It is also the dividing line between a person who can use the tool and a person who can define an engineering methodology.