a1f95a1161
Replaces public-comms.md and code-comments.md (749 words, ~25 rules, almost all prohibitions, no examples) with a single writing.md that leads with worked examples. The rule is selection, not compression: keep output short by cutting whole ideas that don't change what the reader does next, then write what survives as plain sentences. Not by dropping articles or writing fragments, which Anthropic's Fable 5 guide calls out as the wrong lever. Prompt style leaks into output style, so the file is written in the voice it asks for. Drops the BLUF ask-line rule entirely: everyone on a PR already knows who reviews and who merges, and read literally it produced openers like "Ask: reviewers please merge". Links the contract to ~/.agents/AGENTS.md, which Codex had nothing in at all, and to the nix module for the NixOS machine.
64 lines
2.2 KiB
Bash
Executable File
64 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Symlink centralized skills/commands/hooks/context into each agent's config dir.
|
|
# For non-Nix machines (NixOS boxes use nix/home.nix instead).
|
|
# Idempotent. Backs up any pre-existing real dir once to <name>.bak.
|
|
set -euo pipefail
|
|
|
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
# targets: agent config skill roots. Claude Code reads ~/.claude/skills,
|
|
# Codex reads ~/.agents/skills. Both consume the same SKILL.md dirs.
|
|
CLAUDE_SKILLS="$HOME/.claude/skills"
|
|
CODEX_SKILLS="$HOME/.agents/skills"
|
|
CLAUDE_CMDS="$HOME/.claude/commands" # commands are Claude-only; Codex ignores
|
|
CLAUDE_HOOKS="$HOME/.claude/hooks" # hooks are Claude-only
|
|
CLAUDE_HOME="$HOME/.claude" # CLAUDE.md fragments, pulled in via @name.md
|
|
AGENTS_HOME="$HOME/.agents" # Codex global config root
|
|
|
|
# Per-FILE links, never a whole-dir link: ~/.claude/hooks and ~/.claude itself hold
|
|
# machine-local files this repo does not own, and a dir symlink would hide them.
|
|
|
|
# backups go OUTSIDE the skill dirs — a *.bak left inside gets discovered as a
|
|
# duplicate skill by both Claude Code and Codex.
|
|
BACKUP="$HOME/.agent-skills-backup"
|
|
|
|
link() { # link <src> <dst>
|
|
local src="$1" dst="$2"
|
|
if [ -e "$dst" ] && [ ! -L "$dst" ]; then
|
|
mkdir -p "$BACKUP"
|
|
mv "$dst" "$BACKUP/$(basename "$(dirname "$dst")")-$(basename "$dst").bak"
|
|
echo "backed up existing $dst -> $BACKUP/"
|
|
fi
|
|
ln -sfn "$src" "$dst"
|
|
echo "linked $dst -> $src"
|
|
}
|
|
|
|
mkdir -p "$CLAUDE_SKILLS" "$CODEX_SKILLS" "$CLAUDE_CMDS" "$CLAUDE_HOOKS" "$AGENTS_HOME"
|
|
|
|
for d in "$REPO"/skills/*/; do
|
|
name="$(basename "$d")"
|
|
link "$d" "$CLAUDE_SKILLS/$name"
|
|
link "$d" "$CODEX_SKILLS/$name"
|
|
done
|
|
|
|
for f in "$REPO"/commands/*.md; do
|
|
[ -e "$f" ] || continue
|
|
link "$f" "$CLAUDE_CMDS/$(basename "$f")"
|
|
done
|
|
|
|
for f in "$REPO"/hooks/*.py "$REPO"/hooks/*.sh; do
|
|
[ -e "$f" ] || continue
|
|
link "$f" "$CLAUDE_HOOKS/$(basename "$f")"
|
|
done
|
|
|
|
for f in "$REPO"/claude-md/*.md; do
|
|
[ -e "$f" ] || continue
|
|
link "$f" "$CLAUDE_HOME/$(basename "$f")"
|
|
done
|
|
|
|
# Codex reads ~/.agents/AGENTS.md; it has no @import, so the contract is the file.
|
|
link "$REPO/claude-md/writing.md" "$AGENTS_HOME/AGENTS.md"
|
|
|
|
echo "done."
|
|
echo "hooks still need wiring in ~/.claude/settings.json — see hooks/README.md"
|