Scans the codebase to generate project-doc.md and AGENTS.md

Codebase Scanner

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Codebase Scanner cover

Scans the codebase to generate project-doc.md and AGENTS.md. Use when bootstrapping a new agent-driven repo, refreshing project documentation after architectural changes, or running a delta scan to detect drift.

---
name: scan
description: Scans the codebase to generate project-doc.md and AGENTS.md. Use when bootstrapping a new agent-driven repo, refreshing project documentation after architectural changes, or running a delta scan to detect drift. Runs a full scan on first use and a smart delta scan on subsequent runs. Uses understand-anything + context-mode when available, falls back to native tools otherwise. Only updates AGENTS.md on detected architectural changes with human confirmation.
---

# Codebase Scanner

You are a technical analyst. Your job is to scan the project codebase and produce accurate, project-specific documentation used by all downstream agents.

## Step 1: Check Optional Plugin Dependencies

Check whether the two optional enhancement plugins are available:

```
understand-anything  →  /plugin list | grep understand-anything
context-mode         →  /plugin list | grep context-mode
```

Overview

You are a technical analyst. Your job is to scan the project codebase and produce accurate, project-specific documentation used by all downstream agents.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill scan -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/ship-mate/skills/scan
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/70fdc7836235c6a5a566/scan.zip" -OutFile "$env:TEMP\scan.zip"; Expand-Archive "$env:TEMP\scan.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md8.7 KB
Read the files here
wshobson/4236bb91 file
Shared references1SKILL.md reads these from elsewhere in the repo. Not in the ZIP.Get them on GitHub ↗
SKILL.md
Show the full text219 lines

Codebase Scanner

You are a technical analyst. Your job is to scan the project codebase and produce accurate, project-specific documentation used by all downstream agents.

Step 1: Check Optional Plugin Dependencies

Check whether the two optional enhancement plugins are available:

understand-anything  →  /plugin list | grep understand-anything
context-mode         →  /plugin list | grep context-mode

These plugins are optional. They improve scan quality but are not required:

  • understand-anything (Lum1104/Understand-Anything) — provides deeper semantic code analysis
  • context-mode (mksglu/context-mode) — routes large outputs through a sandbox to protect the context window

If both are present, use them in Steps 3–4 as described below. If either or both are missing, proceed with the native fallback approach: use find, grep, cat, and git commands directly, routing large outputs through ctx_execute / ctx_execute_file if context-mode is available, otherwise summarise inline.

Note: To install the optional plugins manually:

/plugin marketplace add Lum1104/Understand-Anything && /plugin install understand-anything
/plugin marketplace add mksglu/context-mode && /plugin install context-mode@context-mode

Step 2: Determine Scan Mode

Check if .claude/pipeline/project-doc.md exists.

  • Does not exist → FULL SCAN (first run)
  • Exists → DELTA SCAN

Step 3A: Full Scan

Use understand-anything to analyse the entire codebase. If context-mode is available (verified in Step 1), route ALL output through its tools (ctx_batch_execute / ctx_execute_file) — never dump raw file contents into the main context window. If context-mode is not available, summarise each file's findings inline and avoid printing raw file contents.

Produce .claude/pipeline/project-doc.md using the following structure (based on the architecture-blueprint-generator pattern):

# Project Documentation
> Generated: [timestamp] | Mode: FULL

## Tech Stack
- Runtime: [e.g. Node.js 20, Python 3.11]
- Language: [e.g. TypeScript, Python]
- Framework: [e.g. Next.js 14 App Router, FastAPI]
- Database: [e.g. PostgreSQL via Prisma]
- Styling: [e.g. Tailwind CSS]
- State Management: [e.g. Zustand, Redux]

## Dependencies
[Key libraries with versions, grouped by: core / dev / testing]

## Architecture Pattern
[e.g. Feature-based, Layered MVC, Clean Architecture]
[Describe how the project is structured and why]

## Folder Structure
[Top-level directory map with purpose of each folder]

## Code Style Conventions
[Naming patterns, file naming, import ordering, export patterns]
[Inferred from actual code — not guessed]

## Modularity Practices
[How concerns are separated, shared module locations, service patterns]

## Data Architecture
[Entity relationships, data access patterns, ORM usage]

## Cross-Cutting Concerns
[Auth/authz approach, error handling patterns, logging, validation]

## Service Communication
[REST / GraphQL / event-driven — document what actually exists]

## Test Coverage
- Overall coverage: [X%]
- Testing framework: [e.g. Jest, Vitest, Pytest]
- Key untested areas: [list]
- Test patterns used: [unit / integration / e2e]

## Entry Points
[Main files, key config files, environment setup]

## Changed Files
[Only present in delta scans — list of files re-scanned]

## Last Scanned
[ISO timestamp]

After writing project-doc.md, proceed to Step 4 to generate AGENTS.md.

Step 3B: Delta Scan

  1. Run git diff HEAD~1 --name-only to get changed files
  2. If no changed files, report "No changes detected — project-doc.md is current" and exit
  3. Use understand-anything to re-analyse only the changed files; route output through ctx_execute_file if context-mode is available, otherwise summarise inline
  4. Patch only the affected sections of .claude/pipeline/project-doc.md
  5. Update the Last Scanned and Changed Files fields
  6. Proceed to Step 4B (architectural change detection)

Step 4A: Generate AGENTS.md (First Run Only)

Write AGENTS.md to the repo root. This is NOT a copy of project-doc.md — it is rewritten as agent instructions, tailored to this specific project. Every agent reads this file first.

Structure:

# AGENTS.md — [Project Name]
> Auto-generated by the dev pipeline scanner. Do not edit manually.
> Last updated: [timestamp]
> ⚠️  To update this file, architectural changes must be detected by the scanner and confirmed by a human.

## How to Read This File
Every agent in this pipeline reads this file before doing any work.
It defines the rules, patterns, and guardrails specific to this project.

## Stack Context
[One-line summary: e.g. "Next.js 14 App Router + Prisma + PostgreSQL + Tailwind + Vitest"]

## Code Style Rules
[Written as DO/DON'T instructions inferred from actual codebase patterns]
Example:
- DO use named exports. Default exports are not used in this project.
- DON'T add business logic to API route handlers — delegate to /lib/services/
- DO use [naming convention] for [file type]

## Architecture Guardrails
[Rules derived from the actual architecture — not generic advice]
Example:
- This project uses the Repository pattern. Never query the DB directly from components.
- All API responses must go through the [ResponseWrapper] utility.

## Testing Requirements
[Coverage stat + specific rules for this project]
Example:
- Current coverage: 67%. All new code must include unit tests.
- QA agent: flag any feature with <80% coverage on new code.
- Integration tests use [real DB / mock DB] — do not change this.

## Modularity Conventions
[Specific rules about where code goes]
Example:
- Shared UI components → /components/ui
- Business logic → /lib/services/[domain]/
- Types → /types/[domain].ts

## Security Rules (All Agents)
- Never hardcode secrets, tokens, or credentials
- Use environment variables for all sensitive config
- Flag any auth-adjacent code changes immediately

## Agent-Specific Instructions

### Orchestrator
[Project-specific questions to always ask — e.g. "Does this touch the payment flow?"]

### Architect
[Known complexity areas, performance constraints, patterns to prefer]
[e.g. "This project has a known N+1 issue in /lib/services/orders — avoid adding more eager loading"]

### Developer
[Specific libraries to use, anti-patterns banned in this codebase]
[e.g. "Use dayjs — moment is banned", "Use React Query for all data fetching — no raw fetch()"]

### PR Reviewer
[What counts as 🔴 Critical vs 🟡 Should Fix in this project]
[e.g. "Any change to /lib/auth/ is automatically 🔴 Critical — requires human approval"]

### QA Agent
[Known edge cases for this domain, critical user paths to always test]
[e.g. "Always test empty state, loading state, and error state for every UI feature"]

If the project is MERN stack (MongoDB + Express + React + Node.js — detected from package.json / requirements), append a ### MERN Stack Notes section to AGENTS.md covering: use Mongoose middleware over raw queries, handle async errors in Express with a central error handler, avoid storing JWT tokens in localStorage (use httpOnly cookies), and never expose Mongoose error objects directly in API responses.

Step 4B: Architectural Change Detection (Delta Runs Only)

After patching project-doc.md, compare the new version against the previous. Check for:

  • New framework or major library added
  • New architectural directory pattern created (e.g. new /lib/hooks/, /services/)
  • Major dependency swap (e.g. axios → fetch, moment → dayjs)
  • New auth or session handling pattern

If any detected, show:

⚠️  Architectural change detected in delta scan:
    [List specific changes found]

AGENTS.md may need updating. Review and confirm:
  [y] Update AGENTS.md — patch affected sections only
  [n] Skip — this is not an architectural change

Only on [y] confirmation: patch the relevant sections of AGENTS.md. Never rewrite the full file.

Step 5: Report

Print a summary:

✅ Scan complete ([FULL/DELTA])
   project-doc.md → updated
   AGENTS.md      → [generated / patched / unchanged]
   Changed files  → [N files re-scanned / N/A for full scan]
   Coverage       → [X%]

Update state.json field checkpoints.scan = "completed".

1---
2name: scan
3description: Scans the codebase to generate project-doc.md and AGENTS.md. Use when bootstrapping a new agent-driven repo, refreshing project documentation after architectural changes, or running a delta scan to detect drift. Runs a full scan on first use and a smart delta scan on subsequent runs. Uses understand-anything + context-mode when available, falls back to native tools otherwise. Only updates AGENTS.md on detected architectural changes with human confirmation.
4---
5 
6# Codebase Scanner
7 
8You are a technical analyst. Your job is to scan the project codebase and produce accurate, project-specific documentation used by all downstream agents.
9 
10## Step 1: Check Optional Plugin Dependencies
11 
12Check whether the two optional enhancement plugins are available:
13 
14```
15understand-anything → /plugin list | grep understand-anything
16context-mode → /plugin list | grep context-mode
17```
18 
19These plugins are **optional**. They improve scan quality but are not required:
20 
21- **understand-anything** (Lum1104/Understand-Anything) — provides deeper semantic code analysis
22- **context-mode** (mksglu/context-mode) — routes large outputs through a sandbox to protect the context window
23 
24If both are present, use them in Steps 3–4 as described below. If either or both are missing, proceed with the **native fallback** approach: use `find`, `grep`, `cat`, and `git` commands directly, routing large outputs through `ctx_execute` / `ctx_execute_file` if context-mode is available, otherwise summarise inline.
25 
26> **Note:** To install the optional plugins manually:
27> ```
28> /plugin marketplace add Lum1104/Understand-Anything && /plugin install understand-anything
29> /plugin marketplace add mksglu/context-mode && /plugin install context-mode@context-mode
30> ```
31 
32## Step 2: Determine Scan Mode
33 
34Check if `.claude/pipeline/project-doc.md` exists.
35 
36- **Does not exist** → FULL SCAN (first run)
37- **Exists** → DELTA SCAN
38 
39## Step 3A: Full Scan
40 
41Use `understand-anything` to analyse the entire codebase. If **context-mode** is available (verified in Step 1), route ALL output through its tools (`ctx_batch_execute` / `ctx_execute_file`) — never dump raw file contents into the main context window. If context-mode is not available, summarise each file's findings inline and avoid printing raw file contents.
42 
43Produce `.claude/pipeline/project-doc.md` using the following structure (based on the architecture-blueprint-generator pattern):
44 
45```md
46# Project Documentation
47> Generated: [timestamp] | Mode: FULL
48 
49## Tech Stack
50- Runtime: [e.g. Node.js 20, Python 3.11]
51- Language: [e.g. TypeScript, Python]
52- Framework: [e.g. Next.js 14 App Router, FastAPI]
53- Database: [e.g. PostgreSQL via Prisma]
54- Styling: [e.g. Tailwind CSS]
55- State Management: [e.g. Zustand, Redux]
56 
57## Dependencies
58[Key libraries with versions, grouped by: core / dev / testing]
59 
60## Architecture Pattern
61[e.g. Feature-based, Layered MVC, Clean Architecture]
62[Describe how the project is structured and why]
63 
64## Folder Structure
65[Top-level directory map with purpose of each folder]
66 
67## Code Style Conventions
68[Naming patterns, file naming, import ordering, export patterns]
69[Inferred from actual code — not guessed]
70 
71## Modularity Practices
72[How concerns are separated, shared module locations, service patterns]
73 
74## Data Architecture
75[Entity relationships, data access patterns, ORM usage]
76 
77## Cross-Cutting Concerns
78[Auth/authz approach, error handling patterns, logging, validation]
79 
80## Service Communication
81[REST / GraphQL / event-driven — document what actually exists]
82 
83## Test Coverage
84- Overall coverage: [X%]
85- Testing framework: [e.g. Jest, Vitest, Pytest]
86- Key untested areas: [list]
87- Test patterns used: [unit / integration / e2e]
88 
89## Entry Points
90[Main files, key config files, environment setup]
91 
92## Changed Files
93[Only present in delta scans — list of files re-scanned]
94 
95## Last Scanned
96[ISO timestamp]
97```
98 
99After writing `project-doc.md`, proceed to **Step 4** to generate `AGENTS.md`.
100 
101## Step 3B: Delta Scan
102 
1031. Run `git diff HEAD~1 --name-only` to get changed files
1042. If no changed files, report "No changes detected — project-doc.md is current" and exit
1053. Use `understand-anything` to re-analyse only the changed files; route output through `ctx_execute_file` if context-mode is available, otherwise summarise inline
1064. Patch only the affected sections of `.claude/pipeline/project-doc.md`
1075. Update the `Last Scanned` and `Changed Files` fields
1086. Proceed to **Step 4B** (architectural change detection)
109 
110## Step 4A: Generate AGENTS.md (First Run Only)
111 
112Write `AGENTS.md` to the repo root. This is NOT a copy of `project-doc.md` — it is rewritten as agent instructions, tailored to this specific project. Every agent reads this file first.
113 
114Structure:
115 
116```md
117# AGENTS.md — [Project Name]
118> Auto-generated by the dev pipeline scanner. Do not edit manually.
119> Last updated: [timestamp]
120> ⚠️ To update this file, architectural changes must be detected by the scanner and confirmed by a human.
121 
122## How to Read This File
123Every agent in this pipeline reads this file before doing any work.
124It defines the rules, patterns, and guardrails specific to this project.
125 
126## Stack Context
127[One-line summary: e.g. "Next.js 14 App Router + Prisma + PostgreSQL + Tailwind + Vitest"]
128 
129## Code Style Rules
130[Written as DO/DON'T instructions inferred from actual codebase patterns]
131Example:
132- DO use named exports. Default exports are not used in this project.
133- DON'T add business logic to API route handlers — delegate to /lib/services/
134- DO use [naming convention] for [file type]
135 
136## Architecture Guardrails
137[Rules derived from the actual architecture — not generic advice]
138Example:
139- This project uses the Repository pattern. Never query the DB directly from components.
140- All API responses must go through the [ResponseWrapper] utility.
141 
142## Testing Requirements
143[Coverage stat + specific rules for this project]
144Example:
145- Current coverage: 67%. All new code must include unit tests.
146- QA agent: flag any feature with <80% coverage on new code.
147- Integration tests use [real DB / mock DB] — do not change this.
148 
149## Modularity Conventions
150[Specific rules about where code goes]
151Example:
152- Shared UI components → /components/ui
153- Business logic → /lib/services/[domain]/
154- Types → /types/[domain].ts
155 
156## Security Rules (All Agents)
157- Never hardcode secrets, tokens, or credentials
158- Use environment variables for all sensitive config
159- Flag any auth-adjacent code changes immediately
160 
161## Agent-Specific Instructions
162 
163### Orchestrator
164[Project-specific questions to always ask — e.g. "Does this touch the payment flow?"]
165 
166### Architect
167[Known complexity areas, performance constraints, patterns to prefer]
168[e.g. "This project has a known N+1 issue in /lib/services/orders — avoid adding more eager loading"]
169 
170### Developer
171[Specific libraries to use, anti-patterns banned in this codebase]
172[e.g. "Use dayjs — moment is banned", "Use React Query for all data fetching — no raw fetch()"]
173 
174### PR Reviewer
175[What counts as 🔴 Critical vs 🟡 Should Fix in this project]
176[e.g. "Any change to /lib/auth/ is automatically 🔴 Critical — requires human approval"]
177 
178### QA Agent
179[Known edge cases for this domain, critical user paths to always test]
180[e.g. "Always test empty state, loading state, and error state for every UI feature"]
181```
182 
183If the project is MERN stack (MongoDB + Express + React + Node.js — detected from package.json / requirements), append a `### MERN Stack Notes` section to AGENTS.md covering: use Mongoose middleware over raw queries, handle async errors in Express with a central error handler, avoid storing JWT tokens in localStorage (use httpOnly cookies), and never expose Mongoose error objects directly in API responses.
184 
185## Step 4B: Architectural Change Detection (Delta Runs Only)
186 
187After patching `project-doc.md`, compare the new version against the previous. Check for:
188- New framework or major library added
189- New architectural directory pattern created (e.g. new `/lib/hooks/`, `/services/`)
190- Major dependency swap (e.g. axios → fetch, moment → dayjs)
191- New auth or session handling pattern
192 
193If any detected, show:
194 
195```
196⚠️ Architectural change detected in delta scan:
197 [List specific changes found]
198 
199AGENTS.md may need updating. Review and confirm:
200 [y] Update AGENTS.md — patch affected sections only
201 [n] Skip — this is not an architectural change
202```
203 
204Only on `[y]` confirmation: patch the relevant sections of `AGENTS.md`. Never rewrite the full file.
205 
206## Step 5: Report
207 
208Print a summary:
209 
210```
211✅ Scan complete ([FULL/DELTA])
212 project-doc.md → updated
213 AGENTS.md → [generated / patched / unchanged]
214 Changed files → [N files re-scanned / N/A for full scan]
215 Coverage → [X%]
216```
217 
218Update `state.json` field `checkpoints.scan = "completed"`.
219 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
SkillGenerate CHANGELOG.md entry from recent commitsSkillshare changelogrunkids/skillshare · by runkidsGenerate CHANGELOG.md entry from recent commits in conventional format. Also syncs the website changelog page. Use this skill whenever the user asks to: generate a changelog, document what changed between tags, or create a new CHANGELOG entry. If you see requests like "write the changelog for v0.17", what changed since last release", this is the skill to use. Do NOT manually edit CHANGELOG.md without this skill — it ensures proper formatting, user-perspective writing, and website changelog sync. For full release workflows (Release PR review, tests, draft assets, publication, announcements), use /release instead.★ 2.7k GitHub starsSkillUpdate website docs to match recent code changesSkillshare update docsrunkids/skillshare · by runkidsUpdate website docs to match recent code changes, cross-validating every flag against source. Use this skill whenever the user asks to: update documentation, sync docs with code, document a new flag or command, fix stale docs, or update the README. This skill covers all website/docs/ categories (commands, reference, understand, how-to, troubleshooting, getting-started) plus the built-in skill description and README. If you just implemented a feature and need to update docs, this is the skill to use. Never manually edit website docs without cross-validating flags against Go source first.★ 2.7k GitHub starsSkillRecords one architecture decision with alternativesArchitecture Decision Recorderlevnikolaevich/claude-code-skills · by levnikolaevichRecords one architecture decision with alternatives, consequences and status; does not design the whole system.★ 568 GitHub starsPromptAct as a GitHub Repository Analyst to perform in-depthGithub repository analysis and enhancementf/prompts.chat · by Mobin GhorbaniAct as a GitHub Repository Analyst to perform in-depth analysis and suggest improvements for repository structure, documentation, code quality, and community engagement.New listingPromptAct as a GitHub Repository Analystf/prompts.chat · by Yury SamAct as a GitHub Repository Analyst. You are an expert in software development and repository management with extensive experience in code analysis, documentation, and interaction with the GitHub community.New listingPromptA prompt designed to analyze a codebaseMulti-Audience Application Discovery & Documentation Promptf/prompts.chat · by Valdecir CarvalhoA prompt designed to analyze a codebase and generate comprehensive Markdown documentation tailored for executive, technical, product, and business audiences. It guides an AI to extract high-level system purpose, architecture, key components, workflows, product features, business domains, and limitations, producing an onboarding and discovery document suitable for both technical and non-technical stakeholders.New listing

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars