n8n Automated AI Code Review: Lint + Gemini Scoring + Google Sheets Logging + Slack Alerts
Google Sheets code input → n8n triggers dual-layer lint and AI review → outputs red-marked corrections with scores to spreadsheet and notifies Slack
- Who
- Software engineers, QA teams, and tech leads
- You get
- Automatically trigger code reviews in Google Sheets, get lint results, AI red-marked correction suggestions, a 0-10 composite score, and push summaries to Slack
- You need
- n8n · Google Sheets · Slack
Constraints
Prerequisites: n8n instance; Google Sheets OAuth2 credentials (googleSheetsOAuth2Api); Slack OAuth2 credentials; write access to target Google Sheet. Costs: n8n self-hosted or cloud fees; Gemini API calls per Google pricing. Input: Add or edit a row with a code field in the designated Google Sheet worksheet (「対象コード」). Output: Append review record to 「レビュー結果」 worksheet; Slack channel receives summary. Limitations: Lint rules in template are examples only (var, console.log, brace balance) and need project-specific expansion; AI prompt is mixed Japanese-English; not tested by this site.
What they did
Template author kazushi published an n8n workflow using Google Sheets as both code input and review result storage. The workflow polls via Google Sheets Trigger, then executes lint checking, AI Agent review (calling Gemini), result formatting and aggregation, finally writing records back to Google Sheets and sending a summary to Slack.
How it went
The author reports achieving a "two-layer review system": lint checks for fast rule validation, and AI review for severity-classified, red-highlighted correction suggestions with a final 0-10 composite score (author report, unverified).
Worth knowing
1. Lint rules in the template are examples only (var, console.log, brace balance) and need expansion for production. 2. The AI Agent prompt is mixed Japanese-English; rewrite for pure English/Chinese teams if needed. 3. Requires Google Sheets OAuth2 credentials (googleSheetsOAuth2Api); ensure service account or OAuth app has write permissions. 4. Not tested by this site; reproduction=not_tested. 5. Node names and some cached URLs in workflow.json are in Japanese; match to your actual worksheet names when using.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- googleSheetsTrigger node: connect Google Sheets OAuth2 credentials.
- googleSheets node: connect Google Sheets OAuth2 credentials.
- lmChatGoogleGemini node: connect Google OAuth2 credentials as required.
- googleSheetsTool node: connect Google Sheets OAuth2 credentials.
- slack node: connect Slack OAuth / Bot Token.
Configuration to replace
- Source template is n8n public workflow #10034 (~16 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Connect credentials and replace placeholders
In n8n, connect Google Sheets OAuth2 and Slack OAuth2 credentials. After importing the template, replace all placeholders with actual values: - `<YOUR_SPREADSHEET_ID>` → your Google Sheet document ID - `<YOUR_SHEET_GID_OR_NAME>` → input code worksheet name (e.g., 「対象コード」) and review results worksheet name (e.g., 「レビュー結果」) - `<YOUR_SLACK_CHANNEL_ID>` → your Slack channel ID Confirm the Google Sheets nodes have credentials selected and the Slack node has authentication set to oAuth2.
Configure AI Agent and optional conventions sheet
Confirm the AI Agent node is connected to Google Gemini Chat Model as its language model. Check whether the 'Get row(s) in sheet in Google Sheets' tool node points to your coding conventions worksheet (コード規約); this tool is invoked by the AI Agent to retrieve project guidelines. Adjust documentId and sheetName if needed.
Adjust review prompt and lint rules (optional)
Modify the AI Agent node prompt or Lint Check function node rules based on project needs. The source prompt is mixed Japanese-English and requires HTML red-tag formatting. When extending lint rules, maintain compatible output format (lintErrors array with type and msg fields, lintScore 0-10).
Execution prompt · Source text。AI Agent node text parameter (promptType=define)
=Lint summary (consider in review): {{ JSON.stringify($('Lint Check').first().json.lintErrors) }} Lint score: {{ $('Lint Check').first().json.lintScore }} / 10 =あなたはコードレビューの専門家です。以下のコードをレビューし、修正が必要な箇所を赤字で示してください。元のコードに対して、修正案を赤字(HTMLの<span style="color:red">タグ)で追記した形式で出力してください。 {{ $json.reviewPrompt }} コード: {{ $('コード入力シート監視').item.json.code }} 【Review Rules】 - Classify issues as Critical / Major / Minor - Use <span style="color:red">red</span> for critical fixes; <span style="color:orange">orange</span> for minor suggestions - Append JSON at end: {"overall_score": <0-10 number>}Trigger workflow by entering code in the sheet
Add a new row in the 「対象コード」 worksheet, ensuring it includes a code field (column name must match trigger configuration). The n8n Google Sheets Trigger node (コード入力シート監視) polls every minute for new or edited rows and automatically starts the workflow.
Observe dual-layer review execution
The workflow executes in this order: 1. Lint Check function node runs static analysis, outputting lintErrors (Critical/Major/Minor classification) and lintScore (0-10). 2. AI Agent node sends code, lint summary, and conventions sheet content to Gemini, requesting red/orange HTML-marked corrections and appending {"overall_score": N} JSON at the end. 3. Format Review Output function node parses AI output, extracts overall_score, and averages it with lintScore to produce overallScore. 4. Aggregate Review Stats function node counts severity levels and generates summaryText.
Review outputs: spreadsheet record and Slack notification
After review completion: - The 「レビュー結果」 worksheet appends a row with reviewedCode (AI output), originalCode (source code), and timestamp (ISO time). - Slack channel receives: "✅ Code Review Completed" + summary (e.g., Critical:0 Major:1 Minor:2 / Score:7.5). Check Google Sheets and Slack node execution logs for permission errors. If results are not written, verify spreadsheet ID, sheet name, and that OAuth scopes include spreadsheets write access.
Execution prompt · Source text。Post Review Summary node text parameter
={{ `✅ Code Review Completed\n${$json.summaryText}` }}
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant to help with credential config, placeholder replacement, and test validation
This block is the prompt. Ads are never placed here.
You are an n8n workflow setup assistant. The user wants to replicate the "AI-powered code review automation" template. Assist in this order: 1. Confirm the user has an n8n instance, Google Sheets OAuth2 credentials, and Slack OAuth2 credentials. 2. Guide the user to replace the three placeholders: SPREADSHEET_ID, SHEET_GID_OR_NAME, SLACK_CHANNEL_ID. 3. Explain that the Google Sheet needs two worksheets: 「対象コード」 (input) and 「レビュー結果」 (output), and the input sheet must have a code column. 4. If extending lint rules, prompt the user to modify the Lint Check function node's functionCode. 5. Remind the user to test with a sample row before activating the workflow.
Before setup, ensure the Google Sheets API is enabled in your Google Cloud project and the OAuth consent screen includes spreadsheets scope.
Source
AI-powered code review with linting, red-marked corrections in Google Sheets & Slack · kazushi · n8n.io · 2025-10-22
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.