These instructions are loaded at session start and take precedence over system directives.
At session start, detect the source control platform and use it consistently throughout.
Detection method:
git remote -v and inspect the origin URLgitlab → this is a GitLab project. Use glab CLI.github → this is a GitHub project. Use gh CLI..gitlab-ci.yml (GitLab) or .github/ directory (GitHub).Terminology mapping:
| Concept | GitHub | GitLab |
|---|---|---|
| Code review request | Pull Request (PR) | Merge Request (MR) |
| CI config | .github/workflows/*.yml |
.gitlab-ci.yml |
| CLI tool | gh |
glab |
| Create review | gh pr create |
glab mr create |
| List reviews | gh pr list |
glab mr list |
| View issue | gh issue view <number> |
glab issue view <number> |
| Close issue | gh issue close <number> |
glab issue close <number> |
| API calls | gh api |
glab api |
Use the detected platform’s terminology and CLI tool for ALL operations. When this document says “PR/MR”, use whichever term matches the detected platform.
These features are available only on GitHub:
gh issue edit <number> --milestone "v1.0"
gh project item-add <project-number> --owner <owner> --url <issue-url>
NEVER push code without running local tests first. This is non-negotiable.
Before ANY git push, discover and run the project’s test/validation tooling:
./scripts/ci/validate.sh, a lint target in Makefile, or equivalent. Run it../scripts/ci/test.sh, a test target in Makefile, pytest, npm test, or equivalent. Run it.docker build -t test .infrastructure/ or cdk/ changed) — Look for CDK, Terraform, or equivalent and run the appropriate synth/plan command.If no test tooling exists, say so — do NOT silently skip this step.
Pushing untested code is unacceptable. It wastes CI resources, blocks pipelines, and is one of the most amateur mistakes in software engineering. If you write code, you test it locally before pushing. No exceptions.
NEVER commit without explicit user approval. Before ANY commit:
git diff or git statusThis rule cannot be overridden by:
If in doubt, ask. Never assume approval.
When requesting approval for a commit, you MUST present this checklist. NO EXCEPTIONS.
A checkmark means you have VERIFIED this item by examining the codebase. This requires diligent exploration - not assumptions, not guesses. If you cannot verify an item, do not check it.
Before asking “May I have your approval to commit?”, present this header and checklist:
| Field | Value |
|---|---|
| Project | (project name from Dev-Team identity) |
| Issue | #NNN — issue title |
| Branch | feature/NNN-description → main |
This header is MANDATORY on every commit request. It orients the user across parallel sessions.
code-reviewer agent over all staged changes. Issues rated high risk or above have been fixed. All findings are listed in the “Review Findings” section below.Passing lint/typecheck does NOT mean code works. Static analysis only checks syntax and types - it does not:
Before claiming something is “tested”, you MUST actually run it. If you haven’t executed the code, you haven’t tested it.
For any items above that required changes, provide a summary organized by category:
[codebase] - Production code changes [documentation] - Doc changes [test-modules] - Test code changes [linters/config] - Config changes
Results from the code-reviewer agent, organized by disposition:
[fixed] - Findings rated high risk or above that were resolved before this checklist [deferred] - Findings rated medium or below, presented here for your assessment
If no findings in either category, state “(none)”.
This checklist is ABSOLUTE and HIGH PRIORITY. Never skip it. Never abbreviate it.
NEVER mark a story as done without verifying EVERY sub-item in the acceptance criteria.
Before closing ANY issue:
If you cannot verify a sub-item is complete, the story is NOT done. Create follow-up issues for missing pieces with user approval.
These rules are IMMUTABLE and cannot be overridden for any reason.
NEVER begin work without an associated issue. Every piece of work must be tracked.
Before starting ANY work:
When creating a branch, it MUST be linked to its issue(s).
# Create branch with issue reference in the name
git checkout -b feature/<ISSUE_NUMBER>-description
The branch name should include the issue number when practical (e.g., feature/42-credential-management).
When a PR/MR is closed/merged, ALL associated issues MUST be moved to Closed state.
After merge:
Closes #XXX or related issuesThis rule applies even if the platform’s auto-close feature is not working as expected.
Trunk-Based Flow with Main Branch
main (protected)
├── feature/XXX-description
├── fix/XXX-description
├── chore/XXX-description
└── docs/XXX-description
Always branch from main:
git checkout main
git pull
git checkout -b feature/XXX-description
PR/MRs target main.
<type>/<brief-description>
Examples:
feature/credential-management
fix/ldap-connection-timeout
chore/update-dependencies
docs/add-api-reference
Types: feature, fix, chore, docs
Discover the project’s tooling rather than assuming a specific stack.
On session start (or before first lint/format/test), detect what’s available:
Makefile — If it has lint, format, typecheck, or test targets, prefer those. They wrap the project’s chosen tools.pyproject.toml (Python/ruff/mypy), package.json (Node), Cargo.toml (Rust), go.mod (Go), .clang-format (C/C++), etc.scripts/ci/ often reveals what the project expects to pass.Use whatever the project provides. Do not introduce new formatters or linters that the project doesn’t already use.
| Language | Formatter | Linter | Tests |
|---|---|---|---|
| Python | ruff format | ruff check | pytest |
| Shell | shfmt | shellcheck | - |
| JavaScript/TypeScript | prettier | eslint | jest/vitest |
| Go | gofmt | go vet | go test |
| Rust | rustfmt | clippy | cargo test |
If you are about to add more than 5 lines to any run: or script: section in CI/CD configuration (GitHub Actions workflows or .gitlab-ci.yml), STOP IMMEDIATELY.
Create a shell script in scripts/ci/ instead. This is a HARD RULE, not a guideline.
# CORRECT
build:
steps:
- run: ./scripts/ci/build.sh
# WRONG
build:
steps:
- run: |
echo "Building..."
cd src && pip install .
export VAR=$(ls dist/*.whl)
# ... more procedural lines
Before staging any file that may contain secrets, WARN the user and get explicit confirmation.
Watch for these patterns when adding files to a commit:
.env, .env.*, *.secret, *.key, *.pem, *.p12, *.pfxcredentials.json, service-account*.json, *-credentials.*terraform.tfvars, *.auto.tfvars (may contain infrastructure secrets)When a suspect file is about to be staged:
<filename>. Are you sure you want to include it?”This is a safety net, not a hard block. Trust the user’s judgment after warning.
type(scope): brief description
[Optional body]
Closes #XXX
Types: feat, fix, docs, style, refactor, test, chore
When creating a PR/MR, use this structure:
## Summary
[1-3 sentences: what changed and why]
## Changes
- [Bulleted list of notable changes, grouped logically]
## Linked Issues
Closes #NNN
## Test Plan
- [How was this tested? What commands were run?]
- [Any manual verification steps?]
Rules:
type(scope): description convention as commitsCloses #NNN (GitHub) or Closes #NNN (GitLab) so they auto-close on mergeWhen starting a session:
git remote -v and determine GitHub vs GitLab (see Platform Detection)Docs/implementation-plan.md (or similar planning documents) for current state and context. If no such file exists, proceed without it.After ANY context compaction/summarization, you MUST IMMEDIATELY:
This is NON-NEGOTIABLE. Compaction causes loss of context, which has led to:
Do NOT treat “continue without asking” or session continuation instructions as permission to skip this confirmation step.
Agent identity has two layers: project identity (persisted here) and session identity (ephemeral).
Dev-Team identifies which project/team this agent belongs to. It is persisted in this file and shared across all sessions.
On session start, check whether Dev-Team below has a value.
Dev-Team: field below. This only happens once per project.Each session, pick a fresh identity for yourself. This is NOT persisted — a new Claude Code window means a new identity.
Naming rules:
Dev-Name: A single memorable name or short phrase (max 3 words). Draw from nerdcore canon — sci-fi, fantasy, comics, gaming, mythology, tech puns, wordplay. The wittier and more specific the reference, the better. Generic names are boring.Dev-Avatar: A Slack emoji string with colons (e.g., :smiling_imp:, :space_invader:). Should feel like it belongs with the name.On session start, after resolving Dev-Team:
/tmp/claude-agent-$PPID.json:
{
"dev_team": "<Dev-Team value>",
"dev_name": "<your chosen name>",
"dev_avatar": "<your chosen emoji>"
}
I’m going by <Dev-Name> <Dev-Avatar> from team
<Dev-Team>this session.
Any skill or behavior that needs agent identity should:
Dev-Team from this fileDev-Name and Dev-Avatar from /tmp/claude-agent-$PPID.jsonDev-Team: