Acquire Codebase Knowledge

Acquire Codebase Knowledge

Maps an existing repository into seven evidence-backed docs (stack, structure, architecture, conventions, integrations, testing, concerns), marking unknowns and asking the user to resolve them.

Skill files11 files

references/

scripts/

assets/templates/

SKILL.md174 lines
1
---
2
name: acquire-codebase-knowledge
3
description: 'Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narrow code edits unless the user asks for repository-level discovery.'
4
license: MIT
5
compatibility: 'Cross-platform. Requires Python 3.8+ and git. Run scripts/scan.py from the target project root.'
6
metadata:
7
version: "1.3"
8
enhancements:
9
- Multi-language manifest detection (25+ languages supported)
10
- CI/CD pipeline detection (10+ platforms)
11
- Container & orchestration detection
12
- Code metrics by language
13
- Security & compliance config detection
14
- Performance testing markers
15
argument-hint: 'Optional: specific area to focus on, e.g. "architecture only", "testing and concerns"'
16
---
17
18
# Acquire Codebase Knowledge
19
20
Produces seven populated documents in `docs/codebase/` covering everything needed to work effectively on the project. Only document what is verifiable from files or terminal output — never infer or assume.
21
22
## Output Contract (Required)
23
24
Before finishing, all of the following must be true:
25
26
1. Exactly these files exist in `docs/codebase/`: `STACK.md`, `STRUCTURE.md`, `ARCHITECTURE.md`, `CONVENTIONS.md`, `INTEGRATIONS.md`, `TESTING.md`, `CONCERNS.md`.
27
2. Every claim is traceable to source files, config, or terminal output.
28
3. Unknowns are marked as `[TODO]`; intent-dependent decisions are marked `[ASK USER]`.
29
4. Every document includes a short "evidence" list with concrete file paths.
30
5. Final response includes numbered `[ASK USER]` questions and intent-vs-reality divergences.
31
32
## Workflow
33
34
Copy and track this checklist:
35
36
```
37
- [ ] Phase 1: Run scan, read intent documents
38
- [ ] Phase 2: Investigate each documentation area
39
- [ ] Phase 3: Populate all seven docs in docs/codebase/
40
- [ ] Phase 4: Validate docs, present findings, resolve all [ASK USER] items
41
```
42
43
## Focus Area Mode
44
45
If the user supplies a focus area (for example: "architecture only" or "testing and concerns"):
46
47
1. Always run Phase 1 in full.
48
2. Fully complete focus-area documents first.
49
3. For non-focus documents not yet analyzed, keep required sections present and mark unknowns as `[TODO]`.
50
4. Still run the Phase 4 validation loop on all seven documents before final output.
51
52
### Phase 1: Scan and Read Intent
53
54
1. Run the scan script from the target project root:
55
```bash
56
python3 "$SKILL_ROOT/scripts/scan.py" --output docs/codebase/.codebase-scan.txt
57
```
58
Where `$SKILL_ROOT` is the absolute path to the skill folder. Works on Windows, macOS, and Linux.
59
60
**Quick start:** If you have the path inline:
61
```bash
62
python3 /absolute/path/to/skills/acquire-codebase-knowledge/scripts/scan.py --output docs/codebase/.codebase-scan.txt
63
```
64
65
2. Search for `PRD`, `TRD`, `README`, `ROADMAP`, `SPEC`, `DESIGN` files and read them.
66
3. Summarise the stated project intent before reading any source code.
67
68
### Phase 2: Investigate
69
70
Use the scan output to answer questions for each of the seven templates. Load [`references/inquiry-checkpoints.md`](references/inquiry-checkpoints.md) for the full per-template question list.
71
72
If the stack is ambiguous (multiple manifest files, unfamiliar file types, no `package.json`), load [`references/stack-detection.md`](references/stack-detection.md).
73
74
### Phase 3: Populate Templates
75
76
Copy each template from `assets/templates/` into `docs/codebase/`. Fill in this order:
77
78
1. [STACK.md](assets/templates/STACK.md) — language, runtime, frameworks, all dependencies
79
2. [STRUCTURE.md](assets/templates/STRUCTURE.md) — directory layout, entry points, key files
80
3. [ARCHITECTURE.md](assets/templates/ARCHITECTURE.md) — layers, patterns, data flow
81
4. [CONVENTIONS.md](assets/templates/CONVENTIONS.md) — naming, formatting, error handling, imports
82
5. [INTEGRATIONS.md](assets/templates/INTEGRATIONS.md) — external APIs, databases, auth, monitoring
83
6. [TESTING.md](assets/templates/TESTING.md) — frameworks, file organization, mocking strategy
84
7. [CONCERNS.md](assets/templates/CONCERNS.md) — tech debt, bugs, security risks, perf bottlenecks
85
86
Use `[TODO]` for anything that cannot be determined from code. Use `[ASK USER]` where the right answer requires team intent.
87
88
### Phase 4: Validate, Repair, Verify
89
90
Run this mandatory validation loop before finalizing:
91
92
1. Validate each doc against `references/inquiry-checkpoints.md`.
93
2. For each non-trivial claim, confirm at least one evidence reference exists.
94
3. If any required section is missing or unsupported:
95
- Fix the document.
96
- Re-run validation.
97
4. Repeat until all seven docs pass.
98
99
Then present a summary of all seven documents, list every `[ASK USER]` item as a numbered question, and highlight any Intent vs. Reality divergences from Phase 1.
100
101
Validation pass criteria:
102
103
- No unsupported claims.
104
- No empty required sections.
105
- Unknowns use `[TODO]` rather than assumptions.
106
- Team-intent gaps are explicitly marked `[ASK USER]`.
107
108
---
109
110
## Gotchas
111
112
**Monorepos:** Root `package.json` may have no source — check for `workspaces`, `packages/`, or `apps/` directories. Each workspace may have independent dependencies and conventions. Map each sub-package separately.
113
114
**Outdated README:** README often describes intended architecture, not the current one. Cross-reference with actual file structure before treating any README claim as fact.
115
116
**TypeScript path aliases:** `tsconfig.json` `paths` config means imports like `@/foo` don't map directly to the filesystem. Map aliases to real paths before documenting structure.
117
118
**Generated/compiled output:** Never document patterns from `dist/`, `build/`, `generated/`, `.next/`, `out/`, or `__pycache__/`. These are artefacts — document source conventions only.
119
120
**`.env.example` reveals required config:** Secrets are never committed. Read `.env.example`, `.env.template`, or `.env.sample` to discover required environment variables.
121
122
**`devDependencies` ≠ production stack:** Only `dependencies` (or equivalent, e.g. `[tool.poetry.dependencies]`) runs in production. Document linters, formatters, and test frameworks separately as dev tooling.
123
124
**Test TODOs ≠ production debt:** TODOs inside `test/`, `tests/`, `__tests__/`, or `spec/` are coverage gaps, not production technical debt. Separate them in `CONCERNS.md`.
125
126
**High-churn files = fragile areas:** Files appearing most in recent git history have the highest modification rate and likely hidden complexity. Always note them in `CONCERNS.md`.
127
128
---
129
130
## Anti-Patterns
131
132
| ❌ Don't | ✅ Do instead |
133
|---------|--------------|
134
| "Uses Clean Architecture with Domain/Data layers." (when no such directories exist) | State only what directory structure actually shows. |
135
| "This is a Next.js project." (without checking `package.json`) | Check `dependencies` first. State what's actually there. |
136
| Guess the database from a variable name like `dbUrl` | Check manifest for `pg`, `mysql2`, `mongoose`, `prisma`, etc. |
137
| Document `dist/` or `build/` naming patterns as conventions | Source files only. |
138
139
---
140
141
## Enhanced Scan Output Sections
142
143
The `scan.py` script now produce the following sections in addition to the original output:
144
145
- **CODE METRICS** — Total files, lines of code by language, largest files (complexity signals)
146
- **CI/CD PIPELINES** — Detected GitHub Actions, GitLab CI, Jenkins, CircleCI, etc.
147
- **CONTAINERS & ORCHESTRATION** — Docker, Docker Compose, Kubernetes, Vagrant configs
148
- **SECURITY & COMPLIANCE** — Snyk, Dependabot, SECURITY.md, SBOM, security policies
149
- **PERFORMANCE & TESTING** — Benchmark configs, profiling markers, load testing tools
150
151
Use these sections during Phase 2 to inform investigation questions and identify tool-specific patterns.
152
153
---
154
155
## Bundled Assets
156
157
| Asset | When to load |
158
|-------|-------------|
159
| [`scripts/scan.py`](scripts/scan.py) | Phase 1 — run first, before reading any code (Python 3.8+ required) |
160
| [`references/inquiry-checkpoints.md`](references/inquiry-checkpoints.md) | Phase 2 — load for per-template investigation questions |
161
| [`references/stack-detection.md`](references/stack-detection.md) | Phase 2 — only if stack is ambiguous |
162
| [`assets/templates/STACK.md`](assets/templates/STACK.md) | Phase 3 step 1 |
163
| [`assets/templates/STRUCTURE.md`](assets/templates/STRUCTURE.md) | Phase 3 step 2 |
164
| [`assets/templates/ARCHITECTURE.md`](assets/templates/ARCHITECTURE.md) | Phase 3 step 3 |
165
| [`assets/templates/CONVENTIONS.md`](assets/templates/CONVENTIONS.md) | Phase 3 step 4 |
166
| [`assets/templates/INTEGRATIONS.md`](assets/templates/INTEGRATIONS.md) | Phase 3 step 5 |
167
| [`assets/templates/TESTING.md`](assets/templates/TESTING.md) | Phase 3 step 6 |
168
| [`assets/templates/CONCERNS.md`](assets/templates/CONCERNS.md) | Phase 3 step 7 |
169
170
Template usage mode:
171
172
- Default mode: complete only the "Core Sections (Required)" in each template.
173
- Extended mode: add optional sections only when the repo complexity justifies them.
174

© awesome-copilot contributors · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…