Search by

maarheeze / guidelines

wietsewarendorff

This package is abandoned and no longer maintained. The author suggests using the https://github.com/maarheeze/guidelines package instead.

maarheeze guidelines

Package info

github.com/maarheeze/guidelines

Language:Shell

pkg:composer/maarheeze/guidelines

Statistics

Installs: 52

Dependents: 2

Suggesters: 0

Stars: 0

Open Issues: 0

1.8.0 2026-09-24 14:29 UTC

This package is auto-updated.

Last update: 2026-12-03 20:15:48 UTC


README

Development guidelines for AI agents.

Use it in a project

Commit this to the project as .claude/settings.json. If the file already exists, add the hooks key to it.

{
    "hooks": {
        "SessionStart": [
            {
                "hooks": [
                    {
                        "type": "command",
                        "command": "d=\"$HOME/.cache/maarheeze-guidelines\"; if [ -d \"$d/.git\" ]; then git -c http.lowSpeedLimit=1000 -c http.lowSpeedTime=10 -C \"$d\" pull -q --ff-only; else git -c http.lowSpeedLimit=1000 -c http.lowSpeedTime=10 clone -q --depth 1 https://github.com/maarheeze/guidelines.git \"$d\"; fi >/dev/null 2>&1; if [ -f \"$d/hooks/session-start.sh\" ]; then bash \"$d/hooks/session-start.sh\"; else echo 'The guidelines could not be downloaded. Tell the user before starting the task.'; fi",
                        "timeout": 30
                    }
                ]
            }
        ]
    }
}

Whoever checks out the project and trusts the folder gets the guidelines in every session. The hook downloads this repository, or updates its copy in ~/.cache/maarheeze-guidelines/, so a change pushed here arrives at the next session start. Without a connection, the last downloaded copy is used.

Building on these guidelines

A company or team repository can use these guidelines as its base. Its own hook script downloads this repository and runs it with its own guidelines directory as the top layer:

bash "$base/hooks/session-start.sh" "Acme" "/path/to/acme/.ai/guidelines"

How the guidelines reach an agent

Nothing depends on the agent deciding to open a file: that decision is made mid-task, and it is the one that gets skipped.

.ai/guidelines/always/ becomes a Claude Code rule without globs. The hook copies its files into the project's .claude/rules/guidelines/<layer>/always/, and Claude Code loads them in full at session start, before the agent has read a line of the task. always/ is for rules that hold whatever the project contains — how to work with the user, what the agent may not do on your machine.

The index is printed into the session. Keep it small: Claude Code cuts a hook's output at 10,000 characters to a short preview, and the index of every layer shares that.

Every file the index names becomes a Claude Code rule. .ai/guidelines/index.md maps file globs to guideline files. At every session start the hook copies each file it names into the project's .claude/rules/guidelines/<layer>/, with the globs of every row that names it as its paths. Claude Code loads the file as soon as the agent reads or edits a matching file. A file that matches nothing in your project costs that project nothing.

The folder is rebuilt at every session start and kept out of git through .git/info/exclude. It is written by the hook after Claude Code has read it, so a session loads the rules the previous session wrote: a fresh checkout gets its rules from its second session on, and the first session says so.

Writing a guideline file

Add the file to the table in index.md, with the globs it applies to:

| `**/*.php` | `php.md` |

The globs use Claude Code's rule syntax; a trailing /** is copied as /**/*, the form Claude Code matches.

Write each rule in the format described in index.md › Writing a rule.

The index is the only route to a file, so one that is missing from the table is never delivered. The file itself says nothing about its own scope — the table is the single place globs are written down.