Agent-alchemy project-conventions
Guides discovery and application of project-specific conventions including code patterns, naming, structure, and team practices. Use when exploring a codebase or implementing features to match existing patterns.
git clone https://github.com/sequenzia/agent-alchemy
T=$(mktemp -d) && git clone --depth=1 https://github.com/sequenzia/agent-alchemy "$T" && mkdir -p ~/.claude/skills && cp -r "$T/ported/20260305-191444/skills/project-conventions" ~/.claude/skills/sequenzia-agent-alchemy-project-conventions-df7c40 && rm -rf "$T"
ported/20260305-191444/skills/project-conventions/SKILL.mdProject Conventions
This skill guides you in discovering and applying project-specific conventions. Every codebase has its own patterns and practices - your job is to find them and follow them.
Convention Discovery Process
Step 1: Project Configuration
Check these files for explicit conventions:
Code Style:
,.eslintrc*
- JavaScript/TypeScript linting ruleseslint.config.*
,.prettierrc*
- Formatting rulesprettier.config.*
,pyproject.toml
,setup.cfg
- Python config.flake8
- Editor settings.editorconfig
,ruff.toml
- Ruff linter config.ruff.toml
Project Structure:
- TypeScript paths and settingstsconfig.json
- Scripts, dependenciespackage.json
- Python project configpyproject.toml
Documentation:
- Contribution guidelinesCONTRIBUTING.md
- AI coding guidelinesCLAUDE.md
- Project overviewREADME.md
- Extended documentationdocs/
Step 2: Existing Code Patterns
Study the codebase to find implicit conventions:
File Organization:
- List the contents of
to see how components are organizedsrc/components/ - Search for files matching
,*.test.*
, or*_test.*
to find test file patternstest_* - List the contents of
,src/utils/
, orsrc/lib/
to see utility organizationsrc/helpers/
Naming Patterns:
- Search for exported function declarations in
to find function naming patternssrc/ - Search for Python function definitions (
) indef
to find naming conventionssrc/ - Search for exported class declarations to find class naming patterns
Import Patterns:
- Search for import statements in
to find import style (absolute vs relative)src/ - Search for relative imports in Python files (
) to find local import conventionsfrom .
Step 3: Similar Features
Find features similar to what you're building:
-
Search for similar functionality:
- Search file contents for terms related to your feature (e.g., "profile")
- Search for files matching feature-related name patterns
-
Study the implementation:
- How is it structured?
- What patterns does it use?
- How does it handle errors?
- How is it tested?
-
Note the patterns:
- Component structure
- State management approach
- API call patterns
- Validation approach
Common Convention Areas
Naming Conventions
Discover by example:
- Search for function declarations like
in TypeScript files(export )?(async )?function - Search for variable declarations like
in TypeScript files(const|let|var) - Search for component declarations like
in TSX files(export )?function [A-Z]
Common patterns:
for functions/variablescamelCase
for components/classesPascalCase
for constantsUPPER_SNAKE
for file names (some projects)kebab-case
for file names (Python)snake_case
File Structure
Discover the pattern:
- List the contents of a component directory (e.g.,
)src/components/Button/ - List the contents of a feature module directory (e.g.,
)src/features/auth/
Common patterns:
Flat structure:
components/ Button.tsx Button.test.tsx Button.styles.ts
Folder per component:
components/ Button/ index.ts Button.tsx Button.test.tsx Button.module.css
Feature-based:
features/ auth/ components/ hooks/ api.ts types.ts
Error Handling
Discover the pattern:
- Search for try-catch patterns in TypeScript files
- Search for custom error types (
) in the sourceextends Error - Search for error handling in API modules
Apply what you find:
- Use the same error types
- Follow the same handling pattern
- Match logging approach
Testing Patterns
Discover the pattern:
- Read the first 50 lines of test files to understand the test structure
- Read test setup and utility files (
,src/test/setup.ts
)src/test/utils.ts
Match the patterns:
- Test file location (co-located vs separate)
- Naming convention (
vs*.test.ts
)*.spec.ts - Setup and teardown approach
- Mocking strategy
- Assertion style
API Patterns
Discover the pattern:
- Search for API call patterns (
,fetch
,axios
) in the sourceapi. - Read API response handling in API modules
Match the patterns:
- How are endpoints defined?
- How is authentication handled?
- What's the error format?
- How are responses typed?
Convention Application Checklist
When implementing a feature, verify you're following conventions for:
Code Style
- Variable naming matches existing code
- Function naming matches existing code
- File naming follows project pattern
- Import style matches (absolute vs relative)
Structure
- File location follows project structure
- Component organization matches
- Export style matches (default vs named)
Patterns
- Error handling follows project patterns
- Async patterns match existing code
- State management follows project approach
- API calls follow established patterns
Testing
- Test file location is correct
- Test naming follows convention
- Test structure matches existing tests
- Mocking approach is consistent
Documentation
- Comments follow existing style
- JSDoc/docstrings match project
- README updates if needed
When Conventions Conflict
Sometimes you'll find inconsistent patterns:
- Prefer newer code - Recent files often reflect current team preferences
- Prefer maintained code - Active parts of the codebase reflect current practices
- Prefer documented conventions - Explicit rules in configs override implicit patterns
- Ask if unclear - When in doubt, ask the user which pattern to follow
Red Flags
Watch for these signs that you might be breaking conventions:
- Your code looks very different from surrounding code
- You're using a library/pattern not used elsewhere
- Your file structure doesn't match siblings
- Your naming feels inconsistent with the codebase
- Linting errors (the project has explicit rules you're breaking)
When you notice these, stop and investigate the existing conventions more carefully.
Integration Notes
Reference skill for discovering project conventions. Requires file reading and searching capabilities.