HubSpot Developer Extension Standards
This skill enforces coding standards and best practices for the HubSpot Developer Extension by Avidly Development repository. Use this when working on agent automation code, API integrations, or any development tasks within the HubSpot extension ecosystem.
Instructions
When writing or reviewing code for the HubSpot Developer Extension, follow these standards:
1. General Coding Principles
Write clear, maintainable, and modular codeUse descriptive variable and function names that clearly convey intentInclude comprehensive error handling and input validation for all functionsDocument all public functions and complex logic with clear commentsUse async/await pattern for all asynchronous operationsPrefer configuration files or environment variables over hardcoded values2. Security Requirements
NEVER expose sensitive data, credentials, API keys, or tokens in code or logsValidate and sanitize ALL user input and external data before processingFollow the principle of least privilege for all permissions and API accessUse environment variables for secrets and configurationImplement proper authentication and authorization checks3. Testing Standards
Write unit tests for all agent logic and critical functions where possibleTest all agent code in a safe, non-production environment before mergingEnsure tests cover edge cases, error conditions, and expected failuresValidate API integrations thoroughly before deploying4. Collaboration Guidelines
Follow the repository's CONTRIBUTING.md guidelinesWrite code that is easy for others to review, understand, and extendUse inclusive, welcoming language in all comments and documentationProvide clear commit messages that explain the why, not just the whatRequest code reviews for significant changes5. Code Review Checklist
Before submitting code, verify:
[ ] All functions have proper error handling[ ] No hardcoded credentials or sensitive data[ ] All async operations use async/await[ ] Public functions are documented[ ] Input validation is implemented[ ] Tests are included and passing[ ] Code follows naming conventions[ ] Configuration is externalized6. Documentation Requirements
Document all public APIs and functionsExplain complex logic and business rulesKeep CLAUDE.md updated as standards evolveReference CONTRIBUTING.md and CODE_OF_CONDUCT.md for broader guidelinesExamples
**Good error handling:**
```typescript
async function fetchHubSpotData(apiKey: string, endpoint: string) {
if (!apiKey || !endpoint) {
throw new Error('API key and endpoint are required');
}
try {
const response = await fetch(endpoint, {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
return await response.json();
} catch (error) {
console.error('Failed to fetch HubSpot data:', error);
throw error;
}
}
```
**Good configuration:**
```typescript
// Use environment variables
const config = {
apiKey: process.env.HUBSPOT_API_KEY,
baseUrl: process.env.HUBSPOT_BASE_URL || 'https://api.hubapi.com'
};
```
Constraints
All code must pass existing tests before mergingSecurity vulnerabilities must be addressed immediatelyBreaking changes require documentation updatesFollow the existing code style and patterns in the repository