Reusable skills allow large language model agents to package task-specific procedures, tool affordances, and execution guidance into modular units. Prior work has largely studied how agents retrieve, compose, or synthesize skills before execution. In coding agents, however, execution poses an additional runtime control problem: the same task may be solved through primitive tool calls, macro skills, or hybrid execution that starts with a macro and falls back to micro-level recovery. We introduce Adaptive Skill Granularity, a framework that treats skill granularity as an action-abstraction policy conditioned on task structure, execution state, and macro-skill failures. The system combines a feature-based granularity controller and a finite-state recovery executor. We evaluate the framework with a deterministic coding-agent protocol using verifier-defined success, total cost, and process metrics such as macro adoption, failure recovery, route match, and transition correctness. Results show that fixed macro execution is efficient when applicable but brittle under mismatch, while runtime routing and explicit macro-to-micro recovery improve robustness and recover controlled macro failures that fixed-granularity execution leaves unresolved. Our findings suggest that skill libraries for coding agents should be treated not only as retrievable resources, but also as controllable, verifiable, and recoverable execution abstractions.
Figures & tables
Figure 1: Adaptive Skill Granularity framework. Online execution selects and applies a micro, macro, or hybrid granularity mode, then validates the final workspace. Offline logs support router updates, confidence reporting, and macro-skill registry decisions.
Figure 2: Finite-state recovery executor. Macro runs downgrade to micro tools after recoverable failures when recovery is enabled; otherwise they terminate with macro_failure_no_recovery . Success requires verifier acceptance.
Family
Target count
Purpose
Simple
20
Single-file bugs, documentation examples, and configuration fixes.
Medium
20
Multi-file changes with moderate dependency structure.
Refactor
20
Module moves, symbol renames, import rewrites, and API migration.
Recovery
20
Macro failure, partial execution contamination, and downgrade recovery.
Table 1: GranBench-Code task families
Variant
Success
Mean Steps
Mean Tokens
Macro Adoption
G-score
A-Micro
1.000
6.00
7217.75
0.000
0.1667
B-Macro
0.583
2.71
3609.00
0.916
0.4305
C-Heuristic
0.750
3.22
4097.67
0.833
0.4103
Table 2: Fixed-granularity and heuristic routing results (12 mixed tasks). Pure micro is robust but costly, while pure macro is efficient but brittle.
Fault Mode
Variant
Success
Mean Steps
Mean Tokens
Transition Rate
Before
C-Heuristic-NoRecovery
0.000
-
-
0.000
Before
E-FSM-Downgrade
1.000
6.86
11293.43
1.000
After
C-Heuristic-NoRecovery
1.000
2.71
2440.14
0.000
After
E-FSM-Downgrade
1.000
5.71
7566.71
1.000
Table 3: Dynamic downgrade under injected macro failures (7 tasks). The FSM downgrade recovers early failures perfectly but wastes tokens on late failures.
Variant
Success
Mean Steps
Mean Tokens
Heuristic Match
Emp. Match
C-Heuristic-ModeOnly
0.750
3.11
4172.89
1.000
0.667
D-Learned-ModeOnly
1.000
4.17
5518.33
0.667
1.000
Table 4: Learned vs. Heuristic mode routing (12 tasks). Aligning with empirical labels allows the learned router to achieve 100% success where the heuristic fails.
Fault Mode
Variant
Success
Mean Tokens
G-score
Transition Rate
Before
C-Heuristic-NoRecovery
0.000
-
-
0.000
Before
E-FSM-Downgrade
1.000
11293.43
0.0845
1.000
Before
F-Learned-Full
1.000
9763.57
0.1061
0.857
After
C-Heuristic-NoRecovery
1.000
2280.00
1.1866
0.000
After
E-FSM-Downgrade
1.000
7566.71
0.2142
1.000
After
F-Learned-Full
1.000
3694.43
0.5720
0.143
Table 5: Full end-to-end routing under fault injection (7 tasks). The learned full controller preserves perfect recovery success while significantly reducing token cost.
Figure 3: Evaluation outcome breakdown. Bars separate micro success, macro success, hybrid-recovery success, and terminal failure.
Automated skill evolution enables Large Language Model (LLM) agents to continuously improve without expensive retraining. However, existing approaches typically treat skill evolution as a sequence of local updates, overlooking relationships among skills and often producing overfitted skill updates that fail to generalize across tasks. We propose GSE, a globalized skill evolution framework that jointly optimizes skill compatibility and skill generalization. To preserve consistency across the skill bank, GSE maintains a Skill Relation Graph (SRG) that explicitly models and co-evolves inter-skill relationships. To improve generalization, GSE performs cluster-based skill consolidation to abstract reusable capabilities from local updates and employs replay-driven verification to prevent overfitting and behavioral regressions. We evaluate GSE on two representative software engineering tasks: bug-revealing test generation and false-positive bug report filtering. Across two state-of-the-art coding agents, OpenHands and mini-SWE-agent, GSE consistently achieves the best precision, recall, and F1-score. Compared with existing evolution techniques, GSE improves precision and recall by 6.1%~34.1% and 31.8%~180.0% for test generation, and by 15.4%~96.4% and 13.1%~19.8% for false-positive filtering. Deployment on an internal industrial agent further yields a 61.4% improvement in F1-score, demonstrating the effectiveness and generalizability of GSE for evolving effective skills.
Skill libraries have become a practical way for LLM agents to reuse procedural experience across tasks. However, existing systems typically treat skills as flat, single-resolution prompt blocks. This creates a tension between relevance and cost: injecting coarse skills can introduce irrelevant or misleading context, while rewriting entire skills is expensive and often unnecessary. We propose SkillLens, a hierarchical skill-evolution framework that organizes skills into a four-layer graph of policies, strategies, procedures, and primitives, and retrieves them at mixed granularity. Given a task, SkillLens first retrieves semantically relevant skill seeds, expands them through degree-corrected random walk over the skill graph, and then uses a verifier to decide whether each visited unit should be accepted, decomposed, rewritten, or skipped. This enables the agent to reuse compatible subskills directly while adapting only locally mismatched components. To improve the system over time, SkillLens further refines multi-granularity skills and verifier in order to improve its routing decisions. We provide theoretical analysis showing that mixed-granularity adaptation incurs sublinear cost under sparse mismatch assumptions and that the evolutionary update rule monotonically improves the validation objective until a local optimum. Across MuLocbench and ALFWorld, SkillLens consistently improves over strong skill-based baselines, achieving up to a 6.31 percentage-point Acc@1 gain for bug localization and raising agent success rate from 45.00% to 51.31%.
Current LLM coding agents are predominantly trained on composite benchmarks (e.g., bug fixing), which often leads to task-specific overfitting and limited generalization. To address this, we propose a novel scaling paradigm that shifts the focus from task-level optimization to atomic skill mastery. We first formalize five fundamental atomic skills, code localization, code editing, unit-test generation, issue reproduction, and code review, that serve as the basis vectors for complex software engineering tasks. Compared with composite coding tasks, these atomic skills are more generalizable and composable. Then, we scale coding agents by performing joint RL over atomic skills. In this manner, atomic skills are consistently improved without negative interference or trade-offs between them. Notably, we observe that improvements in these atomic skills generalize well to other unseen composite coding tasks, such as bug-fixing, code refactoring, machine learning engineering, and code security. The observation motivates a new scaling paradigm for coding agents by training with atomic skills. Extensive experiments demonstrate the effectiveness of our proposed paradigm. Notably, our joint RL improves average performance by 18.7% on 5 atomic skills and 5 composite tasks.