PABCD Initiative Documentation Hub pabcd_initiative codexclaw cli-jaw

dev-scaffolding

Source: skills/dev-scaffolding/SKILL.md

Project and module scaffolding with repo-first convention reuse and structural audits.

왜 별도 모듈인가
새 프로젝트나 모듈을 만들 때 에이전트가 기존 코드베이스의 관습을 무시하고 자기만의 구조를 발명하면, 이후 팀이 유지보수할 수 없는 이질적인 코드가 된다. 이 스킬은 기존 레포의 구조, 네이밍, 패키지 구성을 먼저 읽고 재활용하도록 강제하여 '빈 캔버스 증후군'을 차단한다.
LLM 단독 사용 시 발생하는 문제

LLM은 매 세션마다 새로운 컨텍스트에서 시작한다. 기존 프로젝트의 관습(디렉토리 구조, 네이밍, 패키지 구성)을 자발적으로 조사하지 않고, 학습 데이터에서 가장 흔한 구조를 기본값으로 사용한다. 이 결과 같은 프로젝트 안에서도 에이전트가 만든 부분과 기존 코드의 구조가 이질적이 된다. Convention Discovery는 '먼저 기존 구조를 읽으라'는 강제 단계를 만들어 이 문제를 해결한다.

이 스킬이 해결하는 실제 문제

빈 캔버스 증후군

에이전트에게 새 모듈을 만들라고 하면 기존 프로젝트의 구조를 무시하고 자기만의 디렉토리 체계를 발명한다. src/components/ 대신 app/widgets/를 만들고, 기존 네이밍 관습(camelCase vs snake_case)과 다른 스타일을 쓴다. Convention Discovery는 기존 구조를 먼저 스캔하게 한다.

문서 소재지의 혼란

ADR, 기술 결정, 구조 변경 기록이 채팅 히스토리에만 남아 다음 세션에서 사라진다. UNIT-RESIDENCE-01은 모든 구현이 devlog/_plan/YYMMDD_slug/ 유닛에 소속되게 하여, 결정과 결과를 파일 시스템에 영구 기록한다.

세션 간 결정의 휘발성

LLM은 대화가 끝나면 맥락을 잃는다. 이전 세션에서 '이 프로젝트는 monorepo 구조를 쓰기로 했다'는 결정이 다음 세션에서 사라진다. UNIT-RESIDENCE-01은 모든 구현을 devlog/_plan/ 유닛에 기록하여, 결정이 파일 시스템에 영구 보존되게 한다. 이건 LLM의 비영속적 메모리를 영속적 저장소로 보완하는 패턴이다.

Triggers: scaffold, new project, init project, new feature, add module, project setup, structure audit

Key Concepts

  • Repo-First Convention Reuse
  • Structural Audit
  • SoT Documentation Planning
  • Colocation Principle
  • Public Boundary Exports

Reference Documents

DocumentDescription
API Documentation Generation
Implementation Log (devlog) Routine — the documentation loop inside PABCD
Monorepo Tooling — Turborepo vs Nx (2026)

Sections Overview

SectionSummary
Convention Discovery기존 레포에서 디렉토리 구조, 네이밍, 패키지 관습을 먼저 발견하고 재사용한다.
Project Scaffolding새 프로젝트의 디렉토리 구조, 설정 파일, 초기 의존성을 관습에 맞춰 생성한다.
Module Scaffolding기존 프로젝트에 새 모듈/기능을 추가할 때 colocation과 경계를 지킨다.
Structural Audit기존 구조의 문제점(barrel 남용, 순환, SSOT 부재)을 감지하고 개선 계획을 세운다.

Academic References

PaperYearRelevance
Evaluating AGENTS.md: Are Repository-Level Context Files Helpful for Coding Agents?
arXiv:2602.11988
2026레포 수준 컨텍스트 파일이 에이전트의 관습 준수에 미치는 영향. Convention Discovery의 학술적 근거.
Instruction Adherence in Coding Agent Configuration Files
arXiv:2605.10039
2026에이전트 설정 파일 구조 변수가 지시 준수에 미치는 영향의 팩토리얼 연구.
Teaching Code LLMs to Use Autocompletion Tools in Repository-Level Code Generation
arXiv:2401.06391
2024레포 수준 코드 생성에서 LLM에게 자동완성 도구를 사용하도록 가르치는 연구.

Official Guides

Full Specification

Show full SKILL.md content

Dev Scaffolding

> C0/C1 work (small local patches): See dev §0.0 Work Classifier + §0.1 Patch Fast-Path before reading references.

Rules for generating and auditing project structures. Create files directly following these rules. Use the audit script (§12) for verification.

This skill activates by change surface: new project setup, feature/module scaffolding, structural audits, or documentation scaffolding.

Modular References

FileWhen to ReadWhat It Covers
references/implementation-log.mdC3+/multi-phase/cross-session work unitsFull devlog routine: decade-numbered plan folders, P-concretize → A-audit → D-archive loop, mainstream design-doc/RFC mapping
references/api-docs.mdAPI documentation generationOpenAPI 3.1, developer portal, CI doc drift, SDK generation
references/monorepo-tooling.mdSetting up or optimizing monorepo buildsTurborepo vs Nx 2026 decision table, task graph for AI agents, CI optimization

External/current scaffolding evidence

For current generator behavior, template commands, package versions, framework

recommendations, provider bootstrap docs, or source-sensitive tooling choices,

read the active search skill and follow its query-rewrite, source-fetch, and

evidence-status rules. Browser fetch/open/text/get-dom/snapshot is used only

after candidate URLs exist and the setup claim needs source verification.

1. The Lidge Standard

Apply for new projects or when a repo has no clear structural convention of its own; defer to an existing mature convention when one is present (§2). Three pillars:

  1. Screaming Architecture — folder names reveal what the app does (stock-price/, auth/, report/)
  2. Colocation — related files live together (logic + test + schema in the same folder)
  3. Public Boundary Export — each feature/package exposes a single public entry point (index.ts, index.js, __init__.py, or Go package) at its boundary; internal convenience barrels are banned (owned by dev-architecture §5)

2. Existing Repo First

Before scaffolding inside an existing repo:

  1. Detect existing architecture, docs, plans, changelog, ADR, agent-context, source-of-truth, and devlog conventions.
  2. Read existing structure/, devlog/, docs/, plans/, or equivalent source-of-truth logs before proposing new structure.
  3. Reuse clear conventions instead of imposing the Lidge/source-of-truth default.
  4. Show a compact tree before broad additions.
  5. Do not create structure/, devlog/, docs/, AGENTS.md, or similar project-level folders without approval.

MUST preserve mature repo conventions over the Lidge/source-of-truth default.

2.1 Lightweight Source of Truth (implementation-unit devlog)

The implementation-unit devlog routine (devlog/_plan/ units — dev-pabcd §3.1,

UNIT-RESIDENCE-01) is the DEFAULT for any repo you do development work in — a

process rule, not a named style to be requested. Propose the structure/

architecture docs when:

  • The repo is immature, undocumented, or inconsistent; or
  • The user asks for a durable source-of-truth structure; or
  • A broad change needs a durable plan/current-architecture record.

Default proposal:

structure/
  README.md              # index of current architecture docs
  architecture.md        # current system shape, not future wishes
  conventions.md         # naming, layout, commands, testing
devlog/
  _plan/                 # active plans
  _fin/                  # completed work summaries

Folder names are advisory. If the repo already has docs/, adr/, plans/, changelog/, or another convention, propose using those instead.

Also detect optional lightweight source-of-truth files such as CONTEXT.md,

CONTEXT-MAP.md, and docs/adr/. Reuse them when present. Do not create them unless

the repo already uses that convention or the user approves. Create an ADR only for a

decision that is hard to reverse, surprising without context, or has a real tradeoff.

SoT sync (DEFAULT, SOT-SYNC-01): before patching a repo, FIND its general

source-of-truth docs first (structure/, architecture.md, INDEX/context docs)

and read them; any unit that changes architecture, contracts, or structure patches

the SoT doc in the SAME unit (C gate, dev-pabcd §3 C). If the repo has no SoT doc,

recommend creating one — once, via the proposal flow above — rather than silently

working without a source of truth.

Implementation-unit devlog method:

  • Split large work into phase-level documents instead of one huge plan —

dependency-ordered (PHASE-SPLIT-01), ALL written to diff-level up front

(DIFFLEVEL-ROADMAP-01; both defined in dev-pabcd).

  • Keep diff-level plans in files, not chat: exact paths, NEW/MODIFY/DELETE, before/after diffs for MODIFY, complete content for NEW.
  • Keep chat summaries short: explain the phase, show a compact tree/change map, then link the plan file.
  • Move completed phase folders to _fin/; keep pending/future work under _plan/ or an existing equivalent.

Phase document naming uses decade-range prefixes (LEXICO-SPLIT-01). For the canonical table (00–09 research, 10–19 Phase 1, etc.), see dev-pabcd/SKILL.md §3.1 Implementation-Unit Documents — that is the single source of truth.

  • Plan unit folder: devlog/_plan/YYMMDD_slug/
  • The numeric prefix is the source of ordering. Never use bare semantic filenames (PLAN.md, DIFF_PLAN.md, PHASES.md, RCA.md).
  • When adding a document, scan siblings and choose the next unused prefix in the correct decade.

Before creating any structure//devlog/ folders, ask concisely: state that no source-of-truth docs were found, show the proposed tree, give a specific recommendation, and confirm you will not create them without approval. This gate governs INTRODUCING the convention to a repo (the first devlog/ or structure/); once devlog/_plan/ exists, creating unit subfolders — including the minimal record unit mandated by UNIT-RESIDENCE-01 — is routine and needs no approval dialogue.

2.2 Project Skeleton

For a new project, propose the source-of-truth structure in the plan.

If the user explicitly asks for the full source-of-truth standard (§8), create it.

Otherwise ask once before adding structure/ and devlog/.

When creating an approved new project skeleton, include the source-of-truth and feature-based essentials: AGENTS.md + README.md (context/overview), .env.example + .gitignore, devlog/_plan/ + devlog/_fin/ (and str_func/ only for the full standard, §8), src/ with a shared/ for truly-shared code, config/, docs/, and tests/e2e/. Then add the language-appropriate package manifest, entry point, language config, and per-feature public boundary exports (per dev-architecture §5; file names from language detection, §3). Defer exact layout to the framework's own generator when one exists.

3. Language Detection

Detect project type from existing files. Priority order:

File FoundProject Type
tsconfig.jsonTypeScript (Node)
package.json (no tsconfig)JavaScript (Node)
pyproject.toml or requirements.txtPython
go.modGo
Cargo.tomlRust
None of the above→ Tech Stack Decision (below)

For greenfield projects, use the Tech Stack Decision process (§3.1) instead of asking "What language?"

3.1 Tech Stack Decision (New Projects)

When creating a new project with no existing framework, guide the user through plain-language choices:

  1. Type: What are they building? (static site, interactive app, full-stack service, CLI tool, data pipeline)
  2. Scale: How big? (1-3 pages, multi-page, ongoing content, large app)
  3. Features: Login needed? Data storage? Real-time?

Present options as <Framework> — <what it gives you>, recommend one with reasoning, let user pick.

Match tool complexity to task complexity. Escalate tooling only when justified by user requirements (SEO, CMS, scaling).

4. Fullstack Split Rule

Decide project layout based on runtime:

ScenarioLayoutExample
Single runtimesrc/ modularNext.js, Node CLI + API, Python monolith
Multiple runtimesfrontend/ + backend/React + FastAPI, Vue + Go API
Monorepo (3+ apps)packages/ or apps/Turborepo, Nx

Each side gets its own package manifest and entry point. Shared types go in root shared/ or packages/shared/.

5. Feature Module Rules

When adding a new feature, create a folder under src/ with these files:

LanguageFolderMain FileTest FilePublic boundary export
JavaScriptkebab-case/name.tool.jsname.test.jsindex.js
TypeScriptkebab-case/name.tool.tsname.test.tsindex.ts
Pythonkebab-case/name_tool.pytest_name.py__init__.py
Gokebab-case/name.goname_test.go*(package = boundary)*
Rustkebab-case/name.rsinline #[cfg(test)] or tests/lib.rs/parent mod name;

The index.* file is the feature's public boundary export. Barrel discipline is owned

by dev-architecture §5: external consumers import this boundary, internal code imports

sources directly, and convenience-only internal barrels are banned.

Principle: "flat until you can't" — start flat, sub-folder only when a folder becomes hard to scan.

6. Naming Conventions

ItemRuleExample
Folderskebab-casestock-price/, user-auth/
JS/TS fileskebab-case + suffixstock-price.tool.ts
Python filessnake_case + suffixstock_price_tool.py
Go filessnake_casestock_price.go
Rust filessnake_casestock_price.rs
devlog plan foldersYYMMDD_slug/260510_phase_doc_naming/
devlog phase docsdecade-prefixed NN_slug.md, 00_* is the index00_plan.md, 10_phase1_skill_contract.md
Functions (JS/TS)camelCasegetStockPrice()
Functions (Python)snake_caseget_stock_price()
Functions (Go)PascalCase (exported)GetStockPrice()
Functions (Rust)snake_caseget_stock_price()

7. File Suffixes

SuffixRoleLanguages
.tool.ts / .tool.js / _tool.pyCore business logicJS/TS/Python
.test.ts / .test.js / test_*.py / _test.goTestsAll
.schema.ts / .schema.jsType/schema definitionsJS/TS
.route.ts / .route.jsAPI routesJS/TS
.template.mdTemplatesAll

8. str_func Rules

str_func is part of the full Lidge standard, not the lightweight default.

Use it when:

  • The user explicitly asks for the full Lidge structure.
  • The repo already maintains str_func docs.
  • A broad feature needs durable module-level function documentation.

When used:

  • One .md file per feature folder (e.g., price.md, auth.md)
  • Keep each document concise, bounded, and task-oriented — not padded to a fixed length
  • Required sections: File Tree, Module Responsibility, Key Function Signatures, Dependencies, Dependents, Sync Checklist
  • Update the corresponding .md whenever a feature is added or modified
  • Template: <SKILL_DIR>/assets/str_func_template.md

Do not generate heavy feature docs by default for small or immature repos.

Prefer lightweight structure/architecture.md and structure/conventions.md first.

9. Split Rules

Split smells (heuristics, not hard gates):

ConditionAction
File grows past ~500 linesSplit into focused modules within same folder
Folder becomes hard to scanCreate sub-folders by responsibility
Different runtime neededSplit into frontend/ + backend/
3+ apps share codeExtract to shared/ or monorepo packages/

10. Cross-Cutting Scaffolding

Health Endpoints

Backend scaffolds should propose health routes (skip if the mature repo already handles health checks per §2):

  • src/routes/health.ts (or equivalent) — /health (liveness) and /ready (readiness)
  • See dev-backend/references/core/health-checks.md for response format

SEO Boilerplate (Web Projects)

Web project templates should include:

  • public/robots.txt with AI crawler allowlist
  • Meta tag component with OG defaults
  • JSON-LD helper utility
  • Sitemap generation (static or dynamic)

CI Template

Generate CI config scaffold:

lint → typecheck → test (unit) → test (integration) → build → deploy (staging)

Security Boilerplate

Generate security scaffolding: CSP headers, CORS config, rate limiting middleware, .env.example with placeholder secrets. See dev-security/SKILL.md for full patterns.

---

11. Documentation Generation

When role=docs or when generating project documentation:

README Generation

  1. Read existing structure (§2 Existing Repo First)
  2. Generate README with: project purpose, quick start, architecture overview (link to structure/ if present), contribution guide
  3. Match tone to project maturity: immature repos get setup-heavy READMEs; mature repos get architecture-heavy ones

API Documentation

  1. Scan route files and extract endpoint signatures
  2. Generate per-endpoint docs: method, path, params, request/response shape, auth requirements
  3. Place alongside code (colocation) or in docs/api/ per project convention

Structure Documentation

  1. Generate structure/README.md or update existing structure docs
  2. Include: directory tree, module responsibility map, dependency flow
  3. Follow source-of-truth conventions (§2.1) when applicable

Devlog Documentation

  1. Follow decade numbering (dev-pabcd/SKILL.md §3.1, LEXICO-SPLIT-01): 00-09 research, 10-19 phase 1, etc.
  2. Each devlog entry: title, date, what changed, why, evidence paths
  3. Cross-reference related devlog entries within the same _plan/ folder

---

12. Audit

Run the scaffold audit if one is available for the repo (e.g. bash <SKILL_DIR>/scripts/scaffold-audit.sh [project-path]) to check structural compliance. Audit checks should reflect the project's own conventions — covering feature-based structure, colocation, public boundary exports (dev-architecture §5), devlog presence, .env safety, file length, and AGENTS.md where those apply.