agentleFS
ChianWChianW/C31/skills/utils/gsd-map-codebase/SKILL.md

gsd-map-codebase

Skill1 starsChanged 3 months agoMITView on GitHub

Output language: Respond automatically in the user's conversation language. Produce a durable reference of an existing codebase so future work doesn't start from zero context. The output is a set of Markdown files in memory/.planning/codebase/. 1. Directory structure — Run find . -maxdepth 3 -type f (or deeper as needed). Ignore node_modules/, .git/, dist/, build/, __pycache__/, .venv/. 2. Tech stack markers — Look for: - package.json, requirements.txt, go.mod, Cargo.toml, Gemfile, etc. - Dockerfile, docker-compose.yml, k8s/, helm/ - Config files (vite.config.*,…

5 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 6

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use when the user says "map codebase", "analyze codebase", "代码库分析", "brownfield", "existing code", or needs to understand a legacy …

    line 5
  2. Distinctive:

    Before planning a refactor, migration, or major feature on a legacy codebase

    line 29
  3. Distinctive:

    After inheriting a project with no documentation

    line 30
  4. Distinctive:

    When onboarding a new contributor who needs orientation

    line 31
  5. Distinctive:

    Commit message style if visible in git log

    line 67
  6. Very specific:

    Create directory memory/.planning/codebase/ if it doesn't exist.

    line 78
  7. Distinctive:

    Write one file per topic. Each file uses YAML frontmatter:

    line 79

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Multilingual Triggers

LanguageTrigger phrases
ENgsd-map-codebase
ZH分析代码库, 代码库分析
JAコードベース分析

Output language: Respond automatically in the user's conversation language.

Map an Existing Codebase

Produce a durable reference of an existing codebase so future work doesn't start from zero context. The output is a set of Markdown files in memory/.planning/codebase/.

When to Use

  • User says "map this codebase", "analyze the repo", "what's in this project?"
  • Before planning a refactor, migration, or major feature on a legacy codebase
  • After inheriting a project with no documentation
  • When onboarding a new contributor who needs orientation

Execution Flow

Phase 1: Scan

  1. Directory structure — Run find . -maxdepth 3 -type f (or deeper as needed). Ignore node_modules/, .git/, dist/, build/, __pycache__/, .venv/.
  2. Tech stack markers — Look for:
    • package.json, requirements.txt, go.mod, Cargo.toml, Gemfile, etc.
    • Dockerfile, docker-compose.yml, k8s/, helm/
    • Config files (vite.config.*, webpack.config.*, tsconfig.json, etc.)
  3. Architecture signals — Count of services/modules, entry points, API definitions, database schema files, message queue configs, event bus usage.

Phase 2: Detect

Tech Stack (for STACK.md)

  • Primary language(s) and versions
  • Framework(s) and runtime
  • Build tools and package managers
  • Database(s), caches, message queues
  • Deployment / CI platform(s)
  • Testing frameworks

Architecture (for ARCHITECTURE.md)

  • Pattern: monolith, modular monolith, microservices, serverless, etc.
  • Communication style: REST, GraphQL, gRPC, events, message bus
  • Data flow: where is state, where is compute, what is the boundary
  • Key entry points and hot paths

Conventions (for CONVENTIONS.md)

  • Naming: files, classes, functions, variables, branches
  • Folder structure: by feature, by layer, by domain
  • Import / module organization
  • Code style (formatter, linter config if detectable)
  • Commit message style if visible in git log

Concerns (for CONCERNS.md)

  • Security: secrets in code, exposed ports, auth patterns
  • Performance: synchronous blocking calls, N+1 queries, unbounded loops
  • Debt: TODO/FIXME count, deprecated dependencies, code duplication
  • Reliability: missing tests, error handling gaps, no retry logic
  • Scalability: hardcoded limits, single points of failure

Phase 3: Write Artifacts

Create directory memory/.planning/codebase/ if it doesn't exist. Write one file per topic. Each file uses YAML frontmatter:

---
topic: <topic-name>
generated_at: <ISO-8601 timestamp>
---

STACK.md — Bulleted inventory of languages, frameworks, infra. ARCHITECTURE.md — Narrative + a simple ASCII or bullet diagram. CONVENTIONS.md — Patterns the team follows. Note deviations. CONCERNS.md — Ranked by severity: High / Medium / Low. Include file paths. STRUCTURE.md — Directory tree (pruned) with one-line purpose per directory. TESTING.md — Test frameworks, coverage signals, mock strategy, gaps.

Phase 4: Summarize

Return a concise summary:

  • Lines of code / file count (approximate)
  • Primary stack
  • One-line architecture description
  • Top 3 concerns
  • Location of the artifact files

Rules

  1. Never modify source code — This skill is read-only.
  2. Label assumptions — If you infer something without direct evidence, mark it (assumption).
  3. Keep paths repo-relative — Never absolute paths.
  4. Skip generated artifacts — node_modules, dist, lockfiles are metadata only.
  5. Stay under 300 lines total output across all files combined. Be terse.
  6. Idempotent — Re-running should overwrite artifacts cleanly.

Example Artifact (STACK.md)

---
topic: stack
generated_at: 2026-05-19T01:30:00+08:00
---

# Tech Stack

- **Language**: TypeScript 5.4 (Node 20)
- **Framework**: Express + React 18 (Vite)
- **Package Manager**: pnpm
- **Database**: PostgreSQL 15 (Prisma ORM)
- **Cache**: Redis (ioredis)
- **Queue**: BullMQ on Redis
- **Testing**: Vitest + Playwright
- **CI**: GitHub Actions
- **Deploy**: Docker Compose on AWS EC2

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.