/bamboohr-pack:bamboohr-local-dev-loopfrom bamboohr-pack
Sets up a fast, reproducible local development environment for BambooHR API integrations with hot reload, request mocking, and integration testing using TypeScript and Node.js.
Ships in bamboohr-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Set up a fast, reproducible local development workflow for BambooHR integrations with request mocking, hot reload, and integration testing against the real API.
bamboohr-install-auth setupBAMBOOHR_API_KEY and BAMBOOHR_COMPANY_DOMAIN set in .envmy-bamboohr-project/
├── src/
│ ├── bamboohr/
│ │ ├── client.ts # Reusable API client
│ │ ├── types.ts # BambooHR response types
│ │ └── employees.ts # Employee operations
│ └── index.ts
├── tests/
│ ├── mocks/
│ │ └── bamboohr.ts # API response fixtures
│ ├── unit/
│ │ └── employees.test.ts
│ └── integration/
│ └── bamboohr.test.ts
├── .env.local # Real API key (git-ignored)
├── .env.example # Template for team
├── .env.test # Test config (sandbox key)
└── package.json
// src/bamboohr/client.ts
import 'dotenv/config';
export class BambooHRClient {
private baseUrl: string;
private authHeader: string;
constructor(companyDomain?: string, apiKey?: string) {
const domain = companyDomain || process.env.BAMBOOHR_COMPANY_DOMAIN!;
const key = apiKey || process.env.BAMBOOHR_API_KEY!;
this.baseUrl = `https://api.bamboohr.com/api/gateway.php/${domain}/v1`;
this.authHeader = `Basic ${Buffer.from(`${key}:x`).toString('base64')}`;
}
async request<T>(path: string, options: RequestInit = {}): Promise<T> {
const res = await fetch(`${this.baseUrl}${path}`, {
...options,
headers: {
Authorization: this.authHeader,
Accept: 'application/json',
'Content-Type': 'application/json',
...options.headers,
},
});
if (!res.ok) {
const errMsg = res.headers.get('X-BambooHR-Error-Message') || res.statusText;
throw new BambooHRError(res.status, errMsg, path);
}
return res.json() as Promise<T>;
}
async getEmployee(id: number | string, fields: string[]): Promise<Record<string, string>> {
return this.request(`/employees/${id}/?fields=${fields.join(',')}`);
}
async getDirectory(): Promise<{ employees: BambooEmployee[] }> {
return this.request('/employees/directory');
}
}
export class BambooHRError extends Error {
constructor(public status: number, message: string, public path: string) {
super(`BambooHR ${status}: ${message} [${path}]`);
this.name = 'BambooHRError';
}
}
{
"scripts": {
"dev": "tsx watch src/index.ts",
"test": "vitest run",
"test:watch": "vitest --watch",
"test:integration": "DOTENV_CONFIG_PATH=.env.test vitest run tests/integration/",
"typecheck": "tsc --noEmit"
},
"devDependencies": {
"tsx": "^4.0.0",
"vitest": "^2.0.0",
"typescript": "^5.5.0",
"msw": "^2.0.0"
}
}
// tests/mocks/bamboohr.ts
import { http, HttpResponse } from 'msw';
const MOCK_COMPANY = 'testcompany';
const BASE = `https://api.bamboohr.com/api/gateway.php/${MOCK_COMPANY}/v1`;
export const bamboohrHandlers = [
// Employee directory
http.get(`${BASE}/employees/directory`, () => {
return HttpResponse.json({
fields: [{ id: 'displayName', type: 'text', name: 'Display Name' }],
employees: [
{
id: '1', displayName: 'Jane Smith', firstName: 'Jane',
lastName: 'Smith', jobTitle: 'Engineer', department: 'Engineering',
workEmail: '[email protected]', location: 'Remote',
},
{
id: '2', displayName: 'Bob Jones', firstName: 'Bob',
lastName: 'Jones', jobTitle: 'Designer', department: 'Design',
workEmail: '[email protected]', location: 'NYC',
},
],
});
}),
// Single employee
http.get(`${BASE}/employees/:id/`, ({ params }) => {
return HttpResponse.json({
id: params.id, firstName: 'Jane', lastName: 'Smith',
jobTitle: 'Engineer', department: 'Engineering',
hireDate: '2023-01-15', workEmail: '[email protected]',
status: 'Active',
});
}),
// Custom report
http.post(`${BASE}/reports/custom`, () => {
return HttpResponse.json({
title: 'Test Report', employees: [
{ firstName: 'Jane', lastName: 'Smith', department: 'Engineering' },
],
});
}),
];
// tests/unit/employees.test.ts
import { describe, it, expect, beforeAll, afterAll, afterEach } from 'vitest';
import { setupServer } from 'msw/node';
import { bamboohrHandlers } from '../mocks/bamboohr';
import { BambooHRClient } from '../../src/bamboohr/client';
const server = setupServer(...bamboohrHandlers);
beforeAll(() => server.listen({ onUnhandledRequest: 'error' }));
afterEach(() => server.resetHandlers());
afterAll(() => server.close());
describe('BambooHRClient', () => {
const client = new BambooHRClient('testcompany', 'fake-key');
it('fetches the employee directory', async () => {
const dir = await client.getDirectory();
expect(dir.employees).toHaveLength(2);
expect(dir.employees[0].displayName).toBe('Jane Smith');
});
it('fetches a single employee', async () => {
const emp = await client.getEmployee(1, ['firstName', 'lastName', 'jobTitle']);
expect(emp.firstName).toBe('Jane');
expect(emp.jobTitle).toBe('Engineer');
});
});
// tests/integration/bamboohr.test.ts
import { describe, it, expect } from 'vitest';
import { BambooHRClient } from '../../src/bamboohr/client';
const HAS_KEY = !!process.env.BAMBOOHR_API_KEY;
describe.skipIf(!HAS_KEY)('BambooHR Integration', () => {
const client = new BambooHRClient();
it('should fetch the real employee directory', async () => {
const dir = await client.getDirectory();
expect(dir.employees.length).toBeGreaterThan(0);
expect(dir.employees[0]).toHaveProperty('displayName');
}, 15_000);
});
BambooHRClient with typed methodsBAMBOOHR_API_KEY presencetsx watch| Error | Cause | Solution |
|---|---|---|
BambooHRError 401 | Wrong key in .env.local | Re-copy from BambooHR dashboard |
MSW onUnhandledRequest | Unmocked endpoint hit | Add handler to bamboohrHandlers |
ECONNREFUSED in tests | MSW server not started | Ensure beforeAll(() => server.listen()) |
| Slow integration tests | Real API latency | Increase vitest timeout to 15s |
See bamboohr-sdk-patterns for production-ready code patterns.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
18 skills in this plugin
/bamboohr-ci-integrationConfigure CI/CD pipelines for BambooHR integrations with GitHub Actions,
automated testing, and secret management.
Use when setting up automated testing, configuring CI pipelines,
or integrating BambooHR API tests into your build process.
Trigger with phrases like "bamboohr CI", "bamboohr GitHub Actions",
"bamboohr automated tests", "CI bamboohr", "bamboohr pipeline".
/bamboohr-common-errorsDiagnose and fix BambooHR API errors and exceptions.
Use when encountering BambooHR errors, debugging failed requests,
or troubleshooting HTTP 400/401/403/404/429/500/503 responses.
Trigger with phrases like "bamboohr error", "fix bamboohr",
"bamboohr not working", "debug bamboohr", "bamboohr 401", "bamboohr 429".
/bamboohr-npx claudepluginhub flight505/skill-forge --plugin bamboohr-packOther plugins' skills for the same job