Skip to content

azure-prepare: Enforce function file naming and add post-generation README/test update steps#1001

Open
Copilot wants to merge 4 commits intomainfrom
copilot/update-function-file-naming
Open

azure-prepare: Enforce function file naming and add post-generation README/test update steps#1001
Copilot wants to merge 4 commits intomainfrom
copilot/update-function-file-naming

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

When creating Azure Functions, the agent was using generic filenames (httpTrigger.js) regardless of route/purpose, and never updated README or test files after adding new endpoints.

Changes

New: common/post-generation.md

Mandatory reference covering all three gaps:

  • File naming — derive filename from route segment or purpose, not trigger type:
    Route ✅ Correct ❌ Avoid
    /api/random random.js httpTrigger.js
    /api/users users.js httpTrigger.js
  • README updates — template for endpoint table + curl examples (local and deployed)
  • Test file updates — update test.http blocks (GET and POST templates) and testdata.json/similar curl data files; create a new test.http if neither exists

Updated: composition.md

  • Added file naming callout to Step 5 (Replace Source Code)
  • Added new Step 5.5: Post-Generation Updates requiring README and test file updates after every function creation

Updated: recipes/README.md

Added Post-Generation as a MANDATORY entry in the Common Patterns table alongside UAMI Bindings, Error Handling, and Health Check.

Original prompt

This section details on the original issue you should resolve

<issue_title>azure-prepare: Function file naming and README/test updates for new functions</issue_title>
<issue_description>## Problem

When creating a new Azure Function, the default experience has several UX issues:

Issue 1: Generic file naming

Current behavior:

  • User asks to create a function with route /api/random
  • Agent creates src/functions/httpTrigger.js

Expected behavior:

  • File should be named after the route/function: src/functions/random.js or src/functions/httpRandom.js
  • Generic httpTrigger doesn't convey what the function does

Issue 2: README not updated for new function

Current behavior:

  • Template README only documents the original template functions
  • No mention of the new function that was just created
  • User doesn't know how to run/test their new function

Expected behavior:

  • README should be updated to include:
    • New function name and route
    • Example curl command to test it
    • Any specific configuration needed

Issue 3: Test files not updated

Current behavior:

  • Test files (if any) only test template's original functions, which can be unit tests or user test files like test.http or testdata.json used by curl
  • No tests scaffolded for the new function

Expected behavior:

  • revised test files that include new function api or routes asked for by the user

Suggested Updates to azure-prepare skill

1. File naming convention

In generate.md or function generation logic:

## Function File Naming

Name function files after their route/purpose:
- Route `/api/random``src/functions/random.js`
- Route `/api/users``src/functions/users.js`
- Route `/api/health``src/functions/health.js`

Do NOT use generic names like `httpTrigger.js` unless it's the only function.

2. README update requirement

Add to generation workflow:

## Post-Generation Updates

After creating a new function, update README.md:
1. Add function to "Available Endpoints" table
2. Add curl example for testing
3. Document any required environment variables

3. Test scaffolding

## Test Updates

When creating a new function:
1. If test file exists, add test case for new function
2. If no tests, add comment in README: "TODO: Add tests for {function_name}"

Impact

  • Better developer experience
  • Self-documenting projects
  • Easier onboarding for new team members
  • Reduced confusion about what functions exist and how to test them
    </issue_description>

<agent_instructions>Fix. Look across all the functions recipes. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…dance

- New common/post-generation.md with rules for:
  - Naming function files after route/purpose (not httpTrigger.js)
  - Updating README.md with endpoint table and curl examples
  - Updating test files (test.http, unit tests, or TODO comments)
- Updated composition.md: file naming callout in Step 5, new Step 5.5
- Updated recipes/README.md: added Post-Generation to Common Patterns table

Co-authored-by: paulyuk <1968137+paulyuk@users.noreply.github.com>
Copilot AI changed the title [WIP] Update function file naming and README for new Azure Functions azure-prepare: Enforce function file naming and add post-generation README/test update steps Feb 21, 2026
Copilot AI requested a review from paulyuk February 21, 2026 02:56
@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

🔍 Token Analysis Report

@github-copilot-for-azure/scripts@1.0.0 tokens
node --import tsx src/tokens/cli.ts compare --base origin/main --head HEAD --markdown

fatal: path 'plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/post-generation.md' exists on disk, but not in 'origin/main'

📊 Token Change Report

Comparing origin/mainHEAD

Summary

Metric Value
📈 Total Change +833 tokens (+62%)
Before 1,354 tokens
After 2,187 tokens
Files Changed 2

Changed Files

File Before After Change
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/post-generation.md - 797 +797
plugin/skills/azure-prepare/references/services/functions/templates/recipes/README.md 1,354 1,390 +36 (+3%)

@github-copilot-for-azure/scripts@1.0.0 tokens
node --import tsx src/tokens/cli.ts check --markdown

📊 Token Limit Check Report

Checked: 389 files
Exceeded: 94 files

⚠️ Files Exceeding Token Limits

File Tokens Limit Over By
.github/skills/file-test-bug/SKILL.md 613 500 +113
.github/skills/sensei/README.md 3530 1000 +2530
.github/skills/sensei/SKILL.md 2216 500 +1716
.github/skills/sensei/references/EXAMPLES.md 3328 1000 +2328
.github/skills/sensei/references/LOOP.md 3717 1000 +2717
.github/skills/sensei/references/SCORING.md 2521 1000 +1521
.github/skills/sensei/references/TOKEN-INTEGRATION.md 1094 1000 +94
.github/skills/skill-authoring/SKILL.md 732 500 +232
plugin/skills/appinsights-instrumentation/SKILL.md 952 500 +452
plugin/skills/azure-ai/SKILL.md 835 500 +335
plugin/skills/azure-aigateway/SKILL.md 6329 500 +5829
plugin/skills/azure-compliance/SKILL.md 1238 500 +738
plugin/skills/azure-compliance/references/azqr-recommendations.md 1447 1000 +447
plugin/skills/azure-compliance/references/azqr-remediation-patterns.md 1987 1000 +987
plugin/skills/azure-compliance/references/azure-keyvault-expiration-audit.md 1286 1000 +286
plugin/skills/azure-compliance/references/azure-quick-review.md 1268 1000 +268
plugin/skills/azure-cost-optimization/SKILL.md 3456 500 +2956
plugin/skills/azure-deploy/SKILL.md 961 500 +461
plugin/skills/azure-deploy/references/pre-deploy-checklist.md 1004 1000 +4
plugin/skills/azure-deploy/references/recipes/azd/errors.md 1136 1000 +136
plugin/skills/azure-deploy/references/troubleshooting.md 1527 1000 +527
plugin/skills/azure-diagnostics/SKILL.md 876 500 +376
plugin/skills/azure-kusto/SKILL.md 2167 500 +1667
plugin/skills/azure-messaging/SKILL.md 857 500 +357
plugin/skills/azure-messaging/references/service-troubleshooting.md 1044 1000 +44
plugin/skills/azure-observability/SKILL.md 939 500 +439
plugin/skills/azure-postgres/SKILL.md 1519 500 +1019
plugin/skills/azure-postgres/references/entra-rbac-overview.md 1823 1000 +823
plugin/skills/azure-postgres/references/group-sync.md 1844 1000 +844
plugin/skills/azure-postgres/references/permission-templates.md 1647 1000 +647
plugin/skills/azure-postgres/references/troubleshooting.md 1959 1000 +959
plugin/skills/azure-prepare/SKILL.md 1545 500 +1045
plugin/skills/azure-prepare/references/aspire.md 2633 1000 +1633
plugin/skills/azure-prepare/references/azure-context.md 1019 1000 +19
plugin/skills/azure-prepare/references/recipes/azd/aspire.md 1289 1000 +289
plugin/skills/azure-prepare/references/recipes/azd/azure-yaml.md 1709 1000 +709
plugin/skills/azure-prepare/references/recipes/azd/terraform.md 2924 1000 +1924
plugin/skills/azure-prepare/references/research.md 1600 1000 +600
plugin/skills/azure-prepare/references/runtimes/nodejs.md 1508 1000 +508
plugin/skills/azure-prepare/references/security.md 1784 1000 +784
plugin/skills/azure-prepare/references/services/functions/bicep.md 1969 1000 +969
plugin/skills/azure-prepare/references/services/functions/templates/SPEC-composable-templates.md 6187 1000 +5187
plugin/skills/azure-prepare/references/services/functions/templates/recipes/README.md 1390 1000 +390
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/nodejs-entry-point.md 1034 1000 +34
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/uami-bindings.md 1223 1000 +223
plugin/skills/azure-prepare/references/services/functions/templates/recipes/composition.md 4564 1000 +3564
plugin/skills/azure-prepare/references/services/functions/templates/recipes/cosmosdb/README.md 1467 1000 +467
plugin/skills/azure-prepare/references/services/functions/templates/recipes/durable/README.md 1149 1000 +149
plugin/skills/azure-prepare/references/services/functions/templates/recipes/eventhubs/README.md 1403 1000 +403
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/java.md 1312 1000 +312
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/python.md 1207 1000 +207
plugin/skills/azure-prepare/references/services/functions/templates/recipes/mcp/source/typescript.md 1138 1000 +138
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/README.md 1171 1000 +171
plugin/skills/azure-prepare/references/services/functions/templates/recipes/servicebus/source/dotnet.md 1256 1000 +256
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/java.md 1009 1000 +9
plugin/skills/azure-prepare/references/services/functions/templates/recipes/sql/source/python.md 1080 1000 +80
plugin/skills/azure-prepare/references/services/functions/terraform.md 2358 1000 +1358
plugin/skills/azure-prepare/references/services/service-bus/patterns.md 1010 1000 +10
plugin/skills/azure-resource-lookup/SKILL.md 1379 500 +879
plugin/skills/azure-resource-lookup/references/azure-resource-graph.md 1307 1000 +307
plugin/skills/azure-resource-visualizer/SKILL.md 2091 500 +1591
plugin/skills/azure-storage/SKILL.md 1092 500 +592
plugin/skills/azure-storage/references/sdk-usage.md 1096 1000 +96
plugin/skills/azure-validate/SKILL.md 734 500 +234
plugin/skills/azure-validate/references/recipes/azd/README.md 1147 1000 +147
plugin/skills/entra-app-registration/SKILL.md 2055 500 +1555
plugin/skills/entra-app-registration/references/api-permissions.md 2545 1000 +1545
plugin/skills/entra-app-registration/references/cli-commands.md 2211 1000 +1211
plugin/skills/entra-app-registration/references/console-app-example.md 2752 1000 +1752
plugin/skills/entra-app-registration/references/first-app-registration.md 1846 1000 +846
plugin/skills/entra-app-registration/references/oauth-flows.md 2375 1000 +1375
plugin/skills/entra-app-registration/references/troubleshooting.md 1896 1000 +896
plugin/skills/microsoft-foundry/SKILL.md 1934 500 +1434
plugin/skills/microsoft-foundry/foundry-agent/create/create.md 3095 1000 +2095
plugin/skills/microsoft-foundry/foundry-agent/create/references/agentframework.md 1177 1000 +177
plugin/skills/microsoft-foundry/foundry-agent/deploy/deploy.md 3557 1000 +2557
plugin/skills/microsoft-foundry/foundry-agent/invoke/invoke.md 1273 1000 +273
plugin/skills/microsoft-foundry/foundry-agent/troubleshoot/troubleshoot.md 1299 1000 +299
plugin/skills/microsoft-foundry/models/deploy-model/SKILL.md 1627 500 +1127
plugin/skills/microsoft-foundry/models/deploy-model/capacity/SKILL.md 1725 500 +1225
plugin/skills/microsoft-foundry/models/deploy-model/customize/SKILL.md 2220 500 +1720
plugin/skills/microsoft-foundry/models/deploy-model/customize/references/customize-workflow.md 1859 1000 +859
plugin/skills/microsoft-foundry/models/deploy-model/preset/SKILL.md 1212 500 +712
plugin/skills/microsoft-foundry/models/deploy-model/preset/references/preset-workflow.md 4252 1000 +3252
plugin/skills/microsoft-foundry/models/deploy-model/preset/references/workflow.md 1315 1000 +315
plugin/skills/microsoft-foundry/project/create/create-foundry-project.md 1218 1000 +218
plugin/skills/microsoft-foundry/quota/references/ptu-guide.md 1473 1000 +473
plugin/skills/microsoft-foundry/quota/references/troubleshooting.md 1807 1000 +807
plugin/skills/microsoft-foundry/quota/references/workflows.md 1614 1000 +614
plugin/skills/microsoft-foundry/rbac/rbac.md 1752 1000 +752
plugin/skills/microsoft-foundry/references/sdk/foundry-sdk-py.md 1888 1000 +888
plugin/skills/microsoft-foundry/resource/create/create-foundry-resource.md 1489 1000 +489
plugin/skills/microsoft-foundry/resource/create/references/workflows.md 1637 1000 +637
.github/agents/SkillCreator.agent.md 1044 1000 +44

Consider moving content to references/ subdirectories.


Automated token analysis. See skill authoring guidelines for best practices.

@paulyuk
Copy link
Member

paulyuk commented Feb 21, 2026

@copilot i do not want this to focus on unit tests at all. Just focus on the base templates README and test.http and testdata files only. Fix.

…tp and testdata files

Co-authored-by: paulyuk <1968137+paulyuk@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot i do not want this to focus on unit tests at all. Just focus on the base templates README and test.http and testdata files only. Fix.

Done in eb2345a. The test guidance in post-generation.md now only covers test.http (GET and POST templates) and testdata.json/similar curl data files. All unit test content has been removed.

@paulyuk paulyuk requested a review from saikoumudi February 23, 2026 20:57
@paulyuk paulyuk marked this pull request as ready for review February 23, 2026 20:57
Copilot AI review requested due to automatic review settings February 23, 2026 20:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces mandatory post-generation guidance for Azure Functions to address three UX issues: generic file naming (e.g., httpTrigger.js), missing README documentation for new endpoints, and absent test scaffolding. The changes establish clear naming conventions (route-based like random.js instead of httpTrigger.js), README templates with endpoint tables and curl examples, and test.http file patterns.

Changes:

  • Added new mandatory common/post-generation.md reference with file naming rules, README templates, and test file patterns
  • Updated recipes/README.md to list Post-Generation as a MANDATORY common pattern
  • Updated composition.md (verified but not shown in diff) with Step 5.5 requiring post-generation updates

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
plugin/skills/azure-prepare/references/services/functions/templates/recipes/common/post-generation.md New mandatory reference defining file naming conventions (route/purpose-based), README endpoint documentation templates, and test.http file patterns
plugin/skills/azure-prepare/references/services/functions/templates/recipes/README.md Added Post-Generation to Common Patterns table as MANDATORY alongside UAMI Bindings, Error Handling, and Health Check

Comment on lines +117 to +119
### If neither `test.http` nor a testdata file exists

Create a `test.http` file at the project root with a request block for the new function (see template above).
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistency with composition.md Step 5.5: This section says to create a new test.http file when none exists, but composition.md line 168 says to "add a TODO comment in README.md" in that scenario. These two guidance documents should provide the same instruction. Consider aligning them - either always create test.http (more proactive) or always add a TODO comment (less prescriptive).

Copilot uses AI. Check for mistakes.
|----------|-------|--------|------|-------------|
| `random` | `/api/random` | GET | anonymous | Returns a random number |

### Test locally
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding tests is a great way to build confidence in the changes made. Is there a reason why .http files are chosen? Is it for the user to validate the changes/ update the test suite like unit/ integration testing? or is it for the skill to validate if deployed route is functioning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

azure-prepare: Function file naming and README/test updates for new functions

5 participants