project-structure
できること
このスキルは、コードプロジェクトのファイル、エクスポートされた名前、シグネチャを並べた、圧縮された地図のファイルを1つ作ります。コードベース全体についてエージェントに推論させたい開発者向けです。
使う場面
- ✓大きな TypeScript や Swift のプロジェクトの概要がほしいとき。
- ✓重複したコードを探したり、リファクタリングを計画したりするとき。
- ✓別のエージェントに、プロジェクト全体の地図を渡したいとき。
スキルのリンク
https://github.com/steipete/agent-scripts/blob/main/skills/project-structure/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“この TypeScript のプロジェクトのコンパクトな地図を作ってください。プロジェクト全体で重複したコードを探せるようにしたいです。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、プロジェクトのフォルダーに対して同梱のスクリプトを実行します。ファイル、シンボル、シグネチャを含む1つの地図のファイルを書き、その結果の大きさを報告します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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— defaultdense.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 (markedinternal; 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/turnmaps 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-linepackage.jsondescriptions, 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 indense(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+noverflow marker (dense; 10–12 is safe).--members— Swift only (ignored for TS files): additionally emit one-level-deep methods/properties asType.member; extension members appear under their target type.--public-only— Swift only (ignored for TS files): keep only symbols whose written access isopen/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
よくある質問
どの言語に対応していますか?
TypeScript と Swift で、両方を含むリポジトリにも対応します。
型のチェックはしますか?
いいえ。TypeScript の部分は構文の解析だけで、型のチェックは実行しません。
何をインストールしておく必要がありますか?
Node のバージョン 23.6 以降、または tsx というツールです。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 7.4k
- ランキング
- #13242
- ライセンス
- MIT
- 更新日
- 2026/10/30
コメント
- …
このリポジトリの他のスキル
beeper
7.4kローカルの Beeper のチャット履歴を検索して、メッセージを見つけ、あいまいなヒントがどのチャットや連絡先を指すかを特定するようエージェントを支援します。
cloudflare-registrar
7.4kCloudflare Registrar のドメインの価格と空き状況を確認し、確認の手順を経てドメインを登録または一覧表示するようエージェントを支援します。
codexbar
7.4kCodex、Claude、Kimi などの AI サービスの、残りの利用量を、上限、クレジット、リセット時刻を含めて確認するようエージェントを支援します。
create-cli
7.4k人にもスクリプトにも使いやすいように、コマンドラインツールのコマンド、フラグ、ヘルプの文章、出力、エラーを設計するようエージェントを支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。