feat(claude): add global ~/.claude/CLAUDE.md file

This commit is contained in:
Jim Myhrberg
2025-07-25 12:29:56 +01:00
parent ec856e906c
commit 93dfef071c
2 changed files with 77 additions and 4 deletions

44
claude/CLAUDE.md Normal file
View File

@@ -0,0 +1,44 @@
# Rules to always follow
Below are a set of rules you should always try to strive for and follow with
everything you do.
- Try and keep line length to 80 characters or fewer when possible.
- Check and fix linting errors.
- Follow code style and conventions already present in the project when
reasonable, including choice of libraries, test frameworks, etc.
- Do break from project conventions when it fully makes sense to do, for
example, don't copy a pattern from integration-style tests into a unit test,
instead let the unit test be narrower in scope.
- Check Makefile and similar for common project tasks like lint, format, test,
etc.
- When I ask for a fix or explanation, please provide direct code solutions or
detailed technical explanations rather than general advice. I prefer
straightforward answers without introductory phrases like "Here's how you
can..."
- Include robust error handling in code examples and highlight potential edge
cases
- Flag security concerns and performance impacts in solutions
- Suggest appropriate naming conventions and code structure improvements
- Handle changes across multiple files with proper import/dependency management
- Consider version constraints and backward compatibility of
libraries/frameworks
- Generate or update docstrings/comments for new code
- Provide test examples for new functionality when relevant
- Consider build environment constraints and platform-specific issues
- If clarification is needed, make reasonable assumptions and note them
- Be casual unless otherwise specified.
- Be terse.
- Be accurate and thorough.
- Give the answer immediately. Provide detailed explanations afterward if
needed.
- Value good arguments over authorities, the source is irrelevant.
- If your content policy is an issue, provide the closest acceptable response
and explain the content policy issue afterward.
- Cite sources whenever possible at the end, not inline.
- No need to mention your knowledge cutoff.
- No need to disclose you're an AI.
- Respect my formatting preferences when you provide code.
- Respect all code comments, they're usually there for a reason. Remove them
ONLY if they're completely irrelevant after a code change. if unsure, do not
remove the comment.

37
siren
View File

@@ -21,6 +21,7 @@ define_settings() {
)
# Additional static symlinks to create (source => target).
STATIC_SYMLINKS["claude/CLAUDE.md"]="${HOME}/.claude/CLAUDE.md"
STATIC_SYMLINKS["cspell/vscode-user-dictionary.txt"]="${HOME}/.cspell/vscode-user-dictionary.txt"
STATIC_SYMLINKS["harper-ls/dictionary.txt"]="$(harper_config_dir)/dictionary.txt"
STATIC_SYMLINKS["harper-ls/file_dictionaries"]="$(harper_config_dir)/file_dictionaries"
@@ -44,6 +45,7 @@ get_extensions_lock() {
show_help() {
cat << EOF
Usage: $(basename "$0") EDITOR COMMAND [OPTIONS]
$(basename "$0") config
Editors:
cursor, c Cursor editor
@@ -61,6 +63,10 @@ Options:
latest version of each extension instead of the
exact version from the lock file.
Special Usage:
config, conf When used without an editor, creates only static
symlinks (CLAUDE.md, dictionaries, etc.)
Description:
This script manages editor configuration files and extensions.
It can create symlinks for settings, keybindings, and snippets,
@@ -188,8 +194,8 @@ backup_and_link() {
ln -s "${source}" "${target}"
}
# Create symlinks.
do_symlink() {
# Private function: Create editor-specific symlinks.
symlink_editor_config() {
# Create editor config directory if it doesn't exist.
local config_dir
config_dir="$(editor_config_dir)"
@@ -198,13 +204,27 @@ do_symlink() {
for path in "${CONFIG_SOURCES[@]}"; do
backup_and_link "${SCRIPT_DIR}/${path}" "${config_dir}/${path}"
done
}
# Private function: Create static symlinks.
symlink_static_config() {
# Create static symlinks to custom locations.
for source in "${!STATIC_SYMLINKS[@]}"; do
target="${STATIC_SYMLINKS[${source}]}"
backup_and_link "${SCRIPT_DIR}/${source}" "${target}"
done
}
# Public function: Create static symlinks only.
do_static_config() {
symlink_static_config
echo "Static symlink setup complete!"
}
# Public function: Create all symlinks (editor-specific + static).
do_config() {
symlink_editor_config
symlink_static_config
echo "Symlink setup complete!"
}
@@ -592,6 +612,15 @@ main() {
exit 0
fi
# Check if first argument is config/conf (standalone mode).
local first_arg
first_arg="$(echo "${1}" | tr '[:upper:]' '[:lower:]')"
if [[ "${first_arg}" == "config" || "${first_arg}" == "conf" ]]; then
define_settings
do_static_config
exit 0
fi
if [[ $# -lt 2 ]]; then
echo "Error: No command specified"
show_help
@@ -599,7 +628,7 @@ main() {
fi
# Set editor from first argument.
editor="$(echo "${1}" | tr '[:upper:]' '[:lower:]')"
editor="${first_arg}"
case "${editor}" in
"vscode" | "code" | "vsc" | "v")
SETUP_EDITOR="vscode"
@@ -648,7 +677,7 @@ main() {
# Handle commands.
case "${command}" in
"config" | "conf")
do_symlink
do_config
;;
"dump-extensions" | "dump")
do_dump_extensions