Found a pattern that AI agents commonly introduce? We'd love to add it!
git clone https://github.com/allierays/agentic-loop.git
cd agentic-loop
npm installCreate a new file in src/checks/:
// src/checks/check-your-pattern.ts
import type { CheckResult, Finding } from '../utils/types';
const PATTERNS = [
// Your regex patterns here
{ regex: /problematic_pattern/, message: 'Description of issue' },
];
export function checkYourPattern(
filePath: string,
content: string
): CheckResult {
const findings: Finding[] = [];
const lines = content.split('\n');
lines.forEach((line, index) => {
for (const { regex, message } of PATTERNS) {
if (regex.test(line)) {
findings.push({
line: index + 1,
column: 0,
message,
severity: 'warning', // or 'error' for blocking issues
});
}
}
});
return {
filePath,
findings,
hookId: 'your-pattern',
};
}import { checkYourPattern } from './check-your-pattern';
export const hooks = {
// ... existing hooks
'your-pattern': checkYourPattern,
};- id: check-your-pattern
name: Check Your Pattern
entry: npx vibe-check --only your-pattern --fail-on warning
language: node
types_or: [python, javascript, ts]
pass_filenames: trueCreate src/checks/__tests__/check-your-pattern.test.ts:
import { describe, it, expect } from 'vitest';
import { checkYourPattern } from '../check-your-pattern';
describe('checkYourPattern', () => {
it('detects problematic code', () => {
const result = checkYourPattern('test.ts', 'problematic_pattern here');
expect(result.findings).toHaveLength(1);
});
it('ignores valid code', () => {
const result = checkYourPattern('test.ts', 'valid code here');
expect(result.findings).toHaveLength(0);
});
});- Add to
docs/HOOKS.md - Update the hook count in
README.md
git checkout -b add-check-your-pattern
npm run build
npm test
git add .
git commit -m "Add check-your-pattern hook"
git push origin add-check-your-pattern- Warn by default - Use
severity: 'warning'unless it's a security issue - Be specific - Catch real problems, not style preferences
- Allow suppression - Check for
// noqa:comments - Skip tests - Don't flag test files unless relevant
- Clear messages - Tell users what's wrong and how to fix it
Have an idea? We'd love contributions:
check-unused-imports- Imports that aren't usedcheck-async-await- Missingawaiton async callscheck-react-keys- Missing keys in React listscheck-sql-injection- SQL string concatenationcheck-circular-imports- Circular import detectioncheck-type-ignore- Excessive// type: ignorecomments
npm install
npm test # Run all tests
npm run test:run # Run tests once (no watch)
npm run build # Build TypeScript
npm run typecheck # Type check onlyWe use:
- TypeScript for all hooks
- ESLint for linting
- Vitest for testing
Run before committing:
npm run lint
npm run typecheck
npm run build