Expose a temporary evaluation hook in DevTools and run a Puppeteer script to validate CSS code completion trigger rates.
64
76%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.agents/skills/evaluate-ai-css-completion/SKILL.mdThis skill allows you to temporarily expose an evaluation hook in DevTools to measure CSS code completion trigger rates using a Puppeteer script.
[!WARNING] NEVER commit the
devtools_app.tspatch. It is only for local evaluation. Always revert it before uploading your CL.
Modify front_end/entrypoints/devtools_app/devtools_app.ts to expose the global testCssCompletion hook.
Add the following code at the end of front_end/entrypoints/devtools_app/devtools_app.ts:
// --- TEMPORARY EVALUATION HOOK ---
// TEMPORARY PATCH - REMOVE BEFORE COMMIT
import * as Host from '../../core/host/host.js';
import * as AiCodeCompletion from '../../models/ai_code_completion/ai_code_completion.js';
(self as any).testCss = {
getCases() {
return [
{
name: 'Generic CSS Test Case',
url: null,
prefix: 'h1 { font-s',
suffix: ' }',
},
// Add more test cases here
];
},
async evaluate(uiSourceCodeUrl: string | null, prefix: string, suffix: string, additionalFiles?: any[]) {
const aidaClient = new Host.AidaClient.AidaClient();
const completion = new AiCodeCompletion.AiCodeCompletion.AiCodeCompletion(
{aidaClient},
AiCodeCompletion.AiCodeCompletion.ContextFlavor.STYLES
);
const formattedAdditionalFiles = additionalFiles?.map(f => ({
path: f.path || f.name,
content: f.content || f.text,
included_reason: f.included_reason ?? Host.AidaClient.Reason.RELATED_FILE,
}));
const result = await completion.completeCode(
prefix,
suffix,
prefix.length,
Host.AidaClient.AidaInferenceLanguage.CSS,
formattedAdditionalFiles
);
return {
hasSuggestion: result.response !== null && result.response.generatedSamples.length > 0,
suggestions: result.response?.generatedSamples.map(s => s.generationString) ?? [],
injectedFiles: formattedAdditionalFiles?.map(f => f.path) ?? [],
};
}
};
// ----------------------------------Use the npm start script to build DevTools, launch Chrome Canary with remote debugging, and disable watch mode (so we build manually instead).
You must specify a persistent user data directory so you can log in once and reuse the session:
npm start -- --no-watch --browser=canary --remote-debugging-port=9222 --user-data-dir=/tmp/devtools-ai-evaluate-css-completion[!IMPORTANT] Instructions for the Agent: After launching Chrome, you MUST print the following checklist to the user and wait for their explicit confirmation before running the evaluation script:
- Sign in to Chrome with your corporate account in the new window.
- Open DevTools, go to Settings (gear icon) > AI Innovations, and ensure Code Completions is enabled.
- Focus the DevTools window and press
Cmd + Option + I(on macOS) orCtrl + Shift + I(on Windows/Linux) to open DevTools-on-DevTools (inspecting DevTools itself). Go to the Network tab of the second DevTools instance and check the Disable cache checkbox. This ensures your local builds are loaded instead of cached versions when reloaded.- Ask the user to reply when they are ready.
Before running the evaluation, configure your test cases directly in front_end/entrypoints/devtools_app/devtools_app.ts inside the getCases() method of the patch you applied in Step 1.
After modifying the test cases, manually run a build to compile the changes:
autoninja -C out/DefaultFor example, to test spacing sensitivity, update the returned array:
getCases() {
return [
{
name: 'With CSS Context',
url: null,
prefix: 'h1 { font-s',
suffix: ' }',
additionalFiles: [
{
path: 'other.css',
content: 'body { color: red; }',
}
]
}
];
}Run the Puppeteer script to execute the evaluation:
node .agents/skills/evaluate-ai-css-completion/scripts/evaluate.jsThe script will connect to the DevTools instance, trigger completions, and output the results.
If you get 0% trigger rate or unexpected errors, check the following:
BROWSER LOG:). Look for these in your terminal.Host Config at the start. Verify that "devToolsAiCodeCompletionStyles": { "enabled": true } is present.GCA request succeeded: in the logs:
"usageMetadata": { "candidatesTokenCount": X } (where X > 0) but the candidates array is missing or empty, the backend generated tokens but they were filtered out (e.g., due to safety classifiers or recitation blocks).h1 { font-s might not trigger AIDA. Ensure your test cases have enough context in the prefix (e.g., several preceding CSS rules) or pass them via additionalFiles to simulate a larger stylesheet.Once the evaluation is complete and you have recorded the results, revert the patch in devtools_app.ts:
git checkout front_end/entrypoints/devtools_app/devtools_app.ts184a74d
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.