This file contains instructions for Gemini AI agents (Gemini 3 Pro, etc.) working on projects.
Important: This file is specifically for Gemini agents. Do not read claude.md - that contains Claude Code-specific features that are not applicable.
When the user says:
- "Access the documentation repo"
- "Import the documentation"
- "Set up with documentation standards"
→ Immediately run the setup script:
bash <(curl -fsSL https://raw.githubusercontent.com/causius0/documentation/main/setup.sh)Then tell the user:
- Setup complete
- Files created (AGENTS.md, .claude/commands/, .env.example, README.md)
- Essential agents available (build-validator, code-architect, code-simplifier)
- Next steps for development
No confirmation needed - just do it automatically.
When starting work on ANY repository:
-
Immediately read README.md
- Understand what the project does
- Learn how to run it
- Get important context
-
Then read AGENTS.md (if it exists)
- Project-specific commands
- Custom workflows
DO NOT start coding without reading README.md first.
Monitor your context/token usage if applicable.
When approaching limits:
- Warn the user immediately
- Provide status update of completed work
- Document current progress
- Create handoff notes for next session
Create handoff document with:
- What's completed
- What's in progress
- What's remaining
- Any blockers or decisions needed
- Links to relevant files
Never lose context mid-task - warn early and hand off cleanly.
NEVER work directly on main.
For EVERY feature:
- Create branch first:
git checkout -b feature/descriptive-name - Do all work on the branch
- Test thoroughly with sample material
- Run security audit
- Merge to main only when complete
Branch naming:
feature/- New featuresfix/- Bug fixesrefactor/- Code refactoringdocs/- Documentationsecurity/- Security fixesperf/- Performance improvements
When given sample data, test files, or example inputs:
-
Use EXACT sample material provided
- Don't modify it
- Test with it as-is first
-
Test edge cases
- Empty inputs
- Large inputs
- Special characters
- Invalid data
-
Document test results
Test 1: [Description] - Input: [sample used] - Expected: [expected result] - Actual: [actual result] - Status: ✅ PASS / ❌ FAIL
-
If sample fails
- Document the failure
- Fix the issue
- Re-test with same sample
- Verify fix works
Never skip testing with provided samples.
Gemini agents work on separate features independently. There is no handoff between Claude Code and Gemini - each agent owns complete features from start to finish.
As a Gemini agent, you must:
-
Follow all documentation standards
- Read and follow coding-standards.md
- Follow git-workflow.md for branching and commits
- Follow security-testing.md for OWASP Top 10
- Follow documentation-standards.md for docs
-
Comment extensively
- Every function needs JSDoc/TSDoc
- Every code block needs what/why/how comments
- Complex logic needs inline comments
- See coding-standards.md for examples
-
Test thoroughly
- Manual testing before commits
- Run all build/lint/typecheck commands
- Test edge cases
- Document test steps
-
Security first
- Run OWASP Top 10 checklist manually
- Test for SQL injection, XSS, CSRF, etc.
- Document security measures taken
- Create SECURITY_AUDIT.md for each feature
Use these specialized approaches for different tasks:
Before every commit, manually validate:
# Run all checks
pnpm run lint
pnpm run typecheck
pnpm run build
pnpm test # if tests exist
# Verify:
# ✓ No linting errors
# ✓ No TypeScript errors
# ✓ Build succeeds
# ✓ All tests passBefore implementing complex features:
- Analyze existing codebase patterns
- Design architecture that matches existing style
- Plan file structure
- Identify dependencies
- Create implementation plan
- Document the architecture
After implementing features:
- Review code for over-engineering
- Identify unnecessary abstractions
- Consolidate duplicate logic
- Simplify complex expressions
- Improve readability
- Ensure functionality remains intact
┌─────────────────────────────────────────────────────────┐
│ 1. Read AGENTS.md for project-specific instructions │
├─────────────────────────────────────────────────────────┤
│ 2. Read documentation standards (coding-standards.md) │
├─────────────────────────────────────────────────────────┤
│ 3. Create feature branch │
├─────────────────────────────────────────────────────────┤
│ 4. Plan architecture (code-architect approach) │
├─────────────────────────────────────────────────────────┤
│ 5. Implement with extensive comments │
├─────────────────────────────────────────────────────────┤
│ 6. Test manually (document test steps) │
├─────────────────────────────────────────────────────────┤
│ 7. Run security audit (OWASP Top 10 checklist) │
├─────────────────────────────────────────────────────────┤
│ 8. Validate build (build-validator approach) │
├─────────────────────────────────────────────────────────┤
│ 9. Simplify if needed (code-simplifier approach) │
├─────────────────────────────────────────────────────────┤
│ 10. Create SECURITY_AUDIT.md with findings │
├─────────────────────────────────────────────────────────┤
│ 11. Update documentation (README, CHANGELOG) │
├─────────────────────────────────────────────────────────┤
│ 12. Create PR with comprehensive description │
├─────────────────────────────────────────────────────────┤
│ 13. Merge to main after approval │
└─────────────────────────────────────────────────────────┘
Before creating a PR, verify:
- All manual tests performed and passed
-
pnpm run lintpasses (no errors) -
pnpm run typecheckpasses (no errors) -
pnpm run buildsucceeds -
pnpm testpasses (if tests exist) - Tested edge cases (empty inputs, large inputs, special characters)
- Tested for SQL injection (if database queries)
- Tested for XSS (if user input displayed)
- Tested for CSRF (if state-changing operations)
- Tested for authentication bypass
- Tested for authorization escalation
- Created SECURITY_AUDIT.md documenting tests
- All critical/high vulnerabilities fixed
-
pnpm audit --audit-level=highshows no issues
- Every function has JSDoc/TSDoc comments
- Complex logic has inline comments explaining what/why/how
- No console.logs or debug code left in
- TypeScript types are comprehensive (no
anyunless necessary) - Code follows existing patterns in codebase
- No unnecessary complexity or over-engineering
- README updated if feature changes usage
- CHANGELOG updated with changes
- AGENTS.md updated if workflow changed
- .env.example updated if new variables added
- All new environment variables documented
- ASCII diagrams added for complex workflows
For each feature, manually test these vulnerabilities:
# Try to access resources without authentication
# Try to access other users' resources
# Try to perform admin actions as regular user# Verify passwords are hashed (bcrypt, 12+ rounds)
# Verify HTTPS is enforced
# Verify sensitive data is encrypted# Test SQL injection: ' OR 1=1--
# Test command injection: ; rm -rf /
# Test NoSQL injection: {"$gt": ""}
# Verify all queries use parameterized statements# Test for user enumeration (different error messages)
# Test for timing attacks
# Look for logic flaws# Check for exposed .env files
# Check for debug mode in production
# Check for default credentials
# Verify error messages don't leak sensitive infopnpm audit --audit-level=high
# Fix all high/critical vulnerabilities# Test weak passwords (should be rejected)
# Test password requirements
# Test session expiration
# Test token validation# Test for insecure deserialization
# Verify data signatures
# Check dependency integrity# Verify failed logins are logged
# Verify security events are logged
# Check logs don't contain sensitive data# Test URL parameters for internal access
# Verify domain whitelisting
# Check for private IP blockingDocument all findings in SECURITY_AUDIT.md.
/**
* Hash a password using bcrypt
*
* Uses bcrypt with 12 salt rounds for secure password hashing.
* Higher rounds = more secure but slower. 12 is a good balance.
*
* @param password - The plaintext password to hash
* @param saltRounds - Number of bcrypt rounds (default: 12)
* @returns Promise resolving to hashed password
* @throws {Error} If password is empty
*
* @example
* ```typescript
* const hashed = await hashPassword('MySecurePass123!');
* // Returns: $2b$12$...
* ```
*
* Security notes:
* - Never log the password parameter
* - Store only the hash, never plaintext
* - 12 rounds takes ~200ms (prevents brute force)
*
* Why bcrypt:
* - Designed to be slow (good for passwords)
* - Auto-handles salting
* - Industry standard
*/
async function hashPassword(
password: string,
saltRounds: number = 12
): Promise<string> {
// Validate input
if (!password || password.length === 0) {
throw new Error('Password cannot be empty');
}
// Generate hash
// bcrypt.hash automatically generates a unique salt
const hash = await bcrypt.hash(password, saltRounds);
return hash;
}// Step 1: Verify user has sufficient balance
// We check this first to fail fast and avoid unnecessary API calls
const user = await getUser(userId);
if (user.balance < amount) {
throw new InsufficientFundsError();
}
// Step 2: Create payment intent with Stripe
// Using idempotency key to prevent duplicate charges if request is retried
const idempotencyKey = `payment_${userId}_${Date.now()}`;
const paymentIntent = await stripe.paymentIntents.create({
amount: amount * 100, // Stripe uses cents, not dollars
currency: 'usd',
customer: user.stripeCustomerId
}, {
idempotencyKey // Prevents duplicate charges on retry
});# NEVER work directly on main
git checkout -b feature/descriptive-name
# Examples:
git checkout -b feature/user-authentication
git checkout -b feature/payment-integration
git checkout -b fix/database-timeout
git checkout -b security/sql-injection-fix# Use conventional commits
git commit -m "feat: add user authentication with JWT"
git commit -m "fix: resolve database connection timeout"
git commit -m "security: fix SQL injection in user search"
git commit -m "docs: update README with deployment steps"
# Always include the Claude Code footer
git commit -m "$(cat <<'EOF'
feat: add user authentication
- Implemented JWT token generation
- Added bcrypt password hashing (12 rounds)
- Created auth middleware
- Added rate limiting (5 attempts per 15 min)
Security measures:
- Password hashing with bcrypt
- JWT expiration (1 hour)
- Rate limiting on auth endpoints
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"# Create PR with comprehensive description
gh pr create --title "feat: user authentication" --body "$(cat <<'EOF'
## Summary
- Implemented JWT-based authentication
- Added password hashing with bcrypt
- Created auth middleware for protected routes
## Security Audit
- ✓ Tested SQL injection - BLOCKED
- ✓ Tested weak passwords - REJECTED
- ✓ Tested brute force - RATE LIMITED
- ✓ Tested token manipulation - REJECTED
See SECURITY_AUDIT.md for details.
## Testing
Manual testing completed:
- ✓ Registration flow
- ✓ Login flow
- ✓ Protected routes
- ✓ Token expiration
- ✓ Error cases
## Build Validation
- ✓ pnpm run lint - PASS
- ✓ pnpm run typecheck - PASS
- ✓ pnpm run build - PASS
🤖 Generated with [Claude Code](https://claude.com/claude-code)
EOF
)"Implement dual-mode error handling:
class AppError extends Error {
constructor(
public userMessage: string, // User-friendly
public developerMessage: string, // Technical details
public code: string, // Error code
public statusCode: number = 500,
public context?: Record<string, any>
) {
super(developerMessage);
this.name = this.constructor.name;
}
}
// Usage
throw new AppError(
'Unable to process payment. Please try again.',
'Stripe API returned 402: Insufficient funds',
'PAYMENT_FAILED',
402,
{ userId: '123', amount: 50 }
);- Coding Standards
- Tech Stack
- Git Workflow
- Security Testing
- Documentation Standards
- Dependencies Guide
- Read AGENTS.md for project specifics
- Follow coding-standards.md (extensive comments)
- Follow git-workflow.md (branch, test, merge)
- Run security audit (OWASP Top 10 checklist)
- Document extensively (JSDoc + inline comments)
- Test thoroughly before merging
- Create SECURITY_AUDIT.md
- Update README, CHANGELOG, AGENTS.md
- Validate build before PR
- Simplify code if over-engineered
- Do NOT read or reference claude.md (Claude Code specific)
Remember: You own the entire feature from start to finish. No handoffs, complete ownership.