Agent skill
create-cloud-function
Step-by-step procedure for creating a new Firebase Cloud Function in the Nx monorepo. Use when adding a new function.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/create-cloud-function
SKILL.md
Create a New Cloud Function
When to Use
Use this skill when you need to add a new Firebase Cloud Function to the project. CI/CD will NOT deploy your function if the naming pattern is wrong.
Instructions
Follow these steps exactly:
1. Copy an existing function library
# DO NOT use nx generate - it creates wrong structure
cp -r libs/firebase/maple-functions/get-artists libs/firebase/maple-functions/{my-new-function}
2. Update project.json
{
"name": "firebase-maple-functions-{my-new-function}",
"$schema": "../../../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "libs/firebase/maple-functions/{my-new-function}/src",
"projectType": "library",
"tags": ["scope:firebase", "type:feature"],
"targets": {}
}
The project name MUST follow the pattern firebase-maple-functions-{function-name}. This is required for CI/CD detection.
3. Update tsconfig.lib.json
Point include to the new source directory.
4. Create the function
Write your function in src/lib/{my-new-function}.ts.
5. Add path alias to tsconfig.base.json
"@maple/firebase-maple-functions/{my-new-function}": [
"libs/firebase/maple-functions/{my-new-function}/src/index.ts"
]
6. Export from the functions entry point
In apps/functions/src/index.ts:
export { myNewFunction } from '@maple/firebase-maple-functions/{my-new-function}';
7. Validate
npx nx show projects | grep firebase-maple-functions-{my-new-function}
Common Mistakes
- Wrong:
my-new-function(no prefix, CI won't deploy) - Wrong:
maple-functions-my-new-function(wrong prefix, CI won't deploy) - Correct:
firebase-maple-functions-my-new-function
Post-Creation
After creating the function:
- Add unit tests using
vi.mock()to mock repositories (see ADR-017) - Update
docs/reference/deployed-functions.mdwith the new function - Update
docs/reference/implementation-status.mdif part of a tracked feature
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?