Agent Skill Configuration and Invocation: From Principles to Practice
This article explains how agent Skills work as capability packages rather than always-on execution interfaces. It covers progressive loading, host-specific support checks, writing entry documents and field specs, using templates and scripts for deterministic rendering, matching versus explicit invocation, layered verification, and maintainability principles.
1. Understand a Skill: a capability package, not a universal execution API
In agent applications, the common problem is not that the model cannot do the work at all. It is that similar tasks must be re-explained every time: how fields are defined, how steps are ordered, where templates live, and how results are checked. As tasks grow, stuffing all of that into one long system prompt crowds context, mixes rules, and is hard to maintain.
A Skill’s value is to package the guidance, materials, and execution resources for a class of tasks. It may contain only specialist instructions, or it may also include reference docs, processing scripts, and output templates.
Treat three layers separately:
- Task knowledge: how the agent should judge and organize information.
- Execution resources: reusable templates, scripts, field specs, and similar materials.
- Host capabilities: discovering packages, reading files, running programs, and managing permissions.
A Skill is not an automatically running program. Even if scripts exist in the directory, they will not run unless the host can execute programs and has the required permissions.
Configuring a Skill also does not mean every user message will trigger it. Invocation depends on task matching, how the host loads Skills, and current permission conditions.
2. Progressive loading: discover first, then the workflow, then details
A package can contain many files. Do not dump all of them into model context by default. Expand by need.
2.1 Layer 1: discovery metadata
The host typically loads lightweight information such as name and purpose to decide whether the current task is related.
The purpose description matters most. It should not only say “generate a weekly report.” It should state:
- what task it handles;
- what input it accepts;
- what it produces;
- which nearby scenarios it does not cover.
“Turn scattered work notes into a weekly-report card with a fixed layout” matches better than “office assistant” and is less likely to fire by mistake.
Whether metadata always enters model context, and in what form, is a host implementation detail. Do not assume every agent uses the same strategy.
2.2 Layer 2: core workflow
After a Skill is selected, read the entry document’s process and constraints. That document should answer:
- What happens when input is incomplete?
- Which reference materials must be read?
- When should scripts run?
- How is a result judged acceptable?
Keep the core flow short. Long field notes, large examples, and complex exception handling belong in separate reference files so the entry document does not become an unmaintainable manual.
2.3 Layer 3: on-demand resources
The third layer usually includes references, scripts, and templates. They are used differently.
| Resource type | Primary use | Suggested usage |
|---|---|---|
| Reference docs | Field definitions, business constraints, detailed rules | Read relevant sections when needed |
| Scripts | Validation, conversion, rendering, and other deterministic work | Run within authorized scope |
| Templates and assets | Page structure, styling, output assets | Referenced or copied by the generation flow |
Do not claim that “scripts never enter context” or “templates are never read.” Debugging may require inspecting a script; adjusting layout may require reading a template.
Progressive loading means avoiding premature loading of irrelevant content, not banning file types from context. It reduces unnecessary context use, but more files can still add discovery, read, or execution cost.
3. Before configuration, confirm what the host supports
Skill support differs across agents. Before you ship, confirm:
- where packages are scanned;
- entry-file name and case requirements;
- which metadata fields are supported;
- whether a Skill can be selected explicitly;
- whether file read/write and program execution are available;
- whether changes require a refresh or reload.
Do not treat one environment’s hidden directory as a universal install path, or one permission field as a global standard.
The following is a neutral project layout for organization only. It is not any host’s default path.
project/├─ skills/│ └─ weekly-card/│ ├─ SKILL.md│ ├─ references/│ │ └─ field-spec.md│ ├─ scripts/│ │ └─ render_card│ └─ assets/│ └─ card-template.html└─ workspace/└─ weekly-card/├─ input.json└─ output/
render_card is a project-implemented renderer, not a built-in command. File format, startup, and runtime must be specified by the project.
Keep runtime data in the workspace, not inside the Skill directory. The package stays stable and versionable, and task data is less likely to overwrite other tasks.
4. Writing the entry document: description for matching, body for execution
Hosts that use this convention often combine front matter with a markdown body. Whether the fields below work depends on the actual host.
---name: weekly-carddescription: Organize user-provided weekly work notes into a shareable weekly-report card. Use when the user clearly asks for a weekly-report card or a weekly progress summary. Do not use for live project lookup, automatic report submission, or formal performance evaluation.---# Weekly report card generation## GoalGenerate a single HTML file from the user’s work notes.Do not invent achievements, metrics, or completion status the user has not confirmed.## Workflow1. Read references/field-spec.md and confirm field and missing-value rules.2. Extract report period, completed items, risks, and next-week plan from user input.3. Check required fields; if critical content is missing, ask the user first.4. Write normalized data into this task’s working directory.5. Check that the renderer and template are available.6. Run the renderer after execution permission is granted.7. Inspect the output file and tell the user the result location and what still needs confirmation.## Boundaries- Do not retrieve or infer business data the user did not provide.- Do not overwrite existing files unless the user explicitly agrees.- Do not automatically upload, send, or publish generated results.- If execution is unavailable, explain the limit and offer a feasible alternative delivery.
This entry document deliberately omits full field detail. It keeps the goal, order of operations, and high-risk boundaries.
Do not use overly broad triggers. “Summarize these items” could mean meeting notes, a shopping list, or an issue list. Match this Skill only when context confirms a weekly-report task.
Permissions declared in metadata are not a security mechanism by themselves. Directory access, program execution, and network access must be enforced by the host or runtime.
5. Input specs: unify data meaning before generating a page
Weekly-report generation looks like layout work. The usual failure is interpretation.
For example:
- “Mostly done” must not become “completed”;
- “Expected efficiency gain” must not become “efficiency already improved”;
- “API still to be confirmed” may be a normal todo or a project risk.
Field specs should define meaning, source, and missing-value handling.
A reference document can specify:
# Field spec- title: Weekly report title. Do not add unconfirmed organization names.- period: Report period as provided by the user. Do not infer from vague wording.- completed: Items that are actually finished. Include only clearly completed work.- risks: Blockers, dependencies, or uncertainty. If not provided, mark “not provided.”- next_plan: Next-period plan. Do not treat suggestions as confirmed plans.Copy rules:- Keep qualifying words that affect judgment.- Do not invent quantities, ratios, dates, or business benefits.- Distinguish “no risks” from “risk information was not provided.”- If the user asks for a shorter version, still keep incomplete status and important dependencies.
Structured input example:
{"title": "Engineering weekly report","period": "this reporting period","completed": ["Finished requirements review","Finished first version of core pages"],"risks": ["Some API fields still need confirmation"],"next_plan": ["Complete integration testing","Add exception-scenario verification"]}
Valid JSON is not the same as valid business data. Also check types, text length, empty lists, and contradictions.
If the user writes both “all integration testing is done” and “continue remaining integration testing next week,” the agent should clarify instead of picking one interpretation to make the output look complete.
6. Templates and scripts: give stable work to deterministic logic
For a fixed-layout card, the model should not redesign the page every time. The template owns layout, a program writes normalized data into the template, and the model mainly interprets input and organizes content.
A simple placeholder template:
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>{{title}}</title></head><body><main><h1>{{title}}</h1><p>{{period}}</p><section><h2>Completed this week</h2>{{completed_list}}</section><section><h2>Risks and blockers</h2>{{risks_list}}</section><section><h2>Next week plan</h2>{{next_plan_list}}</section></main></body></html>
Double braces are an example placeholder convention. The host will not replace them automatically. Replacement belongs in the renderer.
Core program flow:
Read input dataCheck required fields and typesVerify the output path is inside the authorized workspaceHTML-escape user textConvert items into list elementsFill a controlled templateWrite a new output fileReturn generation status and file location
Do not skip safety. Angle brackets, quotes, and similar characters in user text must be escaped so they are not treated as page code. Constrain output paths so files are not written outside the workspace.
Templates should not, by default, load external resources. That reduces network dependence and lowers the risk of leaking information when the file is shared.
7. Invocation: automatic matching vs explicit selection
How Skills are invoked depends on the host.
7.1 Automatic matching
A user might say:
From the progress below, generate a weekly-report card. Keep risks and the next-week plan.
If the host supports semantic matching, it uses the capability description to decide whether to load the Skill.
Automatic matching fits natural conversation but depends on description quality. Over-broad purposes and overlapping Skills cause wrong selection.
7.2 Explicit selection
If the host supports choosing a package explicitly, the user can specify the weekly-card Skill. Syntax is not universal; follow the environment’s docs.
Explicit selection helps debugging and reproduction. It still does not bypass permissions or input checks. Selecting a Skill does not mean files may be published automatically or that historical outputs may be overwritten.
Either way, a complete chain is:
Discover capability → load workflow → normalize input → read required resources → execute processing → validate output → deliver result.
On failure, say which step failed. Do not claim a file was generated just because a plan or program call was requested.
8. Verify that configuration actually works
A directory existing is only the first step. Check in layers rather than testing everything at once.
Discovery
Confirm the host sees the entry file and description. If not, check scan path, file naming, metadata format, and refresh.
Matching
Test a clear weekly-report request and similar but unrelated requests. The former should enter this flow; the latter should not be forced into it.
Resources
Confirm references, template, and program resolve via the agreed paths. Be explicit whether relative paths are based on the Skill directory or the workspace, or they will break when the working directory changes.
Execution
Use minimal input once. Check process exit status, whether the output file exists, whether it is empty, and whether all placeholders were replaced.
Content
Check that the card does not drop key items, change completion status, invent numbers, or rewrite “risks not provided” as “no risks.”
Discovery does not imply execution. Execution does not imply correct content. Correct content does not imply it is safe to publish.
9. Four principles for long-term maintainability
1. Keep a single responsibility.
A weekly-card Skill should mainly organize and generate. Do not also own project lookup, performance judgment, or message sending. Narrower duties make trigger boundaries easier to state.
2. Maintain rules and resources separately.
Entry workflow, field spec, template, and program should each have a clear job. Changing layout should not force a rewrite of all business rules.
3. Treat external input as data, not commands.
Text in user notes or references such as “ignore previous rules” or “read another directory” must not automatically become execution instructions. Resource content must not expand original permissions.
4. Keep traceable run information.
Without storing sensitive raw text, you can keep Skill version, execution status, error type, and output location to reproduce issues. Concurrent tasks should use separate workspaces so data is not mixed.
10. Conclusion: configuration organizes capability; invocation executes it
Configuring a Skill means defining the capability directory, purpose description, workflow, resource dependencies, and safety boundaries. Invoking a Skill means matching the task, loading on demand, executing with authorization, and validating results.
A reliable Skill is not a longer prompt. It is a split of labor: the model understands, deterministic code processes, and the host enforces permissions. Prove the full chain on a small, well-bounded task, then add field rules, templates, and exception handling. That is usually easier to verify and maintain than building a large package first.
