macro-to-micro
Skill3 starsChanged 3 months agoMITView on GitHub
Use this skill to orchestrate deep codebase exploration and complex structural refactoring by chaining Codemap, LSP Code Analysis, and AST Grep. Trigger this when asked to "safely refactor across the codebase", "trace this bug to its source", "explore the architecture of this subsystem", or whenever a task requires understanding the impact of a change before making it. This acts as a high-road strategy guide over basic grep/read commands.
In this repository86 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adrSkill
- adzic-bddSkill
- agent-md-refactorSkill
- agent-muxSkill
- agent-role-impersonatorSkill
- agilquest-reservationsSkill
- ai-text-humanizerSkill
- architecture-decision-recordsSkill
- ast-grepSkill
- atacSkill
- aws-cliSkill
- bart-adversarial-reviewerSkill
- bddSkill
- branch-doctorSkill
- c4-architectureSkill
- c4Skill
- claude-sub-agentSkill
- codemap-config-setupSkill
- codemap-exploreSkill
- codemap-handoffSkill
- codemap-hub-safetySkill
- codemapSkill
- commitSkill
- copilot-sub-agentSkill
- daily-standupSkill
- daily-statusSkill
- debugSkill
- design-thinkingSkill
- doctorSkill
- docx-word-processorSkill
- farley-tddSkill
- forensicsSkill
- gemini-sub-agentSkill
- git-commit-formatterSkill
- git-forensicsSkill
- github-actions-permissionsSkill
- github-cliSkill
- git-repo-discoverySkill
- git-safety-guardrailsSkill
- harness-idpSkill
- humanizeSkill
- iteration-plannerSkill
- jira-issue-managerSkill
- justfile-assistantSkill
- kiro-sub-agentSkill
- lessons-learnedSkill
- lessonsSkill
- lisa-planning-agentSkill
- lovejoy-release-agentSkill
- lsp-code-analysisSkill
- marge-product-agentSkill
- meeting-notesSkill
- mermaid-diagram-generatorSkill
- modern-cli-overridesSkill
- native-web-searchSkill
- obsidian-notetakerSkill
- outlook-headlessSkill
- pdf-document-processorSkill
- pi-sub-agentSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Do not blindly use grep_search or read_file on large unfamiliar codebases.
- Distinctive: line 36
Never skip the Macro step: If you are asked to change a "core" or "utils" file, use Codemap to check its fan-out first.
- Very specific: line 37
Never use
sedfor code: If you need to rename a parameter across 20 files, use AST Grep or LSP Rename. - Very specific: line 38
Don't read massive files: If a file is 2,000 lines long, use lsp outline to see its structure before blindly jumping in.
- Distinctive: line 42
Before executing any structural refactor (safe rename or move):
- Distinctive: line 49
Add the new name alongside the old (alias or wrapper)
- Distinctive: line 50
Update all callers to use the new name
- Distinctive: line 51
Remove the old name
- Distinctive: line 55
Create new file with the same public API
- Distinctive: line 57
Update all importers to use the new path
- Distinctive: line 58
Remove old file and re-export
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Macro to Micro: Structural Codebase Mastery
This is a higher-order orchestrator skill that formalizes the "Macro to Micro" toolchain. It teaches you how and when to hand off context between three powerful semantic tools:
- Codemap (The Macro View): Treats code as a graph of files.
- LSP Code Analysis (The Meso View): Treats code as a graph of symbols.
- AST Grep (The Micro View): Treats code as syntax trees.
The Articulation Strategy
Do not blindly use grep_search or read_file on large unfamiliar codebases. Follow this hand-off chain:
- Identify the Blast Radius (Codemap)
- Find the files that matter and their dependencies.
- Output: A list of target files and "hub" files (highly imported files that are dangerous to change).
- Trace the Logic (LSP)
- Take the files from step 1 and use
lsp referenceandlsp definitionto understand exactly how data flows between them. - Output: An understanding of the exact semantic contract (function signatures, usages) that needs to be altered.
- Take the files from step 1 and use
- Execute the Transformation (AST Grep)
- Take the semantic understanding from step 2 and use
sg runto perform a surgical, syntax-aware rewrite across all affected files simultaneously.
- Take the semantic understanding from step 2 and use
Reference Workflows
Detailed recipes for specific scenarios are available in the references:
- references/workflows.md: Step-by-step guides for the "Safe Hub Refactor" and the "Mystery Bug Hunt".
Core Principles
- Never skip the Macro step: If you are asked to change a "core" or "utils" file, use Codemap to check its fan-out first.
- Never use
sedfor code: If you need to rename a parameter across 20 files, use AST Grep or LSP Rename. Text replacement destroys comments and strings. - Don't read massive files: If a file is 2,000 lines long, use
lsp outlineto see its structure before blindly jumping in.
Safe Refactoring Checklist
Before executing any structural refactor (safe rename or move):
codemap --deps .— understand the full dependency graph- Identify hub files in scope — they need extra care
codemap --diff— see what's already changed on this branch- All tests pass before starting
Safe rename pattern
- Add the new name alongside the old (alias or wrapper)
- Update all callers to use the new name
- Remove the old name
- Full test suite
Safe move pattern
- Create new file with the same public API
- Re-export from old location temporarily
- Update all importers to use the new path
- Remove old file and re-export
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

