agentleFS
pavel-molyanovpavel-molyanov/molyanov-ai-dev/skills/project-initialization/SKILL.md

project-initialization

Skill296 starsChanged 4 months agoMITView on GitHub

Initializes a project from the standard dual-runtime template, preserves existing files, configures Git hooks, and creates or connects a private GitHub repository with main and dev branches.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    If the current directory contains anything other than .git, move all such entries into the first available directory named old, old2, old3, …

    line 35
  2. Very specific:

    If OLD_DIR is non-empty, inspect it for .env*, *.key, *.pem, credentials.json, and secrets/.

    line 51
  3. Distinctive:

    Never print secret contents.

    line 53
  4. Very specific:

    Create the first initialization commit.

    line 63
  5. Very specific:

    If origin already exists, show its URL and ask whether it is the intended repository.

    line 72
  6. Very specific:

    If origin does not exist, ask for the GitHub repository name unless already supplied.

    line 75
  7. Very specific:

    Before any push, inspect whether a local or remote dev branch already exists.

    line 79
  8. Very specific:

    Ask explicitly before pushing main.

    line 83
  9. Very specific:

    Do not review or merge files from old* during initialization.

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Project Initialization

Initialize the project in the current working directory. Existing project files are preserved in an old* directory for later review; do not merge them into the new scaffold during this workflow.

Dual-Runtime Project Generation

The bundled template contains Claude project sources under .claude/**. Its pre-commit hook runs the installed ~/.claude/scripts/sync-to-codex.sh converter after those sources are staged. This generates and stages the matching AGENTS.md and .codex/** runtime before the commit while .gitignore excludes host-local .codex/.sync/**. A reported conflict or validation error stops the commit.

1. Check the Current Directory

Work only in the current directory. If it is already a Git repository with uncommitted changes, ask whether to commit them first, continue while preserving them in old*, or stop. Do not proceed until the user chooses.

Resolve the directory of this loaded project-initialization skill and set INIT_SKILL_DIR to that absolute path. Verify that its assets/new-project/ directory exists before moving project files.

2. Preserve Existing Files and Apply the Template

If the current directory contains anything other than .git, move all such entries into the first available directory named old, old2, old3, and so on. Do not move .git.

OLD_DIR=""
if find . -mindepth 1 -maxdepth 1 ! -name '.git' -print -quit | grep -q .; then
  OLD_DIR="old"
  N=2
  while [ -e "$OLD_DIR" ]; do OLD_DIR="old${N}"; ((N++)); done
  mkdir "$OLD_DIR"
  find . -mindepth 1 -maxdepth 1 ! -name '.git' ! -name "$OLD_DIR" -exec mv -- {} "$OLD_DIR/" \;
fi

cp -rp "$INIT_SKILL_DIR/assets/new-project/." .

If OLD_DIR is non-empty, inspect it for .env*, *.key, *.pem, credentials.json, and secrets/. Ensure every sensitive path is covered by the new .gitignore before staging files. Never print secret contents.

3. Initialize Git and Hooks

Initialize Git with main as the primary branch when needed. For an existing repository, preserve its history and make the current primary branch main. Then:

  1. Make .githooks/pre-commit executable.
  2. Set git config core.hooksPath .githooks.
  3. Stage the scaffold and preserved old* directory, subject to the secret check above.
  4. Create the first initialization commit. The pre-commit hook generates and stages AGENTS.md and .codex/** while .gitignore excludes .codex/.sync/**. If generation reports a conflict or validation error, the commit stops. If the repository already has history, create a normal initialization commit instead of rewriting existing commits.

4. Connect GitHub and Create Branches

GitHub is required for this workflow. Verify that gh is installed and authenticated.

  • If origin already exists, show its URL and ask whether it is the intended repository. Stop on a mismatch rather than replacing the remote. Confirm through gh that the repository is private; if it is public, stop and ask whether to make it private or use another repository.
  • If origin does not exist, ask for the GitHub repository name unless already supplied. The supplied name authorizes creating the private repository. Create it with gh repo create {name} --private --source=. --remote=origin.

Before any push, inspect whether a local or remote dev branch already exists. If neither exists, create dev from main. If either exists, show its relationship to main and ask whether to reuse it; never reset or recreate an existing dev, and stop if local and remote histories conflict.

Ask explicitly before pushing main. After approval, push main, push the created or approved dev, leave dev checked out, and read the canonical repository URL through gh.

5. Report the Result

Report:

  • the GitHub URL;
  • the created or reused main and dev branches;
  • the preserved old* directory, or that the directory was initially empty;
  • that dev is the active branch;
  • the next step: create the initial Project Knowledge with documentation-writing.

Do not review or merge files from old* during initialization.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.