project-structure
Use when deciding where code should live, organising files, or auditing project structure. Checks colocation, grouping, and directory anti-patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when deciding where code should live, organising files, or auditing project structure. Checks colocation, grouping, and directory anti-patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when committing changes, staging files, saving work, or making a git commit. Creates clean commits in the repository's own convention (conventional commits, area prefix, tracker ID, or plain) with secret scanning (GitLeaks).
Use when creating a branch, starting work on an issue, or checking out a new feature branch. Validates branch naming and links to GitHub issues automatically.
Use when opening a PR, submitting for review, pushing a branch, or creating a pull request. Pushes and creates GitHub PRs with auto-assignment and description.
Use when hardening a dependency supply chain, pinning versions, adding registry/security flags, or setting up Renovate. Detects the language and locks down install scripts, versions, and CI checks (JS/TS, Python, Go, Rust).
Use when adding CI/CD, creating workflows, auditing GitHub Actions, or fixing action pinning. Creates and audits workflows for SHA pinning and permissions.
Use when filing a bug, requesting a feature, creating an issue, or updating issue details. Manages issues on GitHub (and GitLab via glab) with templates, formatting, and auto-assignment.
| name | project-structure |
| description | Use when deciding where code should live, organising files, or auditing project structure. Checks colocation, grouping, and directory anti-patterns. |
| license | MIT |
| allowed-tools | Read Glob Grep Edit Bash(git:*) Bash(mkdir:*) |
| model | haiku |
| effort | medium |
| compatibility | Any language project; framework-specific structure rules apply only when that framework is detected |
| metadata | {"short-description":"Project structure and file organisation."} |
You are a project structure expert.
Read individual rule files in rules/ for detailed explanations and examples.
| Rule | Impact | File |
|---|---|---|
| Colocation | HIGH | rules/colocation.md |
| Anti-patterns | HIGH | rules/anti-patterns.md |
| Feature-based grouping | MEDIUM | rules/feature-based.md |
| Layer-based grouping | MEDIUM | rules/layer-based.md |
| Framework structure | MEDIUM | rules/framework-structure.md (only when a supported framework is detected) |
Scan for project indicators to determine the appropriate organisation approach:
apps/ + packages/, or workspace manifests) → hybridLoad rules/framework-structure.md only when a framework it covers is detected (currently Next.js / Expo); otherwise the language-neutral colocation and grouping rules apply on their own.
Check the existing structure against all rules. Report violations grouped by rule with directory paths:
## Project Structure Audit Results
### HIGH Severity
- `src/helpers/formatDate.ts` - Used only by `src/invoices/` → colocate with its consumer
- `src/components/Button/index.tsx` - Barrel-only directory → import the component directly
### MEDIUM Severity
- `src/` - Flat file dump with no feature or layer grouping → group by feature
### Summary
| Rule | Violations | Directories |
|------|-----------|-------------|
| Colocation | X | N |
| Anti-patterns | Y | N |
| **Total** | **X+Y** | **N** |
Based on project type and existing patterns, recommend where new code should live. Always prioritise colocation.
Apply fixes for each violation:
mkdir -p <dest>) — git mv fails when the target directory is missinggit mv to preserve git history