Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/sebastiendegodez/copilot-instructions/analyzing-code-structurenpx skills add SebastienDegodez/copilot-instructions --skill analyzing-code-structuregit clone --depth 1 https://github.com/SebastienDegodez/copilot-instructionsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/sebastiendegodez/copilot-instructions/analyzing-code-structure)<a href="https://agentmods.dev/skills/sebastiendegodez/copilot-instructions/analyzing-code-structure"><img src="https://agentmods.dev/badge/skills/sebastiendegodez/copilot-instructions/analyzing-code-structure.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00042 | $0.00806 |
| Opus 5 | $0.00021 | $0.00403 |
| Sonnet 5 | $0.00008 | $0.00161 |
| Haiku 4.5 | $0.00004 | $0.00081 |
Grade A, and why
analyzing-code-structure scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 75 lines — stays where its author put it; the contents beside it link to each section on GitHub.
ast-grep: Structural Code Search and Editing
Always invoke the ast-grep skill for structural code search and refactoring - do not execute bash commands directly.
Default Strategy
Invoke analyzing-code-structure skill for structural code search and refactoring. Use when:
- Text-based Edit tool fails with "old_string not unique"
- Need formatting-independent pattern matching
- Performing structural changes across code
Common workflow: Invoke extracting-code-structure skill first, then analyzing-code-structure skill for structural modifications.
Use ast-grep to solve the "old_string not unique" problem by matching code structure instead of exact text. This enables refactoring across formatting variations and structural patterns.
When to Use analyzing-code-structure vs Text Tools
Use analyzing-code-structure when:
- Structural code changes - Refactoring function signatures, method calls, class structures
- Formatting-independent matching - Need to find code regardless of whitespace/line breaks
- Pattern variations - Matching similar structures with different variable names/arguments
- "old_string not unique" problem - Edit tool fails because text appears in multiple contexts
- Complex queries - Finding nested structures, specific AST patterns
Use text tools (Edit/Grep) when:
- Simple, unique string replacement - The exact text appears once or in consistent format
- Non-code files - Markdown, configs, data files
- Comment/documentation edits - Content that isn't code structure
- Very small changes - Single line, obvious context, no ambiguity
Key Decision Rule
If editing code structure and there's any ambiguity in text matching → use analyzing-code-structure.
ast-grep's primary value: Solves the "old_string not unique" problem by matching structure instead of exact text.
Detailed Reference
For comprehensive patterns, syntax, metavariables, common use cases, language-specific tips, and best practices, load analyzing-code-structure guide when needing:
- Complex pattern matching with metavariables
- Language-specific syntax variations
- Advanced refactoring workflows
- Integration with other tools
- Common pitfalls and solutions
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 75 lines · 42 tokens per session scan A d7b37c00c927
analyzing-code-structure is a skill published in the GitHub repository SebastienDegodez/copilot-instructions (192 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 42 tokens to every session and 806 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
distributed-mesh
How to coordinate with squads on different machines using git as transport.
external-comms
PAO workflow for scanning, drafting, and presenting community responses with human review gate.
init-mode
Team initialization flow (Phase 1 proposal + Phase 2 creation).
tiered-memory
Three-tier agent memory model (hot/cold/wiki) for context reduction per spawn.
client-compatibility
Platform detection and adaptive spawning for CLI vs VS Code vs other surfaces.
fact-checking
Review and validate claims using counter-hypothesis testing. Use when verifying technical content, checking references, validating API endpoints, or performing quality assurance on deliverables.