Skip to content
Skillpedia
General coding7.4k Β· #13242

project-structure

What it does

This skill creates a single compressed map file of a code project, listing its files, exported names, and signatures. It is for developers who want an agent to reason about the whole codebase at once.

When to use it

  • βœ“When you want an overview of a large TypeScript or Swift project.
  • βœ“When you are hunting for duplicated code or planning a refactor.
  • βœ“When you want to hand another agent a full map of the project.

Skill link

https://github.com/steipete/agent-scripts/blob/main/skills/project-structure/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/steipete/agent-scripts/blob/main/skills/project-structure/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œMake a compact map of this TypeScript project so we can look for duplicated code across it.”

5 new skills a week. 1 minute to read.

How it works

The agent runs a bundled script over the project folder. It writes one map file with the files, symbols, and signatures, and reports how large the result is.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Project Structure

Compress a TS or Swift repo into one map file an agent can load whole. Backed by map.ts next to this file. TS: parse-only TS compiler, no type-check; ~8k files in ~5s; resolves the typescript package from the target repo, falling back to this skill dir. Swift: zero-dependency regex/brace-depth scanner built into map.ts (no typescript needed for pure-Swift repos). Requires Node >= 23.6 (native type stripping) or npx tsx. .ts/.tsx and .swift files are detected by extension; a repo may mix both.

Run

node <this-skill-dir>/map.ts <repoRoot> [flags]

<this-skill-dir> is the base directory of this skill as announced when the skill loads (canonical: ~/Projects/agent-scripts/skills/project-structure).

Output: one map file (default project-structure-map.txt in cwd) plus a JSON stats line (files, symbols, bytes, approxTokens) on stdout.

Flags

  • --out <file> β€” output path.
  • --mode dense|skeleton|exports|sigs|full β€” default dense.
    • dense: dir-grouped, one line per file: file fn:a,b ty:T cl:C c:x re:./y. Recon tier. File extensions are stripped for compactness, so a same-basename TS and Swift file in one dir share a line prefix (theoretical in practice; grep the repo to disambiguate).
    • skeleton: one symbol per line, names only.
    • exports: exported symbols with full typed signatures, type bodies, first doc-comment line. Refactor-decision tier. TS-only β€” Swift files fall back to their dense-style line (no fabricated signatures).
    • sigs: exports but type/interface bodies collapsed to member names (only ~10% smaller than exports; rarely worth it). TS-only, same Swift fallback.
    • full: exports + non-exported top-level symbols (marked internal; internal consts appear only when function-valued or explicitly typed β€” untyped internal consts are filtered as noise). TS-only, same Swift fallback.
  • --include a,b,c β€” paths to map, relative to repoRoot (default: all top-level dirs, minus skips/boundaries). Accepts nested paths, not just top-level dirs: --include src/channels/turn maps exactly that subtree. Headers stay repoRoot-relative, so running from repo root with --include <subsystem> is the recommended way to map a subsection.
  • --boundary x,y β€” dirs listed as boundary index only: child module names + one-line package.json descriptions, no symbol content. Use for plugin/extension trees.
  • --include-tests β€” keep test files and test-support infra (default: both excluded; Swift test detection is path-based: Tests?/ dirs and *Tests.swift).
  • --no-docs β€” strip doc comments (saves ~13% on typed modes).
  • --fn-consts-only β€” drop non-function const exports (on Swift files: drops every let/var symbol β€” closure-valued consts are indistinguishable without type info). Caution: silently drops files whose only exports are consts (plugin definition objects, schemas, registries). Prefer keeping consts in dense (names are cheap).
  • --re-counts β€” collapse re-export path lists to a count (dense; saves ~10%).
  • --max-per-kind N β€” cap each symbol-kind list per file with +n overflow marker (dense; 10–12 is safe).
  • --members β€” Swift only (ignored for TS files): additionally emit one-level-deep methods/properties as Type.member; extension members appear under their target type.
  • --public-only β€” Swift only (ignored for TS files): keep only symbols whose written access is open/public.

When --include is absent, source files sitting directly in repoRoot are scanned too (so pointing repoRoot at a leaf source dir works); with --include, only the listed paths are walked.

Swift specifics

Zero-dependency line scanner (lexical masking of comments/strings + brace-depth tracking), validated 1:1 against SourceKitten on 1,850 files across two real repos (100% top-level symbol agreement) at ~100Γ— SourceKitten's speed. Known limitations (accepted tradeoffs of the parserless design): one declaration per line is assumed β€” a member on the same line as its type (struct Box { var v = 1 }) or a second semicolon-separated declaration is not emitted; bare /…/ regex literals are not masked (lexically ambiguous with division), so a brace inside one can desync depth for the rest of that file β€” extended #/…/# literals are masked correctly; comments or raw/multiline literals nested inside string interpolations, emoji identifiers, and #if branches whose alternative headers declare differently named containers are best-effort (sam

FAQ

Which languages does it handle?

TypeScript and Swift, including repos that contain both.

Does it check types?

No. The TypeScript part is a parse-only pass and does not run a type check.

What does it need installed?

Node version 23.6 or newer, or a tool called tsx.

Details

Original description by the author

Generate a single-file compressed symbol map of a TypeScript or Swift repository β€” files, exported symbols, typed signatures, plugin boundaries β€” sized to fit an LLM context window. Use for whole-project reasoning: duplication hunting, refactor planning, architecture recon, or feeding another agent a full-project map.

repo: steipete/agent-scripts

Popularity

GitHub stars
7.4k
Ranking position
#13242
License
MIT
Updated
10/30/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills