tidy-project-structure

Organize project files into conventional directories, update stale READMEs, clean configuration drift, and archive deprecated items without changing code logic. Use when files are scattered without clear organization, READMEs are outdated or contain broken examples, configuration files have multiplied across dev/staging/prod, deprecated files remain in the project root, or naming conventions are inconsistent across directories.

9 stars

Best use case

tidy-project-structure is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Organize project files into conventional directories, update stale READMEs, clean configuration drift, and archive deprecated items without changing code logic. Use when files are scattered without clear organization, READMEs are outdated or contain broken examples, configuration files have multiplied across dev/staging/prod, deprecated files remain in the project root, or naming conventions are inconsistent across directories.

Teams using tidy-project-structure should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/tidy-project-structure/SKILL.md --create-dirs "https://raw.githubusercontent.com/pjt222/agent-almanac/main/i18n/caveman-lite/skills/tidy-project-structure/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/tidy-project-structure/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How tidy-project-structure Compares

Feature / Agenttidy-project-structureStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Organize project files into conventional directories, update stale READMEs, clean configuration drift, and archive deprecated items without changing code logic. Use when files are scattered without clear organization, READMEs are outdated or contain broken examples, configuration files have multiplied across dev/staging/prod, deprecated files remain in the project root, or naming conventions are inconsistent across directories.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# tidy-project-structure

## When to Use

Use this skill when project organization has drifted from conventions:

- Files scattered across directories without clear organization
- READMEs are outdated or contain broken examples
- Configuration files have multiplied (dev, staging, prod drift)
- Deprecated files remain in project root
- Naming conventions inconsistent across directories

**Do NOT use** for code refactoring or dependency restructuring. This skill focuses on file organization and documentation hygiene.

## Inputs

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_path` | string | Yes | Absolute path to project root |
| `conventions` | string | No | Path to style guide (e.g., `docs/conventions.md`) |
| `archive_mode` | enum | No | `move` (default) or `delete` for deprecated files |
| `readme_update` | boolean | No | Update stale READMEs (default: true) |

## Procedure

### Step 1: Audit Directory Layout

Compare current structure against project conventions or language best practices.

**Common conventions by language**:

**JavaScript/TypeScript**:
```
src/          # Source code
tests/        # Test files
dist/         # Build output (gitignored)
docs/         # Documentation
.github/      # CI/CD workflows
```

**Python**:
```
package_name/      # Package code
tests/             # Test suite
docs/              # Sphinx docs
scripts/           # Utility scripts
```

**R**:
```
R/                 # R source
tests/testthat/    # Test suite
man/               # Documentation (generated)
vignettes/         # Long-form guides
inst/              # Installed files
data/              # Package data
```

**Rust**:
```
src/          # Source code
tests/        # Integration tests
benches/      # Benchmarks
examples/     # Usage examples
```

**Got:** List of files/directories violating conventions saved to `structure_audit.txt`

**If fail:** If no conventions documented, use language-standard defaults

### Step 2: Move Misplaced Files

Relocate files to their conventional directories.

**Common moves**:
1. Test files outside `tests/` → move to `tests/`
2. Documentation outside `docs/` → move to `docs/`
3. Build artifacts in `src/` → delete (should be gitignored)
4. Config files in root → move to `config/` or `.config/`

For each move:
```bash
# Check if file is referenced anywhere
grep -r "filename" .

# If no references or only relative path references:
mkdir -p target_directory/
git mv source/file target_directory/file

# Update any imports/requires
# (language-specific — see repair-broken-references skill)
```

**Got:** All files in conventional locations; git history preserved via `git mv`

**If fail:** If moving breaks imports, update import paths or escalate

### Step 3: Check README Freshness

Identify stale information in all README files.

**Staleness indicators**:
1. Last modified >6 months ago
2. References to old version numbers
3. Broken links or code examples
4. Missing sections (Installation, Usage, Contributing)
5. No license badge or broken badge links

```bash
# Find all READMEs
find . -name "README.md" -o -name "readme.md"

# For each README:
# - Check last modified date
git log -1 --format="%ci" README.md

# - Check for broken links
markdown-link-check README.md

# - Verify example code still runs (sample first example)
```

**Got:** List of stale READMEs in `readme_freshness.txt` with specific issues

**If fail:** If markdown-link-check unavailable, manually review external links

### Step 4: Update Stale READMEs

Fix broken links, update examples, add missing sections.

**Standard fixes**:
1. Replace broken badge URLs
2. Update version numbers in installation instructions
3. Fix broken example code (run to verify)
4. Add missing sections (use template from project conventions)
5. Update copyright year

**README template structure**:
```markdown
# Project Name

Brief description (1-2 sentences).

## Installation

```bash
# Language-specific install command
```

## Usage

```language
# Basic example
```

## Documentation

Link to full docs.

## Contributing

Link to CONTRIBUTING.md or inline guidelines.

## License

LICENSE badge and link.
```

**Got:** All READMEs updated; examples verified to run

**If fail:** If example code cannot be verified, mark with warning comment

### Step 5: Review Config Files

Identify configuration drift and consolidate duplicate settings.

**Common config issues**:
1. Multiple `.env` files (`.env`, `.env.local`, `.env.dev`, `.env.prod`)
2. Duplicate settings across config files
3. Hardcoded secrets (should use environment variables)
4. Outdated API endpoints or feature flags

```bash
# Find all config files
find . -name "*.config.*" -o -name ".env*" -o -name "*.yml" -o -name "*.yaml"

# For each config:
# - Check for duplicate keys
# - Grep for hardcoded secrets (API keys, tokens, passwords)
grep -E "(api[_-]?key|token|password|secret)" config_file

# - Compare dev vs prod settings
diff .env.dev .env.prod
```

**Got:** Config drift documented in `config_review.txt`; secrets flagged for escalation

**If fail:** If diff shows major divergence, escalate to devops-engineer

### Step 6: Archive Deprecated Files

Move or delete files no longer needed.

**Candidates for archiving**:
- Commented-out config files (e.g., `nginx.conf.old`)
- Legacy scripts not run in >1 year
- Backup files (e.g., `file.bak`, `file~`)
- Build artifacts accidentally committed

**Archive process**:
```bash
# Create archive directory (if archive_mode=move)
mkdir -p archive/YYYY-MM-DD/

# For each deprecated file:
# 1. Verify not referenced anywhere
grep -r "filename" .

# 2. Check git history for last modification
git log -1 --format="%ci" filename

# 3. If not modified in >1 year and no references:
if [ "$archive_mode" = "move" ]; then
  git mv filename archive/YYYY-MM-DD/
else
  git rm filename
fi

# 4. Document in ARCHIVE_LOG.md
echo "- filename (reason, last modified: DATE)" >> ARCHIVE_LOG.md
```

**Got:** Deprecated files archived; `ARCHIVE_LOG.md` updated

**If fail:** If uncertain whether file is deprecated, leave in place and document in report

### Step 7: Verify Naming Conventions

Check for inconsistent file naming across project.

**Common conventions**:
- **kebab-case**: `my-file.js` (common in JS/web projects)
- **snake_case**: `my_file.py` (Python standard)
- **PascalCase**: `MyComponent.tsx` (React components)
- **camelCase**: `myUtility.js` (JavaScript functions)

```bash
# Find files violating conventions
# Example: Python project expecting snake_case
find . -name "*.py" | grep -v "__pycache__" | grep -E "[A-Z-]"

# For each violation, either:
# 1. Rename to match conventions
# 2. Document exception (e.g., Django settings.py convention)
```

**Got:** All files follow naming conventions or exceptions documented

**If fail:** If renaming breaks imports, update references or escalate

### Step 8: Generate Tidying Report

Document all structural changes.

```markdown
# Project Structure Tidying Report

**Date**: YYYY-MM-DD
**Project**: <project_name>

## Directory Changes

- Moved X files to conventional directories
- Created Y new directories
- Archived Z deprecated files

## README Updates

- Updated W stale READMEs
- Fixed X broken links
- Verified Y code examples

## Config Cleanup

- Consolidated X duplicate settings
- Flagged Y hardcoded secrets for removal
- Documented Z config drift issues

## Files Archived

See ARCHIVE_LOG.md for full list (Z files).

## Naming Convention Fixes

- Renamed X files to match conventions
- Documented Y exceptions

## Escalations

- [Config drift requiring devops review]
- [Hardcoded secrets requiring security audit]
```

**Got:** Report saved to `TIDYING_REPORT.md`

**If fail:** (N/A — generate report regardless)

## Validation Checklist

After tidying:

- [ ] All files in conventional directories
- [ ] No broken links in any README
- [ ] README examples verified to run
- [ ] Config files reviewed for secrets
- [ ] Deprecated files archived with documentation
- [ ] Naming conventions consistent
- [ ] Git history preserved (used `git mv`, not `mv`)
- [ ] Tests still pass after moves

## Pitfalls

1. **Breaking Relative Imports**: Moving files breaks relative import paths. Update all references or use absolute imports.

2. **Losing Git History**: Using `mv` instead of `git mv` loses file history. Always use git commands for moves.

3. **Over-Organizing**: Creating too many nested directories makes navigation harder. Keep it flat until complexity requires structure.

4. **Deleting Instead of Archiving**: Direct deletion loses ability to recover. Always archive first unless certain.

5. **Ignoring Language Conventions**: Imposing personal preferences over language standards. Follow established conventions.

6. **Not Updating Documentation**: Moving files without updating README paths leaves docs broken.

## Related Skills

- [clean-codebase](../clean-codebase/SKILL.md) — Remove dead code, fix lint warnings
- [repair-broken-references](../repair-broken-references/SKILL.md) — Fix links and imports after moves
- [escalate-issues](../escalate-issues/SKILL.md) — Route complex config issues to specialists
- [devops/config-management](../../devops/config-management/SKILL.md) — Advanced config consolidation
- [compliance/documentation-audit](../../compliance/documentation-audit/SKILL.md) — Comprehensive doc review

Related Skills

setup-gxp-r-project

9
from pjt222/agent-almanac

Set up an R project structure compliant with GxP regulations (21 CFR Part 11, EU Annex 11). Covers validated environments, qualification documentation, change control, and electronic records requirements. Use when starting an R analysis project in a regulated environment (pharma, biotech, medical devices), setting up R for clinical trial analysis, creating a validated computing environment for regulatory submissions, or implementing 21 CFR Part 11 or EU Annex 11 requirements.

refactor-skill-structure

9
from pjt222/agent-almanac

Refactor an over-long or poorly structured SKILL.md by extracting examples to references/EXAMPLES.md, splitting compound procedures, and reorganizing sections for progressive disclosure. Use when a skill exceeds the 500-line CI limit, when code blocks dominate the skill body, when a procedure step contains multiple unrelated operations, or after a content update pushed the skill over the line limit.

provision-infrastructure-terraform

9
from pjt222/agent-almanac

Provision and manage cloud infrastructure using Terraform with HCL modules, remote state backends, workspaces, and plan/apply workflow. Implement infrastructure as code patterns with variable management, output values, and state locking for team collaboration. Use when provisioning new cloud infrastructure, migrating from ClickOps or CloudFormation to declarative IaC, managing multi-environment infrastructure, versioning infrastructure changes alongside application code, or enforcing standards through reusable modules.

polish-claw-project

9
from pjt222/agent-almanac

Contribute to OpenClaw ecosystem projects (OpenClaw, NemoClaw, NanoClaw) through a structured 9-step workflow: target verification, codebase exploration, parallel audit, finding cross-reference, and pull request creation. Emphasizes false positive prevention and project convention adherence.

draft-project-charter

9
from pjt222/agent-almanac

Draft a project charter that defines scope, stakeholders, success criteria, and initial risk register. Covers problem statement, RACI matrix, milestone planning, and scope boundaries for both agile and classic methodologies. Use when kicking off a new project or initiative, formalizing scope after an informal start, aligning stakeholders before detailed planning begins, or transitioning from discovery to active project work.

cross-review-project

9
from pjt222/agent-almanac

Conduct a structured cross-project code review between two Claude Code instances via the cross-review-mcp broker. Each agent reads its own codebase, reviews the peer's code, and engages in evidence-backed dialogue — with QSG scaling laws enforcing review quality through minimum bandwidth constraints and phase-gated progression.

create-work-breakdown-structure

9
from pjt222/agent-almanac

Create a Work Breakdown Structure (WBS) and WBS Dictionary from project charter deliverables. Covers hierarchical decomposition, WBS coding, effort estimation, dependency identification, and critical path candidates. Use after a project charter is approved, when planning a classic or waterfall project with defined deliverables, breaking a large initiative into manageable work packages, or establishing a basis for effort estimation and resource planning.

skill-name-here

9
from pjt222/agent-almanac

One to three sentences describing what this skill accomplishes, followed by key activation triggers. This field is the primary mechanism agents use to decide whether to activate the skill — it is read during discovery before the full body is loaded. Start with a verb. Include the most important "when to use" conditions inline. Max 1024 characters.

write-vignette

9
from pjt222/agent-almanac

Create R package vignettes using R Markdown or Quarto. Covers vignette setup, YAML configuration, code chunk options, building and testing, and CRAN requirements for vignettes. Use when adding a Getting Started tutorial, documenting complex workflows spanning multiple functions, creating domain-specific guides, or when CRAN submission requires user-facing documentation beyond function help pages.

write-validation-documentation

9
from pjt222/agent-almanac

Write IQ/OQ/PQ validation documentation for computerized systems in regulated environments. Covers protocols, reports, test scripts, deviation handling, and approval workflows. Use when validating R or other software for regulated use, preparing for a regulatory audit, documenting qualification of computing environments, or creating and updating validation protocols and reports for new or re-qualified systems.

write-testthat-tests

9
from pjt222/agent-almanac

Write comprehensive testthat (edition 3) tests for R package functions. Covers test organization, expectations, fixtures, mocking, snapshot tests, parameterized tests, and achieving high coverage. Use when adding tests for new package functions, increasing test coverage for existing code, writing regression tests for bug fixes, or setting up test infrastructure for a package that lacks it.

write-standard-operating-procedure

9
from pjt222/agent-almanac

Write a GxP-compliant Standard Operating Procedure (SOP). Covers regulatory SOP template structure (purpose, scope, definitions, responsibilities, procedure, references, revision history), approval workflow design, periodic review scheduling, and operational procedures for system use. Use when a new validated system requires operational procedures, when existing informal procedures need formalisation, when an audit finding cites missing procedures, when a change control triggers SOP updates, or when periodic review identifies outdated procedural content.