agentleFS
VersoXBTVersoXBT/claude-initial-setup/.github/copilot-instructions.md

claude-initial-setup

Copilot instructions4 starsChanged 9 months agoMITView on GitHub

Always create new objects instead of mutating existing ones. Use spread operators, structuredClone, or immutable patterns like @dataclass(frozen=True) in Python and value receivers in Go. Never use .push(), .pop(), .splice(), .sort(), or .reverse() on shared arrays. Use [...arr, item], .filter(), .map(), .toSorted(), and .toReversed() instead. Keep files between 200-400 lines. Extract separate modules when files grow beyond 800 lines. Organize files by feature or domain, not by type. Keep functions under 50 lines. If longer, extract helper functions with descriptive…

  • Reads credentials

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

41 rules. About 0 are common, 28 are distinctive, and 13 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈28

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 13

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Always create new objects instead of mutating existing ones.

    line 5
  2. Very specific:

    Never use .push(), .pop(), .splice(), .sort(), or .reverse() on shared arrays.

    line 7
  3. Distinctive:

    Keep files between 200-400 lines.

    line 9
  4. Distinctive:

    Keep functions under 50 lines.

    line 11
  5. Distinctive:

    Avoid nesting deeper than 4 levels.

    line 13
  6. Very specific:

    Use plural nouns for collections: users, orderItems.

    line 21
  7. Very specific:

    Use SCREAMING_SNAKE_CASE for true constants: MAX_RETRIES, API_BASE_URL.

    line 23
  8. Distinctive:

    Follow language-specific casing: camelCase for JS/TS variables, PascalCase for classes/types, snake_case for Python, PascalCase for …

    line 25
  9. Very specific:

    Use conventional commits: <type>(<scope>): <description>.

    line 29
  10. Distinctive:

    Write commit messages in imperative mood ("add feature" not "added feature"), lowercase after type, under 72 characters, no trailing period.

    line 31
  11. Distinctive:

    Keep pull requests under 400 lines.

    line 35
  12. Distinctive:

    Never rebase commits that have been pushed to a shared branch.

    line 37
  13. Distinctive:

    Write tests before implementation (TDD).

    line 41
  14. Distinctive:

    Use factories for dynamic test data with unique values.

    line 47
  15. Very specific:

    Always restore mocks after each test.

    line 51
  16. Distinctive:

    Use dependency injection to make code testable.

    line 53
  17. Very specific:

    Never hardcode secrets, API keys, or passwords in source code.

    line 59
  18. Very specific:

    Always include .env, .env.local, *.pem, *.key, credentials.json in .gitignore.

    line 61
  19. Distinctive:

    Prefer allowlists over denylists when filtering or validating input.

    line 67
  20. Distinctive:

    Use parameterized queries for all SQL.

    line 69
  21. Distinctive:

    Verify authorization on every resource access.

    line 77
  22. Distinctive:

    Never log passwords, tokens, API keys, or PII.

    line 83
  23. Distinctive:

    Never return sensitive fields (password hashes, internal notes) in API responses.

    line 85
  24. Distinctive:

    Always handle errors explicitly.

    line 89
  25. Very specific:

    Check response.ok after fetch calls.

    line 93
  26. Distinctive:

    Use custom error classes for domain-specific errors to enable typed error handling.

    line 95
  27. Distinctive:

    Follow the debugging loop: REPRODUCE, HYPOTHESIZE, TEST, ISOLATE, FIX, VERIFY.

    line 101
  28. Very specific:

    Use git bisect to find the commit that introduced a bug.

    line 103
  29. Distinctive:

    Create minimal reproductions that isolate the failing behavior from surrounding complexity.

    line 105
  30. Very specific:

    Avoid N+1 queries. Use joins, include, select_related, or batch loading.

    line 111
  31. Distinctive:

    Use appropriate caching: in-memory LRU for hot paths, Redis for distributed state, CDN for static assets.

    line 115
  32. Very specific:

    Use lazy loading and code splitting for frontend bundles.

    line 119
  33. Distinctive:

    Use multi-stage builds to separate build dependencies from runtime.

    line 123
  34. Very specific:

    Run containers as non-root users.

    line 125
  35. Distinctive:

    Use Alpine-based images unless specific system libraries require a full distribution.

    line 131
  36. Distinctive:

    Use snake_case for all table names, column names, and indexes.

    line 137
  37. Distinctive:

    Add indexes for columns frequently used in WHERE, JOIN, and ORDER BY clauses.

    line 139
  38. Distinctive:

    Use foreign key constraints for referential integrity.

    line 141
  39. Distinctive:

    Check for edge cases: empty arrays, null values, zero, negative numbers, boundary conditions.

    line 149
  40. Distinctive:

    Verify error states are handled: network failures, invalid data, timeouts.

    line 151
  41. Distinctive:

    Look for N+1 queries and unbounded result sets.

    line 155

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Instructions

Code Style

Always create new objects instead of mutating existing ones. Use spread operators, structuredClone, or immutable patterns like @dataclass(frozen=True) in Python and value receivers in Go.

Never use .push(), .pop(), .splice(), .sort(), or .reverse() on shared arrays. Use [...arr, item], .filter(), .map(), .toSorted(), and .toReversed() instead.

Keep files between 200-400 lines. Extract separate modules when files grow beyond 800 lines. Organize files by feature or domain, not by type.

Keep functions under 50 lines. If longer, extract helper functions with descriptive names.

Avoid nesting deeper than 4 levels. Use early returns, guard clauses, or extracted functions to flatten logic.

Name variables to describe WHAT they contain, not HOW they were computed. Use activeUsers instead of data or result.

Prefix boolean variables with is, has, can, should, was, or will: isActive, hasPermission, canEdit.

Name functions with a verb describing what they do: getUserById, formatDate, validateEmail, createOrder.

Use plural nouns for collections: users, orderItems. Use singular for individual items in iteration.

Use SCREAMING_SNAKE_CASE for true constants: MAX_RETRIES, API_BASE_URL.

Follow language-specific casing: camelCase for JS/TS variables, PascalCase for classes/types, snake_case for Python, PascalCase for exported Go identifiers.

Git Workflow

Use conventional commits: <type>(<scope>): <description>. Types: feat, fix, refactor, docs, test, chore, perf, ci.

Write commit messages in imperative mood ("add feature" not "added feature"), lowercase after type, under 72 characters, no trailing period.

Name branches as feature/, fix/, hotfix/, release/ followed by ticket ID and kebab-case description: feature/AUTH-123-add-sso-login.

Keep pull requests under 400 lines. Include a summary, list of changes, and test plan in every PR description.

Never rebase commits that have been pushed to a shared branch. Never force-push to main or develop.

Testing

Write tests before implementation (TDD). Follow Red-Green-Refactor: write a failing test, write minimal code to pass, then refactor.

Target 80% minimum code coverage across unit, integration, and E2E tests.

Co-locate unit tests next to source files: auth.ts and auth.test.ts in the same directory.

Use factories for dynamic test data with unique values. Use fixtures for static, predictable test data.

Mock only at system boundaries: external APIs, databases, file I/O, email services. Never mock pure functions or the code under test.

Always restore mocks after each test. Use afterEach(() => vi.restoreAllMocks()) or equivalent.

Use dependency injection to make code testable. Accept dependencies as parameters rather than importing directly.

For bug fixes, always write a test that reproduces the bug before writing the fix.

Security

Never hardcode secrets, API keys, or passwords in source code. Use environment variables loaded from .env files.

Always include .env, .env.local, *.pem, *.key, credentials.json in .gitignore.

Validate required environment variables at application startup using Zod, Pydantic, or equivalent schema validation.

Validate all user input at system boundaries. Use Zod for TypeScript, Pydantic for Python, struct tags for Go.

Prefer allowlists over denylists when filtering or validating input.

Use parameterized queries for all SQL. Never concatenate user input into query strings.

Sanitize user-generated HTML with DOMPurify. Use textContent instead of innerHTML for plain text.

Implement CSRF protection with anti-CSRF tokens and SameSite cookie attributes.

Prevent SSRF by allowlisting permitted domains for server-side HTTP requests.

Verify authorization on every resource access. Check that the requesting user owns or has permission to access the resource.

Rate limit authentication endpoints. Use bcrypt with 12+ salt rounds for password hashing.

Set security headers using helmet or equivalent: CSP, HSTS, Referrer-Policy.

Never log passwords, tokens, API keys, or PII.

Never return sensitive fields (password hashes, internal notes) in API responses. Select only needed fields.

Error Handling

Always handle errors explicitly. Never swallow errors with empty catch blocks.

Throw descriptive errors with context: include what operation failed and relevant identifiers.

Check response.ok after fetch calls. Throw on non-2xx responses with status and statusText.

Use custom error classes for domain-specific errors to enable typed error handling.

Return consistent API error responses with success, error, and field-level validation details.

Debugging

Follow the debugging loop: REPRODUCE, HYPOTHESIZE, TEST, ISOLATE, FIX, VERIFY.

Use git bisect to find the commit that introduced a bug. Use git bisect run <test-script> for automation.

Create minimal reproductions that isolate the failing behavior from surrounding complexity.

Fix root causes, not symptoms. Do not add null checks to silence errors without understanding why values are null.

Performance

Avoid N+1 queries. Use joins, include, select_related, or batch loading.

Bound all database queries with LIMIT and pagination. Never fetch entire tables.

Use appropriate caching: in-memory LRU for hot paths, Redis for distributed state, CDN for static assets.

Set proper Cache-Control headers: public for shared resources, private for user-specific data, no-store for sensitive data.

Use lazy loading and code splitting for frontend bundles. Prefer React.lazy and dynamic import().

Docker

Use multi-stage builds to separate build dependencies from runtime.

Run containers as non-root users. Create a dedicated user with adduser.

Order Dockerfile instructions to maximize layer caching: dependencies first, source code last.

Include HEALTHCHECK directives in production Dockerfiles.

Use Alpine-based images unless specific system libraries require a full distribution.

Database

Normalize schemas to 3NF. Denormalize selectively only when proven necessary for performance.

Use snake_case for all table names, column names, and indexes.

Add indexes for columns frequently used in WHERE, JOIN, and ORDER BY clauses.

Use foreign key constraints for referential integrity.

Plan migrations for zero downtime. Add new columns as nullable, backfill, then add constraints.

Code Review

Review priority: Correctness, Security, Performance, Maintainability, Testing, Style.

Check for edge cases: empty arrays, null values, zero, negative numbers, boundary conditions.

Verify error states are handled: network failures, invalid data, timeouts.

Confirm authorization checks exist on every resource access endpoint.

Look for N+1 queries and unbounded result sets.

Automate style enforcement with linters and formatters. Do not nitpick formatting in reviews.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.